Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/uart/uart_tty.c
Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | uart_tty_intr(void *arg) | ||||
if (sc->sc_leaving) | if (sc->sc_leaving) | ||||
return; | return; | ||||
pend = atomic_readandclear_32(&sc->sc_ttypend); | pend = atomic_readandclear_32(&sc->sc_ttypend); | ||||
if (!(pend & SER_INT_MASK)) | if (!(pend & SER_INT_MASK)) | ||||
return; | return; | ||||
tp = sc->sc_u.u_tty.tp; | tp = sc->sc_u.u_tty.tp; | ||||
tty_lock(tp); | ttydisc_lock(tp); | ||||
if (pend & SER_INT_RXREADY) { | if (pend & SER_INT_RXREADY) { | ||||
while (!uart_rx_empty(sc) && !sc->sc_isquelch) { | while (!uart_rx_empty(sc) && !sc->sc_isquelch) { | ||||
xc = uart_rx_peek(sc); | xc = uart_rx_peek(sc); | ||||
c = xc & 0xff; | c = xc & 0xff; | ||||
if (xc & UART_STAT_FRAMERR) | if (xc & UART_STAT_FRAMERR) | ||||
err |= TRE_FRAMING; | err |= TRE_FRAMING; | ||||
if (xc & UART_STAT_OVERRUN) | if (xc & UART_STAT_OVERRUN) | ||||
Show All 19 Lines | if (sig & SER_DDCD) | ||||
ttydisc_modem(tp, sig & SER_DCD); | ttydisc_modem(tp, sig & SER_DCD); | ||||
if (sig & SER_DCTS) | if (sig & SER_DCTS) | ||||
uart_tty_outwakeup(tp); | uart_tty_outwakeup(tp); | ||||
} | } | ||||
if (pend & SER_INT_TXIDLE) | if (pend & SER_INT_TXIDLE) | ||||
uart_tty_outwakeup(tp); | uart_tty_outwakeup(tp); | ||||
ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
tty_unlock(tp); | ttydisc_unlock(tp); | ||||
} | } | ||||
static void | static void | ||||
uart_tty_free(void *arg __unused) | uart_tty_free(void *arg __unused) | ||||
{ | { | ||||
/* | /* | ||||
* XXX: uart(4) could reuse the device unit number before it is | * XXX: uart(4) could reuse the device unit number before it is | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | uart_tty_detach(struct uart_softc *sc) | ||||
return (0); | return (0); | ||||
} | } | ||||
struct mtx * | struct mtx * | ||||
uart_tty_getlock(struct uart_softc *sc) | uart_tty_getlock(struct uart_softc *sc) | ||||
{ | { | ||||
if (sc->sc_u.u_tty.tp != NULL) | if (sc->sc_u.u_tty.tp != NULL) | ||||
return (tty_getlock(sc->sc_u.u_tty.tp)); | return (ttydisc_getlock(sc->sc_u.u_tty.tp)); | ||||
else | else | ||||
return (NULL); | return (NULL); | ||||
} | } |