This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PowerPC hal_delay_us()


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]