Previous 199869 Revisions Next

r28760 Thursday 20th March, 2014 at 17:42:19 UTC by Osso
Converted wd33c93.c to devcb2 (nw)
[src/emu/machine]wd33c93.c wd33c93.h
[src/mame/drivers]cps3.c
[src/mess/drivers]ip20.c ip22.c

trunk/src/emu/machine/wd33c93.c
r28759r28760
203203   regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
204204
205205   /* if we have a callback, call it */
206   if (!m_irq_func.isnull())
206   if (!m_irq_cb.isnull())
207207   {
208      m_irq_func(1);
208      m_irq_cb(1);
209209   }
210210}
211211
r28759r28760
643643         {
644644            regs[WD_AUXILIARY_STATUS] &= ~ASR_INT;
645645
646            if (!m_irq_func.isnull())
646            if (!m_irq_cb.isnull())
647647            {
648               m_irq_func(0);
648               m_irq_cb(0);
649649            }
650650
651651            LOG(( "WD33C93: PC=%08x - Status read (%02x)\n", space.device().safe_pc(), regs[WD_SCSI_STATUS] ));
r28759r28760
742742}
743743
744744wd33c93_device::wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
745   : device_t(mconfig, WD33C93, "33C93 SCSI", tag, owner, clock, "wd33c93", __FILE__)
745   : device_t(mconfig, WD33C93, "33C93 SCSI", tag, owner, clock, "wd33c93", __FILE__),
746      m_irq_cb(*this)
746747{
747748}
748749
749void wd33c93_device::device_config_complete()
750{
751   // inherit a copy of the static data
752   const WD33C93interface *intf = reinterpret_cast<const WD33C93interface *>(static_config());
753   if (intf != NULL)
754   {
755      *static_cast<WD33C93interface *>(this) = *intf;
756   }
757}
758
759750void wd33c93_device::device_start()
760751{
761752   memset(regs, 0, sizeof(regs));
r28759r28760
779770         devices[scsidev->GetDeviceID()] = scsidev;
780771      }
781772   }
782   m_irq_func.resolve(m_irq_cb, *this);
773   m_irq_cb.resolve();
783774
784775   /* allocate a timer for commands */
785776   cmd_timer = timer_alloc(0);
trunk/src/emu/machine/wd33c93.h
r28759r28760
88
99#include "machine/scsihle.h"
1010
11struct WD33C93interface
12{
13   devcb_write_line m_irq_cb; /* irq callback */
14};
15
1611/* wd register names */
1712
1813enum
r28759r28760
5045#define TEMP_INPUT_LEN  262144
5146#define FIFO_SIZE       12
5247
53#define MCFG_WD33C93_ADD( _tag, _config ) \
54   MCFG_DEVICE_ADD( _tag, WD33C93, 0 ) \
55   MCFG_DEVICE_CONFIG(_config)
48#define MCFG_WD33C93_IRQ_CB(_devcb) \
49   devcb = &wd33c93_device::set_irq_callback(*device, DEVCB2_##_devcb);
5650
57class wd33c93_device : public device_t,
58                  public WD33C93interface
51class wd33c93_device : public device_t
5952{
6053public:
6154   // construction/destruction
6255   wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
56   
57   template<class _Object> static devcb2_base &set_irq_callback(device_t &device, _Object object) { return downcast<wd33c93_device &>(device).m_irq_cb.set_callback(object); }
6358
6459   DECLARE_READ8_MEMBER(read);
6560   DECLARE_WRITE8_MEMBER(write);
r28759r28760
7166
7267protected:
7368   // device-level overrides
74   virtual void device_config_complete();
7569   virtual void device_start();
7670   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
7771
r28759r28760
107101   emu_timer   *cmd_timer;
108102   emu_timer   *service_req_timer;
109103   emu_timer   *deassert_cip_timer;
110   devcb_resolved_write_line m_irq_func;
104   devcb2_write_line m_irq_cb; /* irq callback */
111105};
112106
113107// device type definition
trunk/src/mess/drivers/ip20.c
r28759r28760
480480{
481481}
482482
483static const struct WD33C93interface wd33c93_intf =
484{
485   DEVCB_DRIVER_LINE_MEMBER(ip20_state,scsi_irq)      /* command completion IRQ */
486};
487
488483DRIVER_INIT_MEMBER(ip20_state,ip204415)
489484{
490485}
r28759r28760
613608
614609   MCFG_SCSIBUS_ADD("scsi")
615610   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_6)
616   MCFG_WD33C93_ADD("scsi:wd33c93", wd33c93_intf)
611   MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0)
612   MCFG_WD33C93_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, ip20_state, scsi_irq))      /* command completion IRQ */
617613
618614   MCFG_SOUND_MODIFY( "scsi:cdrom:cdda" )
619615   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^mono", 1.0)
trunk/src/mess/drivers/ip22.c
r28759r28760
14781478   }
14791479}
14801480
1481static const struct WD33C93interface wd33c93_intf =
1482{
1483   DEVCB_DRIVER_LINE_MEMBER(ip22_state,scsi_irq)      /* command completion IRQ */
1484};
1485
14861481void ip22_state::machine_start()
14871482{
14881483   sgi_mc_init(machine());
r28759r28760
16381633   MCFG_SCSIBUS_ADD("scsi")
16391634   MCFG_SCSIDEV_ADD("scsi:harddisk1", SCSIHD, SCSI_ID_1)
16401635   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_4)
1641   MCFG_WD33C93_ADD("scsi:wd33c93", wd33c93_intf)
1636   MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0)
1637   MCFG_WD33C93_IRQ_CB(DEVWRITELINE(DEVICE_SELF_OWNER, ip22_state,scsi_irq))
16421638
16431639   MCFG_SOUND_MODIFY( "scsi:cdrom:cdda" )
16441640   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "^^^lspeaker", 1.0)
trunk/src/mame/drivers/cps3.c
r28759r28760
23282328//static sh2_cpu_core sh2cp_conf_slave  = { 1, NULL };
23292329
23302330
2331static const struct WD33C93interface wd33c93_intf =
2332{
2333   DEVCB_NULL            /* command completion IRQ */
2334};
2335
23362331void cps3_state::machine_reset()
23372332{
23382333   m_current_table_address = -1;
r28759r28760
25672562
25682563   MCFG_SCSIBUS_ADD("scsi")
25692564   MCFG_SCSIDEV_ADD("scsi:cdrom", SCSICD, SCSI_ID_1)
2570   MCFG_WD33C93_ADD("scsi:wd33c93", wd33c93_intf)
2565   MCFG_DEVICE_ADD("scsi:wd33c93", WD33C93, 0)
25712566
25722567   /* video hardware */
25732568   MCFG_SCREEN_ADD("screen", RASTER)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team