From 8dcc6ca9f1df7e7d982b2507863104e2c9a17162 Mon Sep 17 00:00:00 2001 From: mahi Date: Tue, 11 Sep 2012 16:09:41 +0200 Subject: [PATCH] EcuM: More SchM,Gpt stuff --- arch/ppc/mpc55xx/drivers/Gpt.c | 118 ++++++++++++++++----------------- include/EcuM_Types.h | 2 + system/EcuM/EcuM.c | 4 +- system/SchM/SchM.c | 3 +- 4 files changed, 65 insertions(+), 62 deletions(-) diff --git a/arch/ppc/mpc55xx/drivers/Gpt.c b/arch/ppc/mpc55xx/drivers/Gpt.c index 9676cf12..d71bd691 100644 --- a/arch/ppc/mpc55xx/drivers/Gpt.c +++ b/arch/ppc/mpc55xx/drivers/Gpt.c @@ -581,82 +581,82 @@ void Gpt_DisableNotification(Gpt_ChannelType channel) #if ( GPT_WAKEUP_FUNCTIONALITY_API == STD_ON ) - void Gpt_SetMode(Gpt_ModeType mode) - { - int i; +void Gpt_SetMode(Gpt_ModeType mode) +{ + int i; - VALIDATE( (Gpt_Global.initRun == STD_ON), GPT_SETMODE_SERVIVCE_ID, GPT_E_UNINIT ); - VALIDATE( ( mode <= GPT_MODE_SLEEP ), GPT_SETMODE_SERVIVCE_ID, GPT_E_PARAM_MODE ); + VALIDATE( (Gpt_Global.initRun == STD_ON), GPT_SETMODE_SERVIVCE_ID, GPT_E_UNINIT ); + VALIDATE( ( mode <= GPT_MODE_SLEEP ), GPT_SETMODE_SERVIVCE_ID, GPT_E_PARAM_MODE ); #if defined(CFG_MPC560X) - if (mode == GPT_MODE_NORMAL) - { - PIT.PITMCR.B.MDIS = 0; - // Do NOT restart channels - } - else if (mode == GPT_MODE_SLEEP) + if (mode == GPT_MODE_NORMAL) + { + PIT.PITMCR.B.MDIS = 0; + // Do NOT restart channels + } + else if (mode == GPT_MODE_SLEEP) + { + PIT.PITMCR.B.MDIS = 0; + // Disable all but RTI + for (i= 0; i <= GPT_CHANNEL_PIT_LAST; i++) { - PIT.PITMCR.B.MDIS = 0; - // Disable all but RTI - for (i= 0; i <= GPT_CHANNEL_PIT_LAST; i++) - { - Gpt_StopTimer(i); - } + Gpt_StopTimer(i); } + } #else - if (mode == GPT_MODE_NORMAL) - { - PIT.CTRL.B.MDIS = 0; - // Do NOT restart channels - } - else if (mode == GPT_MODE_SLEEP) - { - - PIT.CTRL.B.MDIS = 1; - // Disable all but RTI - for (i= 0; i <= GPT_CHANNEL_PIT_LAST; i++) - { - Gpt_StopTimer(i); - } - } -#endif + if (mode == GPT_MODE_NORMAL) + { + PIT.CTRL.B.MDIS = 0; + // Do NOT restart channels } - - void Gpt_DisableWakeup(Gpt_ChannelType channel) + else if (mode == GPT_MODE_SLEEP) { - VALIDATE( (Gpt_Global.initRun == STD_ON), GPT_DISABLEWAKEUP_SERVICE_ID, GPT_E_UNINIT ); - VALIDATE( VALID_CHANNEL(channel), GPT_DISABLEWAKEUP_SERVICE_ID, GPT_E_PARAM_CHANNEL ); - // Only RTI have system wakeup - if (channel == GPT_CHANNEL_RTI) - { - Gpt_Global.wakeupEnabled = STD_OFF; - } - else + + PIT.CTRL.B.MDIS = 1; + // Disable all but RTI + for (i= 0; i <= GPT_CHANNEL_PIT_LAST; i++) { - // TODO: - //assert(0); + Gpt_StopTimer(i); } } +#endif +} - void Gpt_EnableWakeup(Gpt_ChannelType channel) +void Gpt_DisableWakeup(Gpt_ChannelType channel) +{ + VALIDATE( (Gpt_Global.initRun == STD_ON), GPT_DISABLEWAKEUP_SERVICE_ID, GPT_E_UNINIT ); + VALIDATE( VALID_CHANNEL(channel), GPT_DISABLEWAKEUP_SERVICE_ID, GPT_E_PARAM_CHANNEL ); + // Only RTI have system wakeup + if (channel == GPT_CHANNEL_RTI) { - VALIDATE( (Gpt_Global.initRun == STD_ON), GPT_ENABLEWAKEUP_SERVICE_ID, GPT_E_UNINIT ); - VALIDATE( VALID_CHANNEL(channel),GPT_ENABLEWAKEUP_SERVICE_ID, GPT_E_PARAM_CHANNEL ); - if (channel == GPT_CHANNEL_RTI) - { - Gpt_Global.wakeupEnabled = STD_ON; - } - else - { - // TODO: - //assert(0); - } + Gpt_Global.wakeupEnabled = STD_OFF; } - - void Gpt_Cbk_CheckWakeup(EcuM_WakeupSourceType wakeupSource) + else { + // TODO: + //assert(0); + } +} +void Gpt_EnableWakeup(Gpt_ChannelType channel) +{ + VALIDATE( (Gpt_Global.initRun == STD_ON), GPT_ENABLEWAKEUP_SERVICE_ID, GPT_E_UNINIT ); + VALIDATE( VALID_CHANNEL(channel),GPT_ENABLEWAKEUP_SERVICE_ID, GPT_E_PARAM_CHANNEL ); + if (channel == GPT_CHANNEL_RTI) + { + Gpt_Global.wakeupEnabled = STD_ON; + } + else + { + // TODO: + //assert(0); } +} + +void Gpt_Cbk_CheckWakeup(EcuM_WakeupSourceType wakeupSource) +{ + +} #endif diff --git a/include/EcuM_Types.h b/include/EcuM_Types.h index 99e35a41..860044c2 100644 --- a/include/EcuM_Types.h +++ b/include/EcuM_Types.h @@ -142,6 +142,7 @@ typedef enum #include "Mcu.h" +#if defined(USE_WDGM) typedef struct EcuM_WdgM { WdgM_SupervisedEntityIdType EcuMSupervisedEntity; @@ -151,6 +152,7 @@ typedef struct EcuM_WdgM WdgM_ModeType EcuMWdgMPostRunMode; WdgM_ModeType EcuMWdgMShutdownMode; } EcuM_WdgMType; +#endif typedef struct EcuM_WakeupSourceConfig { EcuM_WakeupSourceType EcuMWakeupSourceId; diff --git a/system/EcuM/EcuM.c b/system/EcuM/EcuM.c index 8cc0886d..a7129716 100644 --- a/system/EcuM/EcuM.c +++ b/system/EcuM/EcuM.c @@ -497,15 +497,17 @@ EcuM_WakeupSourceType EcuM_GetPendingWakeupEvents( void ) { void EcuM_CheckValidation(EcuM_WakeupSourceType wakeupSource) { /* Used only if CanIf is used ? CanIf_Checkvalidation(wakeupSource) */ + (void)wakeupSource; } EcuM_WakeupSourceType EcuM_GetValidatedWakeupEvents( void ) { // TODO: + return 0; } EcuM_WakeupStatusType EcuM_GetStatusOfWakeupSource( EcuM_WakeupSourceType sources ) { - + return 0; } diff --git a/system/SchM/SchM.c b/system/SchM/SchM.c index a75e7f19..cab78fc7 100644 --- a/system/SchM/SchM.c +++ b/system/SchM/SchM.c @@ -348,8 +348,6 @@ TASK(SchM_Startup){ /* At this point EcuM == ECUM_STATE_STARTUP_ONE */ - /* Schedule memory task more often that usaul so that EcuM_StartupTwo() may return quicker */ - ActivateTask(TASK_ID_SchM_BswService); /* Set events on TASK_ID_BswService_Mem */ SetRelAlarm(ALARM_ID_Alarm_BswService, 10, 2); @@ -362,6 +360,7 @@ TASK(SchM_Startup){ EcuM_StartupTwo(); /* Start to schedule BSW parts */ + CancelAlarm(ALARM_ID_Alarm_BswService); SetRelAlarm(ALARM_ID_Alarm_BswService, 10, 5); EcuM_RequestRUN(ECUM_USER_User_1); -- 2.39.2