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:
Steven Chang 2024-03-31 12:14:34 +08:00 committed by Fabio Baltieri
parent 5be02da636
commit e44c0987b9
2 changed files with 2 additions and 2 deletions

View File

@ -82,7 +82,7 @@ static int wdt_kb1200_install_timeout(const struct device *dev,
data->timeout_installed = false;
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 */
if (cfg->wdt->WDTM < WDT_MIN_CNT) {
data->timeout_installed = false;

View File

@ -24,7 +24,7 @@ struct wdt_regs {
};
#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 1