]> rtime.felk.cvut.cz Git - arc.git/blob - system/kernel/include/alarm_i.h
19045ee53fe6dc65c8398a5762f68042f4b5e10b
[arc.git] / system / kernel / include / alarm_i.h
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
6  * This source code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published by the
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15
16 #ifndef ALARM_I_H_\r
17 #define ALARM_I_H_\r
18 \r
19 #include "counter_i.h"\r
20
21 /* STD container : OsAlarmSetEvent
22  * OsAlarmSetEventRef:                  1
23  * OsAlarmSetEventTaskRef:              1
24  * */
25
26 /* STD container : OsAlarmActivateTask
27  * OsAlarmActivateTaskRef:              1
28  * */
29
30 /* STD container : OsAlarmCallback
31  * OsAlarmCallbackName:                 1    Function Ptr
32  * */
33
34 /* STD container : OsAlarmIncrementCounter
35  * OsAlarmIncrementCounterRef:  1    Ref to counter
36  * */
37
38 \r
39 struct OsCounter;\r
40 \r
41 typedef enum alarm_action_type_e {\r
42         ALARM_ACTION_ACTIVATETASK=0,\r
43         ALARM_ACTION_SETEVENT,\r
44         ALARM_ACTION_ALARMCALLBACK,             /* Only class 1 */\r
45         ALARM_ACTION_INCREMENTCOUNTER, /* SWS OS302 */\r
46 } alarm_action_type_t;\r
47 \r
48
49 /* STD container : OsAlarmAction
50  * OsAlarmActivateTask:                 0..1
51  * OsAlarmCallback:                             0..1
52  * OsAlarmIncrementCounter:             0..1
53  * OsAlarmSetEvent:                             0..1
54  * */\r
55 typedef struct OsAlarmAction {\r
56         alarm_action_type_t type;\r
57         TaskType                        task_id;\r
58         EventMaskType           event_id;\r
59         CounterType             counter_id;\r
60 } OsAlarmActionType;\r
61
62
63 enum OsAlarmAutostartTypeType {
64         // Start with SetAbsAlarm()
65         ALARM_AUTOSTART_ABSOLUTE,
66         // Start with SetRelAlarm()
67         ALARM_AUTOSTART_RELATIVE,
68 };
69
70
71 /* STD container : OsAlarmAutostart
72  * OsAlarmAlarmTime:                    1    Int
73  * OsAlarmAutoStartType:                1    Int, ABSOLUTE, RELATIVE
74  * OsAlarmCycleTime:                    1    Int
75  * OsAlarmAppModeRef:                   1..*
76  */\r
77 typedef struct OsAlarmAutostart {
78         uint32 alarmTime;
79         enum OsAlarmAutostartTypeType autostartType;\r
80         uint32 cycleTime;\r
81         uint32 appModeRef;\r
82 } OsAlarmAutostartType;\r
83
84 /* STD container : OsAlarm
85  * OsAlarmAccessionApplication: 0..* Ref to OS application
86  * OsAlamCounterRef:            1    Ref to counter
87  * OsAlarmAction[C]             1    Action when alarm expires
88  * OsAlarmAutostart[C]          0..1 Autostart
89  */
90 typedef struct OsAlarm {\r
91         char    name[16];\r
92         /* Reference to counter */\r
93         struct OsCounter *counter;\r
94 \r
95         CounterType counter_id;\r
96         /* cycle, 0 = no cycle */\r
97         uint32 alarmtime;\r
98         uint32 cycletime;\r
99 //      uint32 appmode_mask;\r
100 \r
101         uint32 app_mask;\r
102 \r
103         /* if the alarm is active or not */\r
104         _Bool   active;\r
105         /* expire value */\r
106         uint32  expire_val;\r
107         /* Action attributes when alarm expires. */\r
108         OsAlarmActionType action;\r
109
110         /* Autostart */
111         const struct OsAlarmAutostart *autostartPtr;
112
113         /* List of alarms connected to the same counter */\r
114         SLIST_ENTRY(OsAlarm) alarm_list;\r
115
116 #if (OS_SC1 == STD_ON)
117 #warning Alarm callbacks NOT implemented
118         /* TODO: OS242, callback in scalability class 1 only..*/
119         /** @req OS242 */
120 #endif
121 \r
122 } OsAlarmType;\r
123 \r
124 #endif /*ALARM_I_H_*/\r