setitimer, getitimer() in rtems?
gds at chartertn.net
Fri Sep 5 17:25:36 UTC 2008
Joel Sherrill wrote:
> Gene Smith wrote:
>> Joel Sherrill wrote:
>>> Gene Smith wrote:
>>>> Porting in some code that runs on linux, my last undefined link items
>>>> are setitimer and getitimer. I can't seem to find them in rtems (4.8.0)
>>>> except in the sys/time.h include file so it compiles. Saw some reference
>>>> to them in old mailing list threads that implied (or said?) that you
>>>> have to implement them using rtems native timer calls. Is this right?
>>> Since they use POSIX signals, you would implement them
>>> in the POSIX API (cpukit/posix) and implement them in terms
>>> of SuperCore timers.
>>> Why do you need these? And which of the three types
>>> (ITIMER_REAL, ITIMER_VIRTUAL, or ITIMER_PROF) do
>>> you want/need?
>> Why: The function is in some existing 3rd party code I need to use for
>> the project.
>> Which: Actually, the code only calls setitimer with parameter ITIMER_REAL.
> Good. That's what I expected. :-D
>> Right now I am using rtems_timer_fire_after() with a callback function
>> to do a similar thing.
> It's certainly the more direct thing to do in RTEMS. The main
> difference is that their method is being called in an ISR rather
> than as a signal handler.
FYI, in their code, the "CallBack" fn seems to become a SIGALRM handler.
Is this what you expect?:
stritimerval.it_interval.tv_sec = 0 ;
stritimerval.it_interval.tv_usec = dwTimerBase ;
stritimerval.it_value.tv_sec = 0 ;
stritimerval.it_value.tv_usec = dwTimerBase ;
gdwCurrentTimerBase = dwTimerBase;
if (setitimer(ITIMER_REAL, &stritimerval, &stritimeroval) == 0)
gdwCurrentTimerBase = 0;
> If you want these implemented, I can put together an estimate
> for you.
Thanks, I'll write to you off-list.
More information about the users