include/sys/timer.h File Reference


Detailed Description

Timer management definitions.


Defines

#define TM_ONESHOT

Typedefs

typedef _NUTTIMERINFO NUTTIMERINFO
 Timer type.

Functions

void NutTimerInit (void)
 Timer 0 interrupt entry. Initialize system 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)
u_long NutTimerMillisToTicks (u_long ms)
 Create an asynchronous timer.
void NutTimerStop (HANDLE handle)
 Stop a specified timer.
void NutTimerStopAsync (HANDLE handle)
 Asynchronously stop a specified timer.
void NutSleep (u_long ms)
 Temporarily suspends the current thread.
void NutDelay (u_char ms)
 Loop for a specified number of milliseconds.
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

Function Documentation

void NutDelay u_char  ms  ) 
 

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.

Parameters:
ms Delay time in milliseconds, maximum is 255.

void NutTimerInit void   ) 
 

Timer 0 interrupt entry. 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.