<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2314.1000" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>I am working on a
Coldfire 5206e BSP and I noticed a problem that</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>I think needs to be
fixed in the termios code.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>I setup a simple
test program that is just trying to talk with an </SPAN></FONT><FONT face=Arial
size=2><SPAN class=690313015-28092001>external </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>modem. The
program just sends out the "AT\r" string and waits </SPAN></FONT><FONT
face=Arial size=2><SPAN class=690313015-28092001>to receive </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>the "OK" response
string. Once it receives the OK response, it then</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>sends another "AT"
command. </SPAN></FONT><FONT face=Arial size=2><SPAN
class=690313015-28092001>I also have setup a PC with two serial
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001></SPAN></FONT><FONT
face=Arial size=2><SPAN class=690313015-28092001>ports between the Coldfire and
the modem. The PC just displays </SPAN></FONT><FONT face=Arial
size=2><SPAN class=690313015-28092001>all the </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>data that is sent
between the two devices.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>The test works
perfectly the first time. The PC displays the three</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>transmitted
characters and the modem's response. But the second transmit
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>request actually
</SPAN></FONT><FONT face=Arial size=2><SPAN class=690313015-28092001>sent 16
characters to the modem. Most of these</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>characters were
NULL.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>I traced the problem
to the following functions. The transmit interrupt
handler</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>was calling the
function rtems_termios_dequeue_characters(). This
function</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>increments a dequeue
length variable and then calls the function</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001>rtems_termios_refill_transmitter(). The problem
is that when the transmit</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>buffer is empty, the
dequeue length variable is not reset to zero. So the</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>next valid transmit
request was sending extra data. Resetting the dequeue</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>length variable to
zero, fixes the problem.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>Any thoughts?
Should this problem be fixed with a simple change to</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>the termios
code? Or should I have to make the fix in the BSP code</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>to ensure that
transmit iterrupts are not enabled when the buffer is empty.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001>Thanks</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=690313015-28092001>Mike
Siers</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=690313015-28092001></SPAN></FONT> </DIV>
<DIV> </DIV></BODY></HTML>