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

4  * SPDX-License-Identifier: Apache-2.0
44 const struct wdt_litex_config *config = dev->config; in wdt_litex_is_enabled()
46 return litex_read8(config->control_addr) & BIT(0); in wdt_litex_is_enabled()
51 const struct wdt_litex_config *config = dev->config; in wdt_litex_irq_enable()
52 struct wdt_litex_data *data = dev->data; in wdt_litex_irq_enable()
54 if (!data->callback) { in wdt_litex_irq_enable()
58 litex_write8(BIT(0), config->ev_pending_addr); in wdt_litex_irq_enable()
60 litex_write8(BIT(0), config->ev_enable_addr); in wdt_litex_irq_enable()
65 const struct wdt_litex_config *config = dev->config; in wdt_litex_enable()
66 struct wdt_litex_data *data = dev->data; in wdt_litex_enable()
69 if (config->cycles_size <= 4) { in wdt_litex_enable()
70 litex_write32(k_ms_to_cyc_floor32(data->timeout), config->cycles_addr); in wdt_litex_enable()
72 litex_write64(k_ms_to_cyc_floor64(data->timeout), config->cycles_addr); in wdt_litex_enable()
77 if (data->reset_soc_mode) { in wdt_litex_enable()
80 if (data->pause_halted) { in wdt_litex_enable()
84 litex_write32(control, config->control_addr); in wdt_litex_enable()
91 const struct wdt_litex_config *config = dev->config; in wdt_litex_disable()
93 litex_write8(0, config->ev_enable_addr); in wdt_litex_disable()
96 return -EFAULT; in wdt_litex_disable()
98 litex_write16(CONTROL_ENABLE_BIT, config->control_addr); in wdt_litex_disable()
105 const struct wdt_litex_config *config = dev->config; in wdt_litex_feed()
108 return -EINVAL; in wdt_litex_feed()
111 litex_write8(CONTROL_FEED_BIT, config->control_addr); in wdt_litex_feed()
118 struct wdt_litex_data *data = dev->data; in wdt_litex_setup()
120 data->pause_halted = !!(options & WDT_OPT_PAUSE_HALTED_BY_DBG); in wdt_litex_setup()
123 return -ENOTSUP; in wdt_litex_setup()
127 return -EBUSY; in wdt_litex_setup()
138 const struct wdt_litex_config *config = dev->config; in wdt_litex_install_timeout()
139 struct wdt_litex_data *data = dev->data; in wdt_litex_install_timeout()
141 if (cfg->window.min != 0U || cfg->window.max == 0U) { in wdt_litex_install_timeout()
142 return -EINVAL; in wdt_litex_install_timeout()
145 if (cfg->window.max > (config->cycles_size <= 4 ? k_cyc_to_ms_floor32(UINT32_MAX) in wdt_litex_install_timeout()
147 return -EINVAL; in wdt_litex_install_timeout()
151 return -EBUSY; in wdt_litex_install_timeout()
154 data->timeout = cfg->window.max; in wdt_litex_install_timeout()
155 data->callback = cfg->callback; in wdt_litex_install_timeout()
157 /* Set mode of watchdog and callback */ in wdt_litex_install_timeout()
158 switch (cfg->flags) { in wdt_litex_install_timeout()
160 LOG_DBG("Configuring reset SOC mode"); in wdt_litex_install_timeout()
161 data->reset_soc_mode = true; in wdt_litex_install_timeout()
165 LOG_DBG("Configuring non-reset mode"); in wdt_litex_install_timeout()
166 data->reset_soc_mode = false; in wdt_litex_install_timeout()
171 return -EINVAL; in wdt_litex_install_timeout()
180 const struct wdt_litex_config *config = dev->config; in wdt_litex_isr()
181 struct wdt_litex_data *data = dev->data; in wdt_litex_isr()
184 if (data->callback) { in wdt_litex_isr()
185 data->callback(dev, 0); in wdt_litex_isr()
188 litex_write8(BIT(0), config->ev_pending_addr); in wdt_litex_isr()
195 const struct wdt_litex_config *const config = dev->config; in wdt_litex_init()
197 config->irq_cfg_func(); in wdt_litex_init()