Lines Matching full:timer
26 /** Maximum number of timer channels. */
29 /** Number of channels for timer by index. */
105 TIM_TypeDef *timer; member
119 TIM_TypeDef *timer = config->timer; in counter_stm32_start() local
122 LL_TIM_EnableCounter(timer); in counter_stm32_start()
130 TIM_TypeDef *timer = config->timer; in counter_stm32_stop() local
133 LL_TIM_DisableCounter(timer); in counter_stm32_stop()
142 return LL_TIM_GetAutoReload(config->timer); in counter_stm32_get_top_value()
149 return LL_TIM_GetCounter(config->timer); in counter_stm32_read()
201 TIM_TypeDef *timer = config->timer; in counter_stm32_set_cc() local
209 __ASSERT(!check_it_enabled[id](timer), in counter_stm32_set_cc()
217 prev_val = get_timer_compare[id](timer); in counter_stm32_set_cc()
218 set_timer_compare[id](timer, now); in counter_stm32_set_cc()
219 clear_it_flag[id](timer); in counter_stm32_set_cc()
229 * immediate expiration of the timer. Detection is performed in counter_stm32_set_cc()
240 set_timer_compare[id](timer, val); in counter_stm32_set_cc()
260 enable_it[id](timer); in counter_stm32_set_cc()
290 disable_it[chan](config->timer); in counter_stm32_cancel_alarm()
300 TIM_TypeDef *timer = config->timer; in counter_stm32_set_top_value() local
313 LL_TIM_DisableIT_UPDATE(timer); in counter_stm32_set_top_value()
314 LL_TIM_SetAutoReload(timer, cfg->ticks); in counter_stm32_set_top_value()
315 LL_TIM_ClearFlag_UPDATE(timer); in counter_stm32_set_top_value()
321 LL_TIM_SetCounter(timer, 0); in counter_stm32_set_top_value()
325 LL_TIM_SetCounter(timer, 0); in counter_stm32_set_top_value()
330 LL_TIM_EnableIT_UPDATE(timer); in counter_stm32_set_top_value()
343 pending |= LL_TIM_IsActiveFlag_CC4(cfg->timer); in counter_stm32_get_pending_int()
346 pending |= LL_TIM_IsActiveFlag_CC3(cfg->timer); in counter_stm32_get_pending_int()
349 pending |= LL_TIM_IsActiveFlag_CC2(cfg->timer); in counter_stm32_get_pending_int()
352 pending |= LL_TIM_IsActiveFlag_CC1(cfg->timer); in counter_stm32_get_pending_int()
359 * Obtain timer clock speed.
361 * @param pclken Timer clock control subsystem.
362 * @param tim_clk Where computed timer clock will be stored.
418 * Up to a certain threshold value of APB{1,2} prescaler, timer clock in counter_stm32_get_tim_clk()
420 * (2 if TIMPRE=0, 4 if TIMPRE=1). Above threshold, timer clock is set in counter_stm32_get_tim_clk()
448 * If the APB prescaler equals 1, the timer clock frequencies in counter_stm32_get_tim_clk()
467 TIM_TypeDef *timer = cfg->timer; in counter_stm32_init_timer() local
481 LOG_ERR("Could not obtain timer clock (%d)", r); in counter_stm32_init_timer()
491 /* Reset timer to default state using RCC */ in counter_stm32_init_timer()
497 /* initialize timer */ in counter_stm32_init_timer()
505 if (LL_TIM_Init(timer, &init) != SUCCESS) { in counter_stm32_init_timer()
506 LOG_ERR("Could not initialize timer"); in counter_stm32_init_timer()
554 TIM_TypeDef *timer = config->timer; in counter_stm32_alarm_irq_handle() local
560 disable_it[id](timer); in counter_stm32_alarm_irq_handle()
567 uint32_t cc_val = get_timer_compare[id](timer); in counter_stm32_alarm_irq_handle()
589 bool hw_irq = LL_TIM_IsActiveFlag_CC##cc(timer) && \
590 LL_TIM_IsEnabledIT_CC##cc(timer); \
593 LL_TIM_ClearFlag_CC##cc(timer); \
603 TIM_TypeDef *timer = config->timer; in counter_stm32_irq_handler() local
608 TIM_IRQ_HANDLE_CC(timer, 4); in counter_stm32_irq_handler()
611 TIM_IRQ_HANDLE_CC(timer, 3); in counter_stm32_irq_handler()
614 TIM_IRQ_HANDLE_CC(timer, 2); in counter_stm32_irq_handler()
617 TIM_IRQ_HANDLE_CC(timer, 1); in counter_stm32_irq_handler()
621 if (LL_TIM_IsActiveFlag_UPDATE(timer) && LL_TIM_IsEnabledIT_UPDATE(timer)) { in counter_stm32_irq_handler()
622 LL_TIM_ClearFlag_UPDATE(timer); in counter_stm32_irq_handler()
627 #define TIMER(idx) DT_INST_PARENT(idx) macro
630 #define TIM(idx) ((TIM_TypeDef *)DT_REG_ADDR(TIMER(idx)))
633 BUILD_ASSERT(DT_PROP(TIMER(idx), st_prescaler) <= 0xFFFF, \
634 "TIMER prescaler out of range"); \
636 "TIMER too many channels"); \
643 IRQ_CONNECT(DT_IRQN(TIMER(idx)), \
644 DT_IRQ(TIMER(idx), priority), \
648 irq_enable(DT_IRQN(TIMER(idx))); \
660 .timer = TIM(idx), \
661 .prescaler = DT_PROP(TIMER(idx), st_prescaler), \
663 .bus = DT_CLOCKS_CELL(TIMER(idx), bus), \
664 .enr = DT_CLOCKS_CELL(TIMER(idx), bits) \
667 .irqn = DT_IRQN(TIMER(idx)), \
668 .reset = RESET_DT_SPEC_GET(TIMER(idx)), \