rtc65271_device: converted to devcb2 (nw)
This commit is contained in:
parent
7a4219e454
commit
dd34840da9
@ -5,7 +5,7 @@
|
||||
Thierry Nouspikel's IDE card emulation
|
||||
|
||||
This card is just a prototype. It has been designed by Thierry Nouspikel,
|
||||
and its description was published in 2001. The card have been revised in
|
||||
and its description was published in 2001. The card has been revised in
|
||||
2004.
|
||||
|
||||
The specs have been published in <http://www.nouspikel.com/ti99/ide.html>.
|
||||
@ -332,13 +332,9 @@ void nouspikel_ide_interface_device::device_reset()
|
||||
m_tms9995_mode = false; // (device->type()==TMS9995);
|
||||
}
|
||||
|
||||
static const rtc65271_interface ide_rtc_cfg =
|
||||
{
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, nouspikel_ide_interface_device, clock_interrupt_callback)
|
||||
};
|
||||
|
||||
MACHINE_CONFIG_FRAGMENT( tn_ide )
|
||||
MCFG_RTC65271_ADD( "ide_rtc", ide_rtc_cfg )
|
||||
MCFG_DEVICE_ADD( "ide_rtc", RTC65271, 0 )
|
||||
MCFG_RTC65271_INTERRUPT_CB(WRITELINE(nouspikel_ide_interface_device, clock_interrupt_callback))
|
||||
MCFG_ATA_INTERFACE_ADD( "ata", ata_devices, "hdd", NULL, false)
|
||||
MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(nouspikel_ide_interface_device, ide_interrupt_callback))
|
||||
MACHINE_CONFIG_END
|
||||
|
@ -449,14 +449,14 @@ void rtc65271_device::field_interrupts()
|
||||
if (m_regs[reg_C] & m_regs[reg_B] & (reg_C_PF | reg_C_AF | reg_C_UF))
|
||||
{
|
||||
m_regs[reg_C] |= reg_C_IRQF;
|
||||
if (!m_interrupt_func.isnull())
|
||||
m_interrupt_func(1);
|
||||
if (!m_interrupt_cb.isnull())
|
||||
m_interrupt_cb(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_regs[reg_C] &= ~reg_C_IRQF;
|
||||
if (!m_interrupt_func.isnull())
|
||||
m_interrupt_func(0);
|
||||
if (!m_interrupt_cb.isnull())
|
||||
m_interrupt_cb(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -672,30 +672,11 @@ const device_type RTC65271 = &device_creator<rtc65271_device>;
|
||||
|
||||
rtc65271_device::rtc65271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, RTC65271, "RTC65271", tag, owner, clock, "rtc65271", __FILE__),
|
||||
device_nvram_interface(mconfig, *this)
|
||||
device_nvram_interface(mconfig, *this),
|
||||
m_interrupt_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void rtc65271_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const rtc65271_interface *intf = reinterpret_cast<const rtc65271_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<rtc65271_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_interrupt_cb, 0, sizeof(m_interrupt_cb));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -704,7 +685,7 @@ void rtc65271_device::device_start()
|
||||
m_update_timer = machine().scheduler().timer_alloc(FUNC(rtc_begin_update_callback), (void *)this);
|
||||
m_update_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1));
|
||||
m_SQW_timer = machine().scheduler().timer_alloc(FUNC(rtc_SQW_callback), (void *)this);
|
||||
m_interrupt_func.resolve(m_interrupt_cb, *this);
|
||||
m_interrupt_cb.resolve();
|
||||
|
||||
save_item(NAME(m_regs));
|
||||
save_item(NAME(m_cur_reg));
|
||||
|
@ -9,34 +9,29 @@
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_RTC65271_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, RTC65271, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
// ======================> rtc65271_interface
|
||||
#define MCFG_RTC65271_INTERRUPT_CB(_devcb) \
|
||||
devcb = &rtc65271_device::set_interrupt_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
struct rtc65271_interface
|
||||
{
|
||||
devcb_write_line m_interrupt_cb;
|
||||
};
|
||||
|
||||
// ======================> rtc65271_device
|
||||
|
||||
class rtc65271_device : public device_t,
|
||||
public device_nvram_interface,
|
||||
public rtc65271_interface
|
||||
public device_nvram_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
rtc65271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
// device_nvram_interface overrides
|
||||
virtual void nvram_default();
|
||||
virtual void nvram_read(emu_file &file);
|
||||
virtual void nvram_write(emu_file &file);
|
||||
public:
|
||||
|
||||
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); }
|
||||
|
||||
DECLARE_READ8_MEMBER( rtc_r );
|
||||
DECLARE_READ8_MEMBER( xram_r );
|
||||
DECLARE_WRITE8_MEMBER( rtc_w );
|
||||
@ -70,7 +65,7 @@ private:
|
||||
UINT8 m_SQW_internal_state;
|
||||
|
||||
/* callback called when interrupt pin state changes (may be NULL) */
|
||||
devcb_resolved_write_line m_interrupt_func;
|
||||
devcb2_write_line m_interrupt_cb;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -1723,11 +1723,6 @@ MACHINE_RESET_MEMBER(firebeat_state,firebeat)
|
||||
m_layer = 0;
|
||||
}
|
||||
|
||||
const rtc65271_interface firebeat_rtc =
|
||||
{
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
||||
WRITE_LINE_MEMBER( firebeat_state::ata_interrupt )
|
||||
{
|
||||
m_maincpu->set_input_line(INPUT_LINE_IRQ4, state);
|
||||
@ -1749,7 +1744,7 @@ static MACHINE_CONFIG_START( firebeat, firebeat_state )
|
||||
MCFG_MACHINE_START_OVERRIDE(firebeat_state,firebeat)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(firebeat_state,firebeat)
|
||||
|
||||
MCFG_RTC65271_ADD("rtc", firebeat_rtc)
|
||||
MCFG_DEVICE_ADD("rtc", RTC65271, 0)
|
||||
|
||||
MCFG_FUJITSU_29F016A_ADD("flash_main")
|
||||
MCFG_FUJITSU_29F016A_ADD("flash_snd1")
|
||||
@ -1797,7 +1792,7 @@ static MACHINE_CONFIG_START( firebeat2, firebeat_state )
|
||||
MCFG_MACHINE_START_OVERRIDE(firebeat_state,firebeat)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(firebeat_state,firebeat)
|
||||
|
||||
MCFG_RTC65271_ADD("rtc", firebeat_rtc)
|
||||
MCFG_DEVICE_ADD("rtc", RTC65271, 0)
|
||||
|
||||
MCFG_FUJITSU_29F016A_ADD("flash_main")
|
||||
MCFG_FUJITSU_29F016A_ADD("flash_snd1")
|
||||
|
@ -854,10 +854,6 @@ static void scsi_dma_write( twinkle_state *state, UINT32 *p_n_psxram, UINT32 n_a
|
||||
}
|
||||
}
|
||||
|
||||
static const rtc65271_interface twinkle_rtc =
|
||||
{
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( twinkle, twinkle_state )
|
||||
/* basic machine hardware */
|
||||
@ -883,7 +879,7 @@ static MACHINE_CONFIG_START( twinkle, twinkle_state )
|
||||
MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, true)
|
||||
MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(twinkle_state, ide_interrupt))
|
||||
|
||||
MCFG_RTC65271_ADD("rtc", twinkle_rtc)
|
||||
MCFG_DEVICE_ADD("rtc", RTC65271, 0)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561Q, 0x200000, XTAL_53_693175MHz )
|
||||
|
Loading…
Reference in New Issue
Block a user