diff packages/hal/common/current/src/hal_if.c @ 1076:ff838098079a

* 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.
author nickg
date Wed, 25 Jun 2003 17:40:41 +0000
parents 965fc7fbe135
children 0e41ddaf36fe
line wrap: on
line diff
--- a/packages/hal/common/current/src/hal_if.c
+++ b/packages/hal/common/current/src/hal_if.c
@@ -187,7 +187,7 @@ delay_us(cyg_int32 usecs)
             
             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
             {