]> rtime.felk.cvut.cz Git - arc.git/blobdiff - system/EcuM/EcuM.c
EcuM: More SchM,Gpt stuff
[arc.git] / system / EcuM / EcuM.c
index 4dbaf47cec1821ff8b23ed7d450211be94546e48..a7129716dc5be483c8a296ff6bafa21f0c6667df 100644 (file)
 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
@@ -184,6 +186,10 @@ void EcuM_StartupTwo(void)
        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
 \r
@@ -362,12 +368,45 @@ Std_ReturnType EcuM_ReleaseRUN(EcuM_UserType user)
        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
@@ -421,9 +460,9 @@ Std_ReturnType EcuM_ReleasePOST_RUN(EcuM_UserType user)
 }\r
 \r
 /*\r
- * Don't yet understand the use\r
+ * TODO: Don't yet understand the use\r
  */\r
-void EcuM_ClearWakeupEvent( EcuM_WakeupStatusType source )\r
+void EcuM_ClearWakeupEvent( EcuM_WakeupSourceType source )\r
 {\r
        switch(source) {\r
        case ECUM_WKSTATUS_NONE:\r
@@ -440,3 +479,35 @@ void EcuM_ClearWakeupEvent( EcuM_WakeupStatusType source )
        }\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
+void EcuM_CheckValidation(EcuM_WakeupSourceType wakeupSource) {\r
+       /* Used only if CanIf is used ? CanIf_Checkvalidation(wakeupSource) */\r
+       (void)wakeupSource;\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