diff options
author | yz70s <yz70s@users.noreply.github.com> | 2018-08-10 22:18:05 +0200 |
---|---|---|
committer | yz70s <yz70s@users.noreply.github.com> | 2018-08-10 22:18:52 +0200 |
commit | a1370083eddccfa15d6c2d2b93885558966c1f61 (patch) | |
tree | 372f860ebda97db48088806e7a514bd5150a50af | |
parent | 5fc92f26360ff8592d5d8dfc2cc26a7bcd5fa514 (diff) |
fdc37c93x.cpp: remove rs232 ports and put them in pcipc (nw)
-rw-r--r-- | src/devices/machine/fdc37c93x.cpp | 140 | ||||
-rw-r--r-- | src/devices/machine/fdc37c93x.h | 49 | ||||
-rw-r--r-- | src/mame/drivers/pcipc.cpp | 32 |
3 files changed, 189 insertions, 32 deletions
diff --git a/src/devices/machine/fdc37c93x.cpp b/src/devices/machine/fdc37c93x.cpp index d30d6080716..eaf83cd6d28 100644 --- a/src/devices/machine/fdc37c93x.cpp +++ b/src/devices/machine/fdc37c93x.cpp @@ -11,10 +11,6 @@ SMSC FDC37C93x Plug and Play Compatible Ultra I/O Controller #include "emu.h" #include "bus/isa/isa.h" #include "machine/ds128x.h" -#include "bus/rs232/rs232.h" -#include "bus/rs232/ser_mouse.h" -#include "bus/rs232/terminal.h" -#include "bus/rs232/null_modem.h" #include "machine/fdc37c93x.h" DEFINE_DEVICE_TYPE(FDC37C93X, fdc37c93x_device, "fdc37c93x", "SMSC FDC37C93X") @@ -32,6 +28,12 @@ fdc37c93x_device::fdc37c93x_device(const machine_config &mconfig, const char *ta , m_irq1_callback(*this) , m_irq8_callback(*this) , m_irq9_callback(*this) + , m_txd1_callback(*this) + , m_ndtr1_callback(*this) + , m_nrts1_callback(*this) + , m_txd2_callback(*this) + , m_ndtr2_callback(*this) + , m_nrts2_callback(*this) , floppy_controller_fdcdev(*this, "fdc") , pc_lpt_lptdev(*this, "lpt") , pc_serial1_comdev(*this, "uart_0") @@ -233,14 +235,6 @@ static void pc_hd_floppies(device_slot_interface &device) device.option_add("35dd", FLOPPY_35_DD); } -static void isa_com(device_slot_interface &device) -{ - device.option_add("microsoft_mouse", MSFT_SERIAL_MOUSE); - device.option_add("msystems_mouse", MSYSTEM_SERIAL_MOUSE); - device.option_add("terminal", SERIAL_TERMINAL); - device.option_add("null_modem", NULL_MODEM); -} - FLOPPY_FORMATS_MEMBER(fdc37c93x_device::floppy_formats) FLOPPY_PC_FORMAT, FLOPPY_NASLITE_FORMAT @@ -258,27 +252,15 @@ MACHINE_CONFIG_START(fdc37c93x_device::device_add_mconfig) MCFG_PC_LPT_IRQ_HANDLER(WRITELINE(*this, fdc37c93x_device, irq_parallel_w)) // serial ports MCFG_DEVICE_ADD("uart_0", NS16450, XTAL(1'843'200)) // or NS16550 ? - MCFG_INS8250_OUT_TX_CB(WRITELINE("serport0", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(WRITELINE("serport0", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(WRITELINE("serport0", rs232_port_device, write_rts)) MCFG_INS8250_OUT_INT_CB(WRITELINE(*this, fdc37c93x_device, irq_serial1_w)) + MCFG_INS8250_OUT_TX_CB(WRITELINE(*this, fdc37c93x_device, txd_serial1_w)) + MCFG_INS8250_OUT_DTR_CB(WRITELINE(*this, fdc37c93x_device, dtr_serial1_w)) + MCFG_INS8250_OUT_RTS_CB(WRITELINE(*this, fdc37c93x_device, rts_serial1_w)) MCFG_DEVICE_ADD("uart_1", NS16450, XTAL(1'843'200)) - MCFG_INS8250_OUT_TX_CB(WRITELINE("serport1", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(WRITELINE("serport1", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(WRITELINE("serport1", rs232_port_device, write_rts)) MCFG_INS8250_OUT_INT_CB(WRITELINE(*this, fdc37c93x_device, irq_serial2_w)) - MCFG_DEVICE_ADD("serport0", RS232_PORT, isa_com, "microsoft_mouse") - MCFG_RS232_RXD_HANDLER(WRITELINE("uart_0", ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("uart_0", ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart_0", ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(WRITELINE("uart_0", ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart_0", ins8250_uart_device, cts_w)) - MCFG_DEVICE_ADD("serport1", RS232_PORT, isa_com, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("uart_1", ins8250_uart_device, rx_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("uart_1", ins8250_uart_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart_1", ins8250_uart_device, dsr_w)) - MCFG_RS232_RI_HANDLER(WRITELINE("uart_1", ins8250_uart_device, ri_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart_1", ins8250_uart_device, cts_w)) + MCFG_INS8250_OUT_TX_CB(WRITELINE(*this, fdc37c93x_device, txd_serial2_w)) + MCFG_INS8250_OUT_DTR_CB(WRITELINE(*this, fdc37c93x_device, dtr_serial2_w)) + MCFG_INS8250_OUT_RTS_CB(WRITELINE(*this, fdc37c93x_device, rts_serial2_w)) // RTC MCFG_DS12885_ADD("rtc") MCFG_MC146818_IRQ_HANDLER(WRITELINE(*this, fdc37c93x_device, irq_rtc_w)) @@ -319,6 +301,27 @@ WRITE_LINE_MEMBER(fdc37c93x_device::irq_serial1_w) request_irq(configuration_registers[LogicalDevice::Serial1][0x70], state ? ASSERT_LINE : CLEAR_LINE); } +WRITE_LINE_MEMBER(fdc37c93x_device::txd_serial1_w) +{ + if (enabled_logical[LogicalDevice::Serial1] == false) + return; + m_txd1_callback(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::dtr_serial1_w) +{ + if (enabled_logical[LogicalDevice::Serial1] == false) + return; + m_ndtr1_callback(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::rts_serial1_w) +{ + if (enabled_logical[LogicalDevice::Serial1] == false) + return; + m_nrts1_callback(state); +} + WRITE_LINE_MEMBER(fdc37c93x_device::irq_serial2_w) { if (enabled_logical[LogicalDevice::Serial2] == false) @@ -326,6 +329,77 @@ WRITE_LINE_MEMBER(fdc37c93x_device::irq_serial2_w) request_irq(configuration_registers[LogicalDevice::Serial2][0x70], state ? ASSERT_LINE : CLEAR_LINE); } +WRITE_LINE_MEMBER(fdc37c93x_device::txd_serial2_w) +{ + if (enabled_logical[LogicalDevice::Serial2] == false) + return; + m_txd2_callback(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::dtr_serial2_w) +{ + if (enabled_logical[LogicalDevice::Serial2] == false) + return; + m_ndtr2_callback(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::rts_serial2_w) +{ + if (enabled_logical[LogicalDevice::Serial2] == false) + return; + m_nrts2_callback(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::rxd1_w) +{ + pc_serial1_comdev->rx_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::ndcd1_w) +{ + pc_serial1_comdev->dcd_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::ndsr1_w) +{ + pc_serial1_comdev->dsr_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::nri1_w) +{ + pc_serial1_comdev->ri_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::ncts1_w) +{ + pc_serial1_comdev->cts_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::rxd2_w) +{ + pc_serial2_comdev->rx_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::ndcd2_w) +{ + pc_serial2_comdev->dcd_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::ndsr2_w) +{ + pc_serial2_comdev->dsr_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::nri2_w) +{ + pc_serial2_comdev->ri_w(state); +} + +WRITE_LINE_MEMBER(fdc37c93x_device::ncts2_w) +{ + pc_serial2_comdev->cts_w(state); +} + WRITE_LINE_MEMBER(fdc37c93x_device::irq_rtc_w) { if (enabled_logical[LogicalDevice::RTC] == false) @@ -940,6 +1014,12 @@ void fdc37c93x_device::device_start() m_irq1_callback.resolve_safe(); m_irq8_callback.resolve_safe(); m_irq9_callback.resolve_safe(); + m_txd1_callback.resolve_safe(); + m_ndtr1_callback.resolve_safe(); + m_nrts1_callback.resolve_safe(); + m_txd2_callback.resolve_safe(); + m_ndtr2_callback.resolve_safe(); + m_nrts2_callback.resolve_safe(); } void fdc37c93x_device::device_reset() diff --git a/src/devices/machine/fdc37c93x.h b/src/devices/machine/fdc37c93x.h index 30150b4b3c3..3e0264c22ab 100644 --- a/src/devices/machine/fdc37c93x.h +++ b/src/devices/machine/fdc37c93x.h @@ -40,6 +40,12 @@ public: template <class Object> devcb_base &set_irq1_callback(Object &&cb) { return m_irq1_callback.set_callback(std::forward<Object>(cb)); } template <class Object> devcb_base &set_irq8_callback(Object &&cb) { return m_irq8_callback.set_callback(std::forward<Object>(cb)); } template <class Object> devcb_base &set_irq9_callback(Object &&cb) { return m_irq9_callback.set_callback(std::forward<Object>(cb)); } + template <class Object> devcb_base &set_txd1_callback(Object &&cb) { return m_txd1_callback.set_callback(std::forward<Object>(cb)); } + template <class Object> devcb_base &set_ndtr1_callback(Object &&cb) {return m_ndtr1_callback.set_callback(std::forward<Object>(cb)); } + template <class Object> devcb_base &set_nrts1_callback(Object &&cb) {return m_nrts1_callback.set_callback(std::forward<Object>(cb)); } + template <class Object> devcb_base &set_txd2_callback(Object &&cb) { return m_txd2_callback.set_callback(std::forward<Object>(cb)); } + template <class Object> devcb_base &set_ndtr2_callback(Object &&cb) { return m_ndtr2_callback.set_callback(std::forward<Object>(cb)); } + template <class Object> devcb_base &set_nrts2_callback(Object &&cb) { return m_nrts2_callback.set_callback(std::forward<Object>(cb)); } void remap(int space_id, offs_t start, offs_t end) override; @@ -51,9 +57,26 @@ public: DECLARE_WRITE_LINE_MEMBER(drq_floppy_w); // for the internal parallel port DECLARE_WRITE_LINE_MEMBER(irq_parallel_w); - // for the internal serial ports + // for the internal uarts DECLARE_WRITE_LINE_MEMBER(irq_serial1_w); + DECLARE_WRITE_LINE_MEMBER(txd_serial1_w); + DECLARE_WRITE_LINE_MEMBER(dtr_serial1_w); + DECLARE_WRITE_LINE_MEMBER(rts_serial1_w); DECLARE_WRITE_LINE_MEMBER(irq_serial2_w); + DECLARE_WRITE_LINE_MEMBER(txd_serial2_w); + DECLARE_WRITE_LINE_MEMBER(dtr_serial2_w); + DECLARE_WRITE_LINE_MEMBER(rts_serial2_w); + // chip pins for uarts + DECLARE_WRITE_LINE_MEMBER(rxd1_w); + DECLARE_WRITE_LINE_MEMBER(ndcd1_w); + DECLARE_WRITE_LINE_MEMBER(ndsr1_w); + DECLARE_WRITE_LINE_MEMBER(nri1_w); + DECLARE_WRITE_LINE_MEMBER(ncts1_w); + DECLARE_WRITE_LINE_MEMBER(rxd2_w); + DECLARE_WRITE_LINE_MEMBER(ndcd2_w); + DECLARE_WRITE_LINE_MEMBER(ndsr2_w); + DECLARE_WRITE_LINE_MEMBER(nri2_w); + DECLARE_WRITE_LINE_MEMBER(ncts2_w); // rtc DECLARE_WRITE_LINE_MEMBER(irq_rtc_w); // keyboard @@ -125,6 +148,12 @@ private: devcb_write_line m_irq1_callback; devcb_write_line m_irq8_callback; devcb_write_line m_irq9_callback; + devcb_write_line m_txd1_callback; + devcb_write_line m_ndtr1_callback; + devcb_write_line m_nrts1_callback; + devcb_write_line m_txd2_callback; + devcb_write_line m_ndtr2_callback; + devcb_write_line m_nrts2_callback; required_device<pc_fdc_interface> floppy_controller_fdcdev; required_device<pc_lpt_device> pc_lpt_lptdev; required_device<ns16450_device> pc_serial1_comdev; @@ -197,4 +226,22 @@ DECLARE_DEVICE_TYPE(FDC37C93X, fdc37c93x_device); #define MCFG_FDC37C93X_IRQ9_CB(_devcb) \ downcast<fdc37c93x_device &>(*device).set_irq9_callback(DEVCB_##_devcb); +#define MCFG_FDC37C93X_TXD1_CB(_devcb) \ + downcast<fdc37c93x_device &>(*device).set_txd1_callback(DEVCB_##_devcb); + +#define MCFG_FDC37C93X_NDTR1_CB(_devcb) \ + downcast<fdc37c93x_device &>(*device).set_ndtr1_callback(DEVCB_##_devcb); + +#define MCFG_FDC37C93X_NRTS1_CB(_devcb) \ + downcast<fdc37c93x_device &>(*device).set_nrts1_callback(DEVCB_##_devcb); + +#define MCFG_FDC37C93X_TXD2_CB(_devcb) \ + downcast<fdc37c93x_device &>(*device).set_txd2_callback(DEVCB_##_devcb); + +#define MCFG_FDC37C93X_NDTR2_CB(_devcb) \ + downcast<fdc37c93x_device &>(*device).set_ndtr2_callback(DEVCB_##_devcb); + +#define MCFG_FDC37C93X_NRTS2_CB(_devcb) \ + downcast<fdc37c93x_device &>(*device).set_nrts2_callback(DEVCB_##_devcb); + #endif // MAME_MACHINE_FDC37C93X_H diff --git a/src/mame/drivers/pcipc.cpp b/src/mame/drivers/pcipc.cpp index 165b589312f..cb23c04057a 100644 --- a/src/mame/drivers/pcipc.cpp +++ b/src/mame/drivers/pcipc.cpp @@ -26,6 +26,10 @@ #include "machine/i82371sb.h" #include "video/mga2064w.h" #include "bus/isa/isa_cards.h" +#include "bus/rs232/rs232.h" +#include "bus/rs232/ser_mouse.h" +#include "bus/rs232/terminal.h" +#include "bus/rs232/null_modem.h" #include "machine/fdc37c93x.h" class pcipc_state : public driver_device @@ -473,6 +477,14 @@ static void isa_internal_devices(device_slot_interface &device) device.option_add("fdc37c93x", FDC37C93X); } +static void isa_com(device_slot_interface &device) +{ + device.option_add("microsoft_mouse", MSFT_SERIAL_MOUSE); + device.option_add("msystems_mouse", MSYSTEM_SERIAL_MOUSE); + device.option_add("terminal", SERIAL_TERMINAL); + device.option_add("null_modem", NULL_MODEM); +} + void pcipc_state::superio_config(device_t *device) { devcb_base *devcb = nullptr; @@ -482,6 +494,12 @@ void pcipc_state::superio_config(device_t *device) MCFG_FDC37C93X_GP25_GATEA20_CB(INPUTLINE(":maincpu", INPUT_LINE_A20)) MCFG_FDC37C93X_IRQ1_CB(WRITELINE(":pci:07.0:pic8259_master", pic8259_device, ir1_w)) MCFG_FDC37C93X_IRQ8_CB(WRITELINE(":pci:07.0:pic8259_slave", pic8259_device, ir0_w)) + MCFG_FDC37C93X_TXD1_CB(WRITELINE(":serport0", rs232_port_device, write_txd)) + MCFG_FDC37C93X_NDTR1_CB(WRITELINE(":serport0", rs232_port_device, write_dtr)) + MCFG_FDC37C93X_NRTS1_CB(WRITELINE(":serport0", rs232_port_device, write_rts)) + MCFG_FDC37C93X_TXD2_CB(WRITELINE(":serport1", rs232_port_device, write_txd)) + MCFG_FDC37C93X_NDTR2_CB(WRITELINE(":serport1", rs232_port_device, write_dtr)) + MCFG_FDC37C93X_NRTS2_CB(WRITELINE(":serport1", rs232_port_device, write_rts)) } MACHINE_CONFIG_START(pcipc_state::pcipc) @@ -505,7 +523,19 @@ MACHINE_CONFIG_START(pcipc_state::pcipc) MCFG_DEVICE_ADD("isa3", ISA16_SLOT, 0, "pci:07.0:isabus", pc_isa16_cards, nullptr, false) MCFG_DEVICE_ADD("isa4", ISA16_SLOT, 0, "pci:07.0:isabus", pc_isa16_cards, nullptr, false) MCFG_DEVICE_ADD("isa5", ISA16_SLOT, 0, "pci:07.0:isabus", pc_isa16_cards, nullptr, false) -MACHINE_CONFIG_END + MCFG_DEVICE_ADD("serport0", RS232_PORT, isa_com, "microsoft_mouse") + MCFG_RS232_RXD_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, rxd1_w)) + MCFG_RS232_DCD_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, ndcd1_w)) + MCFG_RS232_DSR_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, ndsr1_w)) + MCFG_RS232_RI_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, nri1_w)) + MCFG_RS232_CTS_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, ncts1_w)) + MCFG_DEVICE_ADD("serport1", RS232_PORT, isa_com, nullptr) + MCFG_RS232_RXD_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, rxd2_w)) + MCFG_RS232_DCD_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, ndcd2_w)) + MCFG_RS232_DSR_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, ndsr2_w)) + MCFG_RS232_RI_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, nri2_w)) + MCFG_RS232_CTS_HANDLER(WRITELINE("board4:fdc37c93x", fdc37c93x_device, ncts2_w)) + MACHINE_CONFIG_END MACHINE_CONFIG_START(pcipc_state::pcipctx) MCFG_DEVICE_ADD("maincpu", PENTIUM, 60000000) |