gettimeofday_rt available? NEW version
Paolo Mantegazza
mantegazza at aero.polimi.it
Wed Jun 14 08:46:40 CEST 2006
Rodrigo Amestica wrote:
> Hi Gustavo,
>
> i'm using rtai-3.3 and in the source code I found that rt_gettimeorig do
> something like this:
>
> void rt_gettimeorig(RTIME time_orig[])
> {
> ...
> rtai_save_flags_and_cli(flags);
> do_gettimeofday(&tv);
> ...
> }
>
> It is my impression that this is not right! Unless
> rtai_save_flags_and_cli is doing some magic I'm not aware of then I
> would insist that this is not right.
>
> If for some reason the rtai context from where you are calling
> rt_gettimeorig has preempted a linux context from where do_settimeofday
> was called, or any other instance that it has locked xtime_lock for
> _writing_, then do_gettimeofday from rt_gettimeorig should while-loop
> for ever, hanging your machine.
>
> It is my experience that this hanging _do_ happen on up and smp
> architectures (always i386 in my case) at some point. Higher the
> frequency at which I call do_gettimeofday from rtai more probable is the
> hanging.
>
> Please, let me know whether you think there is something wrong in my
> argument or not.
>
This has been discussed recently on this list. Rt_gettimeorig must not
be called from a hard real time RTAI task but from an RTAI enabled Linux
one. It will provide an aligned the timeofday aligned with the running
time RTAI uses. Since the latter can be referred to in hard real time
and its absolute time origin is known a user can safely reconstruct the
absolute time while running in hard real time mode.
Following the discussion on this list there has been a helper set of
functions posted here recently.
Paolo.
More information about the Rtai
mailing list