Exemplo 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 = SERIAL_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);
	}

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

	m_write_dtr((m_connection_state & SERIAL_STATE_DTR) ? 0 : 1);

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

	m_write_rts((m_connection_state & SERIAL_STATE_RTS) ? 0 : 1);

	serial_connection_out();
}
Exemplo n.º 2
0
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);
}