Lines Matching refs:timer_config

332     struct apm32_timer *timer_config;  in apm32_hwtimer_init()  local
338 timer_config = (struct apm32_timer *)timer->parent.user_data; in apm32_hwtimer_init()
342 prescaler = (uint32_t)(apm32_hwtimer_clock_get(timer_config->tmr) / 10000) - 1; in apm32_hwtimer_init()
370 TMR_ConfigTimeBase(timer_config->tmr, &base_config); in apm32_hwtimer_init()
374 NVIC_EnableIRQRequest(timer_config->irqn, 3); in apm32_hwtimer_init()
376 TMR_ConfigUPdateRequest(timer_config->tmr, TMR_UPDATE_SOURCE_REGULAR); in apm32_hwtimer_init()
380 NVIC_EnableIRQRequest(timer_config->irqn, 3, 0); in apm32_hwtimer_init()
383 TMR_ConfigUPdateRequest(timer_config->tmr, TMR_UPDATE_SOURCE_REGULAR); in apm32_hwtimer_init()
385 TMR_ConfigUpdateRequest(timer_config->tmr, TMR_UPDATE_SOURCE_REGULAR); in apm32_hwtimer_init()
389 TMR_ClearStatusFlag(timer_config->tmr, TMR_FLAG_UPDATE); in apm32_hwtimer_init()
390 LOG_D("%s init success", timer_config->name); in apm32_hwtimer_init()
397 struct apm32_timer *timer_config = RT_NULL; in apm32_hwtimer_start() local
401 timer_config = (struct apm32_timer *)timer->parent.user_data; in apm32_hwtimer_start()
404 timer_config->tmr->CNT = 0; in apm32_hwtimer_start()
406 timer_config->tmr->AUTORLD = t - 1; in apm32_hwtimer_start()
411 timer_config->tmr->CTRL1_B.SPMEN = 1; in apm32_hwtimer_start()
415 timer_config->tmr->CTRL1_B.SPMEN = 0; in apm32_hwtimer_start()
418 TMR_EnableInterrupt(timer_config->tmr, TMR_INT_UPDATE); in apm32_hwtimer_start()
421 if (timer_config->tmr == TMR1 || timer_config->tmr == TMR2 || timer_config->tmr == TMR3 || \ in apm32_hwtimer_start()
422 timer_config->tmr == TMR15) in apm32_hwtimer_start()
424 if (timer_config->tmr == TMR1) in apm32_hwtimer_start()
426 if (timer_config->tmr == TMR1 || timer_config->tmr == TMR2 || timer_config->tmr == TMR3 || \ in apm32_hwtimer_start()
427 timer_config->tmr == TMR4 || timer_config->tmr == TMR5 || timer_config->tmr == TMR8 || \ in apm32_hwtimer_start()
428 timer_config->tmr == TMR9 || timer_config->tmr == TMR12) in apm32_hwtimer_start()
431 if (timer_config->tmr->SMCTRL_B.SMFSEL != 0x06) in apm32_hwtimer_start()
433 TMR_Enable(timer_config->tmr); in apm32_hwtimer_start()
439 TMR_Enable(timer_config->tmr); in apm32_hwtimer_start()
447 struct apm32_timer *timer_config = RT_NULL; in apm32_hwtimer_stop() local
449 timer_config = (struct apm32_timer *)timer->parent.user_data; in apm32_hwtimer_stop()
451 TMR_DisableInterrupt(timer_config->tmr, TMR_INT_UPDATE); in apm32_hwtimer_stop()
452 TMR_Enable(timer_config->tmr); in apm32_hwtimer_stop()
453 timer_config->tmr->CNT = 0; in apm32_hwtimer_stop()
458 struct apm32_timer *timer_config = RT_NULL; in apm32_hwtimer_ctrl() local
466 timer_config = (struct apm32_timer *)timer->parent.user_data; in apm32_hwtimer_ctrl()
474 val = apm32_hwtimer_clock_get(timer_config->tmr) / freq; in apm32_hwtimer_ctrl()
477 timer_config->tmr->PSC_B.PSC = val - 1; in apm32_hwtimer_ctrl()
478 timer_config->tmr->CEG_B.UEG = 1; in apm32_hwtimer_ctrl()
490 struct apm32_timer *timer_config = RT_NULL; in apm32_hwtimer_counter_get() local
492 timer_config = (struct apm32_timer *)timer->parent.user_data; in apm32_hwtimer_counter_get()
494 return timer_config->tmr->CNT; in apm32_hwtimer_counter_get()