Hello everybody.
I am working on linux serial driver. I faced strange problem: sometimes during transmittion (echo "aaa" > /dev/ttyMY) system did not stops on sending strung "aaa". It starts to send additional rubbish bytes.
My xmit function is written with respect to code I found in /drivers/serial/*. And I try the same test (echo "aaa" > /dev/ttyS0) with existing serial driver and get the same result! I added debug printouts to my driver and found that system calls start_tx after it send needed bytes and I don't understand why it did so.
Als if I start getty /dev/ttyMY 115200 - command prompt works well (but may be getty removes rubbish).
Kernel version is 2.6.16 and I cannot upgrade it.
What is the reason of such behavour?
The system will call
The system will call start_tx whenever the transmitter is ready for new bytes. This can happen when you have no queued bytes to transmit.
start_tx must work this way:
-- If there are one or more bytes to transmit (including the possibility of a software flow-control byte), start transmitting them.
-- Otherwise there are no more bytes to transmit, so quiesce the transmitter. Usually you do this by disabling the "transmit ready" interrupt until the next call to start_tx.