Lines Matching +full:backup +full:- +full:switch +full:- +full:mode

4  * SPDX-License-Identifier: Apache-2.0
53 switch (chan_id) { in chan_id2cc_idx()
93 struct counter_gecko_data *const dev_data = dev->data; in counter_gecko_set_top_value()
99 const struct counter_gecko_config *const dev_cfg = dev->config; in counter_gecko_set_top_value()
101 if (dev_cfg->prescaler != 1) { in counter_gecko_set_top_value()
103 return -EINVAL; in counter_gecko_set_top_value()
109 if (dev_data->alarm[i].callback) { in counter_gecko_set_top_value()
110 return -EBUSY; in counter_gecko_set_top_value()
116 dev_data->top_callback = cfg->callback; in counter_gecko_set_top_value()
117 dev_data->top_user_data = cfg->user_data; in counter_gecko_set_top_value()
118 ticks = cfg->ticks; in counter_gecko_set_top_value()
119 flags = cfg->flags; in counter_gecko_set_top_value()
131 err = -ETIME; in counter_gecko_set_top_value()
154 struct counter_gecko_data *const dev_data = dev->data; in counter_gecko_set_alarm()
158 if ((top_value != 0) && (alarm_cfg->ticks > top_value)) { in counter_gecko_set_alarm()
159 return -EINVAL; in counter_gecko_set_alarm()
161 if (dev_data->alarm[chan_id].callback != NULL) { in counter_gecko_set_alarm()
162 return -EBUSY; in counter_gecko_set_alarm()
165 if ((alarm_cfg->flags & COUNTER_ALARM_CFG_ABSOLUTE) != 0) { in counter_gecko_set_alarm()
166 ccv = alarm_cfg->ticks; in counter_gecko_set_alarm()
169 ccv = count + alarm_cfg->ticks; in counter_gecko_set_alarm()
171 uint64_t ccv64 = count + alarm_cfg->ticks; in counter_gecko_set_alarm()
181 dev_data->alarm[chan_id].callback = alarm_cfg->callback; in counter_gecko_set_alarm()
182 dev_data->alarm[chan_id].user_data = alarm_cfg->user_data; in counter_gecko_set_alarm()
197 struct counter_gecko_data *const dev_data = dev->data; in counter_gecko_cancel_alarm()
205 dev_data->alarm[chan_id].callback = NULL; in counter_gecko_cancel_alarm()
206 dev_data->alarm[chan_id].user_data = NULL; in counter_gecko_cancel_alarm()
224 const struct counter_gecko_config *const dev_cfg = dev->config; in counter_gecko_init()
232 (RTCC_CntPresc_TypeDef)(31UL - __CLZ(dev_cfg->prescaler)), in counter_gecko_init()
234 (RTCC_CntPresc_TypeDef)CMU_DivToLog2(dev_cfg->prescaler), in counter_gecko_init()
239 * RTCC_CCV2 upon backup mode entry. in counter_gecko_init()
246 rtccCntModeNormal, /* Use RTCC in normal mode */ in counter_gecko_init()
254 rtccCapComChModeCompare, /* Use compare mode */ in counter_gecko_init()
298 RTCC->CNT = 0; in counter_gecko_init()
301 dev_cfg->irq_config(); in counter_gecko_init()
303 LOG_INF("Device %s initialized", dev->name); in counter_gecko_init()
324 struct counter_gecko_data *const dev_data = dev->data; in ISR_DIRECT_DECLARE()
332 if (dev_data->top_callback) { in ISR_DIRECT_DECLARE()
333 dev_data->top_callback(dev, dev_data->top_user_data); in ISR_DIRECT_DECLARE()
340 if (dev_data->alarm[i].callback) { in ISR_DIRECT_DECLARE()
341 alarm_callback = dev_data->alarm[i].callback; in ISR_DIRECT_DECLARE()
342 dev_data->alarm[i].callback = NULL; in ISR_DIRECT_DECLARE()
344 dev_data->alarm[i].user_data); in ISR_DIRECT_DECLARE()