Subject: tty output problems
To: Port-i386 <port-i386@NetBSD.ORG>
From: Jukka Marin <jmarin@pyy.jmp.fi>
List: port-i386
Date: 05/21/2000 13:22:43
NetBSD 1.4.2, i386:
I'm running a simple serial protocol between a NetBSD box a some custom
hardware. The problem is that every now and then (especially when the
NetBSD box is doing something CPU intensive) I get protocol timeouts on
the remote device. It seems that NetBSD does not fill the UART transmit
FIFO fast enough, so the data flow is interrupted and the remote device
times out.
How does the tty output system work? I thought the design was something
like this:
application ---> software FIFO ---> UART hardware FIFO ---> serial wire
When the UART transmit interrupt signals that the hardware FIFO has room
for more data, the interrupt routine copies more bytes from software
FIFO to the UART. So, no matter how busy the CPU is running gzip or some
such, the interrupt routine will always copy data from software FIFO to
UART with a small latency. Is this correct?
My protocol uses Write(2) to send a packet to the system and is trying to
write all data at once. If this fails, it will select() and then Write()
more data.
However, there are long gaps in data output, especially when the NetBSD
box is running gzip, Netscape, or some other program that can tie up the
CPU for "long" periods of time. It feels like there was only the UART
hardware FIFO and the application writing data directly into it - when the
scheduler lets the application run - which may not be very often if the
system is busy.
Does the software FIFO exist at all or is the problem somewhere else?
-jm