]> rtime.felk.cvut.cz Git - arc.git/blobdiff - include/EcuM.h
EcuM: More EcuM fixes.
[arc.git] / include / EcuM.h
index aaeb3dc298f77ebb0379ae91a27a2ab27680731f..099495782394d92fa455b22df4168b968e5b56d4 100644 (file)
  * API and type definitions for ECU State Manager.\r
  */\r
 \r
+/*\r
+ * Include structure:\r
+ *\r
+ *\r
+ *\r
+ *   Rte_Type.h -->  Std_Types.h\r
+ *       ^              ^\r
+ *       |              |\r
+ *   Rte_EcuM.h <--  EcuM_Types.h*\r
+ *       ^              ^\r
+ *       |              |     /-----> EcuM_Cfg.h\r
+ *       |              |    /------> EcuM_Generated_Types.h\r
+ *       |              |   /         (Holds EcuM_ConfigType and includes all BSW modules )\r
+ *       |              |  /-------> EcuM_Cbk.h\r
+ *       |              | /           (want types EcuM_WakeupSourceType, EcuM_ConfigType *, EcuM_WakeupSourceType , EcuM_WakeupReactionType )\r
+ *       |              |/\r
+ *       |            EcuM.h  <----- EcuM_Callout_Stubs.c\r
+ *       |              ^       \--- EcuM_PBCfg.c\r
+ *       |              |\r
+ *       |              |\r
+ *       `---------- EcuM_xxx.c ---> Memmap.h\r
+ *                               \-> Det.h, Dem.h\r
+ *\r
+ * *) Only ifdef CFG_ECUM_USE_SERVICE_COMPONENT\r
+ *\r
+ * Problems:\r
+ * - Can_Cfg.h can include just "EcuM_Cbk.h"...\r
+ *   .. it will need at EcuM.h.. problem is that EcuM.h includes EcuM_Cbk.h\r
+ * - Most BSW modules uses DEM that in Dem_Types.h will include "Rte_Type.h"\r
+ *   (if enabled by CFG_DEM_USE_RTE)\r
+ *\r
+ * - EcuM_Generated_Types.h is quite crappy since it includes the\r
+ *\r
+ * Changes:\r
+ *   - EcuM_Cfg.h , must not include ANY include files.\r
+ *   - EcuM_Pbcfg.c must include "EcuM_Generated_Types.h"\r
+ *   - EcuM.c, etc must include "EcuM_Generated_Types.h"\r
+ *   --> The GOOD, we keep circular include from EcuM_Generated_Types.h\r
+ *\r
+ *\r
+ *\r
+ */\r
+\r
+\r
 #ifndef ECUM_H_\r
 #define ECUM_H_\r
 \r
-#include "Std_Types.h"\r
-#include <Os.h>\r
+#include "Modules.h"\r
+\r
+#define ECUM_MODULE_ID                 MODULE_ID_ECUM\r
+#define ECUM_VENDOR_ID                 1\r
+\r
+#define ECUM_SW_MAJOR_VERSION  2\r
+#define ECUM_SW_MINOR_VERSION  0\r
+#define ECUM_SW_PATCH_VERSION  0\r
+\r
+#define ECUM_AR_MAJOR_VERSION  1\r
+#define ECUM_AR_MINOR_VERSION  2\r
+#define ECUM_AR_PATCH_VERSION  2\r
+\r
+\r
+#include "EcuM_Cfg.h"\r
+#include "EcuM_Types.h"\r
+#include "EcuM_Cbk.h"\r
+\r
 #if defined(USE_COM)\r
 #include "ComStack_Types.h"\r
 #endif\r
 \r
+#if defined(USE_COMM)\r
+#include "ComM.h"\r
+#endif\r
+\r
+\r
 /** @name Error Codes */\r
 //@{\r
 #define ECUM_E_NOT_INITIATED (0x10)\r
 #define ECUM_GETAPPMODE_ID (0x11)\r
 #define ECUM_SELECT_BOOTARGET_ID (0x12)\r
 #define ECUM_GET_BOOTARGET_ID (0x13)\r
+#define ECUM_VALIDATE_WAKEUP_EVENT_ID 0x14\r
 #define ECUM_MAINFUNCTION_ID (0x18)\r
 #define ECUM_COMM_HASREQUESTEDRUN_ID (0x1b)\r
 #define ECUM_ARC_STARTUPTWO_ID (0x20)\r
 \r
-/** Possible states */\r
-typedef enum {\r
-       ECUM_STATE_APP_RUN = 0x32,\r
-       ECUM_STATE_SHUTDOWN = 0x40,\r
-       ECUM_STATE_WAKEUP = 0x20,\r
-       ECUM_SUBSTATE_MASK = 0x0F,\r
-       ECUM_STATE_WAKEUP_WAKESLEEP = 0x25,\r
-       ECUM_STATE_WAKEUP_ONE = 0x21,\r
-       ECUM_STATE_OFF = 0x80,\r
-       ECUM_STATE_STARTUP = 0x10,\r
-       ECUM_STATE_PREP_SHUTDOWN = 0x44,\r
-       ECUM_STATE_RUN = 0x30,\r
-       ECUM_STATE_STARTUP_TWO = 0x12,\r
-       ECUM_STATE_WAKEUP_TTII = 0x26,\r
-       ECUM_STATE_WAKEUP_VALIDATION = 0x22,\r
-       ECUM_STATE_GO_SLEEP = 0x49,\r
-       ECUM_STATE_STARTUP_ONE = 0x11,\r
-       ECUM_STATE_WAKEUP_TWO = 0x24,\r
-       ECUM_STATE_SLEEP = 0x50,\r
-       ECUM_STATE_WAKEUP_REACTION = 0x23,\r
-       ECUM_STATE_APP_POST_RUN = 0x33,\r
-       ECUM_STATE_GO_OFF_TWO = 0x4e,\r
-       ECUM_STATE_RESET = 0x90,\r
-       ECUM_STATE_GO_OFF_ONE = 0x4d\r
-} EcuM_StateType;\r
-\r
-typedef uint8 EcuM_UserType;\r
-\r
-enum {\r
-       /** Internal reset of µC (bit 2).\r
-        *  The internal reset typically only resets the µC\r
-        *  core but not peripherals or memory\r
-        *  controllers. The exact behavior is hardware\r
-        *  specific.\r
-        *  This source may also indicate an unhandled\r
-        *  exception. */\r
-       ECUM_WKSOURCE_INTERNAL_RESET = 0x04,\r
-\r
-       /** Reset by external watchdog (bit 4), if\r
-        *  detection supported by hardware */\r
-       ECUM_WKSOURCE_EXTERNAL_WDG = 0x10,\r
-\r
-       /** Reset by internal watchdog (bit 3) */\r
-       ECUM_WKSOURCE_INTERNAL_WDG = 0x08,\r
-\r
-       /** Power cycle (bit 0) */\r
-       ECUM_WKSOURCE_POWER = 0x01,\r
-\r
-       /** ~0 to the power of 29 */\r
-       ECUM_WKSOURCE_ALL_SOURCES = 0x3FFFFFFF,\r
-\r
-       /** Hardware reset (bit 1).\r
-        *  If hardware cannot distinguish between a\r
-        *  power cycle and a reset reason, then this\r
-        *  shall be the default wakeup source */\r
-       ECUM_WKSOURCE_RESET = 0x02\r
-};\r
-\r
-typedef uint32 EcuM_WakeupSourceType;\r
-\r
-typedef enum\r
-{\r
-       ECUM_WKSTATUS_NONE = 0,        /**< No pending wakeup event was detected */\r
-       ECUM_WKSTATUS_PENDING = 1,     /**< The wakeup event was detected but not yet validated */\r
-       ECUM_WKSTATUS_VALIDATED = 2,   /**< The wakeup event is valid */\r
-       ECUM_WKSTATUS_EXPIRED = 3     /**< The wakeup event has not been validated and has expired therefore */\r
-} EcuM_WakeupStatusType;\r
-\r
-typedef enum\r
-{\r
-       ECUM_WWKACT_RUN = 0,       /**< Initialization into RUN state */\r
-       ECUM_WKACT_TTII = 2,       /**< Execute time triggered increased inoperation protocol and shutdown */\r
-       ECUM_WKACT_SHUTDOWN = 3   /**< Immediate shutdown */\r
-} EcuM_WakeupReactionType;\r
-\r
-typedef enum\r
-{\r
-       ECUM_BOOT_TARGET_APP = 0,          /**< The Ecu will boot into the application */\r
-       ECUM_BOOT_TARGET_BOOTLOADER = 1   /**< The Ecu will boot into the bootloader */\r
-} EcuM_BootTargetType;\r
-\r
 \r
 #define ECUM_MODULE_ID                 MODULE_ID_ECUM\r
 #define ECUM_VENDOR_ID                 1\r
@@ -154,7 +139,7 @@ typedef enum
 #define ECUM_AR_MINOR_VERSION  2\r
 #define ECUM_AR_PATCH_VERSION  2\r
 \r
-#include "EcuM_Cfg.h"\r
+//#include "EcuM_Cfg.h"\r
 \r
 #if ( ECUM_VERSION_INFO_API == STD_ON)\r
 #define EcuM_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi,ECUM)\r
@@ -185,7 +170,7 @@ Std_ReturnType EcuM_GetShutdownTarget(EcuM_StateType* shutdownTarget, uint8* sle
 Std_ReturnType EcuM_GetLastShutdownTarget(EcuM_StateType* shutdownTarget, uint8* sleepMode);\r
 \r
 EcuM_WakeupSourceType EcuM_GetPendingWakeupEvents(void);\r
-void EcuM_ClearWakeupEvent(EcuM_WakeupSourceType sources);\r
+void EcuM_ClearWakeupEvent(EcuM_WakeupSourceType source );\r
 EcuM_WakeupSourceType EcuM_GetValidatedWakeupEvents(void);\r
 EcuM_WakeupSourceType EcuM_GetExpiredWakeupEvents(void);\r
 EcuM_WakeupStatusType EcuM_GetStatusOfWakeupSource(EcuM_WakeupSourceType sources);\r
@@ -196,7 +181,10 @@ Std_ReturnType EcuM_GetApplicationMode(AppModeType* appMode);
 Std_ReturnType EcuM_SelectBootTarget(EcuM_BootTargetType target);\r
 Std_ReturnType EcuM_GetBootTarget(EcuM_BootTargetType* target);\r
 \r
+void EcuM_SetWakeupEvent(EcuM_WakeupSourceType sources);\r
+\r
 void EcuM_MainFunction(void);\r
 \r
+\r
 #endif /*ECUM_H_*/\r
 /** @} */\r