Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

AT91 System Timer
[System Support]

Collaboration diagram for AT91 System Timer:


Detailed Description

Nut/OS System Timer implemented on the AT91.


Defines

#define NutEnableTimerIrq()   NutEnterCritical()
#define NutDisableTimerIrq()   NutExitCritical()
#define NUT_TICK_FREQ   1000UL

Functions

void NutDelay (u_char ms)
 Loop for a specified number of milliseconds.
void NutRegisterTimer (void(*handler)(void *))
 Initialize system timer hardware.
u_long NutGetCpuClock (void)
 Return the CPU clock in Hertz.
u_long NutGetTickClock (void)
 Return the number of system ticks per second.
u_long NutTimerMillisToTicks (u_long ms)
 Calculate system ticks for a given number of milliseconds.


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.

Bug:
This function is a miserable hack.
Parameters:
ms Delay time in milliseconds, maximum is 255.

void NutRegisterTimer void(*)(void *)  handler  ) 
 

Initialize system timer hardware.

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.

u_long NutGetCpuClock void   ) 
 

Return the CPU clock in Hertz.

On several AT91 CPUs the processor clock may differ from the clock driving the peripherals. In this case At91GetMasterClock() will provide the correct master clock.

Returns:
CPU clock frequency in Hertz.
Examples:
timers/timers.c.

u_long NutGetTickClock void   ) 
 

Return the number of system ticks per second.

Returns:
System tick frequency in Hertz.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/