driver: wdt: npcx: add WDT_OPT_PAUSE_HALTED_BY_DBG support.

This CL adds WDT_OPT_PAUSE_HALTED_BY_DBG support by enabling freeze mode.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
This commit is contained in:
Mulin Chao 2023-06-30 00:49:40 -07:00 committed by Carles Cufí
commit 2cf3caa11c
5 changed files with 90 additions and 4 deletions

View file

@ -39,6 +39,7 @@
#include <zephyr/logging/log.h>
#include <soc.h>
#include "soc_dbg.h"
LOG_MODULE_REGISTER(wdt_npcx, CONFIG_WDT_LOG_LEVEL);
/* Watchdog operating frequency is fixed to LFCLK (32.768) kHz */
@ -227,9 +228,11 @@ static int wdt_npcx_setup(const struct device *dev, uint8_t options)
return -ENOTSUP;
}
/* Stall the WDT counter when halted by debugger */
if ((options & WDT_OPT_PAUSE_HALTED_BY_DBG) != 0) {
LOG_ERR("WDT_OPT_PAUSE_HALTED_BY_DBG is not supported");
return -ENOTSUP;
npcx_dbg_freeze_enable(true);
} else {
npcx_dbg_freeze_enable(false);
}
/*