[Rtai] Regarding Timer Functions

Jacob Philip jacob.philip at carc.co.in
Fri Dec 4 05:12:46 CET 2009


Hello Torsten,

I am using old versions rtai-3.2 and linux 2.4.32(montavista).
And bug is not directly in ixp23xx code. It was in rtai_llimd(base/include/asm-arm/rtai_hal.h).
Due to overflow when multiplying 64 bit value with 100000000,rt_get_cpu_time_ns was giving wrong values.

I can see this bug is fixed in latest rtai code by storing result in 96 bits.

regards,
Jacob
________________________________________
From: Torsten Koschorrek [devel at koschorrek.com]
Sent: 02 December 2009 12:10
To: Jacob Philip
Cc: Paolo Mantegazza; rtai at rtai.org
Subject: Re: [Rtai] Regarding Timer Functions

Hello,

Jacob Philip wrote:
> Hello Paolo,
>
> 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 .
>

I'm curious. Which RTAI and Linux versions are you using? Because we
don't have support for ixp23xx at least in rtai-versions since rtai-3.2.

(If there are bugs (referring to paolos comment) I want to know them and
get them fixed in the end, although it's working for you now.)


> Thanks and regards,
> Jacob

Torsten


> ________________________________________
> 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
> RTAI feature.
>
>> 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
> there.
>
> 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.
>
> paolo
>
>> Thanks and regards,
>> Jacob
>> _______________________________________________
>> Rtai mailing list
>> Rtai at rtai.org
>> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>>
> _______________________________________________
> Rtai mailing list
> Rtai at rtai.org
> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>


More information about the Rtai mailing list