This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
PowerPC hal_delay_us()
- From: Peter Graf <p dot graf at itknet dot de>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 04 Mar 2004 16:47:37 +0100
- Subject: [ECOS] PowerPC hal_delay_us()
- References: <4014DAFB.3070007@itknet.de> <m3isizj96n.fsf@miso.calivar.com> <4014F251.7030705@itknet.de> <m3ektnj5my.fsf@miso.calivar.com>
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