Esempio n. 1
0
void mos6551_device::update_serial()
{
	int brg = m_ctrl & CTRL_BRG_MASK;

	if (brg == CTRL_BRG_16X_EXTCLK)
	{
		set_rcv_rate(m_ext_rxc / 16);
		set_tra_rate(m_ext_rxc / 16);
	}
	else
	{
		int baud = clock() / brg_divider[brg] / 16;

		set_tra_rate(baud);

		if (m_ctrl & CTRL_RXC_BRG)
		{
			set_rcv_rate(baud);
		}
		else
		{
			set_rcv_rate(m_ext_rxc / 16);
		}

		int num_data_bits = 8;
		int stop_bit_count = 1;
		int parity_code = PARITY_NONE;

		switch (m_ctrl & CTRL_WL_MASK)
		{
		case CTRL_WL_8: num_data_bits = 8; break;
		case CTRL_WL_7: num_data_bits = 7; break;
		case CTRL_WL_6: num_data_bits = 6; break;
		case CTRL_WL_5: num_data_bits = 5; break;
		}

		set_data_frame(num_data_bits, stop_bit_count, parity_code, false);
	}

	if (m_cmd & CMD_DTR)
		m_connection_state |= DTR;
	else
		m_connection_state &= ~DTR;

	m_dtr_handler((m_connection_state & DTR) ? 0 : 1);

	if ((m_cmd & CMD_TC_MASK) == CMD_TC_RTS_HI)
		m_connection_state &= ~RTS;
	else
		m_connection_state |= RTS;

	m_rts_handler((m_connection_state & RTS) ? 0 : 1);

	serial_connection_out();
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
void km035_device::device_reset()
{
	m_rts_handler(0);
}