]> rtime.felk.cvut.cz Git - arc.git/blob - include/EcuM_Types.h
EcuM: Gpt and SchM Fixes.
[arc.git] / include / EcuM_Types.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  * @addtogroup EcuM ECU State Manager\r
18  * @{\r
19  *\r
20  * @file EcuM_Types.h\r
21  * Typedefs needed by EcuM module. Note that types that are generated together with\r
22  * Ecum Service Ports should be guarded by _DEFINED_TYPEDEF_FOR_<Type>_ to avoid re-definition.
23  */\r
24 #ifndef ECUM_TYPES_H_\r
25 #define ECUM_TYPES_H_\r
26 \r
27 #include "Std_Types.h"\r
28 #include <Os.h>\r
29 \r
30 #if defined(RTE_TYPE_H) && defined(__GNUC__)\r
31 //#warning RTE_TYPE included before EcuM_Types.h\r
32 #endif\r
33 \r
34 #ifdef CFG_ECUM_USE_SERVICE_COMPONENT\r
35 #include "Rte_Type.h"\r
36 #endif\r
37 \r
38 \r
39 #if !defined(_DEFINED_TYPEDEF_FOR_EcuM_StateType_)\r
40 /** Possible states */\r
41 typedef enum {\r
42         ECUM_STATE_APP_RUN = 0x32,          //!< ECUM_STATE_APP_RUN\r
43         ECUM_STATE_SHUTDOWN = 0x40,         //!< ECUM_STATE_SHUTDOWN\r
44         ECUM_STATE_WAKEUP = 0x20,           //!< ECUM_STATE_WAKEUP\r
45         ECUM_SUBSTATE_MASK = 0x0F,          //!< ECUM_SUBSTATE_MASK\r
46         ECUM_STATE_WAKEUP_WAKESLEEP = 0x25, //!< ECUM_STATE_WAKEUP_WAKESLEEP\r
47         ECUM_STATE_WAKEUP_ONE = 0x21,       //!< ECUM_STATE_WAKEUP_ONE\r
48         ECUM_STATE_OFF = 0x80,              //!< ECUM_STATE_OFF\r
49         ECUM_STATE_STARTUP = 0x10,          //!< ECUM_STATE_STARTUP\r
50         ECUM_STATE_PREP_SHUTDOWN = 0x44,    //!< ECUM_STATE_PREP_SHUTDOWN\r
51         ECUM_STATE_RUN = 0x30,              //!< ECUM_STATE_RUN\r
52         ECUM_STATE_STARTUP_TWO = 0x12,      //!< ECUM_STATE_STARTUP_TWO\r
53         ECUM_STATE_WAKEUP_TTII = 0x26,      //!< ECUM_STATE_WAKEUP_TTII\r
54         ECUM_STATE_WAKEUP_VALIDATION = 0x22,//!< ECUM_STATE_WAKEUP_VALIDATION\r
55         ECUM_STATE_GO_SLEEP = 0x49,         //!< ECUM_STATE_GO_SLEEP\r
56         ECUM_STATE_STARTUP_ONE = 0x11,      //!< ECUM_STATE_STARTUP_ONE\r
57         ECUM_STATE_WAKEUP_TWO = 0x24,       //!< ECUM_STATE_WAKEUP_TWO\r
58         ECUM_STATE_SLEEP = 0x50,            //!< ECUM_STATE_SLEEP\r
59         ECUM_STATE_WAKEUP_REACTION = 0x23,  //!< ECUM_STATE_WAKEUP_REACTION\r
60         ECUM_STATE_APP_POST_RUN = 0x33,     //!< ECUM_STATE_APP_POST_RUN\r
61         ECUM_STATE_GO_OFF_TWO = 0x4e,       //!< ECUM_STATE_GO_OFF_TWO\r
62         ECUM_STATE_RESET = 0x90,            //!< ECUM_STATE_RESET\r
63         ECUM_STATE_GO_OFF_ONE = 0x4d        //!< ECUM_STATE_GO_OFF_ONE\r
64 } EcuM_StateType;\r
65 \r
66 #define _DEFINED_TYPEDEF_FOR_EcuM_StateType_\r
67 \r
68 #endif\r
69 \r
70 \r
71 #if !defined(_DEFINED_TYPEDEF_FOR_EcuM_UserType_)\r
72 typedef uint8 EcuM_UserType;\r
73 \r
74 #define _DEFINED_TYPEDEF_FOR_EcuM_UserType_\r
75 #endif\r
76 \r
77 #if 0\r
78 enum {\r
79         /** Internal reset of µC (bit 2).\r
80          *  The internal reset typically only resets the µC\r
81          *  core but not peripherals or memory\r
82          *  controllers. The exact behavior is hardware\r
83          *  specific.\r
84          *  This source may also indicate an unhandled\r
85          *  exception. */\r
86         ECUM_WKSOURCE_INTERNAL_RESET = 0x04,\r
87 \r
88         /** Reset by external watchdog (bit 4), if\r
89          *  detection supported by hardware */\r
90         ECUM_WKSOURCE_EXTERNAL_WDG = 0x10,\r
91 \r
92         /** Reset by internal watchdog (bit 3) */\r
93         ECUM_WKSOURCE_INTERNAL_WDG = 0x08,\r
94 \r
95         /** Power cycle (bit 0) */\r
96         ECUM_WKSOURCE_POWER = 0x01,\r
97 \r
98         /** ~0 to the power of 29 */\r
99         ECUM_WKSOURCE_ALL_SOURCES = 0x3FFFFFFF,\r
100 \r
101         /** Hardware reset (bit 1).\r
102          *  If hardware cannot distinguish between a\r
103          *  power cycle and a reset reason, then this\r
104          *  shall be the default wakeup source */\r
105         ECUM_WKSOURCE_RESET = 0x02\r
106 };\r
107 \r
108 \r
109 typedef uint32 EcuM_WakeupSourceType;\r
110 \r
111 #endif\r
112 \r
113 typedef enum\r
114 {\r
115         ECUM_WKSTATUS_NONE = 0,        /**< No pending wakeup event was detected */\r
116         ECUM_WKSTATUS_PENDING = 1,     /**< The wakeup event was detected but not yet validated */\r
117         ECUM_WKSTATUS_VALIDATED = 2,   /**< The wakeup event is valid */\r
118         ECUM_WKSTATUS_EXPIRED = 3     /**< The wakeup event has not been validated and has expired therefore */\r
119 } EcuM_WakeupStatusType;\r
120 \r
121 typedef enum\r
122 {\r
123         ECUM_WKACT_RUN = 0,       /**< Initialization into RUN state */\r
124         ECUM_WKACT_TTII = 2,       /**< Execute time triggered increased inoperation protocol and shutdown */\r
125         ECUM_WKACT_SHUTDOWN = 3   /**< Immediate shutdown */\r
126 } EcuM_WakeupReactionType;\r
127 \r
128 \r
129 #if !defined(_DEFINED_TYPEDEF_FOR_EcuM_BootTargetType_)\r
130 typedef enum\r
131 {\r
132         ECUM_BOOT_TARGET_APP = 0,          /**< The Ecu will boot into the application */\r
133         ECUM_BOOT_TARGET_BOOTLOADER = 1   /**< The Ecu will boot into the bootloader */\r
134 } EcuM_BootTargetType;\r
135 #define _DEFINED_TYPEDEF_FOR_EcuM_BootTargetType_\r
136 #endif\r
137 \r
138 \r
139 #if defined(USE_WDGM)\r
140 #include "WdgM.h"\r
141 #endif\r
142 \r
143 #include "Mcu.h"\r
144 \r
145 typedef struct EcuM_WdgM\r
146 {\r
147         WdgM_SupervisedEntityIdType EcuMSupervisedEntity;\r
148         WdgM_ModeType EcuMWdgMWakeupMode;\r
149         WdgM_ModeType EcuMWdgMStartupMode;\r
150         WdgM_ModeType EcuMWdgMRunMode;\r
151         WdgM_ModeType EcuMWdgMPostRunMode;\r
152         WdgM_ModeType EcuMWdgMShutdownMode;\r
153 } EcuM_WdgMType;\r
154 \r
155 typedef struct EcuM_WakeupSourceConfig {\r
156         EcuM_WakeupSourceType   EcuMWakeupSourceId;\r
157         uint32                                  EcuMValidationTimeout;\r
158         Mcu_ResetType                   EcuMResetReason;\r
159         boolean                                 EcuMWakeupSourcePolling;\r
160         uint8                                   EcuMComMChannel;\r
161 } EcuM_WakeupSourceConfigType;\r
162 \r
163 typedef struct EcuM_SleepMode\r
164 {\r
165    uint8                                        EcuMSleepModeId;\r
166    EcuM_WakeupSourceType        EcuMWakeupSourceMask;\r
167    Mcu_ModeType                         EcuMSleepModeMcuMode;\r
168 #if defined(USE_WDGM)\r
169    WdgM_ModeType                        EcuMSleepModeWdgMMode;\r
170 #endif\r
171  } EcuM_SleepModeType;\r
172 \r
173 \r
174 \r
175 #endif /* ECUM_TYPES_H_ */\r
176 /** @} */\r