Lines Matching refs:timer

42 uint32_t TIMER_Open(TIMER_T *timer, uint32_t u32Mode, uint32_t u32Freq)  in TIMER_Open()  argument
44 uint32_t u32Clk = TIMER_GetModuleClock(timer); in TIMER_Open()
60 timer->CTL = u32Mode | u32Prescale; in TIMER_Open()
61 timer->CMP = u32Cmpr; in TIMER_Open()
76 void TIMER_Close(TIMER_T *timer) in TIMER_Close() argument
78 timer->CTL = 0UL; in TIMER_Close()
79 timer->EXTCTL = 0UL; in TIMER_Close()
97 int32_t TIMER_Delay(TIMER_T *timer, uint32_t u32Usec) in TIMER_Delay() argument
99 uint32_t u32Clk = TIMER_GetModuleClock(timer); in TIMER_Delay()
104 timer->CTL = 0UL; in TIMER_Delay()
105 timer->EXTCTL = 0UL; in TIMER_Delay()
144 timer->CMP = u32Cmpr; in TIMER_Delay()
145 timer->CTL = TIMER_CTL_CNTEN_Msk | TIMER_ONESHOT_MODE | u32Prescale; in TIMER_Delay()
158 u32Delay = (SystemCoreClock / TIMER_GetModuleClock(timer)) * (u32Prescale + 1); in TIMER_Delay()
159 u32Cntr = timer->CNT; in TIMER_Delay()
161 while(timer->CTL & TIMER_CTL_ACTSTS_Msk) in TIMER_Delay()
164 if(u32Cntr == timer->CNT) in TIMER_Delay()
174 u32Cntr = timer->CNT; in TIMER_Delay()
202 void TIMER_EnableCapture(TIMER_T *timer, uint32_t u32CapMode, uint32_t u32Edge) in TIMER_EnableCapture() argument
204 timer->EXTCTL = (timer->EXTCTL & ~(TIMER_EXTCTL_CAPFUNCS_Msk | TIMER_EXTCTL_CAPEDGE_Msk)) | in TIMER_EnableCapture()
218 void TIMER_DisableCapture(TIMER_T *timer) in TIMER_DisableCapture() argument
220 timer->EXTCTL &= ~TIMER_EXTCTL_CAPEN_Msk; in TIMER_DisableCapture()
238 void TIMER_EnableEventCounter(TIMER_T *timer, uint32_t u32Edge) in TIMER_EnableEventCounter() argument
240 timer->EXTCTL = (timer->EXTCTL & ~TIMER_EXTCTL_CNTPHASE_Msk) | u32Edge; in TIMER_EnableEventCounter()
241 timer->CTL |= TIMER_CTL_EXTCNTEN_Msk; in TIMER_EnableEventCounter()
254 void TIMER_DisableEventCounter(TIMER_T *timer) in TIMER_DisableEventCounter() argument
256 timer->CTL &= ~TIMER_CTL_EXTCNTEN_Msk; in TIMER_DisableEventCounter()
270 uint32_t TIMER_GetModuleClock(TIMER_T *timer) in TIMER_GetModuleClock() argument
275 if(timer == TIMER0) in TIMER_GetModuleClock()
279 else if(timer == TIMER1) in TIMER_GetModuleClock()
283 else if(timer == TIMER2) in TIMER_GetModuleClock()
294 if((timer == TIMER0) || (timer == TIMER1)) in TIMER_GetModuleClock()
325 void TIMER_EnableFreqCounter(TIMER_T *timer, in TIMER_EnableFreqCounter() argument
332 t = (timer == TIMER0) ? TIMER1 : TIMER3; in TIMER_EnableFreqCounter()
336 timer->CTL = TIMER_CTL_INTRGEN_Msk | TIMER_CTL_CNTEN_Msk; in TIMER_EnableFreqCounter()
347 void TIMER_DisableFreqCounter(TIMER_T *timer) in TIMER_DisableFreqCounter() argument
349 timer->CTL &= ~TIMER_CTL_INTRGEN_Msk; in TIMER_DisableFreqCounter()
361 void TIMER_SetTriggerSource(TIMER_T *timer, uint32_t u32Src) in TIMER_SetTriggerSource() argument
363 timer->TRGCTL = (timer->TRGCTL & ~TIMER_TRGCTL_TRGSSEL_Msk) | u32Src; in TIMER_SetTriggerSource()
379 void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask) in TIMER_SetTriggerTarget() argument
381timer->TRGCTL = (timer->TRGCTL & ~(TIMER_TRGCTL_TRGPWM_Msk | TIMER_TRGCTL_TRGDAC_Msk | TIMER_TRGCT… in TIMER_SetTriggerTarget()
404 void TIMER_CaptureSelect(TIMER_T *timer, uint32_t u32Src) in TIMER_CaptureSelect() argument
408 timer->CTL = (timer->CTL & ~(TIMER_CTL_CAPSRC_Msk)) | in TIMER_CaptureSelect()
413 timer->CTL = (timer->CTL & ~(TIMER_CTL_CAPSRC_Msk)) | in TIMER_CaptureSelect()
415 timer->EXTCTL = (timer->EXTCTL & ~(TIMER_EXTCTL_INTERCAPSEL_Msk)) | in TIMER_CaptureSelect()
431 int32_t TIMER_ResetCounter(TIMER_T *timer) in TIMER_ResetCounter() argument
435 timer->CTL |= TIMER_CNT_RSTACT_Msk; in TIMER_ResetCounter()
437 u32Delay = (SystemCoreClock / TIMER_GetModuleClock(timer)) * 3; in TIMER_ResetCounter()
438 while(((timer->CTL & TIMER_CNT_RSTACT_Msk) == TIMER_CNT_RSTACT_Msk) && (--u32Delay)) in TIMER_ResetCounter()