diff options
Diffstat (limited to 'src/devices/bus/apricot/expansion/expansion.h')
-rw-r--r-- | src/devices/bus/apricot/expansion/expansion.h | 71 |
1 files changed, 24 insertions, 47 deletions
diff --git a/src/devices/bus/apricot/expansion/expansion.h b/src/devices/bus/apricot/expansion/expansion.h index e7f2b881819..85b0e47dc5e 100644 --- a/src/devices/bus/apricot/expansion/expansion.h +++ b/src/devices/bus/apricot/expansion/expansion.h @@ -47,41 +47,6 @@ #pragma once - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_EXPANSION_ADD(_tag, _cpu_tag) \ - MCFG_DEVICE_ADD(_tag, APRICOT_EXPANSION_BUS, 0) \ - downcast<apricot_expansion_bus_device &>(*device).set_cpu_tag(this, _cpu_tag); - -#define MCFG_EXPANSION_IOP_ADD(_tag) \ - downcast<apricot_expansion_bus_device &>(*device).set_iop_tag(this, _tag); - -#define MCFG_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \ - MCFG_DEVICE_ADD(_tag, APRICOT_EXPANSION_SLOT, 0) \ - MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) - -#define MCFG_EXPANSION_DMA1_HANDLER(_devcb) \ - downcast<apricot_expansion_bus_device &>(*device).set_dma1_handler(DEVCB_##_devcb); - -#define MCFG_EXPANSION_DMA2_HANDLER(_devcb) \ - downcast<apricot_expansion_bus_device &>(*device).set_dma2_handler(DEVCB_##_devcb); - -#define MCFG_EXPANSION_EXT1_HANDLER(_devcb) \ - downcast<apricot_expansion_bus_device &>(*device).set_ext1_handler(DEVCB_##_devcb); - -#define MCFG_EXPANSION_EXT2_HANDLER(_devcb) \ - downcast<apricot_expansion_bus_device &>(*device).set_ext2_handler(DEVCB_##_devcb); - -#define MCFG_EXPANSION_INT2_HANDLER(_devcb) \ - downcast<apricot_expansion_bus_device &>(*device).set_int2_handler(DEVCB_##_devcb); - -#define MCFG_EXPANSION_INT3_HANDLER(_devcb) \ - downcast<apricot_expansion_bus_device &>(*device).set_int3_handler(DEVCB_##_devcb); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -96,6 +61,15 @@ class apricot_expansion_slot_device : public device_t, public device_slot_interf { public: // construction/destruction + template <typename T> + apricot_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) + : apricot_expansion_slot_device(mconfig, tag, owner, (uint32_t)0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + } apricot_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: @@ -115,19 +89,22 @@ class apricot_expansion_bus_device : public device_t { public: // construction/destruction + template <typename T, typename U> + apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu_tag, U &&iop_tag) + : apricot_expansion_bus_device(mconfig, tag, owner, (uint32_t)0) + { + m_cpu.set_tag(std::forward<T>(cpu_tag)); + m_iop.set_tag(std::forward<U>(iop_tag)); + } apricot_expansion_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~apricot_expansion_bus_device(); - template <class Object> devcb_base &set_dma1_handler(Object &&cb) { return m_dma1_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_dma2_handler(Object &&cb) { return m_dma2_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ext1_handler(Object &&cb) { return m_ext1_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_ext2_handler(Object &&cb) { return m_ext2_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_int2_handler(Object &&cb) { return m_int2_handler.set_callback(std::forward<Object>(cb)); } - template <class Object> devcb_base &set_int3_handler(Object &&cb) { return m_int3_handler.set_callback(std::forward<Object>(cb)); } - - // inline configuration - void set_cpu_tag(device_t *owner, const char *tag) { m_cpu_tag = tag; } - void set_iop_tag(device_t *owner, const char *tag) { m_iop_tag = tag; } + auto dma1() { return m_dma1_handler.bind(); } + auto dma2() { return m_dma2_handler.bind(); } + auto ext1() { return m_ext1_handler.bind(); } + auto ext2() { return m_ext2_handler.bind(); } + auto int2() { return m_int2_handler.bind(); } + auto int3() { return m_int3_handler.bind(); } void add_card(device_apricot_expansion_card_interface *card); @@ -163,8 +140,8 @@ private: devcb_write_line m_int3_handler; // configuration - const char *m_cpu_tag; - const char *m_iop_tag; + required_device<cpu_device> m_cpu; + required_device<cpu_device> m_iop; }; // device type definition |