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: Ticks resolution


Cristiano Ligieri Pereira wrote:
> 
> Hi everybody,
> 
> I would like to understand better how the RTC works in eCos. I'm currently
> using i386 platform. In the file hal_i386_pc.h I see the definition of
> three constants :
> 
> #define CYGNUM_HAL_RTC_NUMERATOR        1000000000
> #define CYGNUM_HAL_RTC_DENOMINATOR   100
> #define CYGNUM_HAL_RTC_PERIOD           11932
> 
> According to the documentation, I've seen that numerator over denominator
> gives me the duration between two 'ticks' in nanoseconds. So for these
> definitions, one can see that between two ticks we have 10,000,000
> nanoseconds or 10 miliseconds. Or in other words 100 ticks per
> second. Right?
> 
> What if I wanna have more resolution. What should I do to delay some task
> for less than 10 miliseconds? Lets say 1 milisecond. Should I just modify
> the numerator to 100,000,000 (divide the define value by 10) and
> recompile. If so, how far can I go with this?

No, the timer is programmed with CYGNUM_HAL_RTC_PERIOD to give you the
interrupts at the correct frequency. The numerator and denominator are just
a way of telling the rest of the system how frequently those interrupts
will occur.

So you have to change PERIOD and update NUMERATOR and/or DENOMINATOR to
*reflect* the change you made to the PERIOD. So if you halve the period to
get interrupts twice as fast, you should either halve the numerator or
double the denominator.

Exactly how far you can go depends on the timer hardware. I don't know
offhand what the 8254 can do.

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]