#include <applicfg.h>
#include "timer.h"
Include dependency graph for timer.c:
Go to the source code of this file.
Defines | |
#define | min_val(a, b) ((a<b)?a:b) |
Functions | |
TIMER_HANDLE | SetAlarm (CO_Data *d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period) |
TIMER_HANDLE | DelAlarm (TIMER_HANDLE handle) |
void | TimeDispatch () |
Variables | |
s_timer_entry | timers [MAX_NB_TIMER] = {{TIMER_FREE, NULL, NULL, 0, 0, 0},} |
TIMEVAL | total_sleep_time = TIMEVAL_MAX |
TIMER_HANDLE | last_timer_raw = -1 |
Definition in file timer.c.
#define min_val | ( | a, | |||
b | ) | ((a<b)?a:b) |
TIMER_HANDLE DelAlarm | ( | TIMER_HANDLE | handle | ) |
----- Use this to remove an alarm ----
handle |
Quick and dirty. system timer will continue to be trigged, but no action will be preformed.
Definition at line 112 of file timer.c.
References last_timer_raw, and timers.
Referenced by heartbeatStop(), proceedNODE_GUARD(), ProducerHearbeatAlarm(), and stopSYNC().
TIMER_HANDLE SetAlarm | ( | CO_Data * | d, | |
UNS32 | id, | |||
TimerCallback_t | callback, | |||
TIMEVAL | value, | |||
TIMEVAL | period | |||
) |
------- Use this to declare a new alarm ------
d | ||
id | ||
callback | ||
value | ||
period |
in order to decide new timer setting we have to run over all timer rows
if something to store
and empty row
just store
if successfull
set next wakeup alarm if new entry is sooner than others, or if it is alone
printf("elapsed_time=%d real_timer_value=%d total_sleep_time=%d\n", elapsed_time, real_timer_value, total_sleep_time);
printf("SetAlarm() return %d\n", row_number);
Definition at line 57 of file timer.c.
References last_timer_raw, and timers.
Referenced by heartbeatInit(), proceedNODE_GUARD(), and startSYNC().
void TimeDispatch | ( | ) |
------ TimeDispatch is called on each timer expiration ----
used to compute when should normaly occur next wakeup
First run : change timer state depending on time
Get time since timer signal
if row is active
to be trigged
if simply outdated
ask for trig
or period have expired
set val as interval, with overrun correction
Check if this new timer value is the soonest
Each armed timer value in decremented.
Check if this new timer value is the soonest
Remember how much time we should sleep.
Set timer to soonest occurence
Then trig them or not.
reset trig state (will be free if not periodic)
trig !
Definition at line 131 of file timer.c.
References last_timer_raw, min_val, timers, and total_sleep_time.
TIMER_HANDLE last_timer_raw = -1 |
s_timer_entry timers[MAX_NB_TIMER] = {{TIMER_FREE, NULL, NULL, 0, 0, 0},} |
TIMEVAL total_sleep_time = TIMEVAL_MAX |