Skip to content

Commit

Permalink
Merge pull request #14555 from OpenNuvoton/nuvoton_wdt_stop-n-kick
Browse files Browse the repository at this point in the history
Nuvoton: Fix hal_watchdog_kick() with WDT stopped
  • Loading branch information
0xc0170 committed Apr 30, 2021
2 parents 1f57702 + d489c92 commit 0a6f769
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_M451/watchdog_api.c
Expand Up @@ -125,6 +125,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)

void hal_watchdog_kick(void)
{
/* If a watchdog is not running, this function does nothing */
if (!(WDT->CTL & WDT_CTL_WDTEN_Msk)) {
return;
}

wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
watchdog_setup_cascade_timeout();
}
Expand Down
5 changes: 5 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_M480/watchdog_api.c
Expand Up @@ -126,6 +126,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)

void hal_watchdog_kick(void)
{
/* If a watchdog is not running, this function does nothing */
if (!(WDT->CTL & WDT_CTL_WDTEN_Msk)) {
return;
}

wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
watchdog_setup_cascade_timeout();
}
Expand Down
5 changes: 5 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_NANO100/watchdog_api.c
Expand Up @@ -123,6 +123,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)

void hal_watchdog_kick(void)
{
/* If a watchdog is not running, this function does nothing */
if (!(WDT->CTL & WDT_CTL_WTE_Msk)) {
return;
}

wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
watchdog_setup_cascade_timeout();
}
Expand Down
5 changes: 5 additions & 0 deletions targets/TARGET_NUVOTON/TARGET_NUC472/watchdog_api.c
Expand Up @@ -124,6 +124,11 @@ watchdog_status_t hal_watchdog_init(const watchdog_config_t *config)

void hal_watchdog_kick(void)
{
/* If a watchdog is not running, this function does nothing */
if (!(WDT->CTL & WDT_CTL_WDTEN_Msk)) {
return;
}

wdt_timeout_rmn_clk = NU_MS2WDTCLK(wdt_timeout_reload_ms);
watchdog_setup_cascade_timeout();
}
Expand Down

0 comments on commit 0a6f769

Please sign in to comment.