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]

Re: How to calculate the Real-time clock period?


"Chris C." wrote:
> 
> Hi
> 
> In hal_arm_xxx.cdl, I don't know how to calculate the
> CYGNUM_HAL_RTC_PERIOD. If the cpu clock speed is 24MHz, how to find it
> value? Why at91 use ((CYGNUM_HAL_ARM_AT91_CLOCK_SPEED/32) /
> CYGNUM_HAL_RTC_DENOMINATOR) to calculate the rtc period?

That's sort of a mistake. The numerator and denominator can't be considered
separate so using one and not the other isn't really right. However the
numbers involved tend to be so large that you can't trust the arithmetic
anyway, so this is a bit of a hack.
 
The important thing is that the period is the value passed to the HAL_CLOCK
routines to program the hardware timers to cause a timer interrupt at the
correct frequency.

> What is the function of CYGNUM_HAL_RTC_NUMERATOR and
> CYGNUM_HAL_RTC_DENOMINATOR?

Numerator/denominator should be the nanoseconds per tick corresponding to
the period you've made the hardware tick at (using the period). They
reflect the period used.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine


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