-/* -------------------------------- Arctic Core ------------------------------
- * Arctic Core - the open source AUTOSAR platform http://arccore.com
- *
- * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
- *
- * This source code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by the
- * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- * -------------------------------- Arctic Core ------------------------------*/
-
-
-
-
-
-
-
-
+/* -------------------------------- Arctic Core ------------------------------\r
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
+ *\r
+ * Copyright (C) 2009 ArcCore AB <contact@arccore.com>\r
+ *\r
+ * This source code is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU General Public License version 2 as published by the\r
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\r
+ * for more details.\r
+ * -------------------------------- Arctic Core ------------------------------*/\r
+\r
+/** @addtogroup EcuM ECU State Manager\r
+ * @{ */\r
+\r
+/** @file EcuM.h\r
+ * 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
-// Error codes produced by this module\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_E_SERVICE_DISABLED (0x11)\r
#define ECUM_E_NULL_POINTER (0x12)\r
#define ECUM_E_MISMATCHED_RUN_RELEASE (0x15)\r
#define ECUM_E_STATE_PAR_OUT_OF_RANGE (0x16)\r
#define ECUM_E_UNKNOWN_WAKEUP_SOURCE (0x17)\r
-\r
-// Service ID in this module\r
+#define ECUM_E_ARC_TIMERERROR (0x18)\r
+//@}\r
+\r
+/** @name Service id's */\r
+//@{\r
+#define ECUM_REQUESTRUN_ID (0x03)\r
+#define ECUM_RELEASERUN_ID (0x04)\r
+#define ECUM_SELECTSHUTDOWNTARGET_ID (0x06)\r
#define ECUM_GETSTATE_ID (0x07)\r
+#define ECUM_GETSHUTDOWNTARGET_ID (0x09)\r
+#define ECUM_COMM_REQUESTRUN_ID (0x0e)\r
+#define ECUM_REQUESTPOSTRUN_ID (0x0a)\r
+#define ECUM_RELEASEPOSTRUN_ID (0x0b)\r
#define ECUM_SELECTAPPMODE_ID (0x0f)\r
+#define ECUM_COMM_RELEASERUN_ID (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
-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
-
-
-#define ECUM_SW_MAJOR_VERSION 1
-#define ECUM_SW_MINOR_VERSION 0
-#define ECUM_SW_PATCH_VERSION 0
-
-#define ECUM_AR_MAJOR_VERSION 1
-#define ECUM_AR_MINOR_VERSION 2
-#define ECUM_AR_PATCH_VERSION 2
\r
-#include "EcuM_Cfg.h"\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
+//#include "EcuM_Cfg.h"\r
+\r
#if ( ECUM_VERSION_INFO_API == STD_ON)\r
-void EcuM_GetVersionInfo( Std_VersionInfoType *versionInfo );\r
+#define EcuM_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi,ECUM)\r
#endif\r
\r
void EcuM_Init( void );\r
-void EcuM_StartupTwo();\r
-void EcuM_Shutdown();\r
+void EcuM_StartupTwo(void);\r
+void EcuM_Shutdown(void);\r
\r
Std_ReturnType EcuM_GetState(EcuM_StateType* state);\r
\r
Std_ReturnType EcuM_RequestPOST_RUN(EcuM_UserType user);\r
Std_ReturnType EcuM_ReleasePOST_RUN(EcuM_UserType user);\r
\r
-void EcuM_KillAllRUNRequests();\r
+void EcuM_KillAllRUNRequests(void);\r
\r
-#if defined(USE_COM)\r
+#if defined(USE_COMM)\r
Std_ReturnType EcuM_ComM_RequestRUN(NetworkHandleType channel);\r
Std_ReturnType EcuM_ComM_ReleaseRUN(NetworkHandleType channel);\r
boolean EcuM_ComM_HasRequestedRUN(NetworkHandleType channel);\r
#endif\r
\r
-Std_ReturnType EcuM_SelectShutdownTarget(EcuM_StateType target, uint8 mode);\r
-Std_ReturnType EcuM_GetShutdownTarget(EcuM_StateType* target, uint8* mode);\r
-Std_ReturnType EcuM_GetLastShutdownTarget(EcuM_StateType* target, uint8* mode);\r
+Std_ReturnType EcuM_SelectShutdownTarget(EcuM_StateType shutdownTarget, uint8 sleepMode);\r
+Std_ReturnType EcuM_GetShutdownTarget(EcuM_StateType* shutdownTarget, uint8* sleepMode);\r
+Std_ReturnType EcuM_GetLastShutdownTarget(EcuM_StateType* shutdownTarget, uint8* sleepMode);\r
\r
-EcuM_WakeupSourceType EcuM_GetPendingWakeupEvents();\r
-void EcuM_ClearWakeupEvent(EcuM_WakeupSourceType sources);\r
-EcuM_WakeupSourceType EcuM_GetValidatedWakeupEvents();\r
-EcuM_WakeupSourceType EcuM_GetExpiredWakeupEvents();\r
+EcuM_WakeupSourceType EcuM_GetPendingWakeupEvents(void);\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
\r
Std_ReturnType EcuM_SelectApplicationMode(AppModeType appMode);\r
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
-void EcuM_OnGoOffTwo( void );\r
-void EcuM_AL_SwitchOff( void );\r
\r
#endif /*ECUM_H_*/\r
+/** @} */\r