]> rtime.felk.cvut.cz Git - arc.git/blob - system/EcuM/EcuM_Internals.h
EcuM: Adding more sleep functionility
[arc.git] / system / EcuM / EcuM_Internals.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 \r
17 \r
18 \r
19 \r
20 \r
21 \r
22 \r
23 // Structs and types used internal in the module\r
24 \r
25 #ifndef _ECUM_INTERNALS_H_\r
26 #define _ECUM_INTERNALS_H_\r
27 \r
28 #if  ( ECUM_DEV_ERROR_DETECT == STD_ON )\r
29 #include "Det.h"\r
30 #define VALIDATE(_exp,_api,_err ) \\r
31         if( !(_exp) ) { \\r
32           Det_ReportError(MODULE_ID_ECUM, 0, _api, _err); \\r
33         }\r
34 \r
35 #define VALIDATE_RV(_exp,_api,_err,_rv ) \\r
36         if( !(_exp) ) { \\r
37           Det_ReportError(MODULE_ID_ECUM, 0, _api, _err); \\r
38           return _rv; \\r
39         }\r
40 \r
41 #define VALIDATE_NO_RV(_exp,_api,_err ) \\r
42   if( !(_exp) ) { \\r
43           Det_ReportError(MODULE_ID_ECUM, 0, _api, _err); \\r
44           return; \\r
45         }\r
46 #define DET_REPORTERROR(_module,_instance,_api,_err) Det_ReportError(_module,_instance,_api,_err)\r
47 \r
48 #else\r
49 #define VALIDATE(_exp,_api,_err )\r
50 #define VALIDATE_RV(_exp,_api,_err,_rv )\r
51 #define VALIDATE_NO_RV(_exp,_api,_err )\r
52 #define DET_REPORTERROR(_module,_instance,_api,_err)\r
53 #endif\r
54 \r
55 \r
56 \r
57 typedef struct\r
58 {\r
59         boolean initiated;\r
60         EcuM_ConfigType* config;\r
61         EcuM_StateType shutdown_target;\r
62         uint8 sleep_mode;\r
63         AppModeType app_mode;\r
64         EcuM_StateType current_state;\r
65 #if defined(USE_COMM) || (USE_ECUM_COMM)\r
66         uint32 run_comm_requests;\r
67 #endif\r
68         uint32 run_requests;\r
69         uint32 postrun_requests;\r
70         EcuM_WakeupSourceType wakeupEvents;\r
71         uint32 wakeupTimer;\r
72 } EcuM_GlobalType;\r
73 \r
74 extern EcuM_GlobalType internal_data;\r
75 \r
76 void EcuM_enter_run_mode(void);\r
77 \r
78 #ifdef CFG_ECUM_USE_SERVICE_COMPONENT\r
79 void set_current_state(EcuM_StateType state);\r
80 #else\r
81 #define set_current_state(state) internal_data.current_state = (state)\r
82 #endif\r
83 \r
84 void EcuM_AL_DriverInitZero(void);\r
85 EcuM_ConfigType* EcuM_DeterminePbConfiguration(void);\r
86 void EcuM_AL_DriverInitOne(const EcuM_ConfigType* ConfigPtr);\r
87 void EcuM_AL_DriverInitTwo(const EcuM_ConfigType* ConfigPtr);\r
88 void EcuM_AL_DriverInitThree(const EcuM_ConfigType* ConfigPtr);\r
89 \r
90 \r
91 #endif /*_ECUM_INTERNALS_H_*/\r