]> rtime.felk.cvut.cz Git - arc.git/blobdiff - system/EcuM/EcuM.c
EcuM: Adding more sleep functionility
[arc.git] / system / EcuM / EcuM.c
index 9cf1c8f18af7c89cc672b5fe5d447a9231a03a0a..04d1cf8fff0edb2d3d37a84e55c4c6c4a6c33f60 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
@@ -362,12 +364,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
@@ -441,13 +476,32 @@ void EcuM_ClearWakeupEvent( EcuM_WakeupSourceType source )
 }\r
 \r
 /**\r
- * TODO:\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
+}\r
+\r
+\r
+EcuM_WakeupSourceType EcuM_GetValidatedWakeupEvents( void ) {\r
        // TODO:\r
-       return ECUM_WKSOURCE_INTERNAL_RESET;\r
+}\r
+\r
+EcuM_WakeupStatusType EcuM_GetStatusOfWakeupSource( EcuM_WakeupSourceType sources ) {\r
 \r
 }\r
 \r
+\r