This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with getchar / gets / fgets


Nicolas Brouard wrote:

Hi,
Does somebody have a council to solve my problem?
I have a Shell application and input lost a lot of characters. On my PowerPc
MPC860 target, I have to hit each character several times to display it on
minicom.


IIRC you reported that Redboot worked fine, so it reminded me of having a similar problem. I can only refer to eCos 2.0, but I guess this has not changed. In io/serial...serial.c, serial_read() attempts to fill a buffer of more than one character, even if the upper layer has requested only one, e.g. when the caller was getchar(). Now when your lowlevel driver supports no interrupt driven buffer fill operation (reflected here by cbuf->len==0), this will be done by calling several blocking (funs->getc)(chan), i.e. you must send several characters until the buffer is filled and serial_read() decides to return to its caller. Check if the characters properly arrive in your lowlevel driver first. If they do, it might be related to this. I resolved it by a quick hack in serial.c, never blocking for more than one character, but the proper way is an interrupt driven lowlevel driver.

Peter


-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]