|
@@ -13,7 +13,10 @@
|
|
|
#include "slpman_ec616.h"
|
|
|
#include "plat_config.h"
|
|
|
#include "debug_log.h"
|
|
|
-
|
|
|
+#if (WDT_FEATURE_ENABLE==1)
|
|
|
+#include "wdt_ec616.h"
|
|
|
+#define WDT_TIMEOUT_VALUE (20) // in unit of second, shall be less than 256s
|
|
|
+#endif
|
|
|
#ifdef BL_FILE_LOG
|
|
|
extern uint8_t lockoutState;
|
|
|
#endif
|
|
@@ -132,7 +135,25 @@ static void PMU_WakeupPadInit(void)
|
|
|
|
|
|
slpManSetWakeupPad(cfg);
|
|
|
}
|
|
|
+#if (WDT_FEATURE_ENABLE == 1)
|
|
|
|
|
|
+/*
|
|
|
+ * WDT Initialize, wdt timeout value is 20s
|
|
|
+ * Parameter: none
|
|
|
+ */
|
|
|
+void BSP_WdtInit(void)
|
|
|
+{
|
|
|
+ // Config WDT clock, source from 32.768KHz and divide by WDT_TIMEOUT_VALUE
|
|
|
+ GPR_SetClockSrc(GPR_WDGFuncClk, GPR_WDGClkSel_32K);
|
|
|
+ GPR_SetClockDiv(GPR_WDGFuncClk, WDT_TIMEOUT_VALUE);
|
|
|
+
|
|
|
+ wdt_config_t wdtConfig;
|
|
|
+ wdtConfig.mode = WDT_InterruptResetMode;
|
|
|
+ wdtConfig.timeoutValue = 32768U;
|
|
|
+ WDT_Init(&wdtConfig);
|
|
|
+}
|
|
|
+
|
|
|
+#endif
|
|
|
/*
|
|
|
* custom board related init
|
|
|
* Parameter: none
|
|
@@ -167,7 +188,13 @@ void BSP_CustomInit(void)
|
|
|
}
|
|
|
#endif
|
|
|
#endif
|
|
|
-
|
|
|
+#if (WDT_FEATURE_ENABLE == 1)
|
|
|
+ if(BSP_GetPlatConfigItemValue(PLAT_CONFIG_ITEM_START_WDT))
|
|
|
+ {
|
|
|
+ BSP_WdtInit();
|
|
|
+ WDT_Start();
|
|
|
+ }
|
|
|
+#endif
|
|
|
slpManGetPMUSettings();
|
|
|
|
|
|
PMU_WakeupPadInit();
|