Functions | |
NutTimerThread (void *arg) | |
System timer thread. More... | |
HANDLE | NutTimerStart (u_long ms, void(*callback)(HANDLE, void *), void *arg, u_char flags) |
Create an asynchronous timer. More... | |
void | NutSleep (u_long ms) |
Temporarily suspends the current thread. More... | |
void | NutTimerStop (HANDLE handle) |
Stop a specified timer. More... | |
void | NutDelay (u_char ms) |
Loop for a specified number of milliseconds. More... | |
u_long | NutGetCpuClock (void) |
Return the CPU clock in Hertz. More... | |
void | NutTimerInit (void) |
Initialize system timer. More... | |
Variables | |
NUTTIMERINFO* volatile | nutTimerList |
Linked list of timers. |
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.
|
Loop for a specified number of milliseconds.
This call will not release the CPU and will not switch to another thread. However, because of absent thread switching, this delay time is very exact. Use NutSleep() to avoid blocking the CPU, if no exact timing is needed.
|
|
Return the CPU clock in Hertz.
If called for the first time, this function determines the CPU clock by running a counter loop between two timer interrupts. Subsequent calls will return the previously calculated value.
|
|
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. Note, that the thread may sleep longer than the specified number of milliseconds, depending on the number of threads with higher or equal priority, which are ready to run. If you need more exact timing, use NutDelay().
|
|
Initialize system timer.
This function is automatically called by Nut/OS during system initialization. Nut/OS uses on-chip timer 0 for its timer services. Applications should not modify any registers of this timer, but make use of the Nut/OS timer API. Timer 1 and timer 2 are available to applications. |
|
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 from a system thread at a very high priority and must return as soon as possible and must not call any potentially blocking function.
|
|
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.
|
|
System timer thread.
Woken up periodically by timer interrupts. Tick counters of all timers are decremented by one. If a counter reaches zero, the timer callback function is called and one-shot timers are removed from the list. |