mirror of
https://github.com/holub/mame
synced 2025-07-03 00:56:03 +03:00
bus/psion/sibo/3link.cpp: Implemented RS232 interface.
This commit is contained in:
parent
af17e41011
commit
262fe278c8
@ -48,8 +48,12 @@ device_psion_honda_interface::device_psion_honda_interface(const machine_config
|
||||
psion_honda_slot_device::psion_honda_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, PSION_HONDA_SLOT, tag, owner, clock)
|
||||
, device_single_card_slot_interface<device_psion_honda_interface>(mconfig, *this)
|
||||
, m_rxd_handler(*this)
|
||||
, m_dcd_handler(*this)
|
||||
, m_dsr_handler(*this)
|
||||
, m_cts_handler(*this)
|
||||
, m_sdoe_handler(*this)
|
||||
, m_card(nullptr)
|
||||
, m_int_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -84,6 +88,24 @@ void psion_honda_slot_device::data_w(uint16_t data)
|
||||
m_card->data_w(data);
|
||||
}
|
||||
|
||||
void psion_honda_slot_device::write_txd(int state)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->write_txd(state);
|
||||
}
|
||||
|
||||
void psion_honda_slot_device::write_dtr(int state)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->write_dtr(state);
|
||||
}
|
||||
|
||||
void psion_honda_slot_device::write_rts(int state)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->write_rts(state);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// SLOT_INTERFACE( psion_honda_devices )
|
||||
|
@ -57,21 +57,37 @@ public:
|
||||
psion_honda_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
// callbacks
|
||||
auto int_cb() { return m_int_cb.bind(); }
|
||||
auto rxd_handler() { return m_rxd_handler.bind(); }
|
||||
auto dcd_handler() { return m_dcd_handler.bind(); }
|
||||
auto dsr_handler() { return m_dsr_handler.bind(); }
|
||||
auto cts_handler() { return m_cts_handler.bind(); }
|
||||
auto sdoe_handler() { return m_sdoe_handler.bind(); }
|
||||
|
||||
uint8_t data_r();
|
||||
void data_w(uint16_t data);
|
||||
|
||||
void int_w(int state) { m_int_cb(state); }
|
||||
void write_txd(int state);
|
||||
void write_dtr(int state);
|
||||
void write_rts(int state);
|
||||
|
||||
void write_rxd(int state) { m_rxd_handler(state); }
|
||||
void write_dcd(int state) { m_dcd_handler(state); }
|
||||
void write_dsr(int state) { m_dsr_handler(state); }
|
||||
void write_cts(int state) { m_cts_handler(state); }
|
||||
void write_sdoe(int state) { m_sdoe_handler(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
device_psion_honda_interface *m_card;
|
||||
|
||||
private:
|
||||
devcb_write_line m_int_cb;
|
||||
devcb_write_line m_rxd_handler;
|
||||
devcb_write_line m_dcd_handler;
|
||||
devcb_write_line m_dsr_handler;
|
||||
devcb_write_line m_cts_handler;
|
||||
devcb_write_line m_sdoe_handler;
|
||||
|
||||
device_psion_honda_interface *m_card;
|
||||
};
|
||||
|
||||
|
||||
@ -80,6 +96,10 @@ private:
|
||||
class device_psion_honda_interface : public device_interface
|
||||
{
|
||||
public:
|
||||
virtual void write_txd(int state) { }
|
||||
virtual void write_dtr(int state) { }
|
||||
virtual void write_rts(int state) { }
|
||||
|
||||
virtual uint8_t data_r() { return 0x00; }
|
||||
virtual void data_w(uint16_t data) { }
|
||||
|
||||
|
@ -25,7 +25,7 @@ DEFINE_DEVICE_TYPE(PSION_SIENA_SSD, psion_siena_ssd_device, "psion_siena_ssd", "
|
||||
void psion_siena_ssd_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
PSION_SSD(config, m_ssd);
|
||||
m_ssd->door_cb().set(DEVICE_SELF_OWNER, FUNC(psion_honda_slot_device::int_w));
|
||||
m_ssd->door_cb().set(DEVICE_SELF_OWNER, FUNC(psion_honda_slot_device::write_sdoe));
|
||||
|
||||
RS232_PORT(config, "rs232", default_rs232_devices, nullptr);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Psion 3Fax Modem
|
||||
Psion 3-Fax Modem
|
||||
|
||||
TODO: add other devices
|
||||
- 32K RAM (KM62256)
|
||||
@ -19,7 +19,7 @@
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(PSION_3FAX_MODEM, psion_3fax_modem_device, "psion_3fax", "Psion 3Fax Modem")
|
||||
DEFINE_DEVICE_TYPE(PSION_3FAX_MODEM, psion_3fax_modem_device, "psion_3fax", "Psion 3-Fax Modem")
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Psion 3Fax Modem
|
||||
Psion 3-Fax Modem
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
@ -2,22 +2,28 @@
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Psion 3Link RS232 Serial Interface / Parallel Printer Interface
|
||||
Psion 3-Link RS232 Serial Interface / Parallel Printer Interface
|
||||
|
||||
Note:
|
||||
The Acorn A-Link RS232 Serial Interface has a slightly different wiring
|
||||
to the 3-Link. The A-Link will work fine with PC software, and plugged
|
||||
into a PC, but the 3-Link will not work with the Acorn software.
|
||||
|
||||
The 3-Link and A-Link have been confirmed to have the same ROM.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "3link.h"
|
||||
#include "bus/centronics/ctronics.h"
|
||||
#include "bus/rs232/rs232.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(PSION_3LINK_SERIAL, psion_3link_serial_device, "psion_3link_ser", "Psion 3Link RS232 Serial Interface")
|
||||
DEFINE_DEVICE_TYPE(PSION_3LINK_PARALLEL, psion_3link_parallel_device, "psion_3link_par", "Psion 3Link Parallel Printer Interface")
|
||||
DEFINE_DEVICE_TYPE(PSION_3LINK_SERIAL, psion_3link_serial_device, "psion_3link_ser", "Psion 3-Link RS232 Serial Interface")
|
||||
DEFINE_DEVICE_TYPE(PSION_3LINK_PARALLEL, psion_3link_parallel_device, "psion_3link_par", "Psion 3-Link Parallel Printer Interface")
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -45,19 +51,27 @@ const tiny_rom_entry *psion_3link_serial_device::device_rom_region() const
|
||||
|
||||
void psion_3link_serial_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
PSION_ASIC5(config, m_asic5, DERIVED_CLOCK(1, 1)).set_mode(psion_asic5_device::PERIPHERAL_MODE);
|
||||
PSION_ASIC5(config, m_asic5, 1'536'000).set_mode(psion_asic5_device::PERIPHERAL_MODE); // TODO: clock derived from host
|
||||
m_asic5->set_info_byte(0x05); // ROM + RS232
|
||||
m_asic5->readpa_handler().set([this]() { return m_rom[m_addr_latch & 0x1ffff]; });
|
||||
m_asic5->writepb_handler().set([this](uint8_t data) { m_addr_latch = (m_addr_latch & 0xffff00) | (data << 0); });
|
||||
m_asic5->writepd_handler().set([this](uint8_t data) { m_addr_latch = (m_addr_latch & 0xff00ff) | (data << 8); });
|
||||
m_asic5->writepe_handler().set([this](uint8_t data) { m_addr_latch = (m_addr_latch & 0x00ffff) | (BIT(~data, 1) << 16); }); // CS2
|
||||
m_asic5->writecs_handler().set([this](uint8_t data) { m_addr_latch = (m_addr_latch & 0x00ffff) | (BIT(~data, 1) << 16); });
|
||||
m_asic5->txd_handler().set(m_rs232, FUNC(rs232_port_device::write_txd));
|
||||
m_asic5->rts_handler().set(m_rs232, FUNC(rs232_port_device::write_rts));
|
||||
m_asic5->dtr_handler().set(m_rs232, FUNC(rs232_port_device::write_dtr));
|
||||
m_asic5->int_handler().set(DEVICE_SELF_OWNER, FUNC(psion_sibo_slot_device::int_w));
|
||||
|
||||
RS232_PORT(config, "rs232", default_rs232_devices, nullptr);
|
||||
RS232_PORT(config, m_rs232, default_rs232_devices, nullptr);
|
||||
m_rs232->rxd_handler().set(m_asic5, FUNC(psion_asic5_device::write_rxd));
|
||||
m_rs232->dcd_handler().set(m_asic5, FUNC(psion_asic5_device::write_dcd));
|
||||
m_rs232->dsr_handler().set(m_asic5, FUNC(psion_asic5_device::write_dsr));
|
||||
m_rs232->cts_handler().set(m_asic5, FUNC(psion_asic5_device::write_cts));
|
||||
}
|
||||
|
||||
void psion_3link_parallel_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
PSION_ASIC5(config, m_asic5, DERIVED_CLOCK(1, 1)).set_mode(psion_asic5_device::PERIPHERAL_MODE);
|
||||
PSION_ASIC5(config, m_asic5, 1'536'000).set_mode(psion_asic5_device::PERIPHERAL_MODE); // TODO: clock derived from host
|
||||
m_asic5->set_info_byte(0x02); // Parallel
|
||||
m_asic5->readpa_handler().set("cent_status_in", FUNC(input_buffer_device::read));
|
||||
m_asic5->writepb_handler().set("cent_data_out", FUNC(output_latch_device::write));
|
||||
@ -95,6 +109,7 @@ psion_3link_serial_device::psion_3link_serial_device(const machine_config &mconf
|
||||
, device_psion_sibo_interface(mconfig, *this)
|
||||
, m_rom(*this, "rom")
|
||||
, m_asic5(*this, "asic5")
|
||||
, m_rs232(*this, "rs232")
|
||||
{
|
||||
}
|
||||
|
||||
@ -102,6 +117,7 @@ psion_3link_parallel_device::psion_3link_parallel_device(const machine_config &m
|
||||
: device_t(mconfig, PSION_3LINK_PARALLEL, tag, owner, clock)
|
||||
, device_psion_sibo_interface(mconfig, *this)
|
||||
, m_asic5(*this, "asic5")
|
||||
, m_cent_ctrl_out(*this, "cent_ctrl_out")
|
||||
{
|
||||
}
|
||||
|
||||
@ -112,6 +128,7 @@ psion_3link_parallel_device::psion_3link_parallel_device(const machine_config &m
|
||||
|
||||
void psion_3link_serial_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_addr_latch));
|
||||
}
|
||||
|
||||
void psion_3link_parallel_device::device_start()
|
||||
@ -130,4 +147,5 @@ void psion_3link_serial_device::device_reset()
|
||||
|
||||
void psion_3link_parallel_device::device_reset()
|
||||
{
|
||||
m_cent_ctrl_out->write(0xff); // pullups
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Psion 3Link RS232 Serial Interface / Parallel Printer Interface
|
||||
Psion 3-Link RS232 Serial Interface / Parallel Printer Interface
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
@ -10,7 +10,9 @@
|
||||
#define MAME_BUS_PSION_SIBO_3LINK_H
|
||||
|
||||
#include "slot.h"
|
||||
#include "machine/output_latch.h"
|
||||
#include "machine/psion_asic5.h"
|
||||
#include "bus/rs232/rs232.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -19,15 +21,13 @@
|
||||
|
||||
// ======================> psion_3link_serial_device
|
||||
|
||||
class psion_3link_serial_device :
|
||||
public device_t,
|
||||
public device_psion_sibo_interface
|
||||
class psion_3link_serial_device : public device_t, public device_psion_sibo_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
psion_3link_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
static constexpr feature_type unemulated_features() { return feature::COMMS; }
|
||||
static constexpr feature_type imperfect_features() { return feature::COMMS; }
|
||||
|
||||
protected:
|
||||
// device_t overrides
|
||||
@ -44,6 +44,7 @@ protected:
|
||||
private:
|
||||
required_region_ptr<uint8_t> m_rom;
|
||||
required_device<psion_asic5_device> m_asic5;
|
||||
required_device<rs232_port_device> m_rs232;
|
||||
|
||||
uint32_t m_addr_latch;
|
||||
};
|
||||
@ -51,9 +52,7 @@ private:
|
||||
|
||||
// ======================> psion_3link_parallel_device
|
||||
|
||||
class psion_3link_parallel_device :
|
||||
public device_t,
|
||||
public device_psion_sibo_interface
|
||||
class psion_3link_parallel_device : public device_t, public device_psion_sibo_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
@ -72,6 +71,7 @@ protected:
|
||||
|
||||
private:
|
||||
required_device<psion_asic5_device> m_asic5;
|
||||
required_device<output_latch_device> m_cent_ctrl_out;
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,8 +45,8 @@ device_psion_sibo_interface::device_psion_sibo_interface(const machine_config &m
|
||||
psion_sibo_slot_device::psion_sibo_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, PSION_SIBO_SLOT, tag, owner, clock)
|
||||
, device_single_card_slot_interface<device_psion_sibo_interface>(mconfig, *this)
|
||||
, m_card(nullptr)
|
||||
, m_int_cb(*this)
|
||||
, m_card(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ void psion_sibo_slot_device::data_w(uint16_t data)
|
||||
|
||||
void psion_sibo_devices(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("fax", PSION_3FAX_MODEM); // Psion 3Fax Modem
|
||||
device.option_add("parallel", PSION_3LINK_PARALLEL); // Psion 3Link Parallel Printer Interface
|
||||
device.option_add("serial", PSION_3LINK_SERIAL); // Psion 3Link RS232 Serial Interface
|
||||
device.option_add("fax", PSION_3FAX_MODEM); // Psion 3-Fax Modem
|
||||
device.option_add("parallel", PSION_3LINK_PARALLEL); // Psion 3-Link Parallel Printer Interface
|
||||
device.option_add("serial", PSION_3LINK_SERIAL); // Psion 3-Link RS232 Serial Interface
|
||||
}
|
||||
|
@ -56,13 +56,13 @@ public:
|
||||
void int_w(int state) { m_int_cb(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
device_psion_sibo_interface *m_card;
|
||||
|
||||
private:
|
||||
devcb_write_line m_int_cb;
|
||||
|
||||
device_psion_sibo_interface *m_card;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user