This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: How to calculate the Real-time clock period?
- To: "Chris C." <hksbtx at 2bzd dot com>
- Subject: Re: [ECOS] How to calculate the Real-time clock period?
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Sun, 09 Sep 2001 20:21:38 +0100
- Cc: ecos-discuss at sourceware dot cygnus dot com
- References: <48272001909161552109@2bsure.com>
"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