* for more details.\r
* -------------------------------- Arctic Core ------------------------------*/\r
\r
+\r
+/** @reqSettings DEFAULT_SPECIFICATION_REVISION=3.1.5 */\r
+\r
+/* ----------------------------[information]----------------------------------*/\r
+/*\r
+ * Author: ?+mahi\r
+ *\r
+ * Part of Release:\r
+ * 3.1.5\r
+ *\r
+ * Description:\r
+ * Implements the Can Driver module\r
+ *\r
+ * Support:\r
+ * General Have Support\r
+ * -------------------------------------------\r
+ * ECUM_TTII_ENABLED N\r
+ * ECUM_DEV_ERROR_DETECT Y\r
+ * ECUM_VERSION_INFO_API Y\r
+ * ECUM_INCLUDE_DEM N (controlled by USE_x macro's instead)\r
+ * ECUM_INCLUDE_NVRAM_MGR N (controlled by USE_x macro's instead)\r
+ * ECUM_INLCUDE_DET N (controlled by USE_x macro's instead)\r
+ * ECUM_MAIN_FUNCTION_PERDIOD Y\r
+ * ECUM_TTII_WKSOURCE N\r
+ *\r
+ * Configuration Have Support\r
+ * -------------------------------------------\r
+ * ECUM_SLEEP_ACTIVITY_PERIOD ?\r
+ * ECUM_CONFIGCONSISTENCY_HASH N\r
+ * ECUM_RUN_SELF_REQUEST_PERIOD ?\r
+ * ECUM_NVRAM_WRITEALL_TIMEOUT Y\r
+ * ECUM_DEFAULT_APP_MODE ?\r
+ *\r
+ *\r
+ * DefaultShutdownTarget\r
+ * -------------------------------------------\r
+ * ECUM_DEFAULT_SHUTDOWN_TARGET N\r
+ *\r
+ *\r
+ * Things to start with:\r
+ * - EcuM2181\r
+ * - EcuM2861 , Watchdog\r
+ * - ComM_EcuM_RunModeIndication() not called, See Figure 8 (Seems that the ComM does not do much either)\r
+ *\r
+ *\r
+ *\r
+ */\r
+\r
//lint -emacro(904,VALIDATE,VALIDATE_RV,VALIDATE_NO_RV) //904 PC-Lint exception to MISRA 14.7 (validate macros).\r
\r
+\r
+/* ----------------------------[includes]------------------------------------*/\r
+\r
#include "Std_Types.h"\r
#include "EcuM.h"\r
#include "Modules.h"\r
#include <string.h>\r
#include <Os.h>\r
+#include "EcuM_Generated_Types.h"\r
#include "EcuM_Internals.h"\r
#include "EcuM_Cbk.h"\r
#include "SchM_EcuM.h"\r
#if defined(USE_RTE)\r
#include "Rte_Main.h"\r
#endif\r
+#if defined(USE_SCHM)\r
+#include "SchM.h"\r
+#endif\r
+\r
+\r
+/* ----------------------------[private define]------------------------------*/\r
+/* ----------------------------[private macro]-------------------------------*/\r
+/* ----------------------------[private typedef]-----------------------------*/\r
+/* ----------------------------[private function prototypes]-----------------*/\r
+/* ----------------------------[private variables]---------------------------*/\r
\r
EcuM_GlobalType internal_data;\r
\r
+/* ----------------------------[private functions]---------------------------*/\r
+\r
+\r
+/* ----------------------------[public functions]----------------------------*/\r
+\r
#if !defined(USE_DET) && defined(ECUM_DEV_ERROR_DETECT)\r
#error EcuM configuration error. DET is not enabled when ECUM_DEV_ERROR_DETECT is set\r
#endif\r
// Determine PostBuild configuration\r
internal_data.config = EcuM_DeterminePbConfiguration();\r
\r
+\r
// TODO: Check consistency of PB configuration\r
\r
// Initialize drivers needed before the OS-starts\r
StartOS(appMode); /** @req EcuM2141 */\r
}\r
\r
+/*\r
+ * The order defined here is found in 3.1.5/EcuM2411\r
+ */\r
void EcuM_StartupTwo(void)\r
{\r
//TODO: Validate that we are in state STARTUP_ONE.\r
StatusType tickTimerStatus;\r
#endif\r
\r
- set_current_state(ECUM_STATE_STARTUP_TWO);\r
-\r
// Initialize the BSW scheduler\r
- // TODO SchM_Init();\r
+#if defined(USE_SCHM)\r
+ SchM_Init();\r
+#endif\r
+\r
+#if defined(USE_WDGM)\r
+ WdgM_SetMode(internal_data.config->EcuMWdgMConfig->EcuMWdgMStartupMode);\r
+#endif\r
\r
// Initialize drivers that don't need NVRAM data\r
EcuM_AL_DriverInitTwo(internal_data.config);\r
Rte_Start();\r
#endif\r
\r
+ set_current_state(ECUM_STATE_STARTUP_TWO);\r
+\r
#if defined(USE_NVM)\r
\r
#if 0\r
return E_OK;\r
}\r
\r
+/**\r
+ *\r
+ */\r
void EcuM_KillAllRUNRequests( void ) {\r
/* NOT IMPLEMENTED */\r
}\r
\r
+\r
+/**\r
+ *\r
+ * @param sources\r
+ */\r
void EcuM_SetWakeupEvent(EcuM_WakeupSourceType sources) {\r
- /* NOT IMPLEMENTED */\r
+ /* @req 3.1.5/EcuM2826 The function exists */\r
+ /* @req 3.1.5/EcuM2171 */\r
+\r
+ /* @req 3.1.5/EcuM2867 */\r
+#if ( ECUM_DEV_ERROR_DETECT == STD_ON )\r
+ {\r
+ EcuM_WakeupSourceType wkSource;\r
+ const EcuM_SleepModeType *sleepModePtr;\r
+\r
+ sleepModePtr = &internal_data.config->EcuMSleepModeConfig[internal_data.sleep_mode];\r
+ wkSource = sleepModePtr->EcuMWakeupSourceMask;\r
+\r
+ if( !((sources | wkSource) == wkSource)) {\r
+ Det_ReportError(MODULE_ID_ECUM, 0, ECUM_VALIDATE_WAKEUP_EVENT_ID, ECUM_E_UNKNOWN_WAKEUP_SOURCE );\r
+ return;\r
+ }\r
+ }\r
+#endif\r
+\r
+\r
+ /* @req 3.1.5/EcuM1117 */\r
+ internal_data.wakeupEvents |= sources;\r
+\r
+ /* @req 3.1.5/EcuM2707 @req 3.1.5/EcuM2709*/\r
+// internal_data.wakeupTimer = ECUM_VALIDATION_TIMEOUT;\r
+\r
}\r
\r
#if defined(USE_COMM) || defined(USE_ECUM_COMM)\r
return E_OK;\r
}\r
\r
+/*\r
+ * TODO: Don't yet understand the use\r
+ */\r
+void EcuM_ClearWakeupEvent( EcuM_WakeupSourceType source )\r
+{\r
+ switch(source) {\r
+ case ECUM_WKSTATUS_NONE:\r
+ /* Seems quite pointless */\r
+ break;\r
+ case ECUM_WKSTATUS_PENDING:\r
+ break;\r
+ case ECUM_WKSTATUS_VALIDATED:\r
+ break;\r
+ case ECUM_WKSTATUS_EXPIRED:\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+}\r
+\r
+/**\r
+ * Get the pending wakeup events.\r
+ *\r
+ * @return\r
+ */\r
+EcuM_WakeupSourceType EcuM_GetPendingWakeupEvents( void ) {\r
+ /* @req 3.1.5/EcuM2827 API\r
+ * @req 3.1.5/EcuM2172 Callable from interrupt context\r
+ * */\r
+\r
+ /* @req 3.1.5/EcuM1156 */\r
+ return internal_data.wakeupEvents;\r
+\r
+}\r
+\r
+\r
+EcuM_WakeupSourceType EcuM_GetValidatedWakeupEvents( void ) {\r
+ // TODO:\r
+ return 0;\r
+}\r
+\r
+EcuM_WakeupStatusType EcuM_GetStatusOfWakeupSource( EcuM_WakeupSourceType sources ) {\r
+ return 0;\r
+}\r
+\r
+/**\r
+ *\r
+ * @param sources\r
+ */\r
+void EcuM_ValidateWakeupEvent(EcuM_WakeupSourceType sources) {\r
+\r
+ /* !req 3.1.5/EcuM2344 */\r
+ /* !req 3.1.5/EcuM2645 */\r
+ /* !req 3.1.5/EcuM2868 */\r
+ /* !req 3.1.5/EcuM2345 */\r
+\r
+/*\r
+#if defined(USE_COMM)\r
+ if( internal_data.config->)\r
+ ComM_EcuM_WakeUpIndication()\r
+#endif\r
+*/\r
+ /* !req 3.1.5/EcuM2790 */\r
+ /* !req 3.1.5/EcuM2791 */\r
+\r
+}\r
+\r
+\r
+\r