devices/machine/ins8250.cpp : Simplify handlers, Use shorter type values

This commit is contained in:
cam900 2019-03-30 18:20:27 +09:00
parent ddca2da42d
commit a2d286ba6d
15 changed files with 97 additions and 97 deletions

View File

@ -193,7 +193,7 @@ READ16_MEMBER(dio16_98644_device::io_r)
case 0x0d:
case 0x0e:
case 0x0f:
ret = m_uart->ins8250_r(space, offset & 0x07, mem_mask);
ret = m_uart->ins8250_r(offset & 0x07);
break;
}
@ -230,7 +230,7 @@ WRITE16_MEMBER(dio16_98644_device::io_w)
case 0x0d:
case 0x0e:
case 0x0f:
m_uart->ins8250_w(space, offset & 0x07, data, mem_mask);
m_uart->ins8250_w(offset & 0x07, data);
break;
}
}

View File

@ -118,10 +118,10 @@ isa8_com_device::isa8_com_device(const machine_config &mconfig, device_type type
void isa8_com_device::device_start()
{
set_isa_device();
m_isa->install_device(0x03f8, 0x03ff, read8_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_0")), write8_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_0")) );
m_isa->install_device(0x02f8, 0x02ff, read8_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_1")), write8_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_1")) );
// m_isa->install_device(0x03e8, 0x03ef, read8_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_2")), write8_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_2")) );
// m_isa->install_device(0x02e8, 0x02ef, read8_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_3")), write8_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_3")) );
m_isa->install_device(0x03f8, 0x03ff, read8sm_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_0")), write8sm_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_0")) );
m_isa->install_device(0x02f8, 0x02ff, read8sm_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_1")), write8sm_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_1")) );
// m_isa->install_device(0x03e8, 0x03ef, read8sm_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_2")), write8sm_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_2")) );
// m_isa->install_device(0x02e8, 0x02ef, read8sm_delegate(FUNC(ins8250_device::ins8250_r), subdevice<ins8250_uart_device>("uart_3")), write8sm_delegate(FUNC(ins8250_device::ins8250_w), subdevice<ins8250_uart_device>("uart_3")) );
}
//-------------------------------------------------

View File

@ -115,10 +115,10 @@ void nubus_bootbug_device::device_reset()
WRITE32_MEMBER( nubus_bootbug_device::dev_w )
{
m_uart->ins8250_w(space, offset, data & 0xff);
m_uart->ins8250_w(offset, data & 0xff);
}
READ32_MEMBER( nubus_bootbug_device::dev_r )
{
return m_uart->ins8250_r(space, offset);
return m_uart->ins8250_r(offset);
}

View File

@ -110,7 +110,7 @@ uint8_t pofo_hpc102_device::nrdi_r(offs_t offset, uint8_t data, bool iom, bool b
if (!(offset & 0x08))
{
data = m_uart->ins8250_r(machine().dummy_space(), offset & 0x07);
data = m_uart->ins8250_r(offset & 0x07);
}
}
@ -133,7 +133,7 @@ void pofo_hpc102_device::nwri_w(offs_t offset, uint8_t data, bool iom, bool bcom
if (!(offset & 0x08))
{
m_uart->ins8250_w(machine().dummy_space(), offset & 0x07, data);
m_uart->ins8250_w(offset & 0x07, data);
}
}
}

View File

@ -388,15 +388,15 @@ uint8_t s100_wunderbus_device::s100_sinp_r(offs_t offset)
break;
case 1:
data = m_ace1->ins8250_r(machine().dummy_space(), offset & 0x07);
data = m_ace1->ins8250_r(offset & 0x07);
break;
case 2:
data = m_ace2->ins8250_r(machine().dummy_space(), offset & 0x07);
data = m_ace2->ins8250_r(offset & 0x07);
break;
case 3:
data = m_ace3->ins8250_r(machine().dummy_space(), offset & 0x07);
data = m_ace3->ins8250_r(offset & 0x07);
break;
}
}
@ -511,15 +511,15 @@ void s100_wunderbus_device::s100_sout_w(offs_t offset, uint8_t data)
break;
case 1:
m_ace1->ins8250_w(machine().dummy_space(), offset & 0x07, data);
m_ace1->ins8250_w(offset & 0x07, data);
break;
case 2:
m_ace2->ins8250_w(machine().dummy_space(), offset & 0x07, data);
m_ace2->ins8250_w(offset & 0x07, data);
break;
case 3:
m_ace3->ins8250_w(machine().dummy_space(), offset & 0x07, data);
m_ace3->ins8250_w(offset & 0x07, data);
break;
}
}

View File

@ -77,7 +77,7 @@ uint8_t sv805_device::iorq_r(offs_t offset)
case 0x2d:
case 0x2e:
case 0x2f:
return m_uart->ins8250_r(machine().dummy_space(), offset & 0x07);
return m_uart->ins8250_r(offset & 0x07);
}
return 0xff;
@ -95,7 +95,7 @@ void sv805_device::iorq_w(offs_t offset, uint8_t data)
case 0x2d:
case 0x2e:
case 0x2f:
m_uart->ins8250_w(machine().dummy_space(), offset & 0x07, data);
m_uart->ins8250_w(offset & 0x07, data);
}
}

View File

@ -16,11 +16,11 @@ READ8_MEMBER(fdc37c665gt_device::read)
if ((offset & 0x3f8) == 0x3f8)
{
data = m_uart1->ins8250_r(space, offset & 7, mem_mask);
data = m_uart1->ins8250_r(offset & 7);
}
else if ((offset & 0x3f8) == 0x2f8)
{
data = m_uart2->ins8250_r(space, offset & 7, mem_mask);
data = m_uart2->ins8250_r(offset & 7);
}
else
{
@ -33,11 +33,11 @@ WRITE8_MEMBER(fdc37c665gt_device::write)
{
if ((offset & 0x3f8) == 0x3f8)
{
m_uart1->ins8250_w(space, offset & 7, data, mem_mask);
m_uart1->ins8250_w(offset & 7, data);
}
else if ((offset & 0x3f8) == 0x2f8)
{
m_uart2->ins8250_w(space, offset & 7, data, mem_mask);
m_uart2->ins8250_w(offset & 7, data);
}
else
{

View File

@ -581,12 +581,12 @@ void fdc37c93x_device::map_serial1(address_map &map)
READ8_MEMBER(fdc37c93x_device::serial1_read)
{
return pc_serial1_comdev->ins8250_r(space, offset, mem_mask);
return pc_serial1_comdev->ins8250_r(offset);
}
WRITE8_MEMBER(fdc37c93x_device::serial1_write)
{
pc_serial1_comdev->ins8250_w(space, offset, data, mem_mask);
pc_serial1_comdev->ins8250_w(offset, data);
}
void fdc37c93x_device::map_serial1_addresses()
@ -610,12 +610,12 @@ void fdc37c93x_device::map_serial2(address_map &map)
READ8_MEMBER(fdc37c93x_device::serial2_read)
{
return pc_serial2_comdev->ins8250_r(space, offset, mem_mask);
return pc_serial2_comdev->ins8250_r(offset);
}
WRITE8_MEMBER(fdc37c93x_device::serial2_write)
{
pc_serial2_comdev->ins8250_w(space, offset, data, mem_mask);
pc_serial2_comdev->ins8250_w(offset, data);
}
void fdc37c93x_device::map_serial2_addresses()

View File

@ -107,7 +107,7 @@ DEFINE_DEVICE_TYPE(NS16450, ns16450_device, "ns16450", "National Semiconductor
DEFINE_DEVICE_TYPE(NS16550, ns16550_device, "ns16550", "National Semiconductor NS16550 UART")
DEFINE_DEVICE_TYPE(PC16552D, pc16552_device, "pc16552d", "National Semiconductor PC16552D UART")
ins8250_uart_device::ins8250_uart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, dev_type device_type)
ins8250_uart_device::ins8250_uart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, dev_type device_type)
: device_t(mconfig, type, tag, owner, clock)
, device_serial_interface(mconfig, *this)
, m_device_type(device_type)
@ -126,22 +126,22 @@ ins8250_uart_device::ins8250_uart_device(const machine_config &mconfig, device_t
m_regs.ier = 0;
}
ins8250_device::ins8250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
ins8250_device::ins8250_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: ins8250_uart_device(mconfig, INS8250, tag, owner, clock, dev_type::INS8250)
{
}
ns16450_device::ns16450_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
ns16450_device::ns16450_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: ins8250_uart_device(mconfig, NS16450, tag, owner, clock, dev_type::NS16450)
{
}
ns16550_device::ns16550_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
ns16550_device::ns16550_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: ins8250_uart_device(mconfig, NS16550, tag, owner, clock, dev_type::NS16550)
{
}
pc16552_device::pc16552_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
pc16552_device::pc16552_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, PC16552D, tag, owner, clock)
{
}
@ -159,27 +159,27 @@ void pc16552_device::device_start()
#define COM_INT_PENDING_MODEM_STATUS_REGISTER 0x0008
#define COM_INT_PENDING_CHAR_TIMEOUT 0x0011
static constexpr uint8_t INS8250_LSR_TSRE = 0x40;
static constexpr uint8_t INS8250_LSR_THRE = 0x20;
static constexpr uint8_t INS8250_LSR_BI = 0x10;
static constexpr uint8_t INS8250_LSR_FE = 0x08;
static constexpr uint8_t INS8250_LSR_PE = 0x04;
static constexpr uint8_t INS8250_LSR_OE = 0x02;
static constexpr uint8_t INS8250_LSR_DR = 0x01;
static constexpr u8 INS8250_LSR_TSRE = 0x40;
static constexpr u8 INS8250_LSR_THRE = 0x20;
static constexpr u8 INS8250_LSR_BI = 0x10;
static constexpr u8 INS8250_LSR_FE = 0x08;
static constexpr u8 INS8250_LSR_PE = 0x04;
static constexpr u8 INS8250_LSR_OE = 0x02;
static constexpr u8 INS8250_LSR_DR = 0x01;
static constexpr uint8_t INS8250_MCR_DTR = 0x01;
static constexpr uint8_t INS8250_MCR_RTS = 0x02;
static constexpr uint8_t INS8250_MCR_OUT1 = 0x04;
static constexpr uint8_t INS8250_MCR_OUT2 = 0x08;
static constexpr uint8_t INS8250_MCR_LOOPBACK = 0x10;
static constexpr u8 INS8250_MCR_DTR = 0x01;
static constexpr u8 INS8250_MCR_RTS = 0x02;
static constexpr u8 INS8250_MCR_OUT1 = 0x04;
static constexpr u8 INS8250_MCR_OUT2 = 0x08;
static constexpr u8 INS8250_MCR_LOOPBACK = 0x10;
static constexpr uint8_t INS8250_LCR_BITCOUNT_MASK= 0x03;
static constexpr uint8_t INS8250_LCR_2STOP_BITS = 0x04;
//static constexpr uint8_t INS8250_LCR_PEN = 0x08;
//static constexpr uint8_t INS8250_LCR_EVEN_PAR = 0x10;
//static constexpr uint8_t INS8250_LCR_PARITY = 0x20;
//static constexpr uint8_t INS8250_LCR_BREAK = 0x40;
static constexpr uint8_t INS8250_LCR_DLAB = 0x80;
static constexpr u8 INS8250_LCR_BITCOUNT_MASK= 0x03;
static constexpr u8 INS8250_LCR_2STOP_BITS = 0x04;
//static constexpr u8 INS8250_LCR_PEN = 0x08;
//static constexpr u8 INS8250_LCR_EVEN_PAR = 0x10;
//static constexpr u8 INS8250_LCR_PARITY = 0x20;
//static constexpr u8 INS8250_LCR_BREAK = 0x40;
static constexpr u8 INS8250_LCR_DLAB = 0x80;
/* ints will continue to be set for as long as there are ints pending */
void ins8250_uart_device::update_interrupt()
@ -257,7 +257,7 @@ void ins8250_uart_device::update_baud_rate()
tra_complete();
}
WRITE8_MEMBER( ins8250_uart_device::ins8250_w )
void ins8250_uart_device::ins8250_w(offs_t offset, u8 data)
{
int tmp;
@ -399,7 +399,7 @@ WRITE8_MEMBER( ins8250_uart_device::ins8250_w )
}
}
READ8_MEMBER( ins8250_uart_device::ins8250_r )
u8 ins8250_uart_device::ins8250_r(offs_t offset)
{
int data = 0x0ff;
@ -484,7 +484,7 @@ void ns16550_device::rcv_complete()
return;
}
uint8_t errors = 0;
u8 errors = 0;
if (is_receive_framing_error())
errors |= INS8250_LSR_FE;
if (is_receive_parity_error())
@ -578,7 +578,7 @@ void ins8250_uart_device::tra_callback()
void ins8250_uart_device::update_msr()
{
uint8_t data;
u8 data;
int change;
if (m_regs.mcr & INS8250_MCR_LOOPBACK)
@ -720,15 +720,15 @@ void ns16550_device::device_timer(emu_timer &timer, device_timer_id id, int para
}
}
void ns16550_device::push_tx(uint8_t data)
void ns16550_device::push_tx(u8 data)
{
m_tfifo[m_thead] = data;
++m_thead &= 0x0f;
}
uint8_t ns16550_device::pop_rx()
u8 ns16550_device::pop_rx()
{
uint8_t data = m_rfifo[m_rtail];
u8 data = m_rfifo[m_rtail];
clear_int(COM_INT_PENDING_CHAR_TIMEOUT & ~1); // don't clear bit 1 yet
if(m_rnum)
@ -758,7 +758,7 @@ uint8_t ns16550_device::pop_rx()
return data;
}
void ns16550_device::set_fcr(uint8_t data)
void ns16550_device::set_fcr(u8 data)
{
const int bytes_per_int[] = {1, 4, 8, 14};
if(!(data & 1))

View File

@ -27,8 +27,8 @@ public:
auto out_out1_callback() { return m_out_out1_cb.bind(); }
auto out_out2_callback() { return m_out_out2_cb.bind(); }
DECLARE_WRITE8_MEMBER(ins8250_w);
DECLARE_READ8_MEMBER(ins8250_r);
void ins8250_w(offs_t offset, u8 data);
u8 ins8250_r(offs_t offset);
DECLARE_WRITE_LINE_MEMBER(dcd_w);
DECLARE_WRITE_LINE_MEMBER(dsr_w);
@ -46,7 +46,7 @@ protected:
NS16550A
};
ins8250_uart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, dev_type device_type);
ins8250_uart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, dev_type device_type);
virtual void device_start() override;
virtual void device_reset() override;
@ -54,9 +54,9 @@ protected:
virtual void tra_complete() override;
virtual void tra_callback() override;
virtual void set_fcr(uint8_t data) { }
virtual void push_tx(uint8_t data) { }
virtual uint8_t pop_rx() { return 0; }
virtual void set_fcr(u8 data) { }
virtual void push_tx(u8 data) { }
virtual u8 pop_rx() { return 0; }
void trigger_int(int flag);
void clear_int(int flag);
@ -65,20 +65,20 @@ protected:
const dev_type m_device_type;
struct {
uint8_t thr; /* 0 -W transmitter holding register */
uint8_t rbr; /* 0 R- receiver buffer register */
uint8_t ier; /* 1 RW interrupt enable register */
uint16_t dl; /* 0/1 RW divisor latch (if DLAB = 1) */
uint8_t iir; /* 2 R- interrupt identification register */
uint8_t fcr;
uint8_t lcr; /* 3 RW line control register (bit 7: DLAB) */
uint8_t mcr; /* 4 RW modem control register */
uint8_t lsr; /* 5 R- line status register */
uint8_t msr; /* 6 R- modem status register */
uint8_t scr; /* 7 RW scratch register */
u8 thr; /* 0 -W transmitter holding register */
u8 rbr; /* 0 R- receiver buffer register */
u8 ier; /* 1 RW interrupt enable register */
u16 dl; /* 0/1 RW divisor latch (if DLAB = 1) */
u8 iir; /* 2 R- interrupt identification register */
u8 fcr;
u8 lcr; /* 3 RW line control register (bit 7: DLAB) */
u8 mcr; /* 4 RW modem control register */
u8 lsr; /* 5 R- line status register */
u8 msr; /* 6 R- modem status register */
u8 scr; /* 7 RW scratch register */
} m_regs;
private:
uint8_t m_int_pending;
u8 m_int_pending;
devcb_write_line m_out_tx_cb;
devcb_write_line m_out_dtr_cb;
@ -101,34 +101,34 @@ private:
class ins8250_device : public ins8250_uart_device
{
public:
ins8250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
ins8250_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
class ns16450_device : public ins8250_uart_device
{
public:
ns16450_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
ns16450_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
class ns16550_device : public ins8250_uart_device
{
public:
ns16550_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
ns16550_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void rcv_complete() override;
virtual void tra_complete() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual void set_fcr(uint8_t data) override;
virtual void push_tx(uint8_t data) override;
virtual uint8_t pop_rx() override;
virtual void set_fcr(u8 data) override;
virtual void push_tx(u8 data) override;
virtual u8 pop_rx() override;
private:
void set_timer() { m_timeout->adjust(attotime::from_hz((clock()*4*8)/(m_regs.dl*16))); }
int m_rintlvl;
uint8_t m_rfifo[16];
uint8_t m_efifo[16];
uint8_t m_tfifo[16];
u8 m_rfifo[16];
u8 m_efifo[16];
u8 m_tfifo[16];
int m_rhead, m_rtail, m_rnum;
int m_thead, m_ttail;
emu_timer *m_timeout;
@ -137,10 +137,10 @@ private:
class pc16552_device : public device_t
{
public:
pc16552_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
pc16552_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
DECLARE_READ8_MEMBER(read) { return ((offset & 8) ? m_chan1 : m_chan0)->ins8250_r(space, offset & 7, mem_mask); }
DECLARE_WRITE8_MEMBER(write) { ((offset & 8) ? m_chan1 : m_chan0)->ins8250_w(space, offset & 7, data, mem_mask); }
u8 read(offs_t offset) { return ((offset & 8) ? m_chan1 : m_chan0)->ins8250_r(offset & 7); }
void write(offs_t offset, u8 data) { ((offset & 8) ? m_chan1 : m_chan0)->ins8250_w(offset & 7, data); }
protected:
virtual void device_start() override;

View File

@ -1008,7 +1008,7 @@ WRITE_LINE_MEMBER(vrc5074_device::uart_irq_callback)
READ32_MEMBER(vrc5074_device::serial_r)
{
uint32_t result = m_uart->ins8250_r(space, offset>>1);
uint32_t result = m_uart->ins8250_r(offset>>1);
if (0 && LOG_NILE)
logerror("%s serial_r offset %03X = %08X (%08x)\n", machine().describe_context(), offset>>1, result, offset*4);
@ -1017,7 +1017,7 @@ READ32_MEMBER(vrc5074_device::serial_r)
WRITE32_MEMBER(vrc5074_device::serial_w)
{
m_uart->ins8250_w(space, offset>>1, data);
m_uart->ins8250_w(offset>>1, data);
if (PRINTF_SERIAL && offset == NREG_UARTTHR) {
static std::string debugStr;
printf("%c", data);

View File

@ -173,7 +173,7 @@ READ8_MEMBER(ccs_state::io_read)
{
// A7-A3 are compared against jumper settings
if (m_ser_en->read() && (offset & 0x00f8) == m_ser_addr_sel->read())
return m_ins8250->ins8250_r(space, offset & 7);
return m_ins8250->ins8250_r(offset & 7);
return 0xff;
}
@ -182,7 +182,7 @@ WRITE8_MEMBER(ccs_state::io_write)
{
// A7-A3 are compared against jumper settings
if (m_ser_en->read() && (offset & 0x00f8) == m_ser_addr_sel->read())
m_ins8250->ins8250_w(space, offset & 7, data);
m_ins8250->ins8250_w(offset & 7, data);
}
void ccs_state::ccs2810_mem(address_map &map)

View File

@ -489,12 +489,12 @@ READ32_MEMBER(firebeat_state::keyboard_wheel_r )
READ8_MEMBER(firebeat_state::midi_uart_r )
{
return m_duart_midi->read(space, offset >> 6);
return m_duart_midi->read(offset >> 6);
}
WRITE8_MEMBER(firebeat_state::midi_uart_w )
{
m_duart_midi->write(space, offset >> 6, data);
m_duart_midi->write(offset >> 6, data);
}
WRITE_LINE_MEMBER(firebeat_state::midi_uart_ch0_irq_callback)

View File

@ -568,7 +568,7 @@ READ8_MEMBER( pc1640_state::io_r )
else if (addr >= 0x3b0 && addr <= 0x3df) { decoded = true; }
else if (addr >= 0x3f4 && addr <= 0x3f4) { data = m_fdc->fdc->msr_r(); decoded = true; }
else if (addr >= 0x3f5 && addr <= 0x3f5) { data = m_fdc->fdc->fifo_r(); decoded = true; }
else if (addr >= 0x3f8 && addr <= 0x3ff) { data = m_uart->ins8250_r(space, offset & 0x07); decoded = true; }
else if (addr >= 0x3f8 && addr <= 0x3ff) { data = m_uart->ins8250_r(offset & 0x07); decoded = true; }
if (decoded)
{

View File

@ -214,12 +214,12 @@ void vt100_state::vt100_io(address_map &map)
u8 vt100_state::printer_r(offs_t offset)
{
return m_printer_uart->ins8250_r(machine().dummy_space(), offset >> 2);
return m_printer_uart->ins8250_r(offset >> 2);
}
void vt100_state::printer_w(offs_t offset, u8 data)
{
m_printer_uart->ins8250_w(machine().dummy_space(), offset >> 2, data);
m_printer_uart->ins8250_w(offset >> 2, data);
}
void vt100_state::vt102_io(address_map &map)