![]() |
In periodic mode, the hardware timer ticks periodically without any external programming (aside of the initial one which sets its period).
If the underlying timer source is aperiodic, we need to reprogram the next shot after each tick at hardware level, and we do not need any periodic source.
Depending on the above mode, the timer object stores time values either as count of periodic ticks, or as count of CPU ticks.
Files | |
file | timer.c |
| |
Functions | |
static void | xntimer_do_tick_aperiodic (void) |
Process a timer tick in aperiodic mode. | |
void | xntimer_init (xntimer_t *timer, void(*handler)(xntimer_t *timer)) |
Initialize a timer object. | |
void | xntimer_destroy (xntimer_t *timer) |
Release a timer object. | |
xnticks_t | xntimer_get_date (xntimer_t *timer) |
Return the absolute expiration date. | |
xnticks_t | xntimer_get_timeout (xntimer_t *timer) |
Return the relative expiration date. | |
xnticks_t | xntimer_get_interval (xntimer_t *timer) |
Return the timer interval value. | |
void | xntimer_freeze (void) |
Freeze all timers. |
void xntimer_destroy | ( | xntimer_t * | timer | ) |
Release a timer object.
Destroys a timer. After it has been destroyed, all resources associated with the timer have been released. The timer is automatically deactivated before deletion if active on entry.
timer | The address of a valid timer descriptor. |
This service can be called from:
Rescheduling: never.
void xntimer_do_tick_aperiodic | ( | void | ) | [static] |
Process a timer tick in aperiodic mode.
For internal use only.
This routine informs all active timers that the clock has been updated by processing the outstanding timer list. Elapsed timer actions will be fired.
Environments:
This service can be called from:
Rescheduling: never.
void xntimer_freeze | ( | void | ) |
Freeze all timers.
For internal use only.
This routine deactivates all active timers atomically.
Environments:
This service can be called from:
Rescheduling: never.
xnticks_t xntimer_get_date | ( | xntimer_t * | timer | ) |
Return the absolute expiration date.
Return the next expiration date of a timer in absolute clock ticks (see note).
timer | The address of a valid timer descriptor. |
This service can be called from:
Rescheduling: never.
xnticks_t xntimer_get_interval | ( | xntimer_t * | timer | ) |
Return the timer interval value.
Return the timer interval value in clock ticks (see note).
timer | The address of a valid timer descriptor. |
This service can be called from:
Rescheduling: never.
xnticks_t xntimer_get_timeout | ( | xntimer_t * | timer | ) |
Return the relative expiration date.
Return the next expiration date of a timer in relative clock ticks (see note).
timer | The address of a valid timer descriptor. |
This service can be called from:
Rescheduling: never.
void xntimer_init | ( | xntimer_t * | timer, | |
void(*)(xntimer_t *timer) | handler | |||
) |
Initialize a timer object.
Creates a timer. When created, a timer is left disarmed; it must be started using xntimer_start() in order to be activated.
timer | The address of a timer descriptor the nucleus will use to store the object-specific data. This descriptor must always be valid while the object is active therefore it must be allocated in permanent memory. | |
handler | The routine to call upon expiration of the timer. |
Environments:
This service can be called from:
Rescheduling: never.