+
/***************************************************************************** */
void watchdog_feed(void)
{
return wdt->timer_value;
}
+
/* Change the watchdog timer value, if not protected */
+#define LPC_WDT_TIMER_MAX 0xFFFFFF /* This one is the shiffted value, and must not be exported to user */
void watchdog_set_timer_val(uint32_t nb_clk)
{
struct lpc_watchdog* wdt = LPC_WDT;
/* Power wadchdog block before changing it's configuration */
subsystem_power(LPC_SYS_AHB_CLK_CTRL_Watchdog, 1);
- /* Configure the watchdog clock source frequency */
- sys_config->WDT_osc_ctrl = LPC_WDT_CLK_DIVIDER(4) | LPC_WDT_FREQSEL_4MHz; /* 1MHz */
/* Power ON Watchdog clock */
sys_config->powerdown_run_cfg &= ~(LPC_POWER_DOWN_WDT_OSC);
+ /* Configure the watchdog clock source frequency */
+ sys_config->WDT_osc_ctrl = LPC_WDT_CLK_DIVIDER(4) | LPC_WDT_FREQSEL_4MHz; /* 1MHz */
/* Configure watchdog timeout for normal operation */
wdt->timer_const = ((wd_conf->nb_clk >> 2) & LPC_WDT_TIMER_MAX);
}
}
+ /* Enable Watchdog as wakeup source from deep sleep and power down modes */
+ enable_intr_wake_source(LPC_WWDT_INT_WAKEUP_EN);
+
/* Feed sequence to validate the configuration */
watchdog_feed();
/* Return current watchdog timer value */
uint32_t watchdog_get_timer_val(void);
-/* Change the watchdog timer value, if not protected */
+/* Change the watchdog timer value, if not protected
+ * The change will take effect at the next watchdog feed.
+ */
void watchdog_set_timer_val(uint32_t nb_clk);
};
#define LPC_WDT ((struct lpc_watchdog *) LPC_WDT_BASE)
-#define LPC_WDT_TIMER_MAX 0xFFFFFF
+#define LPC_WATCHDOG_TIMER_MAX_VAL 0x03FFFFFF
/* Mode register */
#define LPC_WDT_EN (0x01 << 0)