lkml.org 
[lkml]   [1999]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectserial.c (race?)
Hi,

I ran into an effect which might be a race in the serial drivers of
2.2.12. I run a program which communicates via the Hart protocol. This is
a simplex protocol and uses the IO port more or less like RS485.

The basic function to communicate does:
- open the port
- write a few bytes (about 10) with single writes to the port
- test for the transmitter register empty bit in the LSR with an
ioctl call
- drop RTS so that the Hart modem goes from Xmit to Rcv.
- collect data with single reads each after a poll call, to detect
timeouts and interrupted data stream
- close the port

With various machines: 130 MHz Pentium, 200 Mhz-K6 this worked always
with ports with an 16450 chip, like a fourport ttyS4..S7. It NEVER worked
on ttyS0/ttyS1 which were 16550A chips.

Some checking and putting DEBUG flags in ../drivers/char/serial.c showed
in the logs that the Xmit cycle completed but NO data was received. In my
program I added a check BEFORE the rts drop which tested the status of the
Transmitter Empty bit: it was set!!.

For me this means that on a sufficient fast machine even when there is
already data in the output buffers there is no reliable check to see if
all this data is processed.

I added a check in my program after the first write call to wait for the
drop of the Transmitter Empty bit first before to proceed. That worked.

This effect would also cause trouble for real RS485 applications.
I believe that for the return status of Transmitter Register Empty also
the output buffer should be checked.

The effect was fully reproducable.

Kees

BTW: should it be possible to downgrade the port with setserial?
I tried to use setserial to set uart to 16450 on a real 16550A
but then nothing worked...


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.695 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site