[ECOS] RedBoot: patch to improve net timekeeping.

Grant Edwards grante@visi.com
Mon Jan 22 15:11:00 GMT 2001

Here's a patch to net_io.c that changes the getc() routines
to call MS_TICKS() rather than CYGACC_CALL_IF_DELAY_US() when
waiting for input.

If a similar approach is used in the HAL's serial i/o routines,
it results in the system time being fairly accurate if the CPU
isn't heavily loaded.  As long as you call MS_TICKS() when
you're in a busy-idle loop, the accuracy of the system time is
determined by the CPU usage: 10% CPU means the clock is 10%
slow.  This should make it fairly useful for non-critical
interval timing.

NB: This changes the incremental wait in the net_io getc
    routines from 100us to 1ms.  If somebody really needs 100us
    wiats, a second delay routine could be added to ticks.c
    that delays for 100us and increments the "ticks" variable
    every 10th call.

Grant Edwards

More information about the Ecos-discuss mailing list