Lines Matching +full:zephyr +full:- +full:base

4  * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/drivers/pinctrl.h>
10 #include <zephyr/drivers/watchdog.h>
11 #include <zephyr/sys_clock.h>
15 #include <zephyr/logging/log.h>
16 #include <zephyr/irq.h>
19 #define WDOG_TMOUT_SEC(x) (((x * 2) / MSEC_PER_SEC) - 1)
22 WDOG_Type *base; member
35 const struct mcux_wdog_config *config = dev->config; in mcux_wdog_setup()
36 struct mcux_wdog_data *data = dev->data; in mcux_wdog_setup()
37 WDOG_Type *base = config->base; in mcux_wdog_setup() local
39 if (!data->timeout_valid) { in mcux_wdog_setup()
41 return -EINVAL; in mcux_wdog_setup()
44 data->wdog_config.workMode.enableStop = in mcux_wdog_setup()
47 data->wdog_config.workMode.enableDebug = in mcux_wdog_setup()
50 WDOG_Init(base, &data->wdog_config); in mcux_wdog_setup()
58 const struct mcux_wdog_config *config = dev->config; in mcux_wdog_disable()
59 struct mcux_wdog_data *data = dev->data; in mcux_wdog_disable()
60 WDOG_Type *base = config->base; in mcux_wdog_disable() local
62 WDOG_Deinit(base); in mcux_wdog_disable()
63 data->timeout_valid = false; in mcux_wdog_disable()
72 struct mcux_wdog_data *data = dev->data; in mcux_wdog_install_timeout()
74 if (data->timeout_valid) { in mcux_wdog_install_timeout()
76 return -ENOMEM; in mcux_wdog_install_timeout()
79 WDOG_GetDefaultConfig(&data->wdog_config); in mcux_wdog_install_timeout()
80 data->wdog_config.interruptTimeValue = 0U; in mcux_wdog_install_timeout()
82 if (cfg->window.max < (MSEC_PER_SEC / 2)) { in mcux_wdog_install_timeout()
84 return -EINVAL; in mcux_wdog_install_timeout()
87 data->wdog_config.timeoutValue = in mcux_wdog_install_timeout()
88 WDOG_TMOUT_SEC(cfg->window.max); in mcux_wdog_install_timeout()
90 if (cfg->window.min) { in mcux_wdog_install_timeout()
92 return -EINVAL; in mcux_wdog_install_timeout()
94 if (data->wdog_config.timeoutValue > 128) { in mcux_wdog_install_timeout()
95 LOG_ERR("Invalid timeoutValue, valid (0.5s - 128.0s)"); in mcux_wdog_install_timeout()
96 return -EINVAL; in mcux_wdog_install_timeout()
99 data->wdog_config.enableInterrupt = cfg->callback != NULL; in mcux_wdog_install_timeout()
100 data->callback = cfg->callback; in mcux_wdog_install_timeout()
101 data->timeout_valid = true; in mcux_wdog_install_timeout()
108 const struct mcux_wdog_config *config = dev->config; in mcux_wdog_feed()
109 WDOG_Type *base = config->base; in mcux_wdog_feed() local
113 return -EINVAL; in mcux_wdog_feed()
116 WDOG_Refresh(base); in mcux_wdog_feed()
124 const struct mcux_wdog_config *config = dev->config; in mcux_wdog_isr()
125 struct mcux_wdog_data *data = dev->data; in mcux_wdog_isr()
126 WDOG_Type *base = config->base; in mcux_wdog_isr() local
129 flags = WDOG_GetStatusFlags(base); in mcux_wdog_isr()
130 WDOG_ClearInterruptStatus(base, flags); in mcux_wdog_isr()
132 if (data->callback) { in mcux_wdog_isr()
133 data->callback(dev, 0); in mcux_wdog_isr()
139 const struct mcux_wdog_config *config = dev->config; in mcux_wdog_init()
142 config->irq_config_func(dev); in mcux_wdog_init()
144 ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); in mcux_wdog_init()
145 if (ret < 0 && ret != -ENOENT) { in mcux_wdog_init()
164 .base = (WDOG_Type *) DT_INST_REG_ADDR(0),