[ECOS] RedBoot - Bug in _rb_gets()?
Gary Thomas
gthomas@redhat.com
Sat Oct 13 21:04:00 GMT 2001
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.
More information about the Ecos-discuss
mailing list