[Rtai] Regarding Timer Functions
jacob.philip at carc.co.in
Tue Dec 1 14:33:40 CET 2009
Thanks for comments.
I implemented a new function which directly returns rtai_rdtsc() and included related inline also.
and its working fine in user space .
Thanks and regards,
From: Paolo Mantegazza [mantegazza at aero.polimi.it]
Sent: 30 November 2009 21:00
To: Jacob Philip
Cc: rtai at rtai.org
Subject: Re: [Rtai] Regarding Timer Functions
Jacob Philip wrote:
> Hello ,
> This is regarding a doubt on timer function.
> I am using an arm (xscale - ixp23xx) processor . I was using rt_get_cpu_time_ns for checking time.
> But becouse of overflowing of timer values (due to multipication with 10000000000 ) i have issues
> in my program. Actually this fuction returns nagative values after overflow.
I'm unable to be more specific on ARM but, looking at the code, the used
functions (asm-arm/rtai_hal.h), are all pure C inlines. So if what you
say happens there might be a bug. You could help in fixing it by writing
a simple C code that generates random tsc readouts. The conversion can
be checked by using doublefloat.
> Then looking through the code i found it is actually using rdtsc() fuctions which in turn return cpu ticks.
> So it will be useful for me if I get this ticks directly.
> I can use "rt_get_time_cpuid" or "rt_get_time".
> I have some doubts :
> (1) First what is difference between these two function . It seems they both implements same functionality.
There should be no difference as RTAI ARM is single processor only (AFAIK).
> (2) What is default value if my processor does not have different modes - oneshot & peroidic.
You processor has both mode (AFAIK). It should not be a processor but an
> Or simply can I use any of this function safelty in my case for geting cpu ticks directly (means no calculations in between)?
> Question 2:
> If I implement a program inside rtai like one below; what are things I have to take care of.
> RTIME rt_get_cpu_ticks(void)
> return rdtsc();
Better use rtai_rdtsc() nowadays. If it is in kernel space nothing. In
user space you should check and see if the related inline is available
WARNING: I do not know much of ARM I've just spoken because you are
referring to a feature that should be the same everywhere in RTAI.
> Thanks and regards,
> Rtai mailing list
> Rtai at rtai.org
More information about the Rtai