driver: watchdog: prevent floating point usage
Prevent the use of floating point operations Signed-off-by: Steven Chang <steven@ene.com.tw>
This commit is contained in:
parent
5be02da636
commit
e44c0987b9
|
@ -82,7 +82,7 @@ static int wdt_kb1200_install_timeout(const struct device *dev,
|
||||||
data->timeout_installed = false;
|
data->timeout_installed = false;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
cfg->wdt->WDTM = (config->window.max) / WDT_SAMPLE_TIME;
|
cfg->wdt->WDTM = (config->window.max * 1000) / WDT_TICK_TIME_US;
|
||||||
/* (HW design) The counter match value must be >= 3 */
|
/* (HW design) The counter match value must be >= 3 */
|
||||||
if (cfg->wdt->WDTM < WDT_MIN_CNT) {
|
if (cfg->wdt->WDTM < WDT_MIN_CNT) {
|
||||||
data->timeout_installed = false;
|
data->timeout_installed = false;
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct wdt_regs {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define WDT_MIN_CNT 3U
|
#define WDT_MIN_CNT 3U
|
||||||
#define WDT_SAMPLE_TIME 31.25
|
#define WDT_TICK_TIME_US 31250
|
||||||
|
|
||||||
#define WDT_RESET_WHOLE_CHIP_WO_GPIO 0
|
#define WDT_RESET_WHOLE_CHIP_WO_GPIO 0
|
||||||
#define WDT_RESET_WHOLE_CHIP 1
|
#define WDT_RESET_WHOLE_CHIP 1
|
||||||
|
|
Loading…
Reference in a new issue