From 42731038af6759a6d094deaae05896212c40d715 Mon Sep 17 00:00:00 2001 From: smf- Date: Tue, 17 Dec 2013 20:37:12 +0000 Subject: [PATCH] uses device_mconfig_additions() to add ata slots, which allows you to just add the device and configure it rather than using the MCFG_ATA_INTERFACE_ADD #define. [smf] --- src/emu/machine/ataintf.c | 16 ++++++++++++++++ src/emu/machine/ataintf.h | 14 +++++++------- src/emu/machine/idectrl.h | 24 +++++++++++++++--------- src/emu/machine/vt83c461.h | 8 +++++--- src/mame/drivers/jaguar.c | 4 ++-- src/mame/drivers/ksys573.c | 10 ++++------ src/mess/drivers/dccons.c | 12 +++++------- 7 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/emu/machine/ataintf.c b/src/emu/machine/ataintf.c index aa3d7bc5b87..974c9e1d162 100644 --- a/src/emu/machine/ataintf.c +++ b/src/emu/machine/ataintf.c @@ -272,6 +272,22 @@ void ata_interface_device::device_start() } } +static MACHINE_CONFIG_FRAGMENT( ata_interface ) + MCFG_DEVICE_ADD( "0", ATA_SLOT, 0 ) + MCFG_DEVICE_ADD( "1", ATA_SLOT, 0 ) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - return a pointer to +// the device's machine fragment +//------------------------------------------------- + +machine_config_constructor ata_interface_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( ata_interface ); +} + + //************************************************************************** // ATA SLOT DEVICE //************************************************************************** diff --git a/src/emu/machine/ataintf.h b/src/emu/machine/ataintf.h index b06db00e2a0..ec9492d1fdd 100644 --- a/src/emu/machine/ataintf.h +++ b/src/emu/machine/ataintf.h @@ -36,6 +36,7 @@ protected: // device-level overrides virtual void device_start(); virtual void device_config_complete(); + private: ata_device_interface *m_dev; }; @@ -62,16 +63,14 @@ SLOT_INTERFACE_EXTERN(ata_devices); DEVICE CONFIGURATION MACROS ***************************************************************************/ -#define MCFG_ATA_INTERFACE_ADD(_tag, _slotintf, _master, _slave, _fixed) \ +#define MCFG_ATA_INTERFACE_ADD(_tag, _slot_intf, _master, _slave, _fixed) \ MCFG_DEVICE_ADD(_tag, ATA_INTERFACE, 0) \ - MCFG_ATA_SLOT_ADD(_tag ":0", _slotintf, _master, _fixed) \ - MCFG_ATA_SLOT_ADD(_tag ":1", _slotintf, _slave, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":0") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _master, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":1") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _slave, _fixed) \ MCFG_DEVICE_MODIFY(_tag) -#define MCFG_ATA_SLOT_ADD(_tag, _slot_intf, _def_slot, _fixed) \ - MCFG_DEVICE_ADD(_tag, ATA_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) - /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ @@ -100,6 +99,7 @@ public: protected: // device-level overrides virtual void device_start(); + virtual machine_config_constructor device_mconfig_additions() const; virtual void set_irq(int state); virtual void set_dmarq(int state); diff --git a/src/emu/machine/idectrl.h b/src/emu/machine/idectrl.h index af957300820..f90b124f0cc 100644 --- a/src/emu/machine/idectrl.h +++ b/src/emu/machine/idectrl.h @@ -22,10 +22,12 @@ DEVICE CONFIGURATION MACROS ***************************************************************************/ -#define MCFG_IDE_CONTROLLER_ADD(_tag, _slotintf, _master, _slave, _fixed) \ +#define MCFG_IDE_CONTROLLER_ADD(_tag, _slot_intf, _master, _slave, _fixed) \ MCFG_DEVICE_ADD(_tag, IDE_CONTROLLER, 0) \ - MCFG_ATA_SLOT_ADD(_tag ":0", _slotintf, _master, _fixed) \ - MCFG_ATA_SLOT_ADD(_tag ":1", _slotintf, _slave, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":0") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _master, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":1") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _slave, _fixed) \ MCFG_DEVICE_MODIFY(_tag) class ide_controller_device : public ata_interface_device @@ -43,10 +45,12 @@ public: extern const device_type IDE_CONTROLLER; -#define MCFG_IDE_CONTROLLER_32_ADD(_tag, _slotintf, _master, _slave, _fixed) \ +#define MCFG_IDE_CONTROLLER_32_ADD(_tag, _slot_intf, _master, _slave, _fixed) \ MCFG_DEVICE_ADD(_tag, IDE_CONTROLLER_32, 0) \ - MCFG_ATA_SLOT_ADD(_tag ":0", _slotintf, _master, _fixed) \ - MCFG_ATA_SLOT_ADD(_tag ":1", _slotintf, _slave, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":0") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _master, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":1") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _slave, _fixed) \ MCFG_DEVICE_MODIFY(_tag) class ide_controller_32_device : public ide_controller_device @@ -70,10 +74,12 @@ private: extern const device_type IDE_CONTROLLER_32; -#define MCFG_BUS_MASTER_IDE_CONTROLLER_ADD(_tag, _slotintf, _master, _slave, _fixed) \ +#define MCFG_BUS_MASTER_IDE_CONTROLLER_ADD(_tag, _slot_intf, _master, _slave, _fixed) \ MCFG_DEVICE_ADD(_tag, BUS_MASTER_IDE_CONTROLLER, 0) \ - MCFG_ATA_SLOT_ADD(_tag ":0", _slotintf, _master, _fixed) \ - MCFG_ATA_SLOT_ADD(_tag ":1", _slotintf, _slave, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":0") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _master, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":1") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _slave, _fixed) \ MCFG_DEVICE_MODIFY(_tag) #define MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE(bmcpu, bmspace) \ diff --git a/src/emu/machine/vt83c461.h b/src/emu/machine/vt83c461.h index d136a472f6d..d937dbdb4f4 100644 --- a/src/emu/machine/vt83c461.h +++ b/src/emu/machine/vt83c461.h @@ -22,10 +22,12 @@ DEVICE CONFIGURATION MACROS ***************************************************************************/ -#define MCFG_VT83C461_ADD(_tag, _slotintf, _master, _slave, _fixed) \ +#define MCFG_VT83C461_ADD(_tag, _slot_intf, _master, _slave, _fixed) \ MCFG_DEVICE_ADD(_tag, VT83C461, 0) \ - MCFG_ATA_SLOT_ADD(_tag ":0", _slotintf, _master, _fixed) \ - MCFG_ATA_SLOT_ADD(_tag ":1", _slotintf, _slave, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":0") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _master, _fixed) \ + MCFG_DEVICE_MODIFY(_tag ":1") \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _slave, _fixed) \ MCFG_DEVICE_MODIFY(_tag) #define IDE_CONFIG_REGISTERS 0x10 diff --git a/src/mame/drivers/jaguar.c b/src/mame/drivers/jaguar.c index e3c2484aa9b..60b19f83842 100644 --- a/src/mame/drivers/jaguar.c +++ b/src/mame/drivers/jaguar.c @@ -1806,8 +1806,8 @@ static MACHINE_CONFIG_START( cojagr3k, jaguar_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( cojagr3k_rom, cojagr3k ) - MCFG_DEVICE_REMOVE("ide:0") - MCFG_ATA_SLOT_ADD("ide:0", ata_devices, NULL, true) + MCFG_DEVICE_MODIFY("ide:0") + MCFG_SLOT_DEFAULT_OPTION(NULL) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( cojag68k, cojagr3k ) diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 8c373d42c08..4ef1282a873 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -2010,10 +2010,6 @@ static double analogue_inputs_callback( device_t *device, UINT8 input ) return 0; } -SLOT_INTERFACE_START( ksys573_ata_devices ) - SLOT_INTERFACE( "cr589", CR589 ) -SLOT_INTERFACE_END - static MACHINE_CONFIG_FRAGMENT( cr589_config ) MCFG_DEVICE_MODIFY( "cdda" ) MCFG_SOUND_ROUTE( 0, "^^^^lspeaker", 1.0 ) @@ -2035,11 +2031,13 @@ static MACHINE_CONFIG_START( konami573, ksys573_state ) MCFG_DEVICE_ADD( "mb89371", MB89371, 0 ) - MCFG_ATA_INTERFACE_ADD( "ata", ksys573_ata_devices, "cr589", NULL, true ) + MCFG_DEVICE_ADD( "ata", ATA_INTERFACE, 0 ) MCFG_ATA_INTERFACE_IRQ_HANDLER( WRITELINE( ksys573_state, ata_interrupt ) ) MCFG_DEVICE_MODIFY( "ata:0" ) - MCFG_DEVICE_CARD_MACHINE_CONFIG( "cr589", cr589_config ) + MCFG_SLOT_OPTION_ADD( "cr589", CR589 ) + MCFG_SLOT_OPTION_MACHINE_CONFIG( "cr589", cr589_config ) + MCFG_SLOT_DEFAULT_OPTION( "cr589" ) MCFG_DEVICE_ADD( "maincpu:sio1:cassette", KONAMI573_CASSETTE_SLOT_SERIAL, 0 ) diff --git a/src/mess/drivers/dccons.c b/src/mess/drivers/dccons.c index 15b87352f68..b9bc51292e6 100644 --- a/src/mess/drivers/dccons.c +++ b/src/mess/drivers/dccons.c @@ -606,10 +606,6 @@ static const aica_interface dc_aica_interface = static const struct sh4_config sh4cpu_config = { 1, 0, 1, 0, 0, 0, 1, 1, 0, CPU_CLOCK }; -SLOT_INTERFACE_START(dccons_ata_devices) - SLOT_INTERFACE("gdrom", GDROM) -SLOT_INTERFACE_END - static MACHINE_CONFIG_FRAGMENT( gdrom_config ) MCFG_DEVICE_MODIFY("cdda") MCFG_SOUND_ROUTE(0, "^^^^lspeaker", 1.0) @@ -650,13 +646,15 @@ static MACHINE_CONFIG_START( dc, dc_cons_state ) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(0, "rspeaker", 1.0) - MCFG_AICARTC_ADD("aicartc", XTAL_32_768kHz ) + MCFG_AICARTC_ADD("aicartc", XTAL_32_768kHz) - MCFG_ATA_INTERFACE_ADD("ata", dccons_ata_devices, "gdrom", NULL, true) + MCFG_DEVICE_ADD("ata", ATA_INTERFACE, 0) MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(dc_cons_state, ata_interrupt)) MCFG_DEVICE_MODIFY("ata:0") - MCFG_DEVICE_CARD_MACHINE_CONFIG( "gdrom", gdrom_config ) + MCFG_SLOT_OPTION_ADD("gdrom", GDROM) + MCFG_SLOT_OPTION_MACHINE_CONFIG("gdrom", gdrom_config) + MCFG_SLOT_DEFAULT_OPTION("gdrom") MACHINE_CONFIG_END /*