This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
delay_us: Small tweak
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: ecos-patches at sources dot redhat dot com
- Date: 25 Jun 2003 18:41:47 +0100
- Subject: delay_us: Small tweak
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/ChangeLog,v
retrieving revision 1.95
diff -u -5 -r1.95 ChangeLog
--- ChangeLog 24 Jun 2003 04:57:18 -0000 1.95
+++ ChangeLog 25 Jun 2003 17:39:42 -0000
@@ -1,5 +1,15 @@
+2003-06-25 Nick Garnett <nickg@balti.calivar.com>
+
+ * src/hal_if.c (delay_us): The first test against
+ CYGNUM_KERNEL_COUNTERS_RTC_PERIOD is now against the period
+ divided by two. By the time we get to this test we know that usecs
+ can never be > usec_per_period/2 so we can double the range of
+ period values that we can handle without overflow and use the more
+ efficient approximation. The second test is not changed since we
+ cannot make the same assumptions about the elapsed count.
+
2003-06-24 Jonathan Larmour <jifl@eCosCentric.com>
* src/generic-stub.c (crc32): Fix crctable option name typo.
* src/hal_if.c (hal_if_init): Remove kill_by_reset.
Index: src/hal_if.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/common/current/src/hal_if.c,v
retrieving revision 1.24
diff -u -5 -r1.24 hal_if.c
--- src/hal_if.c 24 Jun 2003 04:01:09 -0000 1.24
+++ src/hal_if.c 25 Jun 2003 17:39:54 -0000
@@ -185,11 +185,11 @@
// eliminate it and only compile the branch that is
// selected.
if( usecs > usec_per_period/2 )
slice = CYGNUM_KERNEL_COUNTERS_RTC_PERIOD/2;
- else if( CYGNUM_KERNEL_COUNTERS_RTC_PERIOD >= 0x7FFFFFFF/usec_per_period )
+ else if( CYGNUM_KERNEL_COUNTERS_RTC_PERIOD/2 >= 0x7FFFFFFF/usec_per_period )
slice = usecs * ticks_per_usec;
else
{
slice = usecs*CYGNUM_KERNEL_COUNTERS_RTC_PERIOD;
slice /= usec_per_period;
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts