Lines Matching +full:window +full:- +full:mode

4  * SPDX-License-Identifier: Apache-2.0
9 /* Include esp-idf headers first to avoid redefining BIT() macro */
44 wdt_stage_action_t mode; member
60 struct wdt_esp32_data *data = dev->data; in wdt_esp32_seal()
62 wdt_hal_write_protect_enable(&data->hal); in wdt_esp32_seal()
67 struct wdt_esp32_data *data = dev->data; in wdt_esp32_unseal()
69 wdt_hal_write_protect_disable(&data->hal); in wdt_esp32_unseal()
74 struct wdt_esp32_data *data = dev->data; in wdt_esp32_enable()
77 wdt_hal_enable(&data->hal); in wdt_esp32_enable()
84 struct wdt_esp32_data *data = dev->data; in wdt_esp32_disable()
87 wdt_hal_disable(&data->hal); in wdt_esp32_disable()
97 struct wdt_esp32_data *data = dev->data; in wdt_esp32_feed()
100 wdt_hal_feed(&data->hal); in wdt_esp32_feed()
108 struct wdt_esp32_data *data = dev->data; in wdt_esp32_set_config()
111 wdt_hal_config_stage(&data->hal, WDT_STAGE0, data->timeout, WDT_STAGE_ACTION_INT); in wdt_esp32_set_config()
112 wdt_hal_config_stage(&data->hal, WDT_STAGE1, data->timeout, data->mode); in wdt_esp32_set_config()
123 struct wdt_esp32_data *data = dev->data; in wdt_esp32_install_timeout()
125 if (cfg->window.min != 0U || cfg->window.max == 0U) { in wdt_esp32_install_timeout()
126 return -EINVAL; in wdt_esp32_install_timeout()
129 data->timeout = cfg->window.max; in wdt_esp32_install_timeout()
130 data->callback = cfg->callback; in wdt_esp32_install_timeout()
132 /* Set mode of watchdog and callback */ in wdt_esp32_install_timeout()
133 switch (cfg->flags) { in wdt_esp32_install_timeout()
135 data->mode = WDT_STAGE_ACTION_RESET_SYSTEM; in wdt_esp32_install_timeout()
136 LOG_DBG("Configuring reset SOC mode"); in wdt_esp32_install_timeout()
140 data->mode = WDT_STAGE_ACTION_RESET_CPU; in wdt_esp32_install_timeout()
141 LOG_DBG("Configuring reset CPU mode"); in wdt_esp32_install_timeout()
145 data->mode = WDT_STAGE_ACTION_OFF; in wdt_esp32_install_timeout()
146 LOG_DBG("Configuring non-reset mode"); in wdt_esp32_install_timeout()
151 return -EINVAL; in wdt_esp32_install_timeout()
159 const struct wdt_esp32_config *const config = dev->config; in wdt_esp32_init()
160 struct wdt_esp32_data *data = dev->data; in wdt_esp32_init()
163 if (!device_is_ready(config->clock_dev)) { in wdt_esp32_init()
165 return -ENODEV; in wdt_esp32_init()
168 clock_control_on(config->clock_dev, config->clock_subsys); in wdt_esp32_init()
170 wdt_hal_init(&data->hal, config->wdt_inst, MWDT_TICK_PRESCALER, true); in wdt_esp32_init()
172 flags = ESP_PRIO_TO_FLAGS(config->irq_priority) | ESP_INT_FLAGS_CHECK(config->irq_flags); in wdt_esp32_init()
173 ret = esp_intr_alloc(config->irq_source, flags, (ISR_HANDLER)wdt_esp32_isr, (void *)dev, in wdt_esp32_init()
217 struct wdt_esp32_data *data = dev->data; in wdt_esp32_isr()
219 if (data->callback) { in wdt_esp32_isr()
220 data->callback(dev, 0); in wdt_esp32_isr()
223 wdt_hal_handle_intr(&data->hal); in wdt_esp32_isr()