Go to the documentation of this file.
18 #include <util/atomic.h>
32 static void Alarm_handleAlarmExpiration(
AlarmType alarmID);
53 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
78 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
94 if (*tick >= currentTick) {
95 *tick = *tick - currentTick;
114 if (increment == 0 || increment >
Alarm_Cfg[alarmID]->alarmBase->maxallowedvalue) {
122 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
132 if (tick >
Alarm_Cfg[alarmID]->alarmBase->maxallowedvalue) {
165 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
194 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
213 if (counter == SYSTEM_COUNTER) {
218 bool expired =
false;
225 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
230 Alarm_handleAlarmExpiration(i);
238 bool expired =
false;
245 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
254 Alarm_handleAlarmExpiration(i);
268 static void Alarm_handleAlarmExpiration(
AlarmType alarmID)
270 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
275 switch (
Alarm_Cfg[alarmID]->actionType) {
283 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
297 ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
bool running
Whether or not the alarm is currently running.
StatusType Alarm_GetAlarmBase(AlarmType alarmID, AlarmBaseRefType info)
Get alarm base.
StatusType Alarm_SetAbsAlarm(AlarmType alarmID, TickType start, TickType cycle)
Set absolute alarm.
void Alarm_evaluateSysTickAlarm(void)
Evaluate alarm with SYSTEM_COUNTER.
@ ALARM_ACTION_COUNTER
Alarm increments counter on expiration.
enum StatusType_e StatusType
Type for status.
volatile struct counter_s AlarmBaseType
Type for alarm base.
TickType cycle
Relative value used for cyclic alarm (zero for oneshot alarm)
const CounterType counter
Counter to increment if type is ALARM_ACTION_COUNTER.
@ OSServiceId_GetAlarmBase
StatusType Alarm_GetAlarm(AlarmType alarmID, TickRefType tick)
Get alarm.
const AlarmBaseRefType alarmBase
Reference to counter used as alarm base.
const TaskType task
Task to activate if type is ALARM_ACTION_TASK or to set event for if type is ALARM_ACTION_EVENT.
uint64_t TickType
Data type of counter values.
enum alarm_e AlarmType
Type for alarm reference.
TickType expiration
Absolute expiration value.
TickType * TickRefType
Reference to counter values.
Assert macros and functions.
enum counters_e CounterType
Type for counter reference.
volatile uint32_t sysTick
Current system tick.
@ OSServiceId_SetRelAlarm
const EventMaskType event
Event to set if type is ALARM_ACTION_EVENT.
void Alarm_startup(void)
Startup function for alarm management.
StatusType Alarm_SetRelAlarm(AlarmType alarmID, TickType increment, TickType cycle)
Set relative alarm.
StatusType Events_SetEvent(TaskType TaskID, EventMaskType events)
Set events.
#define OS_SET_ERROR_INFO1(serviceId, paramPtr1, size1)
Set error info with up to one parameter.
volatile uint8_t needSysTickEval
SysTick must be evaluated during timer interrupt.
@ ALARM_ACTION_CALLBACK
Alarm calls callback on expiration.
#define assert(expression)
@ ALARM_ACTION_TASK
Alarm activates task on expiration.
StatusType Task_ActivateTask(TaskType TaskID)
Activate a task.
#define ALARM_COUNT
Count of alarm defined.
StatusType Alarm_CancelAlarm(AlarmType alarmID)
Cancel alarm.
#define OS_SET_ERROR_INFO3(serviceId, paramPtr1, size1, paramPtr2, size2, paramPtr3, size3)
Set error info with up to three parameters.
volatile struct alarm_s * Alarm_Cfg[]
Current alarm control blocks.
StatusType Counter_IncrementCounter(CounterType counterID)
Increment counter.
volatile struct counter_s * Counter_Cfg[]
Current counter control blocks.
const void * action
Untyped value to be used during configuration.
AlarmBaseType * AlarmBaseRefType
Reference for alarm base.
#define OS_SET_ERROR_INFO2(serviceId, paramPtr1, size1, paramPtr2, size2)
Set error info with up to two parameters.
@ ALARM_ACTION_EVENT
Alarm sets event on expiration.
#define OS_CALL_ERROR_HOOK(error)
Call error hook if configured.
void Alarm_evaluateAlarm(CounterType counter)
Evaluate alarms with user generated counter.