[ECOS] PowerPC hal_delay_us()

Peter Graf p.graf@itknet.de
Thu Mar 4 15:47:00 GMT 2004


Hi,

when using a non-default eCos clock tick frequency, I recognized a 
problem in hal_intr.c of the PowerPC architecture.

In hal_delay_us(int us), the factor

(CYGNUM_HAL_RTC_PERIOD * 100)) / 1000000

is used to determine the number of decrementer steps from the 
microseconds argument us. The comment says "the system constant 
CYGNUM_HAL_RTC_PERIOD corresponds to 10,000us". This is not correct in 
general.

Actually CYGNUM_HAL_RTC_PERIOD corresponds to the time which is given by 
dividing the numerator by the denominator, and other values than 10 ms 
should be perfectly OK as well. I propose the factor be changed to:

(CYGNUM_HAL_RTC_PERIOD * CYGNUM_HAL_RTC_DENOMINATOR)) / 
(CYGNUM_HAL_RTC_NUMERATOR/1000)

All the best
Peter


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list