use device_t.static_set_static_config

This commit is contained in:
smf- 2012-08-25 22:04:22 +00:00
parent ccd4b04d55
commit 17aa09603a
4 changed files with 26 additions and 22 deletions

View File

@ -162,6 +162,16 @@ am53cf96_device::am53cf96_device(const machine_config &mconfig, const char *tag,
{
}
void am53cf96_device::device_config_complete()
{
// inherit a copy of the static data
const AM53CF96interface *intf = reinterpret_cast<const AM53CF96interface *>(static_config());
if (intf != NULL)
{
*static_cast<AM53CF96interface *>(this) = *intf;
}
}
void am53cf96_device::device_start()
{
memset(scsi_regs, 0, sizeof(scsi_regs));
@ -186,12 +196,6 @@ void am53cf96_device::device_start()
m_transfer_timer = timer_alloc( TIMER_TRANSFER );
}
void am53cf96_device::static_set_interface(device_t &device, const AM53CF96interface &interface)
{
am53cf96_device &am53cf96 = downcast<am53cf96_device &>(device);
static_cast<AM53CF96interface &>(am53cf96) = interface;
}
// retrieve data from the SCSI controller
void am53cf96_device::dma_read_data(int bytes, UINT8 *pData)
{

View File

@ -15,9 +15,9 @@ struct AM53CF96interface
void (*irq_callback)(running_machine &machine); /* irq callback */
};
#define MCFG_AM53CF96_ADD( _tag, _interface ) \
#define MCFG_AM53CF96_ADD( _tag, _config ) \
MCFG_DEVICE_ADD( _tag, AM53CF96, 0 ) \
am53cf96_device::static_set_interface(*device, _interface);
MCFG_DEVICE_CONFIG(_config)
// 53CF96 register set
enum
@ -48,9 +48,6 @@ public:
// construction/destruction
am53cf96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// inline configuration helpers
static void static_set_interface(device_t &device, const AM53CF96interface &interface);
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@ -59,6 +56,7 @@ 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);

View File

@ -744,6 +744,16 @@ wd33c93_device::wd33c93_device(const machine_config &mconfig, const char *tag, d
{
}
void wd33c93_device::device_config_complete()
{
// inherit a copy of the static data
const WD33C93interface *intf = reinterpret_cast<const WD33C93interface *>(static_config());
if (intf != NULL)
{
*static_cast<WD33C93interface *>(this) = *intf;
}
}
void wd33c93_device::device_start()
{
memset(&regs, 0, sizeof(regs));
@ -772,12 +782,6 @@ void wd33c93_device::device_start()
save_item( NAME( read_pending ) );
}
void wd33c93_device::static_set_interface(device_t &device, const WD33C93interface &interface)
{
wd33c93_device &wd33c93 = downcast<wd33c93_device &>(device);
static_cast<WD33C93interface &>(wd33c93) = interface;
}
void wd33c93_device::get_dma_data( int bytes, UINT8 *pData )
{
int len = bytes;

View File

@ -52,9 +52,9 @@ enum
#define TEMP_INPUT_LEN 262144
#define FIFO_SIZE 12
#define MCFG_WD33C93_ADD( _tag, _interface ) \
#define MCFG_WD33C93_ADD( _tag, _config ) \
MCFG_DEVICE_ADD( _tag, WD33C93, 0 ) \
wd33c93_device::static_set_interface(*device, _interface);
MCFG_DEVICE_CONFIG(_config)
class wd33c93_device : public device_t,
public WD33C93interface
@ -63,9 +63,6 @@ public:
// construction/destruction
wd33c93_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// inline configuration helpers
static void static_set_interface(device_t &device, const WD33C93interface &interface);
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
@ -76,6 +73,7 @@ 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);