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()
75 void TIMER_Close(TIMER_T *timer) in TIMER_Close() argument
77 timer->CTL = 0UL; in TIMER_Close()
78 timer->EXTCTL = 0UL; in TIMER_Close()
94 int32_t TIMER_Delay(TIMER_T *timer, uint32_t u32Usec) in TIMER_Delay() argument
96 uint32_t u32Clk = TIMER_GetModuleClock(timer); in TIMER_Delay()
101 timer->CTL = 0UL; in TIMER_Delay()
102 timer->EXTCTL = 0UL; in TIMER_Delay()
141 timer->CMP = u32Cmpr; in TIMER_Delay()
142 timer->CTL = TIMER_CTL_CNTEN_Msk | TIMER_ONESHOT_MODE | u32Prescale; in TIMER_Delay()
154 u32Delay = (SystemCoreClock / TIMER_GetModuleClock(timer)) * (u32Prescale + 1); in TIMER_Delay()
155 u32Cntr = timer->CNT; in TIMER_Delay()
156 while(timer->CTL & TIMER_CTL_ACTSTS_Msk) in TIMER_Delay()
159 if(u32Cntr == timer->CNT) in TIMER_Delay()
169 u32Cntr = timer->CNT; in TIMER_Delay()
194 void TIMER_EnableCapture(TIMER_T *timer, uint32_t u32CapMode, uint32_t u32Edge) in TIMER_EnableCapture() argument
196 timer->EXTCTL = (timer->EXTCTL & ~(TIMER_EXTCTL_CAPFUNCS_Msk | TIMER_EXTCTL_CAPEDGE_Msk)) | in TIMER_EnableCapture()
209 void TIMER_DisableCapture(TIMER_T *timer) in TIMER_DisableCapture() argument
211 timer->EXTCTL &= ~TIMER_EXTCTL_CAPEN_Msk; in TIMER_DisableCapture()
228 void TIMER_EnableEventCounter(TIMER_T *timer, uint32_t u32Edge) in TIMER_EnableEventCounter() argument
230 timer->EXTCTL = (timer->EXTCTL & ~TIMER_EXTCTL_CNTPHASE_Msk) | u32Edge; in TIMER_EnableEventCounter()
231 timer->CTL |= TIMER_CTL_EXTCNTEN_Msk; in TIMER_EnableEventCounter()
243 void TIMER_DisableEventCounter(TIMER_T *timer) in TIMER_DisableEventCounter() argument
245 timer->CTL &= ~TIMER_CTL_EXTCNTEN_Msk; in TIMER_DisableEventCounter()
258 uint32_t TIMER_GetModuleClock(TIMER_T *timer) in TIMER_GetModuleClock() argument
263 if(timer == TIMER0) in TIMER_GetModuleClock()
267 else if(timer == TIMER1) in TIMER_GetModuleClock()
271 else if(timer == TIMER2) in TIMER_GetModuleClock()
282 if((timer == TIMER0) || (timer == TIMER1)) in TIMER_GetModuleClock()
312 void TIMER_EnableFreqCounter(TIMER_T *timer, in TIMER_EnableFreqCounter() argument
319 t = (timer == TIMER0) ? TIMER1 : TIMER3; in TIMER_EnableFreqCounter()
323 timer->CTL = TIMER_CTL_INTRGEN_Msk | TIMER_CTL_CNTEN_Msk; in TIMER_EnableFreqCounter()
333 void TIMER_DisableFreqCounter(TIMER_T *timer) in TIMER_DisableFreqCounter() argument
335 timer->CTL &= ~TIMER_CTL_INTRGEN_Msk; in TIMER_DisableFreqCounter()
346 void TIMER_SetTriggerSource(TIMER_T *timer, uint32_t u32Src) in TIMER_SetTriggerSource() argument
348 timer->TRGCTL = (timer->TRGCTL & ~TIMER_TRGCTL_TRGSSEL_Msk) | u32Src; in TIMER_SetTriggerSource()
361 void TIMER_SetTriggerTarget(TIMER_T *timer, uint32_t u32Mask) in TIMER_SetTriggerTarget() argument
363timer->TRGCTL = (timer->TRGCTL & ~(TIMER_TRGCTL_TRGPWM_Msk | TIMER_TRGCTL_TRGDAC_Msk | TIMER_TRGCT… in TIMER_SetTriggerTarget()
376 int32_t TIMER_ResetCounter(TIMER_T *timer) in TIMER_ResetCounter() argument
380 timer->CNT = 0UL; in TIMER_ResetCounter()
382 u32Delay = (SystemCoreClock / TIMER_GetModuleClock(timer)) * 3; in TIMER_ResetCounter()
383 while(((timer->CNT&TIMER_CNT_RSTACT_Msk) == TIMER_CNT_RSTACT_Msk) && (--u32Delay)) in TIMER_ResetCounter()
411 void TIMER_EnableCaptureInputNoiseFilter(TIMER_T *timer, uint32_t u32FilterCount, uint32_t u32ClkSr… in TIMER_EnableCaptureInputNoiseFilter() argument
413 timer->CAPNF = (((timer)->CAPNF & ~(TIMER_CAPNF_CAPNFCNT_Msk | TIMER_CAPNF_CAPNFSEL_Msk)) in TIMER_EnableCaptureInputNoiseFilter()
426 void TIMER_DisableCaptureInputNoiseFilter(TIMER_T *timer) in TIMER_DisableCaptureInputNoiseFilter() argument
428 timer->CAPNF &= ~TIMER_CAPNF_CAPNFEN_Msk; in TIMER_DisableCaptureInputNoiseFilter()