Timer services.
[Xenomai nucleus.]


Detailed Description

The Xenomai timer facility behaves slightly differently depending on the underlying system timer mode, i.e. periodic or aperiodic.

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.


Function Documentation

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.

Parameters:
timer The address of a valid timer descriptor.
Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task

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:

  • Interrupt service routine, nklock locked, interrupts off

Rescheduling: never.

Note:
Only active timers are inserted into the timer wheel.

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:

  • Interrupt service routine, nklock unlocked

Rescheduling: never.

Note:
Always make sure the nklock is free when stopping the underlying timing source by calling xnarch_stop_timer(), otherwise, deadlock situations would arise on some architectures.

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).

Parameters:
timer The address of a valid timer descriptor.
Returns:
The expiration date converted to the current time unit. The special value XN_INFINITE is returned if timer is currently inactive.
Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task

Rescheduling: never.

Note:
This service is sensitive to the current operation mode of the system timer, as defined by the xnpod_start_timer() service. In periodic mode, clock ticks are expressed as periodic jiffies. In oneshot mode, clock ticks are expressed as nanoseconds.

xnticks_t xntimer_get_interval xntimer_t *  timer  ) 
 

Return the timer interval value.

Return the timer interval value in clock ticks (see note).

Parameters:
timer The address of a valid timer descriptor.
Returns:
The expiration date converted to the current time unit. The special value XN_INFINITE is returned if timer is currently inactive or aperiodic.
Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task

Rescheduling: never.

Note:
This service is sensitive to the current operation mode of the system timer, as defined by the xnpod_start_timer() service. In periodic mode, clock ticks are expressed as periodic jiffies. In oneshot mode, clock ticks are expressed as nanoseconds.

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).

Parameters:
timer The address of a valid timer descriptor.
Returns:
The expiration date converted to the current time unit. The special value XN_INFINITE is returned if timer is currently inactive. In oneshot mode, it might happen that the timer has already expired when this service is run (even if the associated handler has not been fired yet); in such a case, 1 is returned.
Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task

Rescheduling: never.

Note:
This service is sensitive to the current operation mode of the system timer, as defined by the xnpod_start_timer() service. In periodic mode, clock ticks are expressed as periodic jiffies. In oneshot mode, clock ticks are expressed as nanoseconds.

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.

Parameters:
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.
There is no limitation on the number of timers which can be created/active concurrently.

Environments:

This service can be called from:

  • Kernel module initialization/cleanup code
  • Interrupt service routine
  • Kernel-based task
  • User-space task

Rescheduling: never.


Generated on Mon Dec 25 13:57:10 2006 for Xenomai API by  doxygen 1.4.6