Clean up odds and ends (nw)

- com8116: Delete SY2661-1/-2 tables (these are just second sources of SCN2661A/B)
- mc2661: Remove obsolete device
- rs232: Remove 7200 baud setting formerly required by one driver to work around incorrect table
This commit is contained in:
AJR 2020-03-06 15:00:11 -05:00
parent ddfe149872
commit 6ab1dfb1a8
8 changed files with 2 additions and 639 deletions

View File

@ -1883,18 +1883,6 @@ if (MACHINES["MC14411"]~=null) then
}
end
---------------------------------------------------
--
--@src/devices/machine/mc2661.h,MACHINES["MC2661"] = true
---------------------------------------------------
if (MACHINES["MC2661"]~=null) then
files {
MAME_DIR .. "src/devices/machine/mc2661.cpp",
MAME_DIR .. "src/devices/machine/mc2661.h",
}
end
---------------------------------------------------
--
--@src/devices/machine/mc6843.h,MACHINES["MC6843"] = true

View File

@ -525,7 +525,6 @@ MACHINES["MB89371"] = true
MACHINES["MB89374"] = true
--MACHINES["MC14411"] = true
MACHINES["MC146818"] = true
MACHINES["MC2661"] = true
MACHINES["MC6843"] = true
MACHINES["MC6846"] = true
MACHINES["MC6852"] = true

View File

@ -546,7 +546,6 @@ MACHINES["MB89352"] = true
MACHINES["MB89371"] = true
MACHINES["MC14411"] = true
MACHINES["MC146818"] = true
MACHINES["MC2661"] = true
MACHINES["MC6843"] = true
MACHINES["MC6844"] = true
MACHINES["MC6846"] = true

View File

@ -22,7 +22,6 @@
#define RS232_BAUD_38400 (0x0b)
#define RS232_BAUD_57600 (0x0c)
#define RS232_BAUD_115200 (0x0d)
#define RS232_BAUD_7200 (0x0e)
#define PORT_RS232_BAUD(_tag, _default_baud, _description, _class, _write_line) \
PORT_START(_tag) \
@ -34,7 +33,6 @@
PORT_CONFSETTING( RS232_BAUD_1200, "1200") \
PORT_CONFSETTING( RS232_BAUD_2400, "2400") \
PORT_CONFSETTING( RS232_BAUD_4800, "4800") \
PORT_CONFSETTING( RS232_BAUD_7200, "7200") \
PORT_CONFSETTING( RS232_BAUD_9600, "9600") \
PORT_CONFSETTING( RS232_BAUD_14400, "14400") \
PORT_CONFSETTING( RS232_BAUD_19200, "19200") \
@ -211,8 +209,7 @@ protected:
28800,
38400,
57600,
115200,
7200
115200
};
return values[baud];

View File

@ -45,7 +45,7 @@ const int com8116_device::divisors_16X_5_0688MHz[16] =
const int com8116_device::divisors_16X_6_01835MHz[16] =
{ 7523, 5015, 3420, 2797, 2508, 1881, 1254, 627, 313, 209, 188, 157, 104, 78, 39, 20 };
// SMC/COM5016(T)-5 and WD WD-1943-05; Synertek SY2661-1 and 2 are NOT the same as this despite using same clock speed, see below
// SMC/COM5016(T)-5 and WD WD-1943-05; Synertek SY2661-1 and 2 are NOT the same as this despite using same clock speed
// SMC/COM8156(T)-5 is the same chip but clocked twice as fast and 32x clocks per baud instead of 16x
// Motorola K1135C is similar, with undivided 4.9152 MHz on pin 1
// baud rates are 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200
@ -80,16 +80,6 @@ const int com8116_device::divisors_16X_4_6080MHz[16] =
// COM8046 combines the -6 and STD tables into one device as a 32-entry table
// Synertek SY2661-1 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/synertek/_dataBooks/Synertek_1981-1982_Data_Catalog.pdf page 3-40 (pdf page 139))
// baud rates are 50, 75, 110, 134.5, 150, 200, 300, 600, 1050, 1200, 1800, 2000, 2400, 4800, 9600, 19200
const int com8116_device::divisors_16X_4_9152MHz_SY2661_1[16] =
{ 6144, 4096, 2793, 2284, 2048, 1536, 1024, 512, 292, 256, 171, 154, 128, 64, 32, 16 };
// Synertek SY2661-2 (from http://bitsavers.informatik.uni-stuttgart.de/pdf/synertek/_dataBooks/Synertek_1981-1982_Data_Catalog.pdf page 3-40 (pdf page 139))
// baud rates are 45.5, 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2000, 2400, 4800, 9600, 19200, 38400
const int com8116_device::divisors_16X_4_9152MHz_SY2661_2[16] =
{ 6752, 6144, 4096, 2793, 2284, 2048, 1024, 512, 256, 171, 154, 128, 64, 32, 16, 8 };
//**************************************************************************
// LIVE DEVICE
//**************************************************************************

View File

@ -59,8 +59,6 @@ protected:
static const int divisors_16X_1_8432MHz[16];
static const int divisors_16X_5_0688MHz_030[16];
static const int divisors_16X_4_6080MHz[16];
static const int divisors_16X_4_9152MHz_SY2661_1[16];
static const int divisors_16X_4_9152MHz_SY2661_2[16];
// device-level overrides
virtual void device_start() override;

View File

@ -1,507 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/***************************************************************************
Motorola MC2661/MC68661 Enhanced Programmable Communications Interface
***************************************************************************/
#include "emu.h"
#include "mc2661.h"
//#define VERBOSE 1
#include "logmacro.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(MC2661, mc2661_device, "mc2661", "MC2661")
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
uint32_t baud_rates[16] =
{
50, 75, 110, 135 /*134.5*/, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200
};
enum
{
REGISTER_HOLDING = 0,
REGISTER_STATUS,
REGISTER_SYNC = REGISTER_STATUS,
REGISTER_MODE,
REGISTER_COMMAND
};
#define MODE_BAUD_RATE (m_mr[0] & 0x03)
#define MODE_CHARACTER ((m_mr[0] >> 2) & 0x03)
#define MODE_PARITY BIT(m_mr[0], 4)
#define MODE_PARITY_EVEN BIT(m_mr[0], 5)
#define MODE_TRANSPARENT BIT(m_mr[0], 6)
#define MODE_SINGLE_SYN BIT(m_mr[0], 7)
#define MODE_STOP_BITS ((m_mr[0] >> 6) & 0x03)
#define SYN1 m_sync[0]
#define SYN2 m_sync[1]
#define DLE m_sync[2]
#define COMMAND_TXEN BIT(m_cr, 0)
#define COMMAND_DTR BIT(m_cr, 1)
#define COMMAND_RXEN BIT(m_cr, 2)
#define COMMAND_BREAK BIT(m_cr, 3)
#define COMMAND_DLE BIT(m_cr, 3)
#define COMMAND_RESET BIT(m_cr, 4)
#define COMMAND_RTS BIT(m_cr, 5)
#define COMMAND_MODE (m_cr >> 6)
enum
{
MODE_NORMAL = 0,
MODE_ASYNC,
MODE_LOCAL_LOOP_BACK,
MODE_REMOTE_LOOP_BACK
};
#define STATUS_TXRDY 0x01
#define STATUS_RXRDY 0x02
#define STATUS_TXEMT 0x04
#define STATUS_PE 0x08
#define STATUS_DLE 0x08
#define STATUS_OVERRUN 0x10
#define STATUS_FE 0x20
#define STATUS_SYN 0x20
#define STATUS_DCD 0x40
#define STATUS_DSR 0x80
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// mc2661_device - constructor
//-------------------------------------------------
mc2661_device::mc2661_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, MC2661, tag, owner, clock),
device_serial_interface(mconfig, *this),
m_write_txd(*this),
m_write_rxrdy(*this),
m_write_txrdy(*this),
m_write_rts(*this),
m_write_dtr(*this),
m_write_txemt_dschg(*this),
m_write_bkdet(*this),
m_write_xsync(*this),
m_rxc(0),
m_txc(0),
m_sr(0)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void mc2661_device::device_start()
{
// resolve callbacks
m_write_txd.resolve_safe();
m_write_rxrdy.resolve_safe();
m_write_txrdy.resolve_safe();
m_write_rts.resolve_safe();
m_write_dtr.resolve_safe();
m_write_txemt_dschg.resolve_safe();
m_write_bkdet.resolve_safe();
m_write_xsync.resolve_safe();
// create the timers
if (m_rxc > 0)
{
set_rcv_rate(m_rxc);
}
if (m_txc > 0)
{
set_tra_rate(m_txc);
}
// save state
save_item(NAME(m_rhr));
save_item(NAME(m_thr));
save_item(NAME(m_cr));
save_item(NAME(m_sr));
save_item(NAME(m_mr));
save_item(NAME(m_sync));
save_item(NAME(m_mode_index));
save_item(NAME(m_sync_index));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void mc2661_device::device_reset()
{
receive_register_reset();
transmit_register_reset();
m_mr[0] = m_mr[1] = 0;
m_sync[0] = m_sync[1] = m_sync[2] = 0;
m_cr = 0;
m_sr = 0;
m_mode_index = 0;
m_sync_index = 0;
m_write_txd(1);
m_write_rxrdy(CLEAR_LINE);
m_write_txrdy(CLEAR_LINE);
m_write_rts(1);
m_write_dtr(1);
m_write_txemt_dschg(CLEAR_LINE);
m_write_bkdet(0);
m_write_xsync(0);
}
//-------------------------------------------------
// tra_callback -
//-------------------------------------------------
void mc2661_device::tra_callback()
{
m_write_txd(transmit_register_get_data_bit());
}
//-------------------------------------------------
// tra_complete -
//-------------------------------------------------
void mc2661_device::tra_complete()
{
// TODO
m_sr |= STATUS_TXRDY;
m_write_txrdy(ASSERT_LINE);
}
//-------------------------------------------------
// rcv_complete -
//-------------------------------------------------
void mc2661_device::rcv_complete()
{
// TODO
receive_register_extract();
m_rhr = get_received_char();
m_sr |= STATUS_RXRDY;
if (is_receive_parity_error())
m_sr |= STATUS_PE;
if (is_receive_framing_error())
m_sr |= STATUS_FE;
m_write_rxrdy(ASSERT_LINE);
}
//-------------------------------------------------
// read - register read
//-------------------------------------------------
uint8_t mc2661_device::read(offs_t offset)
{
uint8_t data = 0;
switch (offset & 0x03)
{
case REGISTER_HOLDING:
data = m_rhr;
if (!machine().side_effects_disabled())
{
m_sr &= ~STATUS_RXRDY;
m_write_rxrdy(CLEAR_LINE);
}
break;
case REGISTER_STATUS:
data = m_sr;
break;
case REGISTER_MODE:
data = m_mr[m_mode_index];
if (!machine().side_effects_disabled())
{
m_mode_index++;
m_mode_index &= 0x01;
}
break;
case REGISTER_COMMAND:
if (!machine().side_effects_disabled())
{
m_mode_index = 0;
m_sync_index = 0;
}
data = m_cr;
break;
}
return data;
}
//-------------------------------------------------
// write - register write
//-------------------------------------------------
void mc2661_device::write(offs_t offset, uint8_t data)
{
switch (offset & 0x03)
{
case REGISTER_HOLDING:
LOG("MC2661 Transmit Holding Register: %02x\n", data);
m_thr = data;
if(COMMAND_TXEN)
{
if(COMMAND_MODE != 0x02)
transmit_register_setup(m_thr);
m_sr &= ~STATUS_TXRDY;
m_write_txrdy(CLEAR_LINE);
}
if(COMMAND_MODE == 0x02) // loopback - the Wicat will set this after enabling the transmitter
{
m_rhr = data;
m_sr |= STATUS_RXRDY; // pcd expects this
m_write_rxrdy(ASSERT_LINE);
}
break;
case REGISTER_SYNC:
LOG("MC2661 Sync Register %u: %02x\n", m_sync_index + 1, data);
m_sync[m_sync_index] = data;
m_sync_index++;
if (m_sync_index == 3) m_sync_index = 0;
break;
case REGISTER_MODE:
LOG("MC2661 Mode Register %u: %02x\n", m_mode_index + 1, data);
m_mr[m_mode_index] = data;
if (m_mode_index == 0)
{
int data_bit_count = 5 + MODE_CHARACTER;
parity_t parity;
if (!MODE_PARITY) parity = PARITY_NONE;
else if (MODE_PARITY_EVEN) parity = PARITY_EVEN;
else parity = PARITY_ODD;
stop_bits_t stop_bits;
switch (MODE_STOP_BITS)
{
case 0:
default:
stop_bits = STOP_BITS_0;
break;
case 1:
stop_bits = STOP_BITS_1;
break;
case 2:
stop_bits = STOP_BITS_1_5;
break;
case 3:
stop_bits = STOP_BITS_2;
break;
}
set_data_frame(1, data_bit_count, parity, stop_bits);
}
if(m_mode_index == 1)
{
uint32_t rx_baud = baud_rates[data & 0x0f];
uint32_t tx_baud = baud_rates[data & 0x0f];
if(data & 0x10) // internal receiver clock
{
// if((m_mr[0] & 0x03) != 0)
// rx_baud *= 16;
}
else // external receiver clock
{
switch(m_mr[0] & 0x03)
{
case 0x02:
rx_baud *= 16;
break;
case 0x03:
rx_baud *= 64;
break;
default:
// x1
break;
}
}
if(data & 0x20) // internal transmitter clock
{
// if((m_mr[0] & 0x03) != 0)
// tx_baud *= 16;
}
else // external transmitter clock
{
switch(m_mr[0] & 0x03)
{
case 0x02:
tx_baud *= 16;
break;
case 0x03:
tx_baud *= 64;
break;
default:
// x1
break;
}
}
set_rcv_rate(rx_baud);
set_tra_rate(tx_baud);
}
m_mode_index++;
m_mode_index &= 0x01;
break;
case REGISTER_COMMAND:
LOG("MC2661 Command Register: %02x\n", data);
m_cr = data & 0xef;
m_write_dtr(!COMMAND_DTR);
m_write_rts(!COMMAND_RTS);
if (COMMAND_MODE == 0x02) // local loopback
{
if(COMMAND_DTR && COMMAND_RTS) // CR1 and CR5 must be set to 1 to use local loopback
{
// probably much more to it that this, but this is enough for the Wicat to be happy
m_rhr = m_thr;
m_sr |= STATUS_RXRDY;
m_write_rxrdy(ASSERT_LINE);
return;
}
}
if (COMMAND_TXEN)
{
m_sr |= STATUS_TXRDY;
m_write_txrdy(ASSERT_LINE);
}
else
{
m_sr &= ~STATUS_TXRDY;
m_write_txrdy(CLEAR_LINE);
}
if (!COMMAND_RXEN)
{
m_sr &= ~(STATUS_RXRDY | STATUS_FE | STATUS_OVERRUN | STATUS_PE);
m_write_rxrdy(CLEAR_LINE);
}
if (COMMAND_RESET)
{
m_sr &= ~(STATUS_FE | STATUS_OVERRUN | STATUS_PE);
}
break;
}
}
//-------------------------------------------------
// dsr_w - data set ready
//-------------------------------------------------
WRITE_LINE_MEMBER( mc2661_device::dsr_w )
{
LOG("MC2661 Data Set Ready: %u\n", state);
if (state)
{
m_sr &= ~STATUS_DSR;
}
else
{
m_sr |= STATUS_DSR;
}
}
//-------------------------------------------------
// dcd_w - data carrier detect
//-------------------------------------------------
WRITE_LINE_MEMBER( mc2661_device::dcd_w )
{
LOG("MC2661 Data Carrier Detect: %u\n", state);
if (state)
{
m_sr &= ~STATUS_DCD;
}
else
{
m_sr |= STATUS_DCD;
}
}
//-------------------------------------------------
// cts_w - clear to send
//-------------------------------------------------
WRITE_LINE_MEMBER( mc2661_device::cts_w )
{
LOG("MC2661 Clear to Send: %u\n", state);
}
//-------------------------------------------------
// rxrdy_r - receiver ready
//-------------------------------------------------
READ_LINE_MEMBER( mc2661_device::rxrdy_r )
{
return (m_sr & STATUS_RXRDY) ? ASSERT_LINE : CLEAR_LINE;
}
//-------------------------------------------------
// txemt_r - transmitter empty
//-------------------------------------------------
READ_LINE_MEMBER( mc2661_device::txemt_r )
{
return (m_sr & STATUS_TXEMT) ? ASSERT_LINE : CLEAR_LINE;
}

View File

@ -1,101 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/***************************************************************************
Motorola MC2661/MC68661 Enhanced Programmable Communications Interface
****************************************************************************
_____ _____
D2 1 |* \_/ | 28 D1
D3 2 | | 27 D0
RxD 3 | | 26 Vcc
GND 4 | | 25 _RxC/BKDET
D4 5 | | 24 _DTR
D5 6 | | 23 _RTS
D6 7 | MC2661 | 22 _DSR
D7 8 | MC68661 | 21 RESET
_TxC/XSYNC 9 | | 20 BRCLK
A1 10 | | 19 TxD
_CE 11 | | 18 _TxEMT/DSCHG
A0 12 | | 17 _CTS
_R/W 13 | | 16 _DCD
_RxRDY 14 |_____________| 15 _TxRDY
***************************************************************************/
#ifndef MAME_MACHINE_MC2661_H
#define MAME_MACHINE_MC2661_H
#pragma once
#include "diserial.h"
class mc2661_device : public device_t,
public device_serial_interface
{
public:
// construction/destruction
mc2661_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_rxc(int clock) { m_rxc = clock; }
void set_txc(int clock) { m_txc = clock; }
auto txd_handler() { return m_write_txd.bind(); }
auto rxrdy_handler() { return m_write_rxrdy.bind(); }
auto txrdy_handler() { return m_write_txrdy.bind(); }
auto rts_handler() { return m_write_rts.bind(); }
auto dtr_handler() { return m_write_dtr.bind(); }
auto txemt_dschg_handler() { return m_write_txemt_dschg.bind(); }
auto bkdet_handler() { return m_write_bkdet.bind(); }
auto xsync_handler() { return m_write_xsync.bind(); }
uint8_t read(offs_t offset);
void write(offs_t offset, uint8_t data);
DECLARE_WRITE_LINE_MEMBER( dsr_w );
DECLARE_WRITE_LINE_MEMBER( dcd_w );
DECLARE_WRITE_LINE_MEMBER( cts_w );
DECLARE_READ_LINE_MEMBER( rxrdy_r );
DECLARE_READ_LINE_MEMBER( txemt_r );
DECLARE_WRITE_LINE_MEMBER( rx_w ) { device_serial_interface::rx_w(state); }
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// device_serial_interface overrides
virtual void tra_callback() override;
virtual void tra_complete() override;
virtual void rcv_complete() override;
private:
devcb_write_line m_write_txd;
devcb_write_line m_write_rxrdy;
devcb_write_line m_write_txrdy;
devcb_write_line m_write_rts;
devcb_write_line m_write_dtr;
devcb_write_line m_write_txemt_dschg;
devcb_write_line m_write_bkdet;
devcb_write_line m_write_xsync;
int m_rxc;
int m_txc;
uint8_t m_rhr;
uint8_t m_thr;
uint8_t m_cr;
uint8_t m_sr;
uint8_t m_mr[2];
uint8_t m_sync[3];
int m_mode_index;
int m_sync_index;
};
DECLARE_DEVICE_TYPE(MC2661, mc2661_device)
#endif // MAME_MACHINE_MC2661_H