summaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
author Felipe CorrĂȘa da Silva Sanches <juca@members.fsf.org>2026-03-17 17:08:47 +0000
committer GitHub <noreply@github.com>2026-03-17 18:08:47 +0100
commit15d7137afe56a3cdaa064b6db8d55d02ba29dcd4 (patch)
treeb9d49532964fb4fde420a266d68323f55057b63b /scripts
parentc4b55b749f4087d2d57c26686173fcb53e244afd (diff)
tmp94c241: Add serial port sub-device with I/O interface mode (#15015)
* tmp94c241: Add serial port sub-device with I/O interface mode Replace the inline serial stubs (which just instantly set TX-complete) with a proper sub-device implementation supporting: - I/O interface mode (mode 0): Synchronous clocked serial using SCLK pin. Supports both internal (baud rate generator) and external (IOC=1) clock sources. TX double buffering with auto-load from buffer to shift register. Pre-outputs bit 0 on TXD before first clock edge so receiver can sample it on the rising edge. - Baud rate generator: Configurable via BRxCR register with divisor and clock source selection. Timer drives SCLK at the configured rate. Clock frequency derived from CPU clock. - TX/RX data callbacks: txd(), rxd(), sclk_out(), sclk_in() for connecting external devices to the serial ports. - tx_start callback: Signals the start of each byte transmission with the current PFFC pin function state, allowing connected devices to distinguish real transmissions from phantom ones. The serial registers (SC0BUF/SC1BUF, SC0CR/SC1CR, SC0MOD/SC1MOD, BR0CR/BR1CR) are now delegated to the sub-devices in the internal memory map. TX-complete flags (INTES0/INTES1 bit 7) are set at device_reset to indicate empty TX buffers at power-on. UART modes (7/8/9-bit) are recognized but not yet implemented. Also moves interrupt register indices from a file-scope enum to public static constexpr members of tmp94c241_device. * tmp94c241: move irq vector map to static const class member Per galibert's review suggestion: defining the IRQ vector table as a static const member of tmp94c241_device and providing the out-of-class definition in class scope allows the INTE* constants to be referenced without tmp94c241_device:: qualifiers in the initializer. The nested struct is named irq_vector_entry. NUM_MASKABLE_IRQS is replaced by std::size(irq_vector_map) directly at each use site inside member functions. * tmp94c241: use enum for public interrupt index constants * tmp94c241: use required_device for serial sub-device parent access Replace dynamic_cast with required_device<tmp94c241_device> using DEVICE_SELF_OWNER to access the parent CPU from the serial sub-device. This provides automatic type checking during MAME's -valid pass. Break the circular header dependency by replacing the #include of tmp94c241_serial.h in tmp94c241.h with a forward declaration, and having tmp94c241_serial.h include tmp94c241.h instead. The .cpp files include what they need directly. Addresses review feedback from galibert on PR #15015.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/src/cpu.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua
index 967f01e75ee..f6922a00a9f 100644
--- a/scripts/src/cpu.lua
+++ b/scripts/src/cpu.lua
@@ -3018,6 +3018,8 @@ if CPUS["TLCS900"] then
MAME_DIR .. "src/devices/cpu/tlcs900/900htbl.hxx",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp94c241.cpp",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp94c241.h",
+ MAME_DIR .. "src/devices/cpu/tlcs900/tmp94c241_serial.cpp",
+ MAME_DIR .. "src/devices/cpu/tlcs900/tmp94c241_serial.h",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp95c061.cpp",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp95c061.h",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp95c063.cpp",