mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
mb8795: devcb2. (nw)
This commit is contained in:
parent
88a76175e1
commit
dbfcc63c41
@ -16,24 +16,16 @@ DEVICE_ADDRESS_MAP_START(map, 8, mb8795_device)
|
||||
AM_RANGE(0x8, 0xf) AM_READWRITE(mac_r, mac_w) // Mapping limitation, real is up to 0xd
|
||||
ADDRESS_MAP_END
|
||||
|
||||
mb8795_device::mb8795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, MB8795, "Fujitsu MB8795", tag, owner, clock, "mb8795", __FILE__),
|
||||
device_network_interface(mconfig, *this, 10)
|
||||
mb8795_device::mb8795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, MB8795, "Fujitsu MB8795", tag, owner, clock, "mb8795", __FILE__),
|
||||
device_network_interface(mconfig, *this, 10),
|
||||
irq_tx_cb(*this),
|
||||
irq_rx_cb(*this),
|
||||
drq_tx_cb(*this),
|
||||
drq_rx_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
void mb8795_device::set_irq_cb(line_cb_t tx, line_cb_t rx)
|
||||
{
|
||||
irq_tx_cb = tx;
|
||||
irq_rx_cb = rx;
|
||||
}
|
||||
|
||||
void mb8795_device::set_drq_cb(line_cb_t tx, line_cb_t rx)
|
||||
{
|
||||
drq_tx_cb = tx;
|
||||
drq_rx_cb = rx;
|
||||
}
|
||||
|
||||
void mb8795_device::check_irq()
|
||||
{
|
||||
bool old_irq_tx = irq_tx;
|
||||
@ -48,6 +40,11 @@ void mb8795_device::check_irq()
|
||||
|
||||
void mb8795_device::device_start()
|
||||
{
|
||||
irq_tx_cb.resolve();
|
||||
irq_rx_cb.resolve();
|
||||
drq_tx_cb.resolve();
|
||||
drq_rx_cb.resolve();
|
||||
|
||||
memset(mac, 0, 6);
|
||||
timer_tx = timer_alloc(TIMER_TX);
|
||||
timer_rx = timer_alloc(TIMER_RX);
|
||||
|
@ -6,14 +6,28 @@
|
||||
downcast<mb8795_device *>(device)->set_irq_cb(_tx_irq, _rx_irq); \
|
||||
downcast<mb8795_device *>(device)->set_drq_cb(_tx_drq, _rx_drq);
|
||||
|
||||
#define MCFG_MB8795_TX_IRQ_CALLBACK(_write) \
|
||||
devcb = &mb8795_device::set_tx_irq_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
#define MCFG_MB8795_RX_IRQ_CALLBACK(_write) \
|
||||
devcb = &mb8795_device::set_rx_irq_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
#define MCFG_MB8795_TX_DRQ_CALLBACK(_write) \
|
||||
devcb = &mb8795_device::set_tx_drq_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
#define MCFG_MB8795_RX_DRQ_CALLBACK(_write) \
|
||||
devcb = &mb8795_device::set_rx_drq_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
class mb8795_device : public device_t,
|
||||
public device_network_interface
|
||||
{
|
||||
public:
|
||||
mb8795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
void set_irq_cb(line_cb_t tx, line_cb_t rx);
|
||||
void set_drq_cb(line_cb_t tx, line_cb_t rx);
|
||||
template<class _Object> static devcb2_base &set_tx_irq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).irq_tx_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_rx_irq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).irq_rx_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_tx_drq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).drq_tx_cb.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_rx_drq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).drq_rx_cb.set_callback(object); }
|
||||
|
||||
DECLARE_ADDRESS_MAP(map, 8);
|
||||
|
||||
@ -92,7 +106,7 @@ private:
|
||||
bool drq_tx, drq_rx, irq_tx, irq_rx;
|
||||
emu_timer *timer_tx, *timer_rx;
|
||||
|
||||
line_cb_t irq_tx_cb, irq_rx_cb, drq_tx_cb, drq_rx_cb;
|
||||
devcb2_write_line irq_tx_cb, irq_rx_cb, drq_tx_cb, drq_rx_cb;
|
||||
|
||||
void check_irq();
|
||||
void start_send();
|
||||
|
@ -757,32 +757,32 @@ void next_state::nmi_irq(bool state)
|
||||
irq_set(31, state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( next_state::fdc_irq )
|
||||
WRITE_LINE_MEMBER(next_state::fdc_irq)
|
||||
{
|
||||
irq_set(7, state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( next_state::fdc_drq )
|
||||
WRITE_LINE_MEMBER(next_state::fdc_drq)
|
||||
{
|
||||
dma_drq_w(1, state);
|
||||
}
|
||||
|
||||
void next_state::net_tx_irq(bool state)
|
||||
WRITE_LINE_MEMBER(next_state::net_tx_irq)
|
||||
{
|
||||
irq_set(10, state);
|
||||
}
|
||||
|
||||
void next_state::net_rx_irq(bool state)
|
||||
WRITE_LINE_MEMBER(next_state::net_rx_irq)
|
||||
{
|
||||
irq_set(9, state);
|
||||
}
|
||||
|
||||
void next_state::net_tx_drq(bool state)
|
||||
WRITE_LINE_MEMBER(next_state::net_tx_drq)
|
||||
{
|
||||
dma_drq_w(17, state);
|
||||
}
|
||||
|
||||
void next_state::net_rx_drq(bool state)
|
||||
WRITE_LINE_MEMBER(next_state::net_rx_drq)
|
||||
{
|
||||
dma_drq_w(21, state);
|
||||
}
|
||||
@ -978,11 +978,12 @@ static MACHINE_CONFIG_START( next_base, next_state )
|
||||
MCFG_NSCSI_ADD("scsibus:7", next_scsi_devices, "ncr5390", true)
|
||||
MCFG_DEVICE_CARD_MACHINE_CONFIG("ncr5390", ncr5390)
|
||||
|
||||
MCFG_MB8795_ADD("net",
|
||||
line_cb_t(FUNC(next_state::net_tx_irq), static_cast<next_state *>(owner)),
|
||||
line_cb_t(FUNC(next_state::net_rx_irq), static_cast<next_state *>(owner)),
|
||||
line_cb_t(FUNC(next_state::net_tx_drq), static_cast<next_state *>(owner)),
|
||||
line_cb_t(FUNC(next_state::net_rx_drq), static_cast<next_state *>(owner)))
|
||||
MCFG_DEVICE_ADD("net", MB8795, 0)
|
||||
MCFG_MB8795_TX_IRQ_CALLBACK(WRITELINE(next_state, net_tx_irq))
|
||||
MCFG_MB8795_RX_IRQ_CALLBACK(WRITELINE(next_state, net_rx_irq))
|
||||
MCFG_MB8795_TX_DRQ_CALLBACK(WRITELINE(next_state, net_tx_drq))
|
||||
MCFG_MB8795_RX_DRQ_CALLBACK(WRITELINE(next_state, net_rx_drq))
|
||||
|
||||
MCFG_NEXTMO_ADD("mo",
|
||||
line_cb_t(FUNC(next_state::mo_irq), static_cast<next_state *>(owner)),
|
||||
line_cb_t(FUNC(next_state::mo_drq), static_cast<next_state *>(owner)))
|
||||
|
@ -105,10 +105,10 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(fdc_irq);
|
||||
DECLARE_WRITE_LINE_MEMBER(fdc_drq);
|
||||
|
||||
void net_tx_irq(bool state);
|
||||
void net_rx_irq(bool state);
|
||||
void net_tx_drq(bool state);
|
||||
void net_rx_drq(bool state);
|
||||
DECLARE_WRITE_LINE_MEMBER(net_tx_irq);
|
||||
DECLARE_WRITE_LINE_MEMBER(net_rx_irq);
|
||||
DECLARE_WRITE_LINE_MEMBER(net_tx_drq);
|
||||
DECLARE_WRITE_LINE_MEMBER(net_rx_drq);
|
||||
|
||||
void mo_irq(bool state);
|
||||
void mo_drq(bool state);
|
||||
|
Loading…
Reference in New Issue
Block a user