From 37c2d0587d5c27ab699dad1e58a722d5e043b40f Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 6 Apr 2014 08:48:33 +0000 Subject: [PATCH] added RS232 loopback [smf] --- .gitattributes | 2 ++ src/emu/bus/bus.mak | 1 + src/emu/bus/rs232/loopback.c | 16 ++++++++++++++++ src/emu/bus/rs232/loopback.h | 25 +++++++++++++++++++++++++ src/emu/bus/rs232/rs232.c | 4 +++- 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/emu/bus/rs232/loopback.c create mode 100644 src/emu/bus/rs232/loopback.h diff --git a/.gitattributes b/.gitattributes index 6592e49cf83..cd08a4b90b3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1160,6 +1160,8 @@ src/emu/bus/plus4/user.c svneol=native#text/plain src/emu/bus/plus4/user.h svneol=native#text/plain src/emu/bus/rs232/keyboard.c svneol=native#text/plain src/emu/bus/rs232/keyboard.h svneol=native#text/plain +src/emu/bus/rs232/loopback.c svneol=native#text/plain +src/emu/bus/rs232/loopback.h svneol=native#text/plain src/emu/bus/rs232/null_modem.c svneol=native#text/plain src/emu/bus/rs232/null_modem.h svneol=native#text/plain src/emu/bus/rs232/rs232.c svneol=native#text/plain diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index e95447ba6fc..70cefb05ddb 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -703,6 +703,7 @@ endif ifneq ($(filter RS232,$(BUSES)),) OBJDIRS += $(BUSOBJ)/rs232 BUSOBJS += $(BUSOBJ)/rs232/keyboard.o +BUSOBJS += $(BUSOBJ)/rs232/loopback.o BUSOBJS += $(BUSOBJ)/rs232/null_modem.o BUSOBJS += $(BUSOBJ)/rs232/rs232.o BUSOBJS += $(BUSOBJ)/rs232/ser_mouse.o diff --git a/src/emu/bus/rs232/loopback.c b/src/emu/bus/rs232/loopback.c new file mode 100644 index 00000000000..4cd97f8adb2 --- /dev/null +++ b/src/emu/bus/rs232/loopback.c @@ -0,0 +1,16 @@ +// license:MAME +// copyright-holders:smf + +#include "loopback.h" + +const device_type RS232_LOOPBACK = &device_creator; + +rs232_loopback_device::rs232_loopback_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, RS232_LOOPBACK, "RS232 Loopback", tag, owner, clock, "rs232_loopback", __FILE__), + device_rs232_port_interface(mconfig, *this) +{ +} + +void rs232_loopback_device::device_start() +{ +} diff --git a/src/emu/bus/rs232/loopback.h b/src/emu/bus/rs232/loopback.h new file mode 100644 index 00000000000..3459a7bf1c2 --- /dev/null +++ b/src/emu/bus/rs232/loopback.h @@ -0,0 +1,25 @@ +// license:MAME +// copyright-holders:smf + +#ifndef RS232_LOOPBACK_H_ +#define RS232_LOOPBACK_H_ + +#include "bus/rs232/rs232.h" + +class rs232_loopback_device : public device_t, + public device_rs232_port_interface +{ +public: + rs232_loopback_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual WRITE_LINE_MEMBER( input_txd ) { output_rxd(state); } + virtual WRITE_LINE_MEMBER( input_rts ) { output_ri(state); output_cts(state); } + virtual WRITE_LINE_MEMBER( input_dtr ) { output_dsr(state); output_dcd(state); } + +protected: + virtual void device_start(); +}; + +extern const device_type RS232_LOOPBACK; + +#endif diff --git a/src/emu/bus/rs232/rs232.c b/src/emu/bus/rs232/rs232.c index eeff291621a..74f5c371b22 100644 --- a/src/emu/bus/rs232/rs232.c +++ b/src/emu/bus/rs232/rs232.c @@ -96,10 +96,12 @@ device_rs232_port_interface::~device_rs232_port_interface() { } +#include "loopback.h" #include "null_modem.h" #include "terminal.h" SLOT_INTERFACE_START( default_rs232_devices ) - SLOT_INTERFACE("serial_terminal", SERIAL_TERMINAL) + SLOT_INTERFACE("loopback", SERIAL_LOOPBACK) SLOT_INTERFACE("null_modem", NULL_MODEM) + SLOT_INTERFACE("serial_terminal", SERIAL_TERMINAL) SLOT_INTERFACE_END