From: Nathael Pajani Date: Mon, 23 Nov 2015 12:17:35 +0000 (+0100) Subject: Improve the name of watchdog config fields X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=0942856df2c8cb499f537798d36605300c1f66ad;p=soft%2Flpc122x%2Fcore Improve the name of watchdog config fields --- diff --git a/core/watchdog.c b/core/watchdog.c index 431181b..a9d0974 100644 --- a/core/watchdog.c +++ b/core/watchdog.c @@ -161,17 +161,17 @@ void watchdog_config(const struct wdt_config* wd_conf) wdt->clk_src_sel = LPC_WDT_CLK_WDOSC; } /* Use the windows functionnality ? */ - if (wd_conf->nb_clk_win > 0x100) { - wdt->window_compare = (wd_conf->nb_clk_win & LPC_WDT_TIMER_MAX); + if (wd_conf->wdt_window > 0x100) { + wdt->window_compare = (wd_conf->wdt_window & LPC_WDT_TIMER_MAX); } else { wdt->window_compare = LPC_WDT_TIMER_MAX; } /* Warning interrupt ? */ - if (wd_conf->nb_clk_warn != 0) { - if (wd_conf->nb_clk_warn > LPC_WDT_WARNINT_MAXVAL) { + if (wd_conf->wdt_warn != 0) { + if (wd_conf->wdt_warn > LPC_WDT_WARNINT_MAXVAL) { wdt->warning_int_compare = LPC_WDT_WARNINT_MAXVAL; } else { - wdt->warning_int_compare = wd_conf->nb_clk_warn; + wdt->warning_int_compare = wd_conf->wdt_warn; } } /* Protect any of the watchdog functions now ? */ diff --git a/include/core/watchdog.h b/include/core/watchdog.h index d261e9f..54b40c5 100644 --- a/include/core/watchdog.h +++ b/include/core/watchdog.h @@ -45,9 +45,12 @@ struct wdt_config { int clk_sel; int intr_mode_only; /* If set to 1, a watchdog timeout will trigger an interrupt instead of a reset */ uint32_t locks; /* Bitfield from WDT_*_LOCK defined in watchdog.h */ - uint32_t nb_clk; /* Watchdog timer reload value : 0x3FF to 0x03FFFFFF */ - uint32_t nb_clk_win; /* Watchdog window value : 0x100 to 0x00FFFFFF */ - uint16_t nb_clk_warn; /* 0x00 to 0x3FF */ + /* Number of clk_src clocks before the watchdog timer times out. Will be divided by 4 to give + * the watchdog reload value */ + uint32_t nb_clk; /* 0x3FF to 0x03FFFFFF */ + /* The next two values are relative to the timer value, not the number of clk_src clocks. */ + uint32_t wdt_window; /* Watchdog window value : 0x100 to 0x00FFFFFF */ + uint16_t wdt_warn; /* 0x00 to 0x3FF */ }; /***************************************************************************** */