I'm using rt_com-0.5.3., not with RTL but with RTAI. I don't know exactly 
how RTL treats interrupts but that should not matter your question.

I have deeply analyzed rt_com code because I need to implement a special
serial protocol for my application using RTAI and I want to use rt_com
as a base code.
I've done some tests using rt_com and the FIFO_TRIGGER works ok.
I don't know how you are testing the serial driver but I imagine that you
are using a terminal emulator to send characters to the driver, and at
the same time checking the related interrupts.

The 16550A uart generates an interrupt both when it has received more
than FIFO_TRIGGER characters in the rx FIFO and when: ((no character has
been removed from the FIFO, OR there was no input to the receiver FIFO)
during the last four characters time) AND there is at least one character
in the FIFO during this time.
So if the time between two characters is more than the 4 characters
reception time you have an interrupt from the 16550A receiver called
"Character time-out indication". (For more information see the 16550A
data sheet).
If it was not so, you have an interrupt only if the trigger is fired, but
the rt_com should be modified so that every time you call rt_com_read it
must check if there are some characters in the FIFO, otherwise you will
not see them until the trigger will be fired.

Anyway, analyzing rt_com code, I think to have found a bug and a "not optimal
behaviour".

The bug is that at the end of the interrupt routine there is a wrong check
to see if there are other interrupts pending.
In fact the original code checks if the low nibble of IIR is zero, but
when there are no interrupts pending, the low nibble of IIR is 0x01 and
not zero!!!.
And if there are no interrupt, the default is to execute the "disable
Transmitter Holding Register Empty Interrupt" and you can see that it
can be executed 4 times (3 useless and expensive IOs).

The "not optimal behaviour" is that the rt_com use implicitly only 4
characters of the tx FIFO.  So you have a tx interrupt every 4 characters 
instead of 16.
I think that the "magic" number 4 that initialize the loop variable is
connected to the "4 characters time" of the rx timeout but is not
correct to do so.
The right way should be to put characters in the FIFO only when you are
sure that it's empty so you can put in 16 characters.

I think to have fixed both problems and I'll send the corrections to
Jochen Kuepper ASAP.

Ciao, Giuseppe.


-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to