mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00
68340: Preliminary cleanups (nw)
This commit is contained in:
parent
ccc8aaed97
commit
3e890234e7
@ -86,11 +86,11 @@ WRITE32_MEMBER( m68340_cpu_device::m68340_internal_base_w )
|
|||||||
read32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_r),this),
|
read32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_r),this),
|
||||||
write32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_w),this));
|
write32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_w),this));
|
||||||
m_internal->install_readwrite_handler(base + 0x600, base + 0x63f,
|
m_internal->install_readwrite_handler(base + 0x600, base + 0x63f,
|
||||||
READ16_DEVICE_DELEGATE(m_timer1, mc68340_timer_module_device, read),
|
READ16_DEVICE_DELEGATE(m_timer[0], mc68340_timer_module_device, read),
|
||||||
WRITE16_DEVICE_DELEGATE(m_timer1, mc68340_timer_module_device, write),0xffffffff);
|
WRITE16_DEVICE_DELEGATE(m_timer[0], mc68340_timer_module_device, write),0xffffffff);
|
||||||
m_internal->install_readwrite_handler(base + 0x640, base + 0x67f,
|
m_internal->install_readwrite_handler(base + 0x640, base + 0x67f,
|
||||||
READ16_DEVICE_DELEGATE(m_timer2, mc68340_timer_module_device, read),
|
READ16_DEVICE_DELEGATE(m_timer[1], mc68340_timer_module_device, read),
|
||||||
WRITE16_DEVICE_DELEGATE(m_timer2, mc68340_timer_module_device, write),0xffffffff);
|
WRITE16_DEVICE_DELEGATE(m_timer[1], mc68340_timer_module_device, write),0xffffffff);
|
||||||
m_internal->install_readwrite_handler(base + 0x700, base + 0x723,
|
m_internal->install_readwrite_handler(base + 0x700, base + 0x723,
|
||||||
read8sm_delegate(FUNC(mc68340_serial_module_device::read), &*m_serial),
|
read8sm_delegate(FUNC(mc68340_serial_module_device::read), &*m_serial),
|
||||||
write8sm_delegate(FUNC(mc68340_serial_module_device::write), &*m_serial),0xffffffff);
|
write8sm_delegate(FUNC(mc68340_serial_module_device::write), &*m_serial),0xffffffff);
|
||||||
@ -119,12 +119,14 @@ void m68340_cpu_device::m68340_internal_map(address_map &map)
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// device_add_mconfig - add device configuration
|
// device_add_mconfig - add device configuration
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
MACHINE_CONFIG_START(m68340_cpu_device::device_add_mconfig)
|
|
||||||
MCFG_DEVICE_ADD("serial", MC68340_SERIAL_MODULE, 0)
|
void m68340_cpu_device::device_add_mconfig(machine_config &config)
|
||||||
MCFG_MC68340SER_IRQ_CALLBACK(WRITELINE("serial", mc68340_serial_module_device, irq_w))
|
{
|
||||||
MCFG_DEVICE_ADD("timer1", MC68340_TIMER_MODULE, 0)
|
MC68340_SERIAL_MODULE(config, m_serial);
|
||||||
MCFG_DEVICE_ADD("timer2", MC68340_TIMER_MODULE, 0)
|
m_serial->irq_cb().set(m_serial, FUNC(mc68340_serial_module_device::irq_w));
|
||||||
MACHINE_CONFIG_END
|
MC68340_TIMER_MODULE(config, m_timer[0]);
|
||||||
|
MC68340_TIMER_MODULE(config, m_timer[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -134,8 +136,7 @@ MACHINE_CONFIG_END
|
|||||||
m68340_cpu_device::m68340_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
m68340_cpu_device::m68340_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: fscpu32_device(mconfig, tag, owner, clock, M68340, 32,32, address_map_constructor(FUNC(m68340_cpu_device::m68340_internal_map), this))
|
: fscpu32_device(mconfig, tag, owner, clock, M68340, 32,32, address_map_constructor(FUNC(m68340_cpu_device::m68340_internal_map), this))
|
||||||
, m_serial(*this, "serial")
|
, m_serial(*this, "serial")
|
||||||
, m_timer1(*this, "timer1")
|
, m_timer(*this, "timer%u", 1U)
|
||||||
, m_timer2(*this, "timer2")
|
|
||||||
, m_clock_mode(0)
|
, m_clock_mode(0)
|
||||||
, m_crystal(0)
|
, m_crystal(0)
|
||||||
, m_extal(0)
|
, m_extal(0)
|
||||||
|
@ -27,22 +27,22 @@ public:
|
|||||||
auto pb_in_callback() { return m_pb_in_cb.bind(); }
|
auto pb_in_callback() { return m_pb_in_cb.bind(); }
|
||||||
auto pb_out_callback() { return m_pb_out_cb.bind(); }
|
auto pb_out_callback() { return m_pb_out_cb.bind(); }
|
||||||
|
|
||||||
auto tout1_out_callback() { return m_timer1->m_tout_out_cb.bind(); }
|
auto tout1_out_callback() { return m_timer[0]->m_tout_out_cb.bind(); }
|
||||||
auto tin1_in_callback() { return m_timer1->m_tin_in_cb.bind(); }
|
auto tin1_in_callback() { return m_timer[0]->m_tin_in_cb.bind(); }
|
||||||
auto tgate1_in_callback() { return m_timer1->m_tgate_in_cb.bind(); }
|
auto tgate1_in_callback() { return m_timer[0]->m_tgate_in_cb.bind(); }
|
||||||
auto tout2_out_callback() { return m_timer2->m_tout_out_cb.bind(); }
|
auto tout2_out_callback() { return m_timer[1]->m_tout_out_cb.bind(); }
|
||||||
auto tin2_in_callback() { return m_timer2->m_tin_in_cb.bind(); }
|
auto tin2_in_callback() { return m_timer[1]->m_tin_in_cb.bind(); }
|
||||||
auto tgate2_in_callback() { return m_timer2->m_tgate_in_cb.bind(); }
|
auto tgate2_in_callback() { return m_timer[1]->m_tgate_in_cb.bind(); }
|
||||||
|
|
||||||
uint16_t get_cs(offs_t address);
|
uint16_t get_cs(offs_t address);
|
||||||
|
|
||||||
void set_crystal(const XTAL &crystal) { set_crystal(crystal.value()); }
|
void set_crystal(const XTAL &crystal) { set_crystal(crystal.value()); }
|
||||||
|
|
||||||
// Timer input methods, can be used instead of the corresponding polling MCFG callbacks
|
// Timer input methods, can be used instead of the corresponding polling MCFG callbacks
|
||||||
DECLARE_WRITE_LINE_MEMBER( tin1_w ) { m_timer1->tin_w(state); }
|
DECLARE_WRITE_LINE_MEMBER( tin1_w ) { m_timer[0]->tin_w(state); }
|
||||||
DECLARE_WRITE_LINE_MEMBER( tgate1_w ){ m_timer1->tgate_w(state); }
|
DECLARE_WRITE_LINE_MEMBER( tgate1_w ){ m_timer[0]->tgate_w(state); }
|
||||||
DECLARE_WRITE_LINE_MEMBER( tin2_w ) { m_timer2->tin_w(state); }
|
DECLARE_WRITE_LINE_MEMBER( tin2_w ) { m_timer[1]->tin_w(state); }
|
||||||
DECLARE_WRITE_LINE_MEMBER( tgate2_w ){ m_timer2->tgate_w(state); }
|
DECLARE_WRITE_LINE_MEMBER( tgate2_w ){ m_timer[1]->tgate_w(state); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
@ -51,8 +51,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
required_device<mc68340_serial_module_device> m_serial;
|
required_device<mc68340_serial_module_device> m_serial;
|
||||||
required_device<mc68340_timer_module_device> m_timer1;
|
required_device_array<mc68340_timer_module_device, 2> m_timer;
|
||||||
required_device<mc68340_timer_module_device> m_timer2;
|
|
||||||
|
|
||||||
TIMER_CALLBACK_MEMBER(periodic_interrupt_timer_callback);
|
TIMER_CALLBACK_MEMBER(periodic_interrupt_timer_callback);
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ private:
|
|||||||
void do_tick_pit();
|
void do_tick_pit();
|
||||||
|
|
||||||
int calc_cs(offs_t address) const;
|
int calc_cs(offs_t address) const;
|
||||||
int get_timer_index(mc68340_timer_module_device *timer) { return (timer == m_timer1) ? 0 : 1; }
|
int get_timer_index(mc68340_timer_module_device *timer) { return (timer == m_timer[0].target()) ? 0 : 1; }
|
||||||
|
|
||||||
int m_currentcs;
|
int m_currentcs;
|
||||||
uint32_t m_clock_mode;
|
uint32_t m_clock_mode;
|
||||||
|
@ -19,7 +19,7 @@ class mc68340_serial_module_device : public mc68340_duart_device
|
|||||||
friend class m68340_cpu_device;
|
friend class m68340_cpu_device;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
mc68340_serial_module_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
mc68340_serial_module_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||||
|
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
|
@ -12,7 +12,7 @@ class mc68340_timer_module_device : public device_t
|
|||||||
friend class m68340_cpu_device;
|
friend class m68340_cpu_device;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
mc68340_timer_module_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
mc68340_timer_module_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||||
|
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user