Date: Fri, 15 Jun 2007 09:03:50 -0700 From: Marcel Moolenaar <xcllnt@mac.com> To: Christian Kandeler <christian.kandeler@hob.de> Cc: freebsd-hackers@freebsd.org Subject: Re: Question about serial console code Message-ID: <8D1F83C2-C7A6-4C86-88BE-17DD516DA4D9@mac.com> In-Reply-To: <200706151541.51913.christian.kandeler@hob.de> References: <200706151541.51913.christian.kandeler@hob.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jun 15, 2007, at 6:41 AM, Christian Kandeler wrote: > sc->sc_txdatasz = q_to_b(&tp->t_outq, sc->sc_txbuf, sc->sc_txfifosz); > This copies at most sc->sc_txfifosz (the size of the UART's FIFO) > bytes from > tp->outq to sc->sc_txbuf. After that, UART_TRANSMIT is called and > outputs the > characters just copied to the serial device. Yes. > Now obviously, the number of > characters in tp->t_outq can be greater than the UART's FIFO size, > but I > can't for the life of me find a loop anywhere in the call tree. So > what > happens to the rest of the outq buffer? The loop is formed by the transmit interrupt of the UART. When UART_TRANSMIT() is called, the FIFO of the UART is written and transmission starts. Eventually the UART will raise a "transmission done" interrupt, which will trigger the next iteration. > And what if the UART has no FIFO at > all (e.g. 8250)? sc->sc_txfifosz is zero in that case, so how does > anything > ever get printed then? If the UART has no FIFO (in the 16550-sense), then sc_txfifosz is still 1. There's obviously always at least 1 8-bit register in the UART to which data can to be written or read. The use of FIFO in the uart(4) is not limited to its definition in PC hardware. FYI, -- Marcel Moolenaar xcllnt@mac.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8D1F83C2-C7A6-4C86-88BE-17DD516DA4D9>