diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2021-06-19 23:02:17 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2021-06-19 23:03:41 -0400 |
commit | 4d2c305b27d3acd331dec316306eed627717a3cf (patch) | |
tree | d23278c9bbfa093ba3b6343d9af75627bda56f76 | |
parent | ec687c94a03c80896e1553135f76ead5ebda312f (diff) |
vme: Modernize slot device code and eliminate deprecation warnings; actually propagate slot number
-rw-r--r-- | src/devices/bus/vme/vme.cpp | 54 | ||||
-rw-r--r-- | src/devices/bus/vme/vme.h | 30 | ||||
-rw-r--r-- | src/devices/bus/vme/vme_fccpu20.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/vme/vme_fcisio.cpp | 1 | ||||
-rw-r--r-- | src/devices/bus/vme/vme_fcscsi.cpp | 1 | ||||
-rw-r--r-- | src/devices/bus/vme/vme_hcpu30.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/vme/vme_mvme350.cpp | 1 | ||||
-rw-r--r-- | src/devices/bus/vme/vme_mzr8300.cpp | 1 |
8 files changed, 26 insertions, 66 deletions
diff --git a/src/devices/bus/vme/vme.cpp b/src/devices/bus/vme/vme.cpp index d0338a4b71d..57f0c6170d2 100644 --- a/src/devices/bus/vme/vme.cpp +++ b/src/devices/bus/vme/vme.cpp @@ -109,54 +109,34 @@ vme_slot_device::vme_slot_device(const machine_config &mconfig, const char *tag, vme_slot_device::vme_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , device_slot_interface(mconfig, *this) - , m_vme_tag(nullptr) - , m_vme_slottag(nullptr) + , m_vme(*this, finder_base::DUMMY_TAG) + , m_slot_nbr(0) , m_vme_j1_callback(*this) { LOG("%s %s\n", tag, FUNCNAME); } //------------------------------------------------- -// update_vme_chains -//------------------------------------------------- -void vme_slot_device::update_vme_chains(uint32_t slot_nbr) -{ - LOG("%s %s - %d\n", FUNCNAME, tag(), slot_nbr); -} - -//------------------------------------------------- -// set_vme_slot +// device_start - device-specific startup //------------------------------------------------- -void vme_slot_device::set_vme_slot(const char *tag, const char *slottag) +void vme_slot_device::device_start() { - LOG("%s %s - %s\n", FUNCNAME, tag, slottag); - m_vme_tag = tag; - m_vme_slottag = slottag; + // m_card = dynamic_cast<device_vme_card_interface *>(get_card_device()); } //------------------------------------------------- -// device_start - device-specific startup +// device_resolve_objects - resolve objects that +// may be needed for other devices to set +// initial conditions at start time //------------------------------------------------- -void vme_slot_device::device_start() +void vme_slot_device::device_resolve_objects() { device_vme_card_interface *dev = dynamic_cast<device_vme_card_interface *>(get_card_device()); - LOG("%s %s - %s:%s\n", tag(), FUNCNAME, m_vme_tag, m_vme_slottag); + LOG("%s %s - %s\n", tag(), FUNCNAME, m_vme.finder_tag()); if (dev) { - dev->set_vme_tag(m_vme_tag, m_vme_slottag); + dev->set_vme_bus(*m_vme, m_slot_nbr); } - - // m_card = dynamic_cast<device_vme_card_interface *>(get_card_device()); -} - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- -void vme_slot_device::device_config_complete() -{ - LOG("%s %s\n", tag(), FUNCNAME); } //------------------------------------------------- @@ -457,8 +437,6 @@ void vme_device::install_device(vme_amod_t amod, offs_t start, offs_t end, read3 device_vme_card_interface::device_vme_card_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "vme") , m_vme(nullptr) - , m_vme_tag(nullptr) - , m_vme_slottag(nullptr) , m_slot(0) , m_next(nullptr) { @@ -471,17 +449,9 @@ device_vme_card_interface::~device_vme_card_interface() LOG("%s %s\n", m_device->tag(), FUNCNAME); } -void device_vme_card_interface::set_vme_tag(const char *tag, const char *slottag) -{ - LOG("%s %s\n", tag, FUNCNAME); - m_vme_tag = tag; - m_vme_slottag = slottag; -} - -void device_vme_card_interface::set_vme_device() +void device_vme_card_interface::interface_post_start() { LOG("%s %s\n", m_device->tag(), FUNCNAME); - m_vme = dynamic_cast<vme_device *>(device().machine().device(m_vme_tag)); // printf("*** %s %sfound\n", m_vme_tag, m_vme ? "" : "not "); if (m_vme) m_vme->add_vme_card(this); } diff --git a/src/devices/bus/vme/vme.h b/src/devices/bus/vme/vme.h index 93947e40e91..e49b23cbbbe 100644 --- a/src/devices/bus/vme/vme.h +++ b/src/devices/bus/vme/vme.h @@ -55,12 +55,11 @@ // CONSTANTS //************************************************************************** -#define VME_BUS_TAG "vme" - //void vme_slot1(device_slot_interface &device); // Disabled until we know how to combine a board driver and a slot device. void vme_slots(device_slot_interface &device); class device_vme_card_interface; // This interface is standardized +class vme_device; class vme_slot_device : public device_t, public device_slot_interface @@ -85,16 +84,15 @@ public: }; // construction/destruction - template <typename T> - vme_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, uint32_t slot_nbr, char const *bus_tag) + template <typename T, typename U> + vme_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt, uint32_t slot_nbr, U &&bus_tag) : vme_slot_device(mconfig, tag, owner, 0) { option_reset(); opts(*this); set_default_option(dflt); set_fixed(false); - set_vme_slot(bus_tag, tag); - update_vme_chains(slot_nbr); + set_vme_slot(std::forward<U>(bus_tag), slot_nbr); } vme_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -102,8 +100,7 @@ public: // Callbacks to the board from the VME bus comes through here auto vme_j1_callback() { return m_vme_j1_callback.bind(); } - void set_vme_slot(const char *tag, const char *slottag); - void update_vme_chains(uint32_t slot_nbr); + template <typename T> void set_vme_slot(T &&tag, uint32_t slot_nbr) { m_vme.set_tag(std::forward<T>(tag)); m_slot_nbr = slot_nbr; } virtual uint8_t read8(offs_t offset); virtual void write8(offs_t offset, uint8_t data); @@ -113,10 +110,11 @@ protected: // device-level overrides virtual void device_start() override; - virtual void device_config_complete() override; + virtual void device_resolve_objects() override; // configuration - const char *m_vme_tag, *m_vme_slottag; + required_device<vme_device> m_vme; + uint32_t m_slot_nbr; // callbacks devcb_write_line m_vme_j1_callback; @@ -139,8 +137,6 @@ public: void set_cputag(const char *tag) { m_cputag = tag; } void use_owner_spaces(); - virtual space_config_vector memory_space_config() const override; - const address_space_config m_a32_config; void add_vme_card(device_vme_card_interface *card); @@ -196,6 +192,8 @@ protected: virtual void device_reset() override; simple_list<device_vme_card_interface> m_device_list; + virtual space_config_vector memory_space_config() const override; + // internal state cpu_device *m_maincpu; @@ -218,22 +216,22 @@ class device_vme_card_interface : public device_interface template <class ElementType> friend class simple_list; public: // inline configuration - void set_vme_tag(const char *tag, const char *slottag); + void set_vme_bus(vme_device &vme, int slot) { m_vme = &vme; m_slot = slot; } // construction/destruction virtual ~device_vme_card_interface(); - void set_vme_device(); virtual uint8_t read8(offs_t offset); virtual void write8(offs_t offset, uint8_t data); +protected: device_vme_card_interface(const machine_config &mconfig, device_t &device); -protected: + virtual void interface_post_start() override; + device_t *m_device; vme_device *m_vme; - const char *m_vme_tag, *m_vme_slottag; int m_slot; private: diff --git a/src/devices/bus/vme/vme_fccpu20.cpp b/src/devices/bus/vme/vme_fccpu20.cpp index 8759c47d143..ee07b86e1be 100644 --- a/src/devices/bus/vme/vme_fccpu20.cpp +++ b/src/devices/bus/vme/vme_fccpu20.cpp @@ -443,8 +443,6 @@ void vme_fccpu20_device::device_start() { LOG("%s\n", FUNCNAME); - set_vme_device(); - save_pointer (NAME (m_sysrom), sizeof(m_sysrom)); save_pointer (NAME (m_sysram), sizeof(m_sysram)); // save_item(NAME(m_board_id)); // TODO: Save this "non base type" item diff --git a/src/devices/bus/vme/vme_fcisio.cpp b/src/devices/bus/vme/vme_fcisio.cpp index d9e35370812..de4c03dfab8 100644 --- a/src/devices/bus/vme/vme_fcisio.cpp +++ b/src/devices/bus/vme/vme_fcisio.cpp @@ -405,7 +405,6 @@ vme_fcisio1_card_device::vme_fcisio1_card_device(const machine_config &mconfig, void vme_fcisio1_card_device::device_start() { LOG("%s\n", FUNCNAME); - set_vme_device(); /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ m_sysrom = (uint16_t*)(memregion ("maincpu")->base () + 0xf00000); diff --git a/src/devices/bus/vme/vme_fcscsi.cpp b/src/devices/bus/vme/vme_fcscsi.cpp index 508ae910e9c..7324dd907b6 100644 --- a/src/devices/bus/vme/vme_fcscsi.cpp +++ b/src/devices/bus/vme/vme_fcscsi.cpp @@ -329,7 +329,6 @@ vme_fcscsi1_card_device::vme_fcscsi1_card_device(const machine_config &mconfig, void vme_fcscsi1_card_device::device_start() { LOG("%s\n", FUNCNAME); - set_vme_device(); /* Setup pointer to bootvector in ROM for bootvector handler bootvect_r */ m_sysrom = (uint16_t*)(memregion ("maincpu")->base () + 0xe00000); diff --git a/src/devices/bus/vme/vme_hcpu30.cpp b/src/devices/bus/vme/vme_hcpu30.cpp index 0c072c20191..2d70c85dd94 100644 --- a/src/devices/bus/vme/vme_hcpu30.cpp +++ b/src/devices/bus/vme/vme_hcpu30.cpp @@ -180,8 +180,6 @@ void vme_hcpu30_card_device::device_start() { LOG("%s %s\n", tag(), FUNCNAME); - set_vme_device(); - save_pointer (NAME (m_sysrom), sizeof(m_sysrom)); save_pointer (NAME (m_sysram), sizeof(m_sysram)); diff --git a/src/devices/bus/vme/vme_mvme350.cpp b/src/devices/bus/vme/vme_mvme350.cpp index 1b8f2f7a564..a0dca46b996 100644 --- a/src/devices/bus/vme/vme_mvme350.cpp +++ b/src/devices/bus/vme/vme_mvme350.cpp @@ -224,7 +224,6 @@ vme_mvme350_card_device::vme_mvme350_card_device(const machine_config &mconfig, void vme_mvme350_card_device::device_start() { LOG("%s %s\n", tag(), FUNCNAME); - set_vme_device(); /* Setup r/w handlers for shared memory area */ #if 0 diff --git a/src/devices/bus/vme/vme_mzr8300.cpp b/src/devices/bus/vme/vme_mzr8300.cpp index cdcd3bd267e..99e2e8c0889 100644 --- a/src/devices/bus/vme/vme_mzr8300.cpp +++ b/src/devices/bus/vme/vme_mzr8300.cpp @@ -168,7 +168,6 @@ vme_mzr8300_card_device::vme_mzr8300_card_device(const machine_config &mconfig, void vme_mzr8300_card_device::device_start() { LOG("%s %s\n", tag(), FUNCNAME); - set_vme_device(); /* Setup r/w handlers for first SIO in A16 */ uint32_t base = 0xFF0000; |