Lines Matching +full:per +full:-

5  * SPDX-License-Identifier: Apache-2.0
32 #define WDT_SYNCBUSY WDT_REGS->STATUS.bit.SYNCBUSY
34 #define WDT_SYNCBUSY WDT_REGS->SYNCBUSY.reg
54 WDT_REGS->CTRLA.bit.ENABLE = on; in wdt_sam0_set_enable()
56 WDT_REGS->CTRL.bit.ENABLE = on; in wdt_sam0_set_enable()
63 return WDT_REGS->CTRLA.bit.ENABLE; in wdt_sam0_is_enabled()
65 return WDT_REGS->CTRL.bit.ENABLE; in wdt_sam0_is_enabled()
83 next_pow2 = (1ULL << 32) >> __builtin_clz(cycles - 1); in wdt_sam0_timeout_to_wdt_period()
89 struct wdt_sam0_dev_data *data = dev->data; in wdt_sam0_isr()
91 WDT_REGS->INTFLAG.reg = WDT_INTFLAG_EW; in wdt_sam0_isr()
93 if (data->cb != NULL) { in wdt_sam0_isr()
94 data->cb(dev, 0); in wdt_sam0_isr()
100 struct wdt_sam0_dev_data *data = dev->data; in wdt_sam0_setup()
104 return -EBUSY; in wdt_sam0_setup()
107 if (!data->timeout_valid) { in wdt_sam0_setup()
109 return -EINVAL; in wdt_sam0_setup()
114 return -ENOTSUP; in wdt_sam0_setup()
119 return -ENOTSUP; in wdt_sam0_setup()
132 return -EFAULT; in wdt_sam0_disable()
144 struct wdt_sam0_dev_data *data = dev->data; in wdt_sam0_install_timeout()
145 uint32_t window, per; in wdt_sam0_install_timeout() local
150 return -EBUSY; in wdt_sam0_install_timeout()
153 if (cfg->flags != WDT_FLAG_RESET_SOC) { in wdt_sam0_install_timeout()
155 return -ENOTSUP; in wdt_sam0_install_timeout()
158 if (cfg->window.max == 0) { in wdt_sam0_install_timeout()
160 return -EINVAL; in wdt_sam0_install_timeout()
163 per = wdt_sam0_timeout_to_wdt_period(cfg->window.max); in wdt_sam0_install_timeout()
164 if (per > WDT_CONFIG_PER_16K_Val) { in wdt_sam0_install_timeout()
169 if (cfg->window.min) { in wdt_sam0_install_timeout()
171 window = wdt_sam0_timeout_to_wdt_period(cfg->window.min); in wdt_sam0_install_timeout()
176 if (per <= window) { in wdt_sam0_install_timeout()
178 per = window + 1; in wdt_sam0_install_timeout()
181 WDT_REGS->CTRLA.bit.WEN = 1; in wdt_sam0_install_timeout()
183 WDT_REGS->CTRL.bit.WEN = 1; in wdt_sam0_install_timeout()
188 if (cfg->callback) { in wdt_sam0_install_timeout()
189 if (per == WDT_CONFIG_PER_8_Val) { in wdt_sam0_install_timeout()
191 per += 1U; in wdt_sam0_install_timeout()
193 WDT_REGS->EWCTRL.bit.EWOFFSET = per - 1U; in wdt_sam0_install_timeout()
197 WDT_REGS->CTRLA.bit.WEN = 0; in wdt_sam0_install_timeout()
199 WDT_REGS->CTRL.bit.WEN = 0; in wdt_sam0_install_timeout()
204 WDT_REGS->CONFIG.reg = WDT_CONFIG_WINDOW(window) | WDT_CONFIG_PER(per); in wdt_sam0_install_timeout()
208 data->cb = cfg->callback; in wdt_sam0_install_timeout()
209 if (data->cb) { in wdt_sam0_install_timeout()
210 WDT_REGS->INTENSET.reg = WDT_INTENSET_EW; in wdt_sam0_install_timeout()
212 WDT_REGS->INTENCLR.reg = WDT_INTENCLR_EW; in wdt_sam0_install_timeout()
213 WDT_REGS->INTFLAG.reg = WDT_INTFLAG_EW; in wdt_sam0_install_timeout()
216 data->timeout_valid = true; in wdt_sam0_install_timeout()
221 data->timeout_valid = false; in wdt_sam0_install_timeout()
222 data->cb = NULL; in wdt_sam0_install_timeout()
224 return -EINVAL; in wdt_sam0_install_timeout()
229 struct wdt_sam0_dev_data *data = dev->data; in wdt_sam0_feed()
231 if (!data->timeout_valid) { in wdt_sam0_feed()
233 return -EINVAL; in wdt_sam0_feed()
237 return -EAGAIN; in wdt_sam0_feed()
240 WDT_REGS->CLEAR.reg = WDT_CLEAR_CLEAR_KEY_Val; in wdt_sam0_feed()
260 MCLK->APBAMASK.bit.WDT_ = 1; in wdt_sam0_init()
264 PM->APBAMASK.bit.WDT_ = 1; in wdt_sam0_init()
267 GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID_WDT in wdt_sam0_init()