]> rtime.felk.cvut.cz Git - arc.git/blob - include/EcuM.h
Merge with ea5761ca133c5fd7c2c76e43d4644ec656889437
[arc.git] / include / EcuM.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 /** @addtogroup EcuM ECU State Manager\r
17  *  @{ */\r
18 \r
19 /** @file EcuM.h\r
20  * API and type definitions for ECU State Manager.\r
21  */\r
22 \r
23 /*\r
24  * Include structure:\r
25  *\r
26  *\r
27  *\r
28  *   Rte_Type.h -->  Std_Types.h\r
29  *       ^              ^\r
30  *       |              |\r
31  *   Rte_EcuM.h <--  EcuM_Types.h*\r
32  *       ^              ^\r
33  *       |              |     /-----> EcuM_Cfg.h\r
34  *       |              |    /------> EcuM_Generated_Types.h\r
35  *       |              |   /         (Holds EcuM_ConfigType and includes all BSW modules )\r
36  *       |              |  /-------> EcuM_Cbk.h\r
37  *       |              | /           (want types EcuM_WakeupSourceType, EcuM_ConfigType *, EcuM_WakeupSourceType , EcuM_WakeupReactionType )\r
38  *       |              |/\r
39  *       |            EcuM.h  <----- EcuM_Callout_Stubs.c\r
40  *       |              ^       \--- EcuM_PBCfg.c\r
41  *       |              |\r
42  *       |              |\r
43  *       `---------- EcuM_xxx.c ---> Memmap.h\r
44  *                               \-> Det.h, Dem.h\r
45  *\r
46  * *) Only if (ECUM_USE_SERVICE_PORTS == STD_ON)\r
47  *\r
48  * Problems:\r
49  * - Can_Cfg.h can include just "EcuM_Cbk.h"...\r
50  *   .. it will need at EcuM.h.. problem is that EcuM.h includes EcuM_Cbk.h\r
51  * - Most BSW modules uses DEM that in Dem_Types.h will include "Rte_Type.h"\r
52  *   (if enabled by CFG_DEM_USE_RTE)\r
53  *\r
54  * - EcuM_Generated_Types.h is quite crappy since it includes the\r
55  *\r
56  * Changes:\r
57  *   - EcuM_Cfg.h , must not include ANY include files.\r
58  *   - EcuM_Pbcfg.c must include "EcuM_Generated_Types.h"\r
59  *   - EcuM.c, etc must include "EcuM_Generated_Types.h"\r
60  *   --> The GOOD, we keep circular include from EcuM_Generated_Types.h\r
61  *\r
62  *\r
63  *\r
64  */\r
65 \r
66 \r
67 #ifndef ECUM_H_\r
68 #define ECUM_H_\r
69 \r
70 #include "Modules.h"\r
71 \r
72 #define ECUM_MODULE_ID                  MODULE_ID_ECUM\r
73 #define ECUM_VENDOR_ID                  1\r
74 \r
75 #define ECUM_SW_MAJOR_VERSION   2\r
76 #define ECUM_SW_MINOR_VERSION   0\r
77 #define ECUM_SW_PATCH_VERSION   0\r
78 \r
79 #define ECUM_AR_MAJOR_VERSION   1\r
80 #define ECUM_AR_MINOR_VERSION   2\r
81 #define ECUM_AR_PATCH_VERSION   2\r
82 \r
83 //#include "EcuM_Types.h"\r
84 //struct EcuM_Config;\r
85 //typedef struct EcuM_Config EcuM_ConfigType;\r
86 \r
87 /* Holds EcuM_ConfigType */\r
88 /* TODO: forward declare all config types here ? */\r
89 /* TODO: EcuM_Generated_Types must have types from Ecu_Types.h */\r
90 #include "EcuM_Types.h"\r
91 #include "EcuM_Cfg.h"\r
92 #include "EcuM_Cbk.h"\r
93 \r
94 #if defined(USE_COM)\r
95 #include "ComStack_Types.h"\r
96 #endif\r
97 \r
98 //#if (ECUM_USE_SERVICE_PORTS == STD_ON) && defined(USE_RTE)\r
99 //#include "Rte_Type.h"\r
100 //#endif\r
101 \r
102 \r
103 \r
104 /** @name Error Codes */\r
105 //@{\r
106 #define ECUM_E_NOT_INITIATED (0x10)\r
107 #define ECUM_E_SERVICE_DISABLED (0x11)\r
108 #define ECUM_E_NULL_POINTER (0x12)\r
109 #define ECUM_E_INVALID_PAR (0x13)\r
110 #define ECUM_E_MULTIPLE_RUN_REQUESTS (0x14)\r
111 #define ECUM_E_MISMATCHED_RUN_RELEASE (0x15)\r
112 #define ECUM_E_STATE_PAR_OUT_OF_RANGE (0x16)\r
113 #define ECUM_E_UNKNOWN_WAKEUP_SOURCE (0x17)\r
114 #define ECUM_E_ARC_TIMERERROR (0x18)\r
115 //@}\r
116 \r
117 /** @name Service id's */\r
118 //@{\r
119 #define ECUM_REQUESTRUN_ID (0x03)\r
120 #define ECUM_RELEASERUN_ID (0x04)\r
121 #define ECUM_SELECTSHUTDOWNTARGET_ID (0x06)\r
122 #define ECUM_GETSTATE_ID (0x07)\r
123 #define ECUM_GETSHUTDOWNTARGET_ID (0x09)\r
124 #define ECUM_COMM_REQUESTRUN_ID (0x0e)\r
125 #define ECUM_REQUESTPOSTRUN_ID (0x0a)\r
126 #define ECUM_RELEASEPOSTRUN_ID (0x0b)\r
127 #define ECUM_SELECTAPPMODE_ID (0x0f)\r
128 #define ECUM_COMM_RELEASERUN_ID (0x10)\r
129 #define ECUM_GETAPPMODE_ID (0x11)\r
130 #define ECUM_SELECT_BOOTARGET_ID (0x12)\r
131 #define ECUM_GET_BOOTARGET_ID (0x13)\r
132 #define ECUM_MAINFUNCTION_ID (0x18)\r
133 #define ECUM_COMM_HASREQUESTEDRUN_ID (0x1b)\r
134 #define ECUM_ARC_STARTUPTWO_ID (0x20)\r
135 \r
136 \r
137 #define ECUM_MODULE_ID                  MODULE_ID_ECUM\r
138 #define ECUM_VENDOR_ID                  1\r
139 \r
140 #define ECUM_SW_MAJOR_VERSION   2\r
141 #define ECUM_SW_MINOR_VERSION   0\r
142 #define ECUM_SW_PATCH_VERSION   0\r
143 \r
144 #define ECUM_AR_MAJOR_VERSION   1\r
145 #define ECUM_AR_MINOR_VERSION   2\r
146 #define ECUM_AR_PATCH_VERSION   2\r
147 \r
148 //#include "EcuM_Cfg.h"\r
149 \r
150 #if ( ECUM_VERSION_INFO_API == STD_ON)\r
151 #define EcuM_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi,ECUM)\r
152 #endif\r
153 \r
154 void EcuM_Init( void );\r
155 void EcuM_StartupTwo(void);\r
156 void EcuM_Shutdown(void);\r
157 \r
158 Std_ReturnType EcuM_GetState(EcuM_StateType* state);\r
159 \r
160 Std_ReturnType EcuM_RequestRUN(EcuM_UserType user);\r
161 Std_ReturnType EcuM_ReleaseRUN(EcuM_UserType user);\r
162 \r
163 Std_ReturnType EcuM_RequestPOST_RUN(EcuM_UserType user);\r
164 Std_ReturnType EcuM_ReleasePOST_RUN(EcuM_UserType user);\r
165 \r
166 void EcuM_KillAllRUNRequests(void);\r
167 \r
168 #if defined(USE_COMM)\r
169 Std_ReturnType EcuM_ComM_RequestRUN(NetworkHandleType channel);\r
170 Std_ReturnType EcuM_ComM_ReleaseRUN(NetworkHandleType channel);\r
171 boolean EcuM_ComM_HasRequestedRUN(NetworkHandleType channel);\r
172 #endif\r
173 \r
174 Std_ReturnType EcuM_SelectShutdownTarget(EcuM_StateType shutdownTarget, uint8 sleepMode);\r
175 Std_ReturnType EcuM_GetShutdownTarget(EcuM_StateType* shutdownTarget, uint8* sleepMode);\r
176 Std_ReturnType EcuM_GetLastShutdownTarget(EcuM_StateType* shutdownTarget, uint8* sleepMode);\r
177 \r
178 EcuM_WakeupSourceType EcuM_GetPendingWakeupEvents(void);\r
179 void EcuM_ClearWakeupEvent(EcuM_WakeupSourceType sources);\r
180 EcuM_WakeupSourceType EcuM_GetValidatedWakeupEvents(void);\r
181 EcuM_WakeupSourceType EcuM_GetExpiredWakeupEvents(void);\r
182 EcuM_WakeupStatusType EcuM_GetStatusOfWakeupSource(EcuM_WakeupSourceType sources);\r
183 \r
184 Std_ReturnType EcuM_SelectApplicationMode(AppModeType appMode);\r
185 Std_ReturnType EcuM_GetApplicationMode(AppModeType* appMode);\r
186 \r
187 Std_ReturnType EcuM_SelectBootTarget(EcuM_BootTargetType target);\r
188 Std_ReturnType EcuM_GetBootTarget(EcuM_BootTargetType* target);\r
189 \r
190 void EcuM_SetWakeupEvent(EcuM_WakeupSourceType sources);\r
191 \r
192 void EcuM_MainFunction(void);\r
193 \r
194 #endif /*ECUM_H_*/\r
195 /** @} */\r