cyg_alarm_create
Name: cyg_alarm_create ( ) - create an alarm
Synopsis:
void cyg_alarm_create
(
  cyg_handle_t   counter,  /* counter to attach to alarm      */
  cyg_alarm_t    *alarmfn, /* alarm call back function        */
  cyg_addrword_t data,     /* data to be passed to callback   */
  cyg_handle_t   *handle,  /* returned handle to alarm object */
  cyg_alarm      *alarm    /* alarm object                    */
)
Description: This creates a new alarm. Alarms are periodic events, generally tied to the system counter. The period is defined when cyg_alarm_initialize is called.

When the alarm expires "*alarmfn" is called with "data" as an argument. Alarms can be setup to be recurring or to execute only once.

The callback "alarmfn" is of the form: void cyg_alarm_fn(Cyg_Alarm *alarm, CYG_ADDRWORD data).

The newly created alarm is written to "*handle".

Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_alarm_delete, cyg_alarm_initialize, cyg_alarm_get_times, cyg_alarm_enable, cyg_alarm_disable

cyg_alarm_delete
Name: cyg_alarm_delete ( ) - delete alarm
Synopsis:
void cyg_alarm_delete
(
  cyg_handle_t alarm /* alarm to delete */
)
Description: This function deletes an alarm from the system and invalidates the handle to the alarm. The alarm cannot be used once it is deleted.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_alarm_create, cyg_alarm_disable

cyg_alarm_initialize
Name: cyg_alarm_initialize ( ) - initialize (start) an alarm
Synopsis:
void cyg_alarm_initialize
(
  cyg_handle_t     alarm,   /* handle of alarm to initialize */
  cyg_tick_count_t trigger, /* absolute trigger time         */
  cyg_tick_count_t interval /* re-trigger interval           */
)
Description: This initializes an alarm to trigger at the absolute time of "trigger". The trigger time is an absolute time. You can get the current trigger time of a clock by calling cyg_counter_current_value on the counter.

If the alarm is to be triggered at a regular interval, "interval" can be set to a non 0 value.

When the trigger fires the alarm function associated with the alarm will be called.

Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_alarm_initialize, cyg_alarm_get_times, cyg_alarm_enable, cyg_alarm_disable

cyg_alarm_get_times
Name: cyg_alarm_get_times ( ) - get alarm times
Synopsis:
void cyg_alarm_get_times
(
  cyg_handle_t     alarm,    /* alarm to get the times of   */
  cyg_tick_count_t *trigger, /* next trigger time           */
  cyg_tick_count_t *interval /* current re-trigger interval */
)
Description: This function will return the next absolute trigger time for the alarm and its re-trigger interval. If either of the parameters are not needed, you can safely pass NULL instead of an actual pointer.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing.
See Also: cyg_alarm_initialize, cyg_alarm_enable, cyg_alarm_disable

cyg_alarm_enable
Name: cyg_alarm_enable ( ) - re-enable an alarm
Synopsis:
void cyg_alarm_enable
(
  cyg_handle_t alarm /* alarm to re-enable */
)
Description: This re-enables an alarm that has previously been disabled by a call to cyg_alarm_disable. This is most often used with a periodic alarm.

A periodic alarm that has been disabled and later re-enabled will fire at the same intervals it did previously. For example, a periodic alarm that fired every 10 seconds at time T0, T10, T20, T30... etc that was disabled for 15 seconds at time T31 and then re-enabled would then start firing again at T50, T60, T70 etc.

You can call cyg_alarm_initialize if you want to reset the periodic interval.

Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_alarm_initialize, cyg_alarm_get_times, cyg_alarm_disable

cyg_alarm_disable
Name: cyg_alarm_disable ( ) - disable an alarm
Synopsis:
void cyg_alarm_disable
(
  cyg_handle_t alarm /* alarm to disable */
)
Description: This disables an alarm. This is most often used with a periodic alarm.
Include: #include <cyg/kernel/kapi.h>
Returns: nothing
See Also: cyg_alarm_initialize, cyg_alarm_get_times, cyg_alarm_enable