diff options
author | smf- <smf-@users.noreply.github.com> | 2012-09-06 07:34:28 +0000 |
---|---|---|
committer | smf- <smf-@users.noreply.github.com> | 2012-09-06 07:34:28 +0000 |
commit | 24f0842e1b61067972740d0365f017d01fac405d (patch) | |
tree | 5df852c3964444df1916d1807b83b6d058e9b66d /src/emu | |
parent | a50849088e1406403ffdef0c15b97e74923c3bee (diff) |
Split out callbacks from scsibus_device into scscb_device, eventually this will be a SCSI device. SCSIBus_interface is no longer required and has been removed. [smf]
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/emu.mak | 3 | ||||
-rw-r--r-- | src/emu/machine/scsibus.c | 48 | ||||
-rw-r--r-- | src/emu/machine/scsibus.h | 43 | ||||
-rw-r--r-- | src/emu/machine/scsicb.c | 29 | ||||
-rw-r--r-- | src/emu/machine/scsicb.h | 64 |
5 files changed, 121 insertions, 66 deletions
diff --git a/src/emu/emu.mak b/src/emu/emu.mak index ee79e13173a..6351390faee 100644 --- a/src/emu/emu.mak +++ b/src/emu/emu.mak @@ -244,7 +244,8 @@ EMUMACHINEOBJS = \ $(EMUMACHINE)/s3c2410.o \ $(EMUMACHINE)/s3c2440.o \ $(EMUMACHINE)/s3520cf.o \ - $(EMUMACHINE)/scsibus.o \ + $(EMUMACHINE)/scsicb.o \ + $(EMUMACHINE)/scsibus.o \ $(EMUMACHINE)/scsicd.o \ $(EMUMACHINE)/scsidev.o \ $(EMUMACHINE)/scsihd.o \ diff --git a/src/emu/machine/scsibus.c b/src/emu/machine/scsibus.c index 0bb74d4708b..2a2e827ee77 100644 --- a/src/emu/machine/scsibus.c +++ b/src/emu/machine/scsibus.c @@ -594,18 +594,21 @@ void scsibus_device::scsi_out_line_change_now(UINT8 line, UINT8 state) LOG(3,"scsi_out_line_change(%s,%d)\n",linenames[line],state); - if(line_change_cb!=NULL) - line_change_cb(this, line,state); - - switch (line) + if(m_scsicb != NULL) { - case SCSI_LINE_BSY: out_bsy_func(state); break; - case SCSI_LINE_SEL: out_sel_func(state); break; - case SCSI_LINE_CD: out_cd_func(state); break; - case SCSI_LINE_IO: out_io_func(state); break; - case SCSI_LINE_MSG: out_msg_func(state); break; - case SCSI_LINE_REQ: out_req_func(state); break; - case SCSI_LINE_RESET: out_rst_func(state); break; + if(m_scsicb->line_change_cb!=NULL) + m_scsicb->line_change_cb(this, line,state); + + switch (line) + { + case SCSI_LINE_BSY: m_scsicb->out_bsy_func(state); break; + case SCSI_LINE_SEL: m_scsicb->out_sel_func(state); break; + case SCSI_LINE_CD: m_scsicb->out_cd_func(state); break; + case SCSI_LINE_IO: m_scsicb->out_io_func(state); break; + case SCSI_LINE_MSG: m_scsicb->out_msg_func(state); break; + case SCSI_LINE_REQ: m_scsicb->out_req_func(state); break; + case SCSI_LINE_RESET: m_scsicb->out_rst_func(state); break; + } } } @@ -746,28 +749,10 @@ scsibus_device::scsibus_device(const machine_config &mconfig, const char *tag, d { } -void scsibus_device::device_config_complete() -{ - // inherit a copy of the static data - const SCSIBus_interface *intf = reinterpret_cast<const SCSIBus_interface *>(static_config()); - if (intf != NULL) - { - *static_cast<SCSIBus_interface *>(this) = *intf; - } -} - void scsibus_device::device_start() { memset(devices, 0, sizeof(devices)); - out_bsy_func.resolve(_out_bsy_func, *this); - out_sel_func.resolve(_out_sel_func, *this); - out_cd_func.resolve(_out_cd_func, *this); - out_io_func.resolve(_out_io_func, *this); - out_msg_func.resolve(_out_msg_func, *this); - out_req_func.resolve(_out_req_func, *this); - out_rst_func.resolve(_out_rst_func, *this); - // All lines start high - inactive linestate=0xFF; @@ -787,6 +772,11 @@ void scsibus_device::device_start() { devices[scsidev->GetDeviceID()] = scsidev; } + else + { + scsicb_device *scsicb = dynamic_cast<scsicb_device *>(device); + m_scsicb = scsicb; + } } } diff --git a/src/emu/machine/scsibus.h b/src/emu/machine/scsibus.h index 27dc3d6a10a..a4b6c385726 100644 --- a/src/emu/machine/scsibus.h +++ b/src/emu/machine/scsibus.h @@ -1,43 +1,23 @@ /* SCSIBus.h - Implementation of a raw SCSI/SASI bus for machines that don't use a SCSI - controler chip such as the RM Nimbus, which implements it as a bunch of - 74LS series chips. - */ +#pragma once + #ifndef _SCSIBUS_H_ #define _SCSIBUS_H_ +#include "machine/scsicb.h" #include "machine/scsidev.h" /*************************************************************************** - INTERFACE -***************************************************************************/ - -typedef struct _SCSIBus_interface SCSIBus_interface; -struct _SCSIBus_interface -{ - void (*line_change_cb)(device_t *, UINT8 line, UINT8 state); - - devcb_write_line _out_bsy_func; - devcb_write_line _out_sel_func; - devcb_write_line _out_cd_func; - devcb_write_line _out_io_func; - devcb_write_line _out_msg_func; - devcb_write_line _out_req_func; - devcb_write_line _out_rst_func; -}; - -/*************************************************************************** MACROS ***************************************************************************/ -#define MCFG_SCSIBUS_ADD(_tag, _intrf) \ - MCFG_DEVICE_ADD(_tag, SCSIBUS, 0) \ - MCFG_DEVICE_CONFIG(_intrf) +#define MCFG_SCSIBUS_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, SCSIBUS, 0) /*************************************************************************** @@ -144,8 +124,7 @@ typedef struct UINT8 sectors_per_track; } adaptec_sense_t; -class scsibus_device : public device_t, - public SCSIBus_interface +class scsibus_device : public device_t { public: // construction/destruction @@ -185,7 +164,6 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); @@ -210,14 +188,7 @@ private: void dump_bytes(UINT8 *buff, int count); scsidev_device *devices[8]; - - devcb_resolved_write_line out_bsy_func; - devcb_resolved_write_line out_sel_func; - devcb_resolved_write_line out_cd_func; - devcb_resolved_write_line out_io_func; - devcb_resolved_write_line out_msg_func; - devcb_resolved_write_line out_req_func; - devcb_resolved_write_line out_rst_func; + scsicb_device *m_scsicb; UINT8 linestate; UINT8 last_id; diff --git a/src/emu/machine/scsicb.c b/src/emu/machine/scsicb.c new file mode 100644 index 00000000000..508c11274da --- /dev/null +++ b/src/emu/machine/scsicb.c @@ -0,0 +1,29 @@ +#include "scsicb.h" + +scsicb_device::scsicb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SCSICB, "SCSI callback", tag, owner, clock) +{ +} + +void scsicb_device::device_config_complete() +{ + // inherit a copy of the static data + const SCSICB_interface *intf = reinterpret_cast<const SCSICB_interface *>(static_config()); + if (intf != NULL) + { + *static_cast<SCSICB_interface *>(this) = *intf; + } +} + +void scsicb_device::device_start() +{ + out_bsy_func.resolve(_out_bsy_func, *this); + out_sel_func.resolve(_out_sel_func, *this); + out_cd_func.resolve(_out_cd_func, *this); + out_io_func.resolve(_out_io_func, *this); + out_msg_func.resolve(_out_msg_func, *this); + out_req_func.resolve(_out_req_func, *this); + out_rst_func.resolve(_out_rst_func, *this); +} + +const device_type SCSICB = &device_creator<scsicb_device>; diff --git a/src/emu/machine/scsicb.h b/src/emu/machine/scsicb.h new file mode 100644 index 00000000000..e9cff5385fd --- /dev/null +++ b/src/emu/machine/scsicb.h @@ -0,0 +1,64 @@ +/* + SCSICB.h + + Callbacks from SCSI/SASI bus for machines that don't use a SCSI + controler chip such as the RM Nimbus, which implements it as a bunch of + 74LS series chips. + +*/ + +#pragma once + +#ifndef _SCSICB_H_ +#define _SCSICB_H_ + +#include "emu.h" + +/*************************************************************************** + MACROS +***************************************************************************/ + +#define MCFG_SCSICB_ADD(_tag, _intf) \ + MCFG_DEVICE_ADD(_tag, SCSICB, 0) \ + MCFG_DEVICE_CONFIG(_intf) + + +typedef struct _SCSICB_interface SCSICB_interface; +struct _SCSICB_interface +{ + void (*line_change_cb)(device_t *, UINT8 line, UINT8 state); + + devcb_write_line _out_bsy_func; + devcb_write_line _out_sel_func; + devcb_write_line _out_cd_func; + devcb_write_line _out_io_func; + devcb_write_line _out_msg_func; + devcb_write_line _out_req_func; + devcb_write_line _out_rst_func; +}; + +class scsicb_device : public device_t, + public SCSICB_interface +{ +public: + // construction/destruction + scsicb_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + devcb_resolved_write_line out_bsy_func; + devcb_resolved_write_line out_sel_func; + devcb_resolved_write_line out_cd_func; + devcb_resolved_write_line out_io_func; + devcb_resolved_write_line out_msg_func; + devcb_resolved_write_line out_req_func; + devcb_resolved_write_line out_rst_func; + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); +}; + +// device type definition +extern const device_type SCSICB; + +#endif |