]> rtime.felk.cvut.cz Git - arc.git/blob - system/kernel/include/alarm_i.h
Merged in from default
[arc.git] / system / kernel / include / alarm_i.h
1 /* -------------------------------- Arctic Core ------------------------------\r
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
3  *\r
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
5  *\r
6  * This source code is free software; you can redistribute it and/or modify it\r
7  * under the terms of the GNU General Public License version 2 as published by the\r
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
9  *\r
10  * This program is distributed in the hope that it will be useful, but\r
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
13  * for more details.\r
14  * -------------------------------- Arctic Core ------------------------------*/\r
15 \r
16 #ifndef ALARM_I_H_\r
17 #define ALARM_I_H_\r
18 \r
19 #include "counter_i.h"\r
20 \r
21 /* STD container : OsAlarmSetEvent\r
22  * OsAlarmSetEventRef:                  1\r
23  * OsAlarmSetEventTaskRef:              1\r
24  * */\r
25 \r
26 /* STD container : OsAlarmActivateTask\r
27  * OsAlarmActivateTaskRef:              1\r
28  * */\r
29 \r
30 /* STD container : OsAlarmCallback\r
31  * OsAlarmCallbackName:                 1    Function Ptr\r
32  * */\r
33 \r
34 /* STD container : OsAlarmIncrementCounter\r
35  * OsAlarmIncrementCounterRef:  1    Ref to counter\r
36  * */\r
37 \r
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 \r
49 /* STD container : OsAlarmAction\r
50  * OsAlarmActivateTask:                 0..1\r
51  * OsAlarmCallback:                             0..1\r
52  * OsAlarmIncrementCounter:             0..1\r
53  * OsAlarmSetEvent:                             0..1\r
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 \r
62 \r
63 enum OsAlarmAutostartTypeType {\r
64         // Start with SetAbsAlarm()\r
65         ALARM_AUTOSTART_ABSOLUTE,\r
66         // Start with SetRelAlarm()\r
67         ALARM_AUTOSTART_RELATIVE\r
68 };\r
69 \r
70 \r
71 /* STD container : OsAlarmAutostart\r
72  * OsAlarmAlarmTime:                    1    Int\r
73  * OsAlarmAutoStartType:                1    Int, ABSOLUTE, RELATIVE\r
74  * OsAlarmCycleTime:                    1    Int\r
75  * OsAlarmAppModeRef:                   1..*\r
76  */\r
77 typedef struct OsAlarmAutostart {\r
78         uint32 alarmTime;\r
79         enum OsAlarmAutostartTypeType autostartType;\r
80         uint32 cycleTime;\r
81         AppModeType appModeRef;\r
82 } OsAlarmAutostartType;\r
83 \r
84 /* STD container : OsAlarm\r
85  * OsAlarmAccessionApplication: 0..* Ref to OS application\r
86  * OsAlamCounterRef:            1    Ref to counter\r
87  * OsAlarmAction[C]             1    Action when alarm expires\r
88  * OsAlarmAutostart[C]          0..1 Autostart\r
89  */\r
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 \r
110         /* Autostart */\r
111         const struct OsAlarmAutostart *autostartPtr;\r
112 \r
113         /* List of alarms connected to the same counter */\r
114         SLIST_ENTRY(OsAlarm) alarm_list;\r
115 \r
116 #if (OS_SC1 == STD_ON)\r
117         /* TODO: OS242, callback in scalability class 1 only..*/\r
118         /** Missing req OS242 */\r
119 #endif\r
120 \r
121 } OsAlarmType;\r
122 \r
123 \r
124 void Os_AlarmCheck(OsCounterType *c_p);\r
125 void Os_AlarmAutostart(void);\r
126 \r
127 #endif /*ALARM_I_H_*/\r