diff --git a/src/devices/machine/68340.cpp b/src/devices/machine/68340.cpp index 68f1db3134c..d1df4fa1617 100644 --- a/src/devices/machine/68340.cpp +++ b/src/devices/machine/68340.cpp @@ -92,8 +92,8 @@ WRITE32_MEMBER( m68340_cpu_device::m68340_internal_base_w ) read16_delegate(FUNC(m68340_cpu_device::m68340_internal_timer_r),this), write16_delegate(FUNC(m68340_cpu_device::m68340_internal_timer_w),this),0xffffffff); internal->install_readwrite_handler(base + 0x700, base + 0x723, - READ8_DEVICE_DELEGATE(m_serial, m68340_serial, read), - WRITE8_DEVICE_DELEGATE(m_serial, m68340_serial, write),0xffffffff); + READ8_DEVICE_DELEGATE(m_serial, mc68340_serial_module_device, read), + WRITE8_DEVICE_DELEGATE(m_serial, mc68340_serial_module_device, write),0xffffffff); internal->install_readwrite_handler(base + 0x780, base + 0x7bf, read32_delegate(FUNC(m68340_cpu_device::m68340_internal_dma_r),this), write32_delegate(FUNC(m68340_cpu_device::m68340_internal_dma_w),this)); @@ -119,8 +119,8 @@ ADDRESS_MAP_END // device_add_mconfig - add device configuration //------------------------------------------------- MACHINE_CONFIG_MEMBER( m68340_cpu_device::device_add_mconfig ) - MCFG_DEVICE_ADD("serial", M68340_SERIAL_MODULE, 0) - MCFG_MC68681_IRQ_CALLBACK(DEVWRITELINE("serial", m68340_serial, irq_w)) + MCFG_DEVICE_ADD("serial", MC68340_SERIAL_MODULE, 0) + MCFG_MC68340SER_IRQ_CALLBACK(DEVWRITELINE("serial", mc68340_serial_module_device, irq_w)) MACHINE_CONFIG_END diff --git a/src/devices/machine/68340.h b/src/devices/machine/68340.h index 22ea42cbabc..ee3b99fdd0d 100644 --- a/src/devices/machine/68340.h +++ b/src/devices/machine/68340.h @@ -51,7 +51,7 @@ class m68340_cpu_device : public fscpu32_device { - friend class m68340_serial; + friend class mc68340_serial_module_device; public: m68340_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -106,7 +106,7 @@ protected: virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; - required_device m_serial; + required_device m_serial; TIMER_CALLBACK_MEMBER(periodic_interrupt_timer_callback); TIMER_CALLBACK_MEMBER(timer1_callback); diff --git a/src/devices/machine/68340ser.cpp b/src/devices/machine/68340ser.cpp index e3b2a382cd3..aa0a626b866 100644 --- a/src/devices/machine/68340ser.cpp +++ b/src/devices/machine/68340ser.cpp @@ -32,13 +32,13 @@ #define FUNCNAME __PRETTY_FUNCTION__ #endif -void m68340_serial::device_start() +void mc68340_serial_module_device::device_start() { m_cpu = downcast(owner()); - m68340_serial_device::device_start(); + mc68340_duart_device::device_start(); } -READ8_MEMBER( m68340_serial::read ) +READ8_MEMBER( mc68340_serial_module_device::read ) { LOG("%s\n", FUNCNAME); int val = 0; @@ -87,10 +87,10 @@ READ8_MEMBER( m68340_serial::read ) "MR1B", "SRB", "n/a", "RBB", "n/a", "IP", "n/a", "n/a", // 0x18 - 0x1f "MR2A", "MR2B" }}[offset]); // 0x20 - 0x21 - return offset >= 0x10 && offset < 0x22 ? m68340_serial_device::read(space, offset - 0x10, mem_mask) : val; + return offset >= 0x10 && offset < 0x22 ? mc68340_duart_device::read(space, offset - 0x10, mem_mask) : val; } -WRITE8_MEMBER( m68340_serial::write ) +WRITE8_MEMBER( mc68340_serial_module_device::write ) { LOG("\n%s\n", FUNCNAME); LOGSETUP(" * Reg %02x <- %02x - %s\n", offset, data, @@ -140,12 +140,12 @@ WRITE8_MEMBER( m68340_serial::write ) LOGSERIAL("- Interrupt Vector: %02x\n", data); break; default: - if (offset >= 0x10 && offset < 0x22) m68340_serial_device::write(space, offset - 0x10, data, mem_mask); + if (offset >= 0x10 && offset < 0x22) mc68340_duart_device::write(space, offset - 0x10, data, mem_mask); } } -WRITE_LINE_MEMBER( m68340_serial::irq_w ) +WRITE_LINE_MEMBER( mc68340_serial_module_device::irq_w ) { LOGINT("IRQ!\n%s\n", FUNCNAME); if (m_ilr > 0) @@ -163,9 +163,9 @@ WRITE_LINE_MEMBER( m68340_serial::irq_w ) } } -m68340_serial::m68340_serial(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m68340_serial_device(mconfig, "serial", owner, clock) +mc68340_serial_module_device::mc68340_serial_module_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mc68340_duart_device(mconfig, MC68340_SERIAL_MODULE, tag, owner, clock) { } -DEFINE_DEVICE_TYPE(M68340_SERIAL_MODULE, m68340_serial, "m68340 serial module", "Motorola 68340 Serial Module") +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 271b26dafcd..536d645cb13 100644 --- a/src/devices/machine/68340ser.h +++ b/src/devices/machine/68340ser.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:David Haywood +// copyright-holders:David Haywood, Joakim Larsson Edstrom #ifndef MAME_MACHINE_68340SER_H #define MAME_MACHINE_68340SER_H @@ -7,14 +7,19 @@ #include "machine/mc68681.h" +// MCFG macros to hide the implementation +#define MCFG_MC68340SER_IRQ_CALLBACK(_cb) MCFG_MC68681_IRQ_CALLBACK(_cb) +#define MCFG_MC68340SER_A_TX_CALLBACK(_cb) MCFG_MC68681_A_TX_CALLBACK(_cb) +#define MCFG_MC68340SER_B_TX_CALLBACK(_cb) MCFG_MC68681_B_TX_CALLBACK(_cb) + class m68340_cpu_device; -class m68340_serial : public m68340_serial_device +class mc68340_serial_module_device : public mc68340_duart_device { friend class m68340_cpu_device; public: - m68340_serial(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); // device-level overrides virtual void device_start() override; @@ -56,6 +61,6 @@ protected: }; }; -DECLARE_DEVICE_TYPE(M68340_SERIAL_MODULE, m68340_serial) +DECLARE_DEVICE_TYPE(MC68340_SERIAL_MODULE, mc68340_serial_module_device) #endif // MAME_MACHINE_68340SER_H diff --git a/src/devices/machine/mc68681.cpp b/src/devices/machine/mc68681.cpp index 0659dc3dc29..da860478f6d 100644 --- a/src/devices/machine/mc68681.cpp +++ b/src/devices/machine/mc68681.cpp @@ -10,7 +10,7 @@ Updated by Jonathan Gevaryahu AKA Lord Nightmare Improved interrupt handling by R. Belmont Rewrite and modernization in progress by R. Belmont - Addition of 68340 serial module support by Edstrom + Addition of the duart compatible 68340 serial module support by Edstrom */ #include "emu.h" @@ -62,7 +62,7 @@ static const int baud_rate_ACR_1[] = { 75, 110, 134, 150, 300, 600, 1200, 2000, // device type definition DEFINE_DEVICE_TYPE(MC68681, mc68681_device, "mc68681", "MC68681 DUART") DEFINE_DEVICE_TYPE(SC28C94, sc28c94_device, "sc28c94", "SC28C94 QUART") -DEFINE_DEVICE_TYPE(M68340SERIAL, m68340_serial_device, "m68340ser", "M68340 SERIAL MODULE") +DEFINE_DEVICE_TYPE(MC68340_DUART, mc68340_duart_device, "mc68340duart", "MC68340 DUART Device") DEFINE_DEVICE_TYPE(MC68681_CHANNEL, mc68681_channel, "mc68681_channel", "MC68681 DUART channel") @@ -110,8 +110,13 @@ sc28c94_device::sc28c94_device(const machine_config &mconfig, const char *tag, d // that the code knows all of this and will not warn if those registers are accessed as it could be ported code. // TODO: A lot of subtle differences and also detect misuse of unavailable registers as they should be ignored //-------------------------------------------------------------------------------------------------------------------- -m68340_serial_device::m68340_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : mc68681_base_device(mconfig, M68340SERIAL, tag, owner, clock) +mc68340_duart_device::mc68340_duart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : mc68681_base_device(mconfig, type, tag, owner, clock) +{ +} + +mc68340_duart_device::mc68340_duart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : mc68340_duart_device(mconfig, MC68340_DUART, tag, owner, clock) { } @@ -187,7 +192,7 @@ MACHINE_CONFIG_MEMBER( sc28c94_device::device_add_mconfig ) MCFG_DEVICE_ADD(CHAND_TAG, MC68681_CHANNEL, 0) MACHINE_CONFIG_END -MACHINE_CONFIG_MEMBER( m68340_serial_device::device_add_mconfig ) +MACHINE_CONFIG_MEMBER( mc68340_duart_device::device_add_mconfig ) MCFG_DEVICE_ADD(CHANA_TAG, MC68681_CHANNEL, 0) MCFG_DEVICE_ADD(CHANB_TAG, MC68681_CHANNEL, 0) MACHINE_CONFIG_END @@ -366,7 +371,7 @@ TIMER_CALLBACK_MEMBER( mc68681_base_device::duart_timer_callback ) } -READ8_MEMBER( m68340_serial_device::read ) +READ8_MEMBER( mc68340_duart_device::read ) { uint8_t r = 0; @@ -522,7 +527,7 @@ READ8_MEMBER( mc68681_base_device::read ) return r; } -WRITE8_MEMBER( m68340_serial_device::write ) +WRITE8_MEMBER( mc68340_duart_device::write ) { //printf("Duart write %02x -> %02x\n", data, offset); diff --git a/src/devices/machine/mc68681.h b/src/devices/machine/mc68681.h index 47e15e3c318..ebc29c98fd1 100644 --- a/src/devices/machine/mc68681.h +++ b/src/devices/machine/mc68681.h @@ -41,9 +41,9 @@ #define MCFG_SC28C94_D_TX_CALLBACK(_cb) \ devcb = &sc28c94_device::set_d_tx_cb(*device, DEVCB_##_cb); -// M68340SERIAL specific callbacks -#define MCFG_M68340SERIAL_ADD(_tag, _clock) \ - MCFG_DEVICE_ADD(_tag, M68340SERIAL, _clock) +// MC68340SERIAL specific callbacks +#define MCFG_MC68340DUART_ADD(_tag, _clock) \ + MCFG_DEVICE_ADD(_tag, MC68340_DUART, _clock) #define MC68681_RX_FIFO_SIZE 3 @@ -240,23 +240,22 @@ protected: private: }; -class m68340_serial_device : public mc68681_base_device +class mc68340_duart_device : public mc68681_base_device { public: - m68340_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + mc68340_duart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual DECLARE_READ8_MEMBER(read) override; virtual DECLARE_WRITE8_MEMBER(write) override; protected: virtual void device_add_mconfig(machine_config &config) override; - -private: + mc68340_duart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(MC68681, mc68681_device) DECLARE_DEVICE_TYPE(SC28C94, sc28c94_device) -DECLARE_DEVICE_TYPE(M68340SERIAL, m68340_serial_device) +DECLARE_DEVICE_TYPE(MC68340_DUART, mc68340_duart_device) DECLARE_DEVICE_TYPE(MC68681_CHANNEL, mc68681_channel) #endif // MAME_MACHINE_MC68681_H diff --git a/src/mame/drivers/dbox.cpp b/src/mame/drivers/dbox.cpp index 2ed325e9f89..b427c1a16f9 100644 --- a/src/mame/drivers/dbox.cpp +++ b/src/mame/drivers/dbox.cpp @@ -136,22 +136,6 @@ * SIM40 + 0x0058: 0x000007F2 CS3 mask 1 - block size = 2048 (2KB) * SIM40 + 0x005C: 0x00780003 CS3 base 1 * SIM40 + 0x001F: 0x40 PBARB Port B Pin Assignment - * -- 0000007a void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000040, 003ffff5 (ffffffff) - not implemented -- 00000082 void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000044, 00000003 (ffffffff) - not implemented -- 0000008a void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000048, 003ffff5 (ffffffff) - not implemented -- 00000092 void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 0000004c, 00800003 (ffffffff) - not implemented -- 0000009a void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000050, 00007fff (ffffffff) - not implemented -- 000000a2 void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000054, 00700003 (ffffffff) - not implemented -- 000000aa void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000058, 000007f2 (ffffffff) - not implemented -- 000000b2 void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 0000005c, 00780003 (ffffffff) - not implemented -... -- 008004d8 void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000044, 00000053 (ffffffff) - not implemented -- 008004e2 void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000040, 003fff05 (ffffffff) - not implemented -- 008004ee void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000040, 003ffff5 (ffffffff) - not implemented -- 008004f8 void m68340_cpu_device::m68340_internal_sim_cs_w(address_space&, offs_t, osd::u32, osd::u32) 00000044, 0000005b (ffffffff) - not implemented - - * ------------------------------------------------------------- * The bootstrap copies the firmware to RAM and jumps to it * ------------------------------------------------------------- @@ -625,12 +609,12 @@ static MACHINE_CONFIG_START( dbox ) #define CHA ":rs232" #define CHB ":modem" MCFG_DEVICE_MODIFY("maincpu:serial") - MCFG_MC68681_A_TX_CALLBACK(DEVWRITELINE(CHA, rs232_port_device, write_txd)) - MCFG_MC68681_B_TX_CALLBACK(DEVWRITELINE(CHB, rs232_port_device, write_txd)) - MCFG_RS232_PORT_ADD (CHA, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER (DEVWRITELINE (":maincpu:serial", m68340_serial, rx_a_w)) - MCFG_RS232_PORT_ADD (CHB, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER (DEVWRITELINE (":maincpu:serial", m68340_serial, rx_b_w)) + MCFG_MC68340SER_A_TX_CALLBACK(DEVWRITELINE(CHA, rs232_port_device, write_txd)) + MCFG_MC68340SER_B_TX_CALLBACK(DEVWRITELINE(CHB, rs232_port_device, write_txd)) + MCFG_RS232_PORT_ADD (CHA, default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER (DEVWRITELINE (":maincpu:serial", mc68340_serial_module_device, rx_a_w)) + MCFG_RS232_PORT_ADD (CHB, default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER (DEVWRITELINE (":maincpu:serial", mc68340_serial_module_device, rx_b_w)) /* Add the boot flash */ MCFG_AMD_29F800B_16BIT_ADD("flash") @@ -663,4 +647,4 @@ ROM_START( dbox ) ROMX_LOAD( "bootCi106.bin", 0x000000, 0x020000, BAD_DUMP CRC(641762a9) SHA1(7c5233390cc66d3ddf4c730a3418ccfba1dc2905), ROM_BIOS(3) ) ROM_END -COMP( 1996, dbox, 0, 0, dbox, dbox, dbox_state, dbox, "Nokia Multimedia", "D-box 1, Kirsch gruppe", MACHINE_IS_SKELETON ) +COMP( 1996, dbox, 0, 0, dbox, dbox, dbox_state, dbox, "Nokia Multimedia", "D-box 1, Kirsch gruppe", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )