Lines Matching +full:divider +full:- +full:int +full:- +full:4

4  * SPDX-License-Identifier: Apache-2.0
37 #error Must be initial-timeout > 0
41 #error Must be initial-timeout <= (256 * 4095 * 1000 / GD32_LOW_SPEED_IRC_FREQUENCY)
51 * @return 0 on success, -EINVAL if the timeout is out of range
53 static int gd32_fwdgt_calc_timeout(uint32_t timeout, uint32_t *prescaler, in gd32_fwdgt_calc_timeout()
56 uint16_t divider = 4U; in gd32_fwdgt_calc_timeout() local
61 while ((ticks / divider) > FWDGT_RELOAD_MAX) { in gd32_fwdgt_calc_timeout()
63 divider = 4U << shift; in gd32_fwdgt_calc_timeout()
67 return -EINVAL; in gd32_fwdgt_calc_timeout()
72 *reload = (ticks / divider) - 1U; in gd32_fwdgt_calc_timeout()
77 static int gd32_fwdgt_setup(const struct device *dev, uint8_t options) in gd32_fwdgt_setup()
86 return -ENOTSUP; in gd32_fwdgt_setup()
92 return -ENOTSUP; in gd32_fwdgt_setup()
100 static int gd32_fwdgt_disable(const struct device *dev) in gd32_fwdgt_disable()
105 return -EPERM; in gd32_fwdgt_disable()
108 static int gd32_fwdgt_install_timeout(const struct device *dev, in gd32_fwdgt_install_timeout()
116 if (config->callback != NULL) { in gd32_fwdgt_install_timeout()
118 return -ENOTSUP; in gd32_fwdgt_install_timeout()
122 if (gd32_fwdgt_calc_timeout(config->window.max, &prescaler, in gd32_fwdgt_install_timeout()
125 return -EINVAL; in gd32_fwdgt_install_timeout()
133 return -EINVAL; in gd32_fwdgt_install_timeout()
140 static int gd32_fwdgt_feed(const struct device *dev, int channel_id) in gd32_fwdgt_feed()
156 static int gd32_fwdgt_init(const struct device *dev) in gd32_fwdgt_init()
158 int ret = 0; in gd32_fwdgt_init()