aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/apps
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-03-03 19:01:53 +0100
committerHarald Welte <laforge@gnumonks.org>2017-03-03 19:01:53 +0100
commit45ebe4591a6158239d6d8d6c637ec0ef2410a3c6 (patch)
tree0dc63ef19696039729a68c93f9c5b0f14d26a8df /firmware/apps
parentaaba4af46cbfa14ae064ae73d5aacb4ac1fa03c7 (diff)
Enable Watchdog (500ms)
Diffstat (limited to 'firmware/apps')
-rw-r--r--firmware/apps/cardem/main.c7
-rw-r--r--firmware/apps/dfu/main.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/firmware/apps/cardem/main.c b/firmware/apps/cardem/main.c
index 8b6be49..7660294 100644
--- a/firmware/apps/cardem/main.c
+++ b/firmware/apps/cardem/main.c
@@ -125,8 +125,9 @@ extern int main(void)
LED_Configure(LED_NUM_GREEN);
LED_Set(LED_NUM_RED);
- /* Disable watchdog */
- WDT_Disable(WDT);
+ /* Enable watchdog for 500ms, with no window */
+ WDT_Enable(WDT, WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
+ (WDT_GetPeriod(500) << 16) | WDT_GetPeriod(500));
req_ctx_init();
@@ -149,6 +150,7 @@ extern int main(void)
SIMtrace_USB_Initialize();
while (USBD_GetState() < USBD_STATE_CONFIGURED) {
+ WDT_Restart(WDT);
check_exec_dbg_cmd();
#if 0
if (i >= MAX_USB_ITER * 3) {
@@ -174,6 +176,7 @@ extern int main(void)
TRACE_INFO("entering main loop...\n\r");
while (1) {
+ WDT_Restart(WDT);
#if TRACE_LEVEL >= TRACE_LEVEL_DEBUG
const char rotor[] = { '-', '\\', '|', '/' };
putchar('\b');
diff --git a/firmware/apps/dfu/main.c b/firmware/apps/dfu/main.c
index f11562a..4e03061 100644
--- a/firmware/apps/dfu/main.c
+++ b/firmware/apps/dfu/main.c
@@ -130,8 +130,10 @@ extern int main(void)
LED_Configure(LED_NUM_GREEN);
LED_Set(LED_NUM_RED);
- /* Disable watchdog */
- WDT_Disable(WDT);
+
+ /* Enable watchdog for 500ms, with no window */
+ WDT_Enable(WDT, WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
+ (WDT_GetPeriod(500) << 16) | WDT_GetPeriod(500));
//req_ctx_init();
@@ -156,6 +158,7 @@ extern int main(void)
USBDFU_Initialize(&dfu_descriptors);
while (USBD_GetState() < USBD_STATE_CONFIGURED) {
+ WDT_Restart(WDT);
check_exec_dbg_cmd();
#if 1
if (i >= MAX_USB_ITER * 3) {
@@ -171,6 +174,7 @@ extern int main(void)
FLASHD_Initialize(BOARD_MCK, 1);
TRACE_INFO("entering main loop...\n\r");
while (1) {
+ WDT_Restart(WDT);
#if TRACE_LEVEL >= TRACE_LEVEL_DEBUG
const char rotor[] = { '-', '\\', '|', '/' };
putchar('\b');