Previous 199869 Revisions Next

r29221 Thursday 3rd April, 2014 at 16:29:09 UTC by Osso
rtc65271_device: converted to devcb2 (nw)
[src/emu/bus/ti99_peb]tn_ide.c
[src/emu/machine]rtc65271.c rtc65271.h
[src/mame/drivers]firebeat.c twinkle.c

trunk/src/mame/drivers/twinkle.c
r29220r29221
854854   }
855855}
856856
857static const rtc65271_interface twinkle_rtc =
858{
859   DEVCB_NULL
860};
861857
862858static MACHINE_CONFIG_START( twinkle, twinkle_state )
863859   /* basic machine hardware */
r29220r29221
883879   MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, true)
884880   MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(twinkle_state, ide_interrupt))
885881
886   MCFG_RTC65271_ADD("rtc", twinkle_rtc)
882   MCFG_DEVICE_ADD("rtc", RTC65271, 0)
887883
888884   /* video hardware */
889885   MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0x200000, XTAL_53_693175MHz )
trunk/src/mame/drivers/firebeat.c
r29220r29221
17231723   m_layer = 0;
17241724}
17251725
1726const rtc65271_interface firebeat_rtc =
1727{
1728   DEVCB_NULL
1729};
1730
17311726WRITE_LINE_MEMBER( firebeat_state::ata_interrupt )
17321727{
17331728   m_maincpu->set_input_line(INPUT_LINE_IRQ4, state);
r29220r29221
17491744   MCFG_MACHINE_START_OVERRIDE(firebeat_state,firebeat)
17501745   MCFG_MACHINE_RESET_OVERRIDE(firebeat_state,firebeat)
17511746
1752   MCFG_RTC65271_ADD("rtc", firebeat_rtc)
1747   MCFG_DEVICE_ADD("rtc", RTC65271, 0)
17531748
17541749   MCFG_FUJITSU_29F016A_ADD("flash_main")
17551750   MCFG_FUJITSU_29F016A_ADD("flash_snd1")
r29220r29221
17971792   MCFG_MACHINE_START_OVERRIDE(firebeat_state,firebeat)
17981793   MCFG_MACHINE_RESET_OVERRIDE(firebeat_state,firebeat)
17991794
1800   MCFG_RTC65271_ADD("rtc", firebeat_rtc)
1795   MCFG_DEVICE_ADD("rtc", RTC65271, 0)
18011796
18021797   MCFG_FUJITSU_29F016A_ADD("flash_main")
18031798   MCFG_FUJITSU_29F016A_ADD("flash_snd1")
trunk/src/emu/machine/rtc65271.c
r29220r29221
449449   if (m_regs[reg_C] & m_regs[reg_B] & (reg_C_PF | reg_C_AF | reg_C_UF))
450450   {
451451      m_regs[reg_C] |= reg_C_IRQF;
452      if (!m_interrupt_func.isnull())
453         m_interrupt_func(1);
452      if (!m_interrupt_cb.isnull())
453         m_interrupt_cb(1);
454454   }
455455   else
456456   {
457457      m_regs[reg_C] &= ~reg_C_IRQF;
458      if (!m_interrupt_func.isnull())
459         m_interrupt_func(0);
458      if (!m_interrupt_cb.isnull())
459         m_interrupt_cb(0);
460460   }
461461}
462462
r29220r29221
672672
673673rtc65271_device::rtc65271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
674674   : device_t(mconfig, RTC65271, "RTC65271", tag, owner, clock, "rtc65271", __FILE__),
675      device_nvram_interface(mconfig, *this)
675      device_nvram_interface(mconfig, *this),
676      m_interrupt_cb(*this)
676677{
677678}
678679
679680//-------------------------------------------------
680//  device_config_complete - perform any
681//  operations now that the configuration is
682//  complete
683//-------------------------------------------------
684
685void rtc65271_device::device_config_complete()
686{
687   // inherit a copy of the static data
688   const rtc65271_interface *intf = reinterpret_cast<const rtc65271_interface *>(static_config());
689   if (intf != NULL)
690      *static_cast<rtc65271_interface *>(this) = *intf;
691
692   // or initialize to defaults if none provided
693   else
694   {
695      memset(&m_interrupt_cb, 0, sizeof(m_interrupt_cb));
696   }
697}
698
699//-------------------------------------------------
700681//  device_start - device-specific startup
701682//-------------------------------------------------
702683void rtc65271_device::device_start()
r29220r29221
704685   m_update_timer = machine().scheduler().timer_alloc(FUNC(rtc_begin_update_callback), (void *)this);
705686   m_update_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
706687   m_SQW_timer = machine().scheduler().timer_alloc(FUNC(rtc_SQW_callback), (void *)this);
707   m_interrupt_func.resolve(m_interrupt_cb, *this);
688   m_interrupt_cb.resolve();
708689
709690   save_item(NAME(m_regs));
710691   save_item(NAME(m_cur_reg));
trunk/src/emu/machine/rtc65271.h
r29220r29221
99//  INTERFACE CONFIGURATION MACROS
1010//**************************************************************************
1111
12#define MCFG_RTC65271_ADD(_tag, _config) \
13   MCFG_DEVICE_ADD(_tag, RTC65271, 0) \
14   MCFG_DEVICE_CONFIG(_config)
15// ======================> rtc65271_interface
12#define MCFG_RTC65271_INTERRUPT_CB(_devcb) \
13   devcb = &rtc65271_device::set_interrupt_callback(*device, DEVCB2_##_devcb);
1614
17struct rtc65271_interface
18{
19   devcb_write_line    m_interrupt_cb;
20};
2115
2216// ======================> rtc65271_device
2317
2418class rtc65271_device : public device_t,
25                  public device_nvram_interface,
26                  public rtc65271_interface
19                  public device_nvram_interface
2720{
2821public:
2922   // construction/destruction
3023   rtc65271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3124protected:
3225   // device-level overrides
33   virtual void device_config_complete();
3426   virtual void device_start();
3527   // device_nvram_interface overrides
3628   virtual void nvram_default();
3729   virtual void nvram_read(emu_file &file);
3830   virtual void nvram_write(emu_file &file);
3931public:
32
33   template<class _Object> static devcb2_base &set_interrupt_callback(device_t &device, _Object object) { return downcast<rtc65271_device &>(device).m_interrupt_cb.set_callback(object); }
34   
4035   DECLARE_READ8_MEMBER( rtc_r );
4136   DECLARE_READ8_MEMBER( xram_r );
4237   DECLARE_WRITE8_MEMBER( rtc_w );
r29220r29221
7065   UINT8 m_SQW_internal_state;
7166
7267   /* callback called when interrupt pin state changes (may be NULL) */
73   devcb_resolved_write_line m_interrupt_func;
68   devcb2_write_line    m_interrupt_cb;
7469};
7570
7671// device type definition
trunk/src/emu/bus/ti99_peb/tn_ide.c
r29220r29221
55    Thierry Nouspikel's IDE card emulation
66
77    This card is just a prototype.  It has been designed by Thierry Nouspikel,
8    and its description was published in 2001.  The card have been revised in
8    and its description was published in 2001.  The card has been revised in
99    2004.
1010
1111    The specs have been published in <http://www.nouspikel.com/ti99/ide.html>.
r29220r29221
332332   m_tms9995_mode =  false; // (device->type()==TMS9995);
333333}
334334
335static const rtc65271_interface ide_rtc_cfg =
336{
337   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, nouspikel_ide_interface_device, clock_interrupt_callback)
338};
339
340335MACHINE_CONFIG_FRAGMENT( tn_ide )
341   MCFG_RTC65271_ADD( "ide_rtc", ide_rtc_cfg )
336   MCFG_DEVICE_ADD( "ide_rtc", RTC65271, 0 )
337   MCFG_RTC65271_INTERRUPT_CB(WRITELINE(nouspikel_ide_interface_device, clock_interrupt_callback))
342338   MCFG_ATA_INTERFACE_ADD( "ata", ata_devices, "hdd", NULL, false)
343339   MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(nouspikel_ide_interface_device, ide_interrupt_callback))
344340MACHINE_CONFIG_END

Previous 199869 Revisions Next


© 1997-2024 The MAME Team