From 2d149e21c9786d159cbde0cecf19ae531dffbd01 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 11 Feb 2019 16:47:02 -0500 Subject: [PATCH] m68000: Add overrideable method to signal RESET instruction to internal peripherals (nw) --- src/devices/cpu/m68000/m68000.h | 2 ++ src/devices/machine/68340.cpp | 9 +++++++++ src/devices/machine/68340.h | 2 ++ src/devices/machine/68340dma.cpp | 5 +++++ src/devices/machine/68340dma.h | 1 + src/devices/machine/68340ser.cpp | 5 +++++ src/devices/machine/68340ser.h | 2 ++ src/devices/machine/68340sim.cpp | 6 ++++++ src/devices/machine/68340sim.h | 1 + src/devices/machine/68340tmu.cpp | 10 ++++++++++ src/devices/machine/68340tmu.h | 11 +++++++---- 11 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/devices/cpu/m68000/m68000.h b/src/devices/cpu/m68000/m68000.h index 0596dd07976..d6afd83d534 100644 --- a/src/devices/cpu/m68000/m68000.h +++ b/src/devices/cpu/m68000/m68000.h @@ -349,6 +349,8 @@ protected: #include "m68kops.h" #include "m68kfpu.hxx" #include "m68kmmu.h" + + virtual void m68k_reset_peripherals() { } }; diff --git a/src/devices/machine/68340.cpp b/src/devices/machine/68340.cpp index e9f8ba7ba8e..bae8be35b62 100644 --- a/src/devices/machine/68340.cpp +++ b/src/devices/machine/68340.cpp @@ -262,3 +262,12 @@ void m68340_cpu_device::device_start() m_int_ack_callback = device_irq_acknowledge_delegate(FUNC(m68340_cpu_device::int_ack), this); } + +void m68340_cpu_device::m68k_reset_peripherals() +{ + m_m68340SIM->module_reset(); + m_m68340DMA->module_reset(); + m_serial->module_reset(); + m_timer[0]->module_reset(); + m_timer[1]->module_reset(); +} diff --git a/src/devices/machine/68340.h b/src/devices/machine/68340.h index 12af250c5b2..23f3ed6b147 100644 --- a/src/devices/machine/68340.h +++ b/src/devices/machine/68340.h @@ -49,6 +49,8 @@ protected: virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; + virtual void m68k_reset_peripherals() override; + private: required_device m_serial; required_device_array m_timer; diff --git a/src/devices/machine/68340dma.cpp b/src/devices/machine/68340dma.cpp index 6649aeb2a94..4a79a4504fc 100644 --- a/src/devices/machine/68340dma.cpp +++ b/src/devices/machine/68340dma.cpp @@ -25,5 +25,10 @@ WRITE32_MEMBER( m68340_cpu_device::m68340_internal_dma_w ) } void m68340_dma::reset() +{ + module_reset(); +} + +void m68340_dma::module_reset() { } diff --git a/src/devices/machine/68340dma.h b/src/devices/machine/68340dma.h index 3a92b4e9a49..8bec4fb88a7 100644 --- a/src/devices/machine/68340dma.h +++ b/src/devices/machine/68340dma.h @@ -10,6 +10,7 @@ class m68340_dma { public: void reset(); + void module_reset(); }; #endif // MAME_MACHINE_68340DMA_H diff --git a/src/devices/machine/68340ser.cpp b/src/devices/machine/68340ser.cpp index fcf6708305e..e0fc3b29fde 100644 --- a/src/devices/machine/68340ser.cpp +++ b/src/devices/machine/68340ser.cpp @@ -157,4 +157,9 @@ mc68340_serial_module_device::mc68340_serial_module_device(const machine_config { } +void mc68340_serial_module_device::module_reset() +{ + mc68340_duart_device::device_reset(); +} + DEFINE_DEVICE_TYPE(MC68340_SERIAL_MODULE, mc68340_serial_module_device, "mc68340sermod", "MC68340 Serial Module") diff --git a/src/devices/machine/68340ser.h b/src/devices/machine/68340ser.h index 595fc512a7d..b9775f2ad86 100644 --- a/src/devices/machine/68340ser.h +++ b/src/devices/machine/68340ser.h @@ -27,6 +27,8 @@ public: uint8_t irq_vector() const { return m_ivr; } uint8_t arbitrate(uint8_t level) const { return (irq_level() == level) ? (m_mcrl & REG_MCRL_ARBLV) : 0; } + void module_reset(); + protected: m68340_cpu_device *m_cpu; diff --git a/src/devices/machine/68340sim.cpp b/src/devices/machine/68340sim.cpp index cf299ba2b22..3dbbfcb0733 100644 --- a/src/devices/machine/68340sim.cpp +++ b/src/devices/machine/68340sim.cpp @@ -493,6 +493,12 @@ void m68340_sim::reset() m_pit_irq = false; } +void m68340_sim::module_reset() +{ + // SYS set in RSR, nothing else happens + m_avr_rsr = (m_avr_rsr & 0xff00) | 0x02; +} + /* do_tick_pit works on whole clock cycles, no flank support */ void m68340_cpu_device::do_tick_pit() { diff --git a/src/devices/machine/68340sim.h b/src/devices/machine/68340sim.h index 3c839984db2..34358e02eff 100644 --- a/src/devices/machine/68340sim.h +++ b/src/devices/machine/68340sim.h @@ -35,6 +35,7 @@ public: bool m_pit_irq; void reset(); + void module_reset(); enum { REG_MCR = 0x00, diff --git a/src/devices/machine/68340tmu.cpp b/src/devices/machine/68340tmu.cpp index 1ceaf65f600..801a9802557 100644 --- a/src/devices/machine/68340tmu.cpp +++ b/src/devices/machine/68340tmu.cpp @@ -308,6 +308,16 @@ void mc68340_timer_module_device::device_start() m_tin_in_cb.resolve_safe(); } +void mc68340_timer_module_device::device_reset() +{ + module_reset(); +} + +void mc68340_timer_module_device::module_reset() +{ + // TODO +} + void mc68340_timer_module_device::do_timer_irq() { assert((m_sr & (REG_SR_TO | REG_SR_TG | REG_SR_TC)) != 0); diff --git a/src/devices/machine/68340tmu.h b/src/devices/machine/68340tmu.h index 0582debd475..8952632792b 100644 --- a/src/devices/machine/68340tmu.h +++ b/src/devices/machine/68340tmu.h @@ -14,9 +14,6 @@ class mc68340_timer_module_device : public device_t public: mc68340_timer_module_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - // device-level overrides - virtual void device_start() override; - READ16_MEMBER( read ); WRITE16_MEMBER( write ); DECLARE_WRITE_LINE_MEMBER( tin_w ); @@ -26,7 +23,13 @@ public: uint8_t irq_vector() const { return m_ir & REG_IR_INTVEC; } uint8_t arbitrate(uint8_t level) const { return (irq_level() == level) ? (m_mcr & REG_MCR_ARBLV) : 0; } - protected: + void module_reset(); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + m68340_cpu_device *m_cpu; uint16_t m_mcr;