This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: RedBoot - Bug in _rb_gets()?
- To: Chris Zankel <zankel at tensilica dot com>
- Subject: Re: [ECOS] RedBoot - Bug in _rb_gets()?
- From: Gary Thomas <gthomas at redhat dot com>
- Date: 14 Oct 2001 12:59:06 +0900
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- References: <3BC7A41C.8020802@tensilica.com>
On Sat, 2001-10-13 at 11:17, Chris Zankel wrote:
> Hello,
>
> Maybe I am missing something, but the while loop in
> ecos/packages/redboot/current/src/io.c:_rb_gets() seems
> to be odd to me:
> Although the timeout value for the mon_read_char_with_timeout()
> function has already been set to a <timeout> value the while
> loop also loops over this <timeout> variable:
>
> ...
> mon_set_read_char_timeout(timeout);
>
> while (timeout > 0) {
> res = mon_read_char_with_timeout(&c);
> if (res) { ... }
> timeout -= 50;
> }
> ...
There are two separate "timeout"s at work here. The innermost one is
what is used by the read_char function to decide if a character has
arrived within some period of time. The outermost is used by RedBoot
to allow it to do some things while waiting for characters to arrive
and will be much larger (orders of magnitude) than the innermost
timeout. The idea is for RedBoot to see if a character has arrived
or wait at most the "innermost" time. If no character has arrived, then
RedBoot can take on some "background" processing, e.g. checking for
any arriving network connections, blanking LCD screens, etc.