There is also software timer facility available at kernel level such
that varying frequency could be provided not only at hardware level but
also based upon requirement of individual application.
Lets assume that user is playing some high end graphic game. In such case, heavy data transfer and processing rate is needed to display all graphical contents, which make system work at high clock rate. On the contrary, if user is trying to use some simple calculation using calculator, not enough clock rate is needed.
To get varying frequency requirements of application, every individual task of application have its own soft-timer facility, which have soft timers (loaded with count value as per individual task requirement).
The soft-timer facility constitute two parts: one component lives within the timer tick ISR (ISR_function) and the other component stays in task context (called worker_task).
Assume that an application requires four soft timers.
Lets assume that user is playing some high end graphic game. In such case, heavy data transfer and processing rate is needed to display all graphical contents, which make system work at high clock rate. On the contrary, if user is trying to use some simple calculation using calculator, not enough clock rate is needed.
To get varying frequency requirements of application, every individual task of application have its own soft-timer facility, which have soft timers (loaded with count value as per individual task requirement).
The soft-timer facility constitute two parts: one component lives within the timer tick ISR (ISR_function) and the other component stays in task context (called worker_task).
Assume that an application requires four soft timers.
- The timeout values equal 50us, 100us, 150us and 200us for which the least common denominator is 50us.
- If each hardware timer tick is 10us, then 50us translates into a count value of 5.
- The ISR_function keeps track of this count value and decrements it by one during each invocation.
- The ISR_function informs the worker_task regarding completion of count value to zero by setting the worker_task's semaphore, effectively allowing the task to be scheduled for execution.
- The ISR_function again initializes the count value back to 5.
- Worker_task must maintain an application-level, timer count table based on 50us granularity.
- Here, the timer table has four countdown values: 1, 2, 3, and 4 representing the 50us, 100us, 150us and 200us application-requested timers.
- Timer-expiration function is associated with each timer during application installation.
- When the counter value reaches zero, the application timer has expired and application function runs.
- Every time the worker_task runs, all the counters value is decremented by 1
- A single ISR-level timer drives 4 application timers at the task-level, providing a good reason why these timers are called soft timers (processing is not synchronized with the hardware timer tick).
No comments:
Post a Comment