]> rtime.felk.cvut.cz Git - arc.git/commitdiff
EcuM: More watchdog stuff
authormahi <devnull@localhost>
Tue, 11 Sep 2012 06:51:39 +0000 (08:51 +0200)
committermahi <devnull@localhost>
Tue, 11 Sep 2012 06:51:39 +0000 (08:51 +0200)
boards/mpc5516it/config/Wdg_Cfg.h [new file with mode: 0644]
boards/mpc5516it/config/Wdg_Lcfg.c [new file with mode: 0644]
include/WdgM_ConfigTypes.h
system/EcuM/EcuM.c
system/EcuM/EcuM_Main.c

diff --git a/boards/mpc5516it/config/Wdg_Cfg.h b/boards/mpc5516it/config/Wdg_Cfg.h
new file mode 100644 (file)
index 0000000..29c26c4
--- /dev/null
@@ -0,0 +1,45 @@
+/* -------------------------------- Arctic Core ------------------------------\r
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
+ *\r
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
+ *\r
+ * This source code is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU General Public License version 2 as published by the\r
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
+ * for more details.\r
+ * -------------------------------- Arctic Core ------------------------------*/\r
+\r
+#ifndef WDG_CFG_H_\r
+#define WDG_CFG_H_\r
+\r
+#include "Std_Types.h"\r
+#include "WdgIf_Types.h"\r
+\r
+typedef struct\r
+{\r
+   uint32 ReloadValue;\r
+   uint8 ActivationBit;\r
+}Wdg_SettingsType;\r
+\r
+typedef struct\r
+{\r
+       WdgIf_ModeType Wdg_DefaultMode;\r
+       Wdg_SettingsType WdgSettingsFast;\r
+       Wdg_SettingsType WdgSettingsSlow;\r
+       Wdg_SettingsType WdgSettingsOff;\r
+}Wdg_ModeConfigType;\r
+\r
+typedef struct\r
+{\r
+       const Wdg_GeneralType    *Wdg_General;\r
+       const Wdg_ModeConfigType *Wdg_ModeConfig;\r
+}Wdg_ConfigType;\r
+\r
+ extern const Wdg_GeneralType WdgGeneral;\r
+ extern const Wdg_ConfigType WdgConfig;\r
+\r
+#endif /* WDG_CFG_H_ */\r
diff --git a/boards/mpc5516it/config/Wdg_Lcfg.c b/boards/mpc5516it/config/Wdg_Lcfg.c
new file mode 100644 (file)
index 0000000..b948ed6
--- /dev/null
@@ -0,0 +1,52 @@
+/* -------------------------------- Arctic Core ------------------------------\r
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
+ *\r
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
+ *\r
+ * This source code is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU General Public License version 2 as published by the\r
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
+ * for more details.\r
+ * -------------------------------- Arctic Core ------------------------------*/\r
+\r
+#include "Wdg.h"\r
+\r
+const Wdg_ModeConfigType WdgModeConfig =\r
+{\r
+       .Wdg_DefaultMode = WDGIF_OFF_MODE,\r
+       .WdgSettingsFast =\r
+       {\r
+               .ReloadValue = 0x200,\r
+               .ActivationBit = 1,\r
+       },\r
+       .WdgSettingsSlow =\r
+       {\r
+               .ReloadValue = 0x7D00,\r
+               .ActivationBit = 1,\r
+       },\r
+       .WdgSettingsOff =\r
+       {\r
+               .ReloadValue = 0x7D00,\r
+               .ActivationBit = 0,\r
+       },\r
+};\r
+\r
+const Wdg_GeneralType WdgGeneral =\r
+{\r
+       .Wdg_Index = 1,\r
+       .Wdg_TriggerLocationPtr = Wdg_Trigger,\r
+       .Wdg_SetModeLocationPtr = Wdg_SetMode,\r
+};\r
+\r
+\r
+const Wdg_ConfigType WdgConfig =\r
+{\r
+  .Wdg_General = &WdgGeneral,\r
+  .Wdg_ModeConfig = &WdgModeConfig,\r
+};\r
+\r
+\r
index cc85acd8018eac0d1d35859eac9d23addbd8b7c1..d5fef146d94f0e7e4fb238760fe1908484648f0f 100644 (file)
@@ -100,17 +100,21 @@ typedef struct
        const float32                    WdgM_TriggerCycle;\r
 }WdgM_ActivationSchMType;\r
 \r
+#if (WDGM_GPT_USED == STD_ON)\r
 typedef struct\r
 {\r
        const uint32                     WdgM_GptCycle;\r
        const Gpt_ChannelType            WdgM_GptChannelRef;\r
 }WdgM_ActivationGPTType;\r
+#endif\r
 \r
 typedef struct\r
 {\r
        const boolean                    WdgM_IsGPTActivated;\r
        const WdgM_ActivationSchMType    WdgM_ActivationSchM;\r
+#if (WDGM_GPT_USED == STD_ON)\r
        const WdgM_ActivationGPTType     WdgM_ActivationGPT;\r
+#endif\r
 }WdgM_ActivationType;\r
 \r
 typedef struct\r
index 5f3cd5689abac1fda31700554d13737de03a6b0f..8cc0886de8337fa1d3c4db38596278f77539eced 100644 (file)
@@ -186,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
index 4cfdf2465898f850c3d696a94e5465ea1ac9f5c2..128a871d0cc1cc00d8cb5ef03e165e356d7e3212 100644 (file)
@@ -269,7 +269,7 @@ static inline void in_state_appRun(void){
                EcuM_OnExitRun();       /** @req EcuM2865 */\r
 \r
 #if defined(USE_WDGM)\r
-               // This is APPRUN not RUN.. so WdgM_SetMode() should not be called?\r
+               WdgM_SetMode(internal_data.config->EcuMWdgMConfig->EcuMWdgMPostRunMode);\r
 #endif\r
 \r
 #if defined(USE_RTE) && defined(CFG_ECUM_USE_SERVICE_COMPONENT)\r
@@ -339,9 +339,17 @@ static inline void in_state_goOffOne(void){
                // Wait for the NVM job (NvmWriteAll) to terminate\r
                NvM_GetErrorStatus(0, &writeAllResult);\r
                if ((writeAllResult != NVM_REQ_PENDING) || (internal_data_go_off_one_state_timeout == 0)){\r
+\r
+#if defined(USE_WDGM)\r
+                       WdgM_SetMode(internal_data.config->EcuMWdgMConfig->EcuMWdgMShutdownMode);\r
+#endif\r
                        ShutdownOS(E_OK);\r
                }\r
 #else\r
+\r
+#if defined(USE_WDGM)\r
+               WdgM_SetMode(internal_data.config->EcuMWdgMConfig->EcuMWdgMShutdownMode);\r
+#endif\r
                ShutdownOS(E_OK);\r
 #endif\r
 }\r