2009-02-06 04:44:39 10 msec interrupt generation using "add_timer" function
Rajesh R (INDIA)
Message: 68982
Hi
I need a interrupt or function call periodically for every 10 msec.
i am using following code for timer config, what is the expiry value i sould give so that i can get a 10 msec periodic function call
struct timer_list timer1_config;
init_timer(&timer1_config);
timer1_config.data = timer_data;
timer1_config.expires = timer_expires; // how much amount i have to give to get a 10 msec periodic function call
timer1_config.function = increment_timer_expired_flag;
Thanks in advance
Regards
R Rajesh
QuoteReplyEditDelete
2009-02-06 05:10:47 Re: 10 msec interrupt generation using "add_timer" function
Michael Hennerich (GERMANY)
Message: 68983
Take a look here:
http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:timers
First of all I would use setup_timer() and mod_timer() functions.
timers use jiffies!
> how much amount i have to give to get a 10 msec periodic function call?
use msecs_to_jiffies(10) ...
mod_timer(&timer1_config, jiffies + msecs_to_jiffies(10));
-Michael
QuoteReplyEditDelete
2009-02-06 06:13:28 Re: 10 msec interrupt generation using "add_timer" function
Rajesh R (INDIA)
Message: 68986
Hi Michael
Thank you so much for your inputs...I will look into the document which you have given the link
I have one doubt...Whether this timing will be realted to system clock(I am using BF-561)...Or related to linux OS
Regards
R Rajesh
QuoteReplyEditDelete
2009-02-06 06:35:24 Re: 10 msec interrupt generation using "add_timer" function
Michael Hennerich (GERMANY)
Message: 68988
Jiffies (linux kernel ticks) are derived form CORE Clock (Core timer), this has nothing todo with the RTC.
-Michael
QuoteReplyEditDelete
2009-02-06 08:54:25 Re: 10 msec interrupt generation using "add_timer" function
Rajesh R (INDIA)
Message: 68992
Thank you so much Michale...
This count which will be incremented with in this function will be taken as 10 mSec count and this will be used to calculate the PTS value of the Audio.
I hope the value will be incremented every 10 mSec perfectly...
QuoteReplyEditDelete
2009-02-06 13:22:10 Re: 10 msec interrupt generation using "add_timer" function
Robin Getz (UNITED STATES)
Message: 69001
Rajesh:
There is no such thing as a "perfect" timer.
Maybe you could describe what you are trying to do - and we could tell you how to do it - rather than asking how a function that isn't going to meet your needs works.
-Robin
QuoteReplyEditDelete
2009-02-09 02:58:23 Re: 10 msec interrupt generation using "add_timer" function
Rajesh R (INDIA)
Message: 69060
Hi Robin,
I am going to implement the audio sync module using the PTS value for streaming application...
The actual PTS value will be send along with the stream...the demuxer will extract the PTS value from strream and put that in one buffer. While decoding the audio frames I will update the PTS value from buffer to one structure which will have current audio frames PTS value and the decoded buffer pointer value.
To implement the audio sync module we should have one global timer and that timer can be used to calculate the PTS value at the system level...
While starting the play back of audio I will update the global timer with the starting audio frame PTS value...
In the audio sync thread, the PTS value from the Global timer is compared with the PTS value at the structure, if the current audio frame is valid then that will be presented to the user....
To implement the global timer ony I am going to try using "add_timer" function to generate 10msec interrupt.
Please guide whether this will workout....
Regards,
Rajesh