Timer Management
[Nut/OS API]
Collaboration diagram for Timer Management:
|
Detailed Description
Asynchronous timer support.The timer management provides functions to start and stop asynchronous timers, determine the CPU speed and let a thread give up the CPU for a specified time period.
Functions | |
| u_long | NutTimerMillisToTicks (u_long ms) |
| Create an asynchronous timer. | |
| HANDLE | NutTimerStart (u_long ms, void(*callback)(HANDLE, void *), void *arg, u_char flags) |
| HANDLE | NutTimerStartTicks (u_long ticks, void(*callback)(HANDLE, void *), void *arg, u_char flags) |
| void | NutSleep (u_long ms) |
| Temporarily suspends the current thread. | |
| void | NutTimerStopAsync (HANDLE handle) |
| Asynchronously stop a specified timer. | |
| void | NutTimerStop (HANDLE handle) |
| Stop a specified timer. | |
| u_long | NutGetCpuClock (void) |
| Return the CPU clock in Hertz. | |
| u_long | NutGetTickCount (void) |
| Return the number of timer ticks. | |
| u_long | NutGetSeconds (void) |
| Return the seconds counter value. | |
| u_long | NutGetMillis (void) |
| Return the milliseconds counter value. | |
Variables | |
| NUTTIMERINFO *volatile | nutTimerList |
| Linked list of all system timers. | |
| NUTTIMERINFO *volatile | nutTimerPool |
| volatile u_char | ms62_5 |
| System tick counter. | |
Function Documentation
|
|
Return the CPU clock in Hertz.
|
|
|
Return the milliseconds counter value. This function returns the value of a counter, which is incremented every system timer tick. During system start, the counter is cleared to zero and will overflow roughly after 49.7 days. The resolution is depends on system ticks.
|
|
|
Return the seconds counter value. This function returns the value of a counter, which is incremented every second. During system start, the counter is cleared to zero.
|
|
|
Return the number of timer ticks. This function returns the TickCount since the system was started. It is limited to the resolution of the system timer.
|
|
|
Temporarily suspends the current thread. Causes the current thread to wait for a specified interval or, if the specified interval is zero, to give up the CPU for another thread with higher or same priority. This function may switch to another application thread, that got the same or a higher priority and is ready to run.
|
|
|
Create an asynchronous timer. The function returns immediately, while the timer runs asynchronously in the background. The timer counts for a specified number of milliseconds, then calls the callback routine with a given argument. The callback function is executed in interrupt context at a very high priority. It can call only a limited set of functions and must return as soon as possible.
|
|
|
Stop a specified timer. Only periodic timers need to be stopped. One-shot timers are automatically stopped by the timer management after ther first timer interval. Anyway, long running one-shot timers may be stopped to release the occupied memory.
|
|
|
Asynchronously stop a specified timer. Stops one-shot and periodic timers.
|
Variable Documentation
|
|
System tick counter. For the time being we put this here to ensure that it will be placed in lower RAM. This is essential for the AVR platform, where we use this counter to determine the system clock and calculate the correct baudrate factors. If this counter would be placed in external RAM, additional wait states may apply. |
|
|
This pool is used to collect released memory from elapsed timers. It's required because we can't free memory in interrupt context. |