Lines Matching +full:timeout +full:- +full:period

5  * SPDX-License-Identifier: Apache-2.0
28 * to select its timeout period.
50 /* Find the rounded up value of cycles for supplied timeout. When using ULFRCO
51 * (default), 1 cycle is 1 ms +/- 12%.
53 static int wdt_gecko_get_persel_from_timeout(uint32_t timeout) in wdt_gecko_get_persel_from_timeout() argument
58 if (wdt_gecko_get_timeout_from_persel(idx) >= timeout) { in wdt_gecko_get_persel_from_timeout()
66 static int wdt_gecko_convert_window(uint32_t window, uint32_t period) in wdt_gecko_convert_window() argument
71 incr_val = period / 8; in wdt_gecko_convert_window()
75 * timeout period up to 87.5% (= 7 * 12.5%) in wdt_gecko_convert_window()
92 const struct wdt_gecko_cfg *config = dev->config; in wdt_gecko_setup()
93 struct wdt_gecko_data *data = dev->data; in wdt_gecko_setup()
94 WDOG_TypeDef *wdog = config->base; in wdt_gecko_setup()
96 if (!data->timeout_installed) { in wdt_gecko_setup()
98 return -EINVAL; in wdt_gecko_setup()
101 data->wdog_config.em2Run = in wdt_gecko_setup()
103 data->wdog_config.em3Run = in wdt_gecko_setup()
106 data->wdog_config.debugRun = in wdt_gecko_setup()
109 if (data->callback != NULL) { in wdt_gecko_setup()
113 /* Enable timeout interrupt */ in wdt_gecko_setup()
116 /* Disable timeout interrupt */ in wdt_gecko_setup()
121 WDOGn_Init(wdog, &data->wdog_config); in wdt_gecko_setup()
129 const struct wdt_gecko_cfg *config = dev->config; in wdt_gecko_disable()
130 struct wdt_gecko_data *data = dev->data; in wdt_gecko_disable()
131 WDOG_TypeDef *wdog = config->base; in wdt_gecko_disable()
134 data->timeout_installed = false; in wdt_gecko_disable()
143 struct wdt_gecko_data *data = dev->data; in wdt_gecko_install_timeout()
144 data->wdog_config = (WDOG_Init_TypeDef)WDOG_INIT_DEFAULT; in wdt_gecko_install_timeout()
147 if (data->timeout_installed) { in wdt_gecko_install_timeout()
149 return -ENOMEM; in wdt_gecko_install_timeout()
152 if ((cfg->window.max < wdt_gecko_get_timeout_from_persel(0)) || in wdt_gecko_install_timeout()
153 (cfg->window.max > wdt_gecko_get_timeout_from_persel( in wdt_gecko_install_timeout()
155 LOG_ERR("Upper limit timeout out of range"); in wdt_gecko_install_timeout()
156 return -EINVAL; in wdt_gecko_install_timeout()
160 data->wdog_config.clkSel = wdogClkSelULFRCO; in wdt_gecko_install_timeout()
163 data->wdog_config.perSel = (WDOG_PeriodSel_TypeDef) in wdt_gecko_install_timeout()
164 wdt_gecko_get_persel_from_timeout(cfg->window.max); in wdt_gecko_install_timeout()
167 data->wdog_config.perSel); in wdt_gecko_install_timeout()
168 LOG_INF("Installed timeout value: %u", installed_timeout); in wdt_gecko_install_timeout()
170 if (cfg->window.min > 0) { in wdt_gecko_install_timeout()
171 /* Window mode. Use rounded up timeout value to in wdt_gecko_install_timeout()
174 data->wdog_config.winSel = (WDOG_WinSel_TypeDef) in wdt_gecko_install_timeout()
175 wdt_gecko_convert_window(cfg->window.min, in wdt_gecko_install_timeout()
179 (installed_timeout / 8) * data->wdog_config.winSel); in wdt_gecko_install_timeout()
182 data->wdog_config.winSel = wdogIllegalWindowDisable; in wdt_gecko_install_timeout()
186 switch (cfg->flags) { in wdt_gecko_install_timeout()
189 if (cfg->callback != NULL) { in wdt_gecko_install_timeout()
191 return -ENOTSUP; in wdt_gecko_install_timeout()
193 data->wdog_config.resetDisable = false; in wdt_gecko_install_timeout()
198 data->wdog_config.resetDisable = true; in wdt_gecko_install_timeout()
199 data->callback = cfg->callback; in wdt_gecko_install_timeout()
200 LOG_DBG("Configuring non-reset mode\n"); in wdt_gecko_install_timeout()
205 return -EINVAL; in wdt_gecko_install_timeout()
208 data->timeout_installed = true; in wdt_gecko_install_timeout()
215 const struct wdt_gecko_cfg *config = dev->config; in wdt_gecko_feed()
216 WDOG_TypeDef *wdog = config->base; in wdt_gecko_feed()
220 return -EINVAL; in wdt_gecko_feed()
231 const struct wdt_gecko_cfg *config = dev->config; in wdt_gecko_isr()
232 struct wdt_gecko_data *data = dev->data; in wdt_gecko_isr()
233 WDOG_TypeDef *wdog = config->base; in wdt_gecko_isr()
240 if (data->callback != NULL) { in wdt_gecko_isr()
241 data->callback(dev, 0); in wdt_gecko_isr()
247 const struct wdt_gecko_cfg *config = dev->config; in wdt_gecko_init()
258 CMU_ClockEnable(config->clock, true); in wdt_gecko_init()
261 CMU_ClockSelectSet(config->clock, cmuSelect_ULFRCO); in wdt_gecko_init()
267 config->irq_cfg_func(); in wdt_gecko_init()
269 LOG_INF("Device %s initialized", dev->name); in wdt_gecko_init()