From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Edwards To: ecos-discuss@sources.redhat.com Subject: [ECOS] RedBoot: patch to improve net timekeeping. Date: Mon, 22 Jan 2001 15:11:00 -0000 Message-id: <20010122171603.B27137@visi.com> X-SW-Source: 2001-01/msg00379.html 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 grante@visi.com