]> rtime.felk.cvut.cz Git - arc.git/commitdiff
EcuM: Added more on the statemachine
authormahi <devnull@localhost>
Sun, 9 Sep 2012 13:41:51 +0000 (15:41 +0200)
committermahi <devnull@localhost>
Sun, 9 Sep 2012 13:41:51 +0000 (15:41 +0200)
system/EcuM/EcuM_Main.c

index a96cabeff1e763c82bf6b569ae961f3db9afc3b4..3fbed82c590d47977d2167ab9e452b8f734ea94e 100644 (file)
@@ -208,6 +208,8 @@ static void in_state_sleep ( void ) {
        const EcuM_SleepModeType *sleepModePtr;\r
        sleepModePtr = &internal_data.config->EcuMSleepModeConfig[internal_data.sleep_mode];\r
 \r
+       EcuM_GenerateRamHash();\r
+\r
        Mcu_SetMode(sleepModePtr->EcuMSleepModeMcuMode);\r
 \r
        /* @req 3.1.5/ECUM2863 */\r
@@ -422,23 +424,27 @@ void EcuM_MainFunction(void){
                        wMask = EcuM_GetValidatedWakeupEvents();\r
 \r
                        /* TODO: We have skipped the TTII timer here */\r
-                       wReaction = ( 0 == wMask ) ? ECUM_WKACT_SHUTDOWN : ECUM_WKACT_RUN\r
+\r
+                       /* If the wakeup mask here is != 0 we have a validated wakeup event ->\r
+                        * go back to RUN */\r
+                       wReaction = ( 0 == wMask ) ? ECUM_WKACT_SHUTDOWN : ECUM_WKACT_RUN;\r
                        wReaction = EcuM_OnWakeupReaction(wReaction);\r
 \r
                        if( wReaction == ECUM_WKACT_RUN) {\r
-\r
                                set_current_state(ECUM_STATE_WAKEUP_TWO);\r
                        } else {\r
-                               /* Shutdown, again */\r
-                               /* TODO:\r
-                               set_current_state(ECUM_STATE_WAKEUP_TWO);\r
+                               /* From figure 28 it seems that we should go to SHUTDOWN/GO SLEEP) again from wakeup\r
+                                * not going up to RUN/RUN II state again. */\r
+                               set_current_state(ECUM_STATE_GO_SLEEP);\r
                        }\r
                        break;\r
                }\r
 \r
                case ECUM_STATE_WAKEUP_TWO:\r
+#if defined(USE_DEM)\r
                        Dem_Init();\r
-\r
+#endif\r
+                       set_current_state(ECUM_STATE_RUN);\r
                        break;\r
 \r
                default:\r