mirror of
https://github.com/holub/mame
synced 2025-06-29 15:38:53 +03:00
Converted NCR5380N to devcb2 [smf]
This commit is contained in:
parent
80194c0fc3
commit
bbdefddd2b
@ -37,11 +37,10 @@ const device_type A2BUS_SCSI = &device_creator<a2bus_scsi_device>;
|
||||
#define SCSI_BUS_TAG "scsibus"
|
||||
#define SCSI_5380_TAG "scsibus:7:ncr5380"
|
||||
|
||||
static const ncr5380n_interface ncr5380_interface =
|
||||
{
|
||||
DEVCB_NULL,
|
||||
DEVCB_DEVICE_LINE_MEMBER("^^^", a2bus_scsi_device, drq_w)
|
||||
};
|
||||
static MACHINE_CONFIG_FRAGMENT( ncr5380 )
|
||||
MCFG_DEVICE_MODIFY(DEVICE_SELF)
|
||||
MCFG_NCR5380N_DRQ_HANDLER(DEVWRITELINE("^^", a2bus_scsi_device, drq_w))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static SLOT_INTERFACE_START( scsi_devices )
|
||||
SLOT_INTERFACE("cdrom", NSCSI_CDROM)
|
||||
@ -60,8 +59,8 @@ MACHINE_CONFIG_FRAGMENT( scsi )
|
||||
MCFG_NSCSI_ADD("scsibus:5", scsi_devices, 0, false)
|
||||
MCFG_NSCSI_ADD("scsibus:6", scsi_devices, "harddisk", false)
|
||||
MCFG_NSCSI_ADD("scsibus:7", scsi_devices, "ncr5380", true)
|
||||
MCFG_DEVICE_CARD_CONFIG("ncr5380", &ncr5380_interface)
|
||||
MCFG_DEVICE_CARD_CLOCK("ncr5380", 10000000)
|
||||
MCFG_DEVICE_CARD_MACHINE_CONFIG("ncr5380", ncr5380)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
ROM_START( scsi )
|
||||
|
@ -27,7 +27,9 @@ DEVICE_ADDRESS_MAP_START(map, 8, ncr5380n_device)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
ncr5380n_device::ncr5380n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: nscsi_device(mconfig, NCR5380N, "5380 SCSI (new)", tag, owner, clock, "ncr5380", __FILE__)
|
||||
: nscsi_device(mconfig, NCR5380N, "5380 SCSI (new)", tag, owner, clock, "ncr5380", __FILE__),
|
||||
m_irq_handler(*this),
|
||||
m_drq_handler(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -45,8 +47,8 @@ void ncr5380n_device::device_start()
|
||||
save_item(NAME(clock_conv));
|
||||
save_item(NAME(m_dmalatch));
|
||||
|
||||
m_irq_func.resolve(m_irq_cb, *this);
|
||||
m_drq_func.resolve(m_drq_cb, *this);
|
||||
m_irq_handler.resolve_safe();
|
||||
m_drq_handler.resolve_safe();
|
||||
|
||||
tcount = 0;
|
||||
status = 0;
|
||||
@ -67,28 +69,10 @@ void ncr5380n_device::device_reset()
|
||||
istatus = 0;
|
||||
m_busstatus = 0;
|
||||
irq = false;
|
||||
if(!m_irq_func.isnull())
|
||||
m_irq_func(irq);
|
||||
m_irq_handler(irq);
|
||||
reset_soft();
|
||||
}
|
||||
|
||||
void ncr5380n_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const ncr5380n_interface *intf = reinterpret_cast<const ncr5380n_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
{
|
||||
*static_cast<ncr5380n_interface *>(this) = *intf;
|
||||
}
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_irq_cb, 0, sizeof(m_irq_cb));
|
||||
memset(&m_drq_cb, 0, sizeof(m_drq_cb));
|
||||
}
|
||||
}
|
||||
|
||||
void ncr5380n_device::reset_soft()
|
||||
{
|
||||
state = IDLE;
|
||||
@ -96,8 +80,7 @@ void ncr5380n_device::reset_soft()
|
||||
scsi_bus->ctrl_wait(scsi_refid, S_ALL, S_ALL);
|
||||
status = 0;
|
||||
drq = false;
|
||||
if(!m_drq_func.isnull())
|
||||
m_drq_func(drq);
|
||||
m_drq_handler(drq);
|
||||
reset_disconnect();
|
||||
}
|
||||
|
||||
@ -416,8 +399,8 @@ void ncr5380n_device::check_irq()
|
||||
#if 0
|
||||
bool oldirq = irq;
|
||||
irq = istatus != 0;
|
||||
if(irq != oldirq && !m_irq_func.isnull())
|
||||
m_irq_func(irq);
|
||||
if(irq != oldirq)
|
||||
m_irq_handler(irq);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -512,8 +495,7 @@ void ncr5380n_device::drq_set()
|
||||
{
|
||||
drq = true;
|
||||
m_busstatus |= BAS_DMAREQUEST;
|
||||
if(!m_drq_func.isnull())
|
||||
m_drq_func(drq);
|
||||
m_drq_handler(drq);
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,8 +505,7 @@ void ncr5380n_device::drq_clear()
|
||||
{
|
||||
drq = false;
|
||||
m_busstatus &= ~BAS_DMAREQUEST;
|
||||
if(!m_drq_func.isnull())
|
||||
m_drq_func(drq);
|
||||
m_drq_handler(drq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,18 +11,21 @@
|
||||
|
||||
#include "machine/nscsi_bus.h"
|
||||
|
||||
struct ncr5380n_interface
|
||||
{
|
||||
devcb_write_line m_irq_cb;
|
||||
devcb_write_line m_drq_cb;
|
||||
};
|
||||
#define MCFG_NCR5380N_IRQ_HANDLER(_devcb) \
|
||||
devcb = &ncr5380n_device::set_irq_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
class ncr5380n_device : public nscsi_device,
|
||||
public ncr5380n_interface
|
||||
#define MCFG_NCR5380N_DRQ_HANDLER(_devcb) \
|
||||
devcb = &ncr5380n_device::set_drq_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
class ncr5380n_device : public nscsi_device
|
||||
{
|
||||
public:
|
||||
ncr5380n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// static configuration helpers
|
||||
template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<ncr5380n_device &>(device).m_irq_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_drq_handler(device_t &device, _Object object) { return downcast<ncr5380n_device &>(device).m_drq_handler.set_callback(object); }
|
||||
|
||||
DECLARE_ADDRESS_MAP(map, 8);
|
||||
|
||||
DECLARE_READ8_MEMBER(scsidata_r);
|
||||
@ -53,7 +56,6 @@ public:
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_config_complete();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
private:
|
||||
@ -194,9 +196,6 @@ private:
|
||||
|
||||
bool irq, drq;
|
||||
|
||||
devcb_resolved_write_line m_irq_func;
|
||||
devcb_resolved_write_line m_drq_func;
|
||||
|
||||
void drq_set();
|
||||
void drq_clear();
|
||||
|
||||
@ -216,6 +215,9 @@ private:
|
||||
|
||||
void delay(int cycles);
|
||||
void delay_cycles(int cycles);
|
||||
|
||||
devcb2_write_line m_irq_handler;
|
||||
devcb2_write_line m_drq_handler;
|
||||
};
|
||||
|
||||
extern const device_type NCR5380N;
|
||||
|
Loading…
Reference in New Issue
Block a user