mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
custom callback to devcb2 (nw)
This commit is contained in:
parent
6ca52d612f
commit
c9b2942ca5
@ -106,37 +106,18 @@ static const char *const ethernet_regname[64] =
|
||||
***************************************************************************/
|
||||
|
||||
smc91c9x_device::smc91c9x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
|
||||
m_irq_handler(*this)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void smc91c9x_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const smc91c9x_interface *intf = reinterpret_cast<const smc91c9x_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<smc91c9x_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_interrupt, 0, sizeof(m_interrupt));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void smc91c9x_device::device_start()
|
||||
{
|
||||
m_irq_handler = m_interrupt;
|
||||
m_irq_handler.resolve_safe();
|
||||
|
||||
/* register ide states */
|
||||
save_item(NAME(m_reg));
|
||||
@ -230,8 +211,8 @@ void smc91c9x_device::update_ethernet_irq()
|
||||
|
||||
/* update the IRQ state */
|
||||
m_irq_state = ((mask & state) != 0);
|
||||
if (m_irq_handler != NULL)
|
||||
(*m_irq_handler)(this, m_irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
if (!m_irq_handler.isnull())
|
||||
m_irq_handler(m_irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,35 +18,25 @@
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
typedef void (*smc91c9x_irq_func)(device_t *device, int state);
|
||||
|
||||
|
||||
struct smc91c9x_interface
|
||||
{
|
||||
smc91c9x_irq_func m_interrupt;
|
||||
};
|
||||
|
||||
|
||||
/* ----- device interface ----- */
|
||||
class smc91c9x_device : public device_t,
|
||||
public smc91c9x_interface
|
||||
class smc91c9x_device : public device_t
|
||||
{
|
||||
public:
|
||||
smc91c9x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
|
||||
~smc91c9x_device() {}
|
||||
|
||||
template<class _Object> static devcb2_base &set_irq_callback(device_t &device, _Object object) { return downcast<smc91c9x_device &>(device).m_irq_handler.set_callback(object); }
|
||||
|
||||
DECLARE_READ16_MEMBER( read );
|
||||
DECLARE_WRITE16_MEMBER( write );
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
private:
|
||||
// internal state
|
||||
smc91c9x_irq_func m_irq_handler;
|
||||
devcb2_write_line m_irq_handler;
|
||||
|
||||
/* raw register data and masks */
|
||||
UINT16 m_reg[64];
|
||||
@ -94,13 +84,17 @@ extern const device_type SMC91C96;
|
||||
DEVICE CONFIGURATION MACROS
|
||||
***************************************************************************/
|
||||
|
||||
#define MCFG_SMC91C94_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, SMC91C94, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
#define MCFG_SMC91C94_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, SMC91C94, 0)
|
||||
|
||||
#define MCFG_SMC91C94_IRQ_CALLBACK(_write) \
|
||||
devcb = &smc91c94_device::set_irq_callback(*device, DEVCB2_##_write);
|
||||
|
||||
#define MCFG_SMC91C96_ADD(_tag, _config) \
|
||||
MCFG_DEVICE_ADD(_tag, SMC91C96, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
#define MCFG_SMC91C96_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, SMC91C96, 0)
|
||||
|
||||
#define MCFG_SMC91C96_IRQ_CALLBACK(_write) \
|
||||
devcb = &smc91c96_device::set_irq_callback(*device, DEVCB2_##_write);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -508,7 +508,7 @@ public:
|
||||
virtual void machine_reset();
|
||||
UINT32 screen_update_seattle(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(galileo_timer_callback);
|
||||
void ethernet_interrupt_machine(int state);
|
||||
DECLARE_WRITE_LINE_MEMBER(ethernet_interrupt);
|
||||
void update_vblank_irq();
|
||||
UINT32 pci_bridge_r(address_space &space, UINT8 reg, UINT8 type);
|
||||
void pci_bridge_w(address_space &space, UINT8 reg, UINT8 type, UINT32 data);
|
||||
@ -642,7 +642,7 @@ WRITE_LINE_MEMBER(seattle_state::ide_interrupt)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void seattle_state::ethernet_interrupt_machine(int state)
|
||||
WRITE_LINE_MEMBER(seattle_state::ethernet_interrupt)
|
||||
{
|
||||
m_ethernet_irq_state = state;
|
||||
if (m_board_config == FLAGSTAFF_CONFIG)
|
||||
@ -655,13 +655,6 @@ void seattle_state::ethernet_interrupt_machine(int state)
|
||||
update_widget_irq();
|
||||
}
|
||||
|
||||
static void ethernet_interrupt(device_t *device, int state)
|
||||
{
|
||||
seattle_state *drvstate = device->machine().driver_data<seattle_state>();
|
||||
drvstate->ethernet_interrupt_machine(state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -739,7 +732,7 @@ WRITE32_MEMBER(seattle_state::interrupt_config_w)
|
||||
|
||||
/* update the states */
|
||||
update_vblank_irq();
|
||||
ethernet_interrupt_machine(m_ethernet_irq_state);
|
||||
ethernet_interrupt(m_ethernet_irq_state);
|
||||
}
|
||||
|
||||
|
||||
@ -752,7 +745,7 @@ WRITE32_MEMBER(seattle_state::seattle_interrupt_enable_w)
|
||||
if (m_vblank_latch)
|
||||
update_vblank_irq();
|
||||
if (m_ethernet_irq_state)
|
||||
ethernet_interrupt_machine(m_ethernet_irq_state);
|
||||
ethernet_interrupt(m_ethernet_irq_state);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2569,13 +2562,10 @@ static MACHINE_CONFIG_DERIVED( seattle150, seattle_common )
|
||||
MCFG_CPU_PROGRAM_MAP(seattle_map)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static const smc91c9x_interface ethernet_intf =
|
||||
{
|
||||
ethernet_interrupt
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( seattle150_widget, seattle150 )
|
||||
MCFG_SMC91C94_ADD("ethernet", ethernet_intf)
|
||||
MCFG_SMC91C94_ADD("ethernet")
|
||||
MCFG_SMC91C94_IRQ_CALLBACK(WRITELINE(seattle_state, ethernet_interrupt))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
@ -2589,7 +2579,8 @@ MACHINE_CONFIG_END
|
||||
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( seattle200_widget, seattle200 )
|
||||
MCFG_SMC91C94_ADD("ethernet", ethernet_intf)
|
||||
MCFG_SMC91C94_ADD("ethernet")
|
||||
MCFG_SMC91C94_IRQ_CALLBACK(WRITELINE(seattle_state, ethernet_interrupt))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static const voodoo_config voodoo_2_intf =
|
||||
@ -2610,7 +2601,8 @@ static MACHINE_CONFIG_DERIVED( flagstaff, seattle_common )
|
||||
MCFG_CPU_CONFIG(r5000_config)
|
||||
MCFG_CPU_PROGRAM_MAP(seattle_map)
|
||||
|
||||
MCFG_SMC91C94_ADD("ethernet", ethernet_intf)
|
||||
MCFG_SMC91C94_ADD("ethernet")
|
||||
MCFG_SMC91C94_IRQ_CALLBACK(WRITELINE(seattle_state, ethernet_interrupt))
|
||||
|
||||
MCFG_DEVICE_REMOVE("voodoo")
|
||||
MCFG_3DFX_VOODOO_1_ADD("voodoo", STD_VOODOO_1_CLOCK, voodoo_2_intf)
|
||||
|
@ -564,6 +564,7 @@ public:
|
||||
DECLARE_READ32_MEMBER( ethernet_r );
|
||||
DECLARE_WRITE32_MEMBER( ethernet_w );
|
||||
DECLARE_WRITE32_MEMBER( dcs3_fifo_full_w );
|
||||
DECLARE_WRITE_LINE_MEMBER(ethernet_interrupt);
|
||||
};
|
||||
|
||||
|
||||
@ -1323,14 +1324,13 @@ static void ioasic_irq(running_machine &machine, int state)
|
||||
}
|
||||
|
||||
|
||||
static void ethernet_interrupt(device_t *device, int state)
|
||||
WRITE_LINE_MEMBER(vegas_state::ethernet_interrupt)
|
||||
{
|
||||
vegas_state *drvstate = device->machine().driver_data<vegas_state>();
|
||||
if (state)
|
||||
drvstate->m_sio_irq_state |= 0x10;
|
||||
m_sio_irq_state |= 0x10;
|
||||
else
|
||||
drvstate->m_sio_irq_state &= ~0x10;
|
||||
drvstate->update_sio_irqs();
|
||||
m_sio_irq_state &= ~0x10;
|
||||
update_sio_irqs();
|
||||
}
|
||||
|
||||
|
||||
@ -2279,11 +2279,6 @@ static const mips3_config r5000_config =
|
||||
SYSTEM_CLOCK /* system clock rate */
|
||||
};
|
||||
|
||||
static const smc91c9x_interface ethernet_intf =
|
||||
{
|
||||
ethernet_interrupt
|
||||
};
|
||||
|
||||
static const voodoo_config voodoo_intf =
|
||||
{
|
||||
2, // fbmem;
|
||||
@ -2308,7 +2303,8 @@ static MACHINE_CONFIG_START( vegascore, vegas_state )
|
||||
MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(vegas_state, ide_interrupt))
|
||||
MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE("maincpu", AS_PROGRAM)
|
||||
|
||||
MCFG_SMC91C94_ADD("ethernet", ethernet_intf)
|
||||
MCFG_SMC91C94_ADD("ethernet")
|
||||
MCFG_SMC91C94_IRQ_CALLBACK(WRITELINE(vegas_state, ethernet_interrupt))
|
||||
|
||||
MCFG_3DFX_VOODOO_2_ADD("voodoo", STD_VOODOO_2_CLOCK, voodoo_intf)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user