Translate modem status reg bits from ns16550 to SER_* values used by the

tty layer.  Also, the line status reg bits are already ns16550 as expected
by the ucom layer, so no need for translation or a local var to hold them.
This commit is contained in:
Ian Lepore 2016-07-26 23:27:28 +00:00
parent b90ce50491
commit ab3249b590

View File

@ -743,15 +743,26 @@ umcs7840_cfg_get_status(struct ucom_softc *ucom, uint8_t *lsr, uint8_t *msr)
{ {
struct umcs7840_softc *sc = ucom->sc_parent; struct umcs7840_softc *sc = ucom->sc_parent;
uint8_t pn = ucom->sc_portno; uint8_t pn = ucom->sc_portno;
uint8_t hw_lsr = 0; /* local line status register */
uint8_t hw_msr = 0; /* local modem status register */ uint8_t hw_msr = 0; /* local modem status register */
/* Read LSR & MSR */ /*
umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, &hw_lsr); * Read status registers. MSR bits need translation from ns16550 to
* SER_* values. LSR bits are ns16550 in hardware and ucom.
*/
umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_LSR, lsr);
umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &hw_msr); umcs7840_get_UART_reg_sync(sc, pn, MCS7840_UART_REG_MSR, &hw_msr);
*lsr = hw_lsr; if (hw_msr & MCS7840_UART_MSR_NEGCTS)
*msr = hw_msr; *msr |= SER_CTS;
if (hw_msr & MCS7840_UART_MSR_NEGDCD)
*msr |= SER_DCD;
if (hw_msr & MCS7840_UART_MSR_NEGRI)
*msr |= SER_RI;
if (hw_msr & MCS7840_UART_MSR_NEGDSR)
*msr |= SER_DSR;
DPRINTF("Port %d status: LSR=%02x MSR=%02x\n", ucom->sc_portno, *lsr, *msr); DPRINTF("Port %d status: LSR=%02x MSR=%02x\n", ucom->sc_portno, *lsr, *msr);
} }