This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Problem with getchar / gets / fgets
- From: Peter Graf <p dot graf at itknet dot de>
- To: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Wed, 06 Oct 2004 15:21:51 +0200
- Subject: Re: [ECOS] Problem with getchar / gets / fgets
- References: <MFENKKFPNAKOOKBAEHLHEEFKCDAA.nicolas.brouard@silicomp.ca>
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