Defines | |
#define | NUT_TICK_FREQ 1000UL |
System timer interrupt frequency. | |
Functions | |
void | NutRegisterTimer (void(*handler)(void *)) |
Initialize system timer. | |
uint32_t | NutArchClockGet (int idx) |
Return the specified clock frequency. | |
uint32_t | NutGetTickClock (void) |
Return the number of system ticks per second. | |
uint32_t | NutTimerMillisToTicks (uint32_t ms) |
Calculate system ticks for a given number of milliseconds. |
#define NUT_TICK_FREQ 1000UL |
System timer interrupt frequency.
Specifies the number of interrupts per second, typically 1000. In order to reduce overhead, you may choose lower values. Note, that Nut/OS API timer values are given in milliseconds. Thus, lower values will reduce the available resolution, while larger values may not provide any benefit.
Referenced by NutGetTickClock().
void NutRegisterTimer | ( | void(*)(void *) | handler | ) |
Initialize system timer.
Applications must not call this function.
It is automatically called by Nut/OS during initialization to register the system timer interrupt handler. It is an essential part of the hardware dependant code and must be available for any platform that is running Nut/OS.
The number of system timer interrupts is define by NUT_TICK_FREQ.
Timer interrupts are enabled when this function returns.
handler | This routine should be called each time, when a system timer interrupt occurs. |
uint32_t NutArchClockGet | ( | int | idx | ) |
Return the specified clock frequency.
Return the CPU clock in Hertz.
Applications must not call this function, but use NutClockGet() instead.
Simple implementations may not provide this function, in which case NUT_CPU_FREQ must define the CPU frequency in Hertz. This can be done in the Configurator.
idx | This zero based index specifies the clock to retrieve. The number of available hardware clocks depends on the target harware and is specified by NUT_HWCLK_MAX + 1. Typically NUT_HWCLK_CPU is used to retrieve the current CPU clock. Additional indices may be available to retrieve one or more peripheral clocks or a special slow clock. |
uint32_t NutGetTickClock | ( | void | ) |
Return the number of system ticks per second.
This routine is used by Nut/OS to convert tick counts into milliseconds.
Applications typically do not deal with system ticks. Instead, they use milliseconds to specify timeouts or call NutGetMillis() and NutGetSeconds() to retrieve an elapsed time.
References NUT_TICK_FREQ.
Calculate system ticks for a given number of milliseconds.
This routine is used by Nut/OS to retrieve the number of system ticks for a given timeout.
ms | Number of milliseconds. |
References NutGetTickClock().