PERFORCE change 37337 for review
Marcel Moolenaar
marcel at FreeBSD.org
Mon Sep 1 13:48:39 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=37337
Change 37337 by marcel at marcel_nfs on 2003/09/01 13:47:41
Implement UART_RECEIVE() and change the size of the Rx FIFO
from 1 to 3. This latter is not really crucial, because we
read characters from the chip until there are no more. But,
it's documented to be at least 3 characters.
We now have a working console in single-user mode. For some
reason getty(8) still waits for DCD. I don't think this is
a problem that relates to the z8530 though. Even if we get
the signals wrong, the console is forced to be CLOCAL so we
don't care if we have DCD or not. At least, that's the idea.
Get the signal state in UART_ATTACH() to have a good begin
situation though.
Affected files ...
.. //depot/projects/uart/dev/uart/uart_dev_z8530.c#9 edit
Differences ...
==== //depot/projects/uart/dev/uart/uart_dev_z8530.c#9 (text+ko) ====
@@ -299,9 +299,11 @@
z8530->tpc &= ~(TPC_DTR|TPC_RTS);
}
- sc->sc_rxfifosz = 1;
+ sc->sc_rxfifosz = 3;
sc->sc_txfifosz = 1;
+ (void)z8530_bus_getsig(sc);
+
uart_setmreg(bas, WR_IC, IC_BRK | IC_CTS | IC_DCD);
uart_barrier(bas);
uart_setmreg(bas, WR_IDT, IDT_TIE | IDT_RIA);
@@ -409,7 +411,24 @@
static int
z8530_bus_receive(struct uart_softc *sc)
{
-
+ struct uart_bas *bas;
+ int xc;
+ uint8_t bes, src;
+
+ bas = &sc->sc_bas;
+ bes = uart_getmreg(bas, RR_BES);
+ while ((bes & BES_RXA) && !uart_rx_full(sc)) {
+ src = uart_getmreg(bas, RR_SRC);
+ xc = uart_getreg(bas, REG_DATA);
+ if (src & SRC_FE)
+ xc |= UART_STAT_FRAMERR;
+ if (src & SRC_PE)
+ xc |= UART_STAT_PARERR;
+ uart_rx_put(sc, xc);
+ if (src & (SRC_FE | SRC_PE))
+ uart_setreg(bas, REG_CTRL, CR_RSTERR);
+ bes = uart_getmreg(bas, RR_BES);
+ }
return (0);
}
More information about the p4-projects
mailing list