i8251: rx and tx data buffers separated

This commit is contained in:
fulivi 2015-08-11 14:59:29 +02:00
parent a7abd5aaac
commit 8678562f7e
2 changed files with 12 additions and 9 deletions

View File

@ -107,7 +107,8 @@ void i8251_device::device_start()
save_item(NAME(m_rxc_count)); save_item(NAME(m_rxc_count));
save_item(NAME(m_txc_count)); save_item(NAME(m_txc_count));
save_item(NAME(m_br_factor)); save_item(NAME(m_br_factor));
save_item(NAME(m_data)); save_item(NAME(m_rx_data));
save_item(NAME(m_tx_data));
save_item(NAME(m_tx_busy)); save_item(NAME(m_tx_busy));
save_item(NAME(m_disable_tx_pending)); save_item(NAME(m_disable_tx_pending));
device_serial_interface::register_save_state(machine().save(), this); device_serial_interface::register_save_state(machine().save(), this);
@ -190,7 +191,7 @@ void i8251_device::transmit_clock()
if (is_transmit_register_empty()) if (is_transmit_register_empty())
{ {
/* set it up */ /* set it up */
transmit_register_setup(m_data); transmit_register_setup(m_tx_data);
/* i8251 transmit reg now empty */ /* i8251 transmit reg now empty */
m_status |=I8251_STATUS_TX_EMPTY; m_status |=I8251_STATUS_TX_EMPTY;
/* ready for next transmit */ /* ready for next transmit */
@ -339,7 +340,8 @@ void i8251_device::device_reset()
m_status = I8251_STATUS_TX_EMPTY | I8251_STATUS_TX_READY; m_status = I8251_STATUS_TX_EMPTY | I8251_STATUS_TX_READY;
m_mode_byte = 0; m_mode_byte = 0;
m_command = 0; m_command = 0;
m_data = 0; m_rx_data = 0;
m_tx_data = 0;
m_rxc_count = m_txc_count = 0; m_rxc_count = m_txc_count = 0;
m_br_factor = 1; m_br_factor = 1;
m_tx_busy = m_disable_tx_pending = false; m_tx_busy = m_disable_tx_pending = false;
@ -688,8 +690,9 @@ READ8_MEMBER(i8251_device::status_r)
WRITE8_MEMBER(i8251_device::data_w) WRITE8_MEMBER(i8251_device::data_w)
{ {
m_data = data; m_tx_data = data;
LOG(("data_w %02x\n" , data));
// printf("i8251 transmit char: %02x\n",data); // printf("i8251 transmit char: %02x\n",data);
/* writing clears */ /* writing clears */
@ -711,9 +714,8 @@ WRITE8_MEMBER(i8251_device::data_w)
void i8251_device::receive_character(UINT8 ch) void i8251_device::receive_character(UINT8 ch)
{ {
// printf("i8251 receive char: %02x\n",ch);
m_data = ch; m_rx_data = ch;
/* char has not been read and another has arrived! */ /* char has not been read and another has arrived! */
if (m_status & I8251_STATUS_RX_READY) if (m_status & I8251_STATUS_RX_READY)
@ -733,12 +735,12 @@ void i8251_device::receive_character(UINT8 ch)
READ8_MEMBER(i8251_device::data_r) READ8_MEMBER(i8251_device::data_r)
{ {
//logerror("read data: %02x, STATUS=%02x\n",m_data,m_status); LOG(("read data: %02x, STATUS=%02x\n",m_rx_data,m_status));
/* reading clears */ /* reading clears */
m_status &= ~I8251_STATUS_RX_READY; m_status &= ~I8251_STATUS_RX_READY;
update_rx_ready(); update_rx_ready();
return m_data; return m_rx_data;
} }

View File

@ -132,7 +132,8 @@ private:
int m_br_factor; int m_br_factor;
/* data being received */ /* data being received */
UINT8 m_data; UINT8 m_rx_data;
UINT8 m_tx_data;
bool m_tx_busy; bool m_tx_busy;
bool m_disable_tx_pending; bool m_disable_tx_pending;
}; };