mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
Converted NCR5390 to devcb2 & use MCFG_DEVICE_CLOCK to set SCSI chip clock [smf]
This commit is contained in:
parent
3cbc80192a
commit
652c5cf751
@ -845,6 +845,7 @@ WRITE32_MEMBER(rastersp_state::ncr53c700_write)
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( ncr53c700 )
|
||||
MCFG_DEVICE_MODIFY(DEVICE_SELF)
|
||||
MCFG_DEVICE_CLOCK(66000000)
|
||||
MCFG_NCR53C7XX_IRQ_HANDLER(DEVWRITELINE(":", rastersp_state, scsi_irq))
|
||||
MCFG_NCR53C7XX_HOST_READ(DEVREAD32(":", rastersp_state, ncr53c700_read))
|
||||
MCFG_NCR53C7XX_HOST_WRITE(DEVWRITE32(":", rastersp_state, ncr53c700_write))
|
||||
@ -895,7 +896,6 @@ static MACHINE_CONFIG_START( rastersp, rastersp_state )
|
||||
MCFG_NSCSI_BUS_ADD("scsibus")
|
||||
MCFG_NSCSI_ADD("scsibus:0", rastersp_scsi_devices, "harddisk", true)
|
||||
MCFG_NSCSI_ADD("scsibus:7", rastersp_scsi_devices, "ncr53c700", true)
|
||||
MCFG_DEVICE_CARD_CLOCK("ncr53c700", 66000000)
|
||||
MCFG_DEVICE_CARD_MACHINE_CONFIG("ncr53c700", ncr53c700)
|
||||
|
||||
/* Video */
|
||||
|
@ -932,11 +932,12 @@ static SLOT_INTERFACE_START( next_scsi_devices )
|
||||
SLOT_INTERFACE_INTERNAL("ncr5390", NCR5390)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static const ncr5390_interface next_ncr5390_interface =
|
||||
{
|
||||
DEVCB_DRIVER_LINE_MEMBER(next_state, scsi_irq),
|
||||
DEVCB_DRIVER_LINE_MEMBER(next_state, scsi_drq)
|
||||
};
|
||||
static MACHINE_CONFIG_FRAGMENT( ncr5390 )
|
||||
MCFG_DEVICE_MODIFY(DEVICE_SELF)
|
||||
MCFG_DEVICE_CLOCK(10000000)
|
||||
MCFG_NCR5390_IRQ_HANDLER(DEVWRITELINE(":", next_state, scsi_irq))
|
||||
MCFG_NCR5390_DRQ_HANDLER(DEVWRITELINE(":", next_state, scsi_drq))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( next_base, next_state )
|
||||
|
||||
@ -965,8 +966,7 @@ static MACHINE_CONFIG_START( next_base, next_state )
|
||||
MCFG_NSCSI_ADD("scsibus:5", next_scsi_devices, 0, false)
|
||||
MCFG_NSCSI_ADD("scsibus:6", next_scsi_devices, 0, false)
|
||||
MCFG_NSCSI_ADD("scsibus:7", next_scsi_devices, "ncr5390", true)
|
||||
MCFG_DEVICE_CARD_CONFIG("ncr5390", &next_ncr5390_interface)
|
||||
MCFG_DEVICE_CARD_CLOCK("ncr5390", 10000000)
|
||||
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)),
|
||||
|
@ -39,6 +39,7 @@ const device_type A2BUS_SCSI = &device_creator<a2bus_scsi_device>;
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( ncr5380 )
|
||||
MCFG_DEVICE_MODIFY(DEVICE_SELF)
|
||||
MCFG_DEVICE_CLOCK(10000000)
|
||||
MCFG_NCR5380N_DRQ_HANDLER(DEVWRITELINE("^^", a2bus_scsi_device, drq_w))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
@ -59,7 +60,6 @@ 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_CLOCK("ncr5380", 10000000)
|
||||
MCFG_DEVICE_CARD_MACHINE_CONFIG("ncr5380", ncr5380)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
@ -20,7 +20,9 @@ DEVICE_ADDRESS_MAP_START(map, 8, ncr5390_device)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
ncr5390_device::ncr5390_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: nscsi_device(mconfig, NCR5390, "5390 SCSI", tag, owner, clock, "ncr5390", __FILE__)
|
||||
: nscsi_device(mconfig, NCR5390, "5390 SCSI", tag, owner, clock, "ncr5390", __FILE__),
|
||||
m_irq_handler(*this),
|
||||
m_drq_handler(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,8 +41,8 @@ void ncr5390_device::device_start()
|
||||
save_item(NAME(drq));
|
||||
save_item(NAME(clock_conv));
|
||||
|
||||
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;
|
||||
config = 0;
|
||||
@ -63,36 +65,17 @@ void ncr5390_device::device_reset()
|
||||
status &= 0x90;
|
||||
istatus = 0;
|
||||
irq = false;
|
||||
if(!m_irq_func.isnull())
|
||||
m_irq_func(irq);
|
||||
m_irq_handler(irq);
|
||||
reset_soft();
|
||||
}
|
||||
|
||||
void ncr5390_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const ncr5390_interface *intf = reinterpret_cast<const ncr5390_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
{
|
||||
*static_cast<ncr5390_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 ncr5390_device::reset_soft()
|
||||
{
|
||||
state = IDLE;
|
||||
scsi_bus->ctrl_wait(scsi_refid, S_SEL|S_BSY|S_RST, S_ALL);
|
||||
status &= 0xef;
|
||||
drq = false;
|
||||
if(!m_drq_func.isnull())
|
||||
m_drq_func(drq);
|
||||
m_drq_handler(drq);
|
||||
reset_disconnect();
|
||||
}
|
||||
|
||||
@ -746,8 +729,8 @@ void ncr5390_device::check_irq()
|
||||
{
|
||||
bool oldirq = irq;
|
||||
irq = istatus != 0;
|
||||
if(irq != oldirq && !m_irq_func.isnull())
|
||||
m_irq_func(irq);
|
||||
if(irq != oldirq)
|
||||
m_irq_handler(irq);
|
||||
|
||||
}
|
||||
|
||||
@ -854,8 +837,7 @@ void ncr5390_device::drq_set()
|
||||
{
|
||||
if(!drq) {
|
||||
drq = true;
|
||||
if(!m_drq_func.isnull())
|
||||
m_drq_func(drq);
|
||||
m_drq_handler(drq);
|
||||
}
|
||||
}
|
||||
|
||||
@ -863,7 +845,6 @@ void ncr5390_device::drq_clear()
|
||||
{
|
||||
if(drq) {
|
||||
drq = false;
|
||||
if(!m_drq_func.isnull())
|
||||
m_drq_func(drq);
|
||||
m_drq_handler(drq);
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,21 @@
|
||||
|
||||
#include "machine/nscsi_bus.h"
|
||||
|
||||
struct ncr5390_interface
|
||||
{
|
||||
devcb_write_line m_irq_cb;
|
||||
devcb_write_line m_drq_cb;
|
||||
};
|
||||
#define MCFG_NCR5390_IRQ_HANDLER(_devcb) \
|
||||
devcb = &ncr5390_device::set_irq_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
class ncr5390_device : public nscsi_device,
|
||||
public ncr5390_interface
|
||||
#define MCFG_NCR5390_DRQ_HANDLER(_devcb) \
|
||||
devcb = &ncr5390_device::set_drq_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
class ncr5390_device : public nscsi_device
|
||||
{
|
||||
public:
|
||||
ncr5390_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<ncr5390_device &>(device).m_irq_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_drq_handler(device_t &device, _Object object) { return downcast<ncr5390_device &>(device).m_drq_handler.set_callback(object); }
|
||||
|
||||
DECLARE_ADDRESS_MAP(map, 8);
|
||||
|
||||
DECLARE_READ8_MEMBER(tcount_lo_r);
|
||||
@ -45,7 +48,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:
|
||||
@ -192,9 +194,6 @@ private:
|
||||
|
||||
bool irq, drq;
|
||||
|
||||
devcb_resolved_write_line m_irq_func;
|
||||
devcb_resolved_write_line m_drq_func;
|
||||
|
||||
void dma_set(int dir);
|
||||
void drq_set();
|
||||
void drq_clear();
|
||||
@ -221,6 +220,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 NCR5390;
|
||||
|
Loading…
Reference in New Issue
Block a user