void i8251_device::device_reset() { LOG(("I8251: Reset\n")); /* what is the default setup when the 8251 has been reset??? */ /* i8251 datasheet explains the state of tx pin at reset */ /* tx is set to 1 */ set_out_data_bit(1); /* assumption, rts is set to 1 */ m_connection_state &= ~SERIAL_STATE_RTS; serial_connection_out(); transmit_register_reset(); receive_register_reset(); /* expecting mode byte */ m_flags |= I8251_EXPECTING_MODE; /* not expecting a sync byte */ m_flags &= ~I8251_EXPECTING_SYNC_BYTE; /* no character to read by cpu */ /* transmitter is ready and is empty */ m_status = I8251_STATUS_TX_EMPTY | I8251_STATUS_TX_READY; m_mode_byte = 0; m_command = 0; /* update tx empty pin output */ update_tx_empty(); /* update rx ready pin output */ update_rx_ready(); /* update tx ready pin output */ update_tx_ready(); }
void i8251_device::transmit_clock() { m_txc_count++; if (m_txc_count != m_br_factor) return; m_txc_count = 0; if (is_transmit_register_empty()) { if ((m_status & I8251_STATUS_TX_READY) == 0 && (is_tx_enabled() || (m_flags & I8251_DELAYED_TX_EN) != 0)) start_tx(); else m_status |= I8251_STATUS_TX_EMPTY; update_tx_ready(); update_tx_empty(); } /* if diserial has bits to send, make them so */ if (!is_transmit_register_empty()) { uint8_t data = transmit_register_get_data_bit(); m_txd_handler(data); } #if 0 /* hunt mode? */ /* after each bit has been shifted in, it is compared against the current sync byte */ if (BIT(m_command, 7)) { /* data matches sync byte? */ if (m_data == m_sync_bytes[m_sync_byte_offset]) { /* sync byte matches */ /* update for next sync byte? */ m_sync_byte_offset++; /* do all sync bytes match? */ if (m_sync_byte_offset == m_sync_byte_count) { /* ent hunt mode */ m_command &= ~(1<<7); } } else { /* if there is no match, reset */ m_sync_byte_offset = 0; } } #endif }
void i8251_device::device_reset() { LOG("I8251: Reset\n"); /* what is the default setup when the 8251 has been reset??? */ /* i8251 datasheet explains the state of tx pin at reset */ /* tx is set to 1 */ m_txd_handler(1); /* assumption */ m_rts_handler(1); m_dtr_handler(1); transmit_register_reset(); receive_register_reset(); m_flags = 0; /* expecting mode byte */ m_flags |= I8251_EXPECTING_MODE; /* not expecting a sync byte */ m_flags &= ~I8251_EXPECTING_SYNC_BYTE; /* no character to read by cpu */ /* transmitter is ready and is empty */ m_status = I8251_STATUS_TX_EMPTY | I8251_STATUS_TX_READY; m_mode_byte = 0; m_command = 0; m_rx_data = 0; m_tx_data = 0; m_rxc_count = m_txc_count = 0; m_br_factor = 1; /* update tx empty pin output */ update_tx_empty(); /* update rx ready pin output */ update_rx_ready(); /* update tx ready pin output */ update_tx_ready(); }
void i8251_device::transmit_clock() { /* transmit enable? */ if (m_command & (1<<0)) { /* transmit register full? */ if ((m_status & I8251_STATUS_TX_READY)==0) { /* if transmit reg is empty */ if (is_transmit_register_empty()) { /* set it up */ transmit_register_setup(m_data); /* i8251 transmit reg now empty */ m_status |=I8251_STATUS_TX_EMPTY; /* ready for next transmit */ m_status |=I8251_STATUS_TX_READY; update_tx_empty(); update_tx_ready(); } } /* if transmit is not empty... transmit data */ if (!is_transmit_register_empty()) { UINT8 data = transmit_register_get_data_bit(); // logerror("I8251\n"); //transmit_register_send_bit(); m_out_txd_func(data); m_connection_state &=~SERIAL_STATE_TX_DATA; m_connection_state|=(data<<5); serial_connection_out(); } } #if 0 /* hunt mode? */ /* after each bit has been shifted in, it is compared against the current sync byte */ if (m_command & (1<<7)) { /* data matches sync byte? */ if (m_data == m_sync_bytes[m_sync_byte_offset]) { /* sync byte matches */ /* update for next sync byte? */ m_sync_byte_offset++; /* do all sync bytes match? */ if (m_sync_byte_offset == m_sync_byte_count) { /* ent hunt mode */ m_command &=~(1<<7); } } else { /* if there is no match, reset */ m_sync_byte_offset = 0; } } #endif }
void i8251_device::transmit_clock() { m_txc_count++; if (m_txc_count == m_br_factor) m_txc_count = 0; else return; /* transmit enabled? */ if (m_command & (1<<0)) { /* do we have a character to send? */ if ((m_status & I8251_STATUS_TX_READY)==0) { /* is diserial ready for it? */ if (is_transmit_register_empty()) { /* set it up */ transmit_register_setup(m_data); /* i8251 transmit reg now empty */ m_status |=I8251_STATUS_TX_EMPTY; /* ready for next transmit */ m_status |=I8251_STATUS_TX_READY; update_tx_empty(); update_tx_ready(); } } /* if diserial has bits to send, make them so */ if (!is_transmit_register_empty()) { UINT8 data = transmit_register_get_data_bit(); m_tx_busy = true; m_txd_handler(data); } // is transmitter totally done? if ((m_status & I8251_STATUS_TX_READY) && is_transmit_register_empty()) { m_tx_busy = false; if (m_disable_tx_pending) { LOG(("Applying pending disable\n")); m_disable_tx_pending = false; m_command &= ~(1<<0); m_txd_handler(1); update_tx_ready(); } } } #if 0 /* hunt mode? */ /* after each bit has been shifted in, it is compared against the current sync byte */ if (m_command & (1<<7)) { /* data matches sync byte? */ if (m_data == m_sync_bytes[m_sync_byte_offset]) { /* sync byte matches */ /* update for next sync byte? */ m_sync_byte_offset++; /* do all sync bytes match? */ if (m_sync_byte_offset == m_sync_byte_count) { /* ent hunt mode */ m_command &=~(1<<7); } } else { /* if there is no match, reset */ m_sync_byte_offset = 0; } } #endif }