Golem  v0.1.1
Generic Operating system Libraries for Embedded Multitasking
 All Data Structures Files Functions Variables Pages
/home/ruud/Engineering/software/projects/golem-project-code/trunk/glm_alarm.h File Reference

Provides functionality to set alarms. More...

#include <stdbool.h>
#include "glm_intbase.h"
#include "glm_signal.h"

Go to the source code of this file.

Functions

bool alarm_init ()
 Initialize the alarm functionality. More...
 
void alarm_reset ()
 Resets the alarm functionality.
 
char * alarm_name ()
 Obtain the name of the alarm software component. More...
 
bool alarm_set (uint_base_t a_time, signal_t a_signal)
 Register a new alarm that will emit the given signal when due. More...
 
bool alarm_set_cb (uint_base_t a_time, p_callback_func_t a_func)
 Register a new alarm that will call the given function when due. More...
 
void alarm_check_due ()
 Checks which alarms are due and lets them go off.
 

Detailed Description

Provides functionality to set alarms.

Author
Ruud Beukema

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Definition in file glm_alarm.h.

Function Documentation

bool alarm_init ( )

Initialize the alarm functionality.

Returns
TRUE if initialization was successful or FALSE if not.

Definition at line 59 of file glm_alarm.c.

char* alarm_name ( )

Obtain the name of the alarm software component.

Returns
Pointer to the alarm software component name.

Definition at line 88 of file glm_alarm.c.

bool alarm_set ( uint_base_t  a_time,
signal_t  a_signal 
)

Register a new alarm that will emit the given signal when due.

The delay is given in ticks, where one tick equals 1/CORE_TICK_FREQ_HZ seconds.

Parameters
a_timeTime to wait before emitting the signal in ticks.
a_signalThe signal to emit when the alarm is due.
Returns
TRUE if alarm is set or FALSE in case of failure.

Definition at line 95 of file glm_alarm.c.

bool alarm_set_cb ( uint_base_t  a_time,
p_callback_func_t  a_func 
)

Register a new alarm that will call the given function when due.

The callback function should take no arguments and return nothing.

Note that the callback function should perform very little executions (e.g. just set or clear a flag) since its execution time, together with other alarms that may be due in the same alarm_check_due()-call, may result in crossing the scheduler's slot boundary and thus potentially screwing up the scheduling of the multitasking system!

Parameters
a_timeTime from now in 1/CORE_TICK_FREQ_HZ seconds when alarm should go off.
a_funcThe function to call when the alarm is due.
Returns
TRUE if alarm is set or FALSE in case of failure.

Definition at line 125 of file glm_alarm.c.