Lines Matching refs:timer
56 #define TIMER_DEVICE_ID(timer) ( \ argument
57 (timer) == TIMER0 ? 0 \
58 : (timer) == TIMER1 ? 1 \
59 : (timer) == TIMER2 ? 2 \
60 : (timer) == TIMER3 ? 3 \
61 : (timer) == TIMER4 ? 4 \
62 : (timer) == TIMER5 ? 5 \
63 : (timer) == TIMER6 ? 6 \
64 : (timer) == TIMER7 ? 7 \
65 : (timer) == TIMER8 ? 8 \
66 : (timer) == TIMER9 ? 9 \
69 #define TIMER_DEVICE_ID(timer) ( \ argument
70 (timer) == TIMER0 ? 0 \
71 : (timer) == TIMER1 ? 1 \
72 : (timer) == TIMER2 ? 2 \
73 : (timer) == TIMER3 ? 3 \
74 : (timer) == TIMER4 ? 4 \
75 : (timer) == TIMER5 ? 5 \
76 : (timer) == TIMER6 ? 6 \
77 : (timer) == TIMER7 ? 7 \
80 #define TIMER_DEVICE_ID(timer) ( \ argument
81 (timer) == TIMER0 ? 0 \
82 : (timer) == TIMER1 ? 1 \
83 : (timer) == TIMER2 ? 2 \
84 : (timer) == TIMER3 ? 3 \
85 : (timer) == TIMER4 ? 4 \
88 #define TIMER_DEVICE_ID(timer) ( \ argument
89 (timer) == TIMER0 ? 0 \
90 : (timer) == TIMER1 ? 1 \
91 : (timer) == TIMER2 ? 2 \
92 : (timer) == TIMER3 ? 3 \
139 static void timerPrsConfig(TIMER_TypeDef * timer, unsigned int cc, unsigned int prsCh, bool async) in timerPrsConfig() argument
141 int i = TIMER_DEVICE_ID(timer); in timerPrsConfig()
178 void TIMER_Init(TIMER_TypeDef *timer, const TIMER_Init_TypeDef *init) in TIMER_Init() argument
180 EFM_ASSERT(TIMER_REF_VALID(timer)); in TIMER_Init()
184 TIMER_SyncWait(timer); in TIMER_Init()
185 timer->EN_CLR = TIMER_EN_EN; in TIMER_Init()
187 while (timer->EN & _TIMER_EN_DISABLING_MASK) { in TIMER_Init()
190 timer->CFG = ((uint32_t)init->prescale << _TIMER_CFG_PRESC_SHIFT) in TIMER_Init()
201 timer->EN_SET = TIMER_EN_EN; in TIMER_Init()
206 timer->CMD = TIMER_CMD_STOP; in TIMER_Init()
210 timer->CNT = _TIMER_CNT_RESETVALUE; in TIMER_Init()
239 timer->CTRL = ctrlRegVal; in TIMER_Init()
243 timer->CMD = TIMER_CMD_START; in TIMER_Init()
264 void TIMER_InitCC(TIMER_TypeDef *timer, in TIMER_InitCC() argument
268 EFM_ASSERT(TIMER_REF_VALID(timer)); in TIMER_InitCC()
269 EFM_ASSERT(TIMER_REF_CH_VALIDATE(timer, ch)); in TIMER_InitCC()
272 TIMER_SyncWait(timer); in TIMER_InitCC()
273 timer->EN_CLR = TIMER_EN_EN; in TIMER_InitCC()
275 while (timer->EN & _TIMER_EN_DISABLING_MASK) { in TIMER_InitCC()
278 timer->CC[ch].CFG = in TIMER_InitCC()
285 timer->CC[ch].CFG |= (uint32_t)init->prsInputType << _TIMER_CC_CFG_INSEL_SHIFT; in TIMER_InitCC()
287 timerPrsConfig(timer, ch, init->prsSel, async); in TIMER_InitCC()
289 timer->CC[ch].CFG |= TIMER_CC_CFG_INSEL_PIN; in TIMER_InitCC()
291 timer->EN_SET = TIMER_EN_EN; in TIMER_InitCC()
293 timer->CC[ch].CTRL = in TIMER_InitCC()
301 timer->CC[ch].CTRL = in TIMER_InitCC()
331 void TIMER_InitDTI(TIMER_TypeDef *timer, const TIMER_InitDTI_TypeDef *init) in TIMER_InitDTI() argument
333 EFM_ASSERT(TIMER_SupportsDTI(timer)); in TIMER_InitDTI()
336 TIMER_EnableDTI(timer, false); in TIMER_InitDTI()
339 TIMER_SyncWait(timer); in TIMER_InitDTI()
340 timer->EN_CLR = TIMER_EN_EN; in TIMER_InitDTI()
342 while (timer->EN & _TIMER_EN_DISABLING_MASK) { in TIMER_InitDTI()
345 timer->DTCFG = (init->autoRestart ? TIMER_DTCFG_DTDAS : 0) in TIMER_InitDTI()
348 timerPrsConfig(timer, TIMER_INPUT_CHANNEL_DTI, init->prsSel, true); in TIMER_InitDTI()
351 timer->DTTIMECFG = in TIMER_InitDTI()
356 timer->DTFCFG = in TIMER_InitDTI()
364 timerPrsConfig(timer, TIMER_INPUT_CHANNEL_DTIFS1, init->faultSourcePrsSel0, true); in TIMER_InitDTI()
367 timerPrsConfig(timer, TIMER_INPUT_CHANNEL_DTIFS2, init->faultSourcePrsSel1, true); in TIMER_InitDTI()
370 timer->EN_SET = TIMER_EN_EN; in TIMER_InitDTI()
376 timer->DTCTRL = in TIMER_InitDTI()
385 timer->DTCTRL = (init->activeLowOut ? TIMER_DTCTRL_DTIPOL : 0) in TIMER_InitDTI()
391 timer->DTTIME = ((uint32_t)init->prescale << _TIMER_DTTIME_DTPRESC_SHIFT) in TIMER_InitDTI()
398 timer->DTFC = in TIMER_InitDTI()
409 timer->DTOGEN = init->outputsEnableMask; in TIMER_InitDTI()
412 TIMER_ClearDTIFault(timer, TIMER_GetDTIFault(timer)); in TIMER_InitDTI()
415 TIMER_EnableDTI(timer, init->enable); in TIMER_InitDTI()
430 void TIMER_Reset(TIMER_TypeDef *timer) in TIMER_Reset() argument
434 EFM_ASSERT(TIMER_REF_VALID(timer)); in TIMER_Reset()
437 timer->EN_SET = TIMER_EN_EN; in TIMER_Reset()
441 timer->CMD = TIMER_CMD_STOP; in TIMER_Reset()
443 timer->CTRL = _TIMER_CTRL_RESETVALUE; in TIMER_Reset()
444 timer->IEN = _TIMER_IEN_RESETVALUE; in TIMER_Reset()
446 timer->IF_CLR = _TIMER_IF_MASK; in TIMER_Reset()
448 timer->IFC = _TIMER_IFC_MASK; in TIMER_Reset()
450 timer->TOPB = _TIMER_TOPB_RESETVALUE; in TIMER_Reset()
452 timer->TOP = _TIMER_TOP_RESETVALUE; in TIMER_Reset()
453 timer->CNT = _TIMER_CNT_RESETVALUE; in TIMER_Reset()
457 for (i = 0; TIMER_REF_CH_VALIDATE(timer, i); i++) { in TIMER_Reset()
458 timer->CC[i].CTRL = _TIMER_CC_CTRL_RESETVALUE; in TIMER_Reset()
460 timer->CC[i].CCV = _TIMER_CC_CCV_RESETVALUE; in TIMER_Reset()
461 timer->CC[i].CCVB = _TIMER_CC_CCVB_RESETVALUE; in TIMER_Reset()
465 timer->CC[i].OC = _TIMER_CC_OC_RESETVALUE; in TIMER_Reset()
466 timer->CC[i].OCB = _TIMER_CC_OCB_RESETVALUE; in TIMER_Reset()
472 timer->DTLOCK = TIMER_DTLOCK_DTILOCKKEY_UNLOCK; in TIMER_Reset()
473 timer->DTCTRL = _TIMER_DTCTRL_RESETVALUE; in TIMER_Reset()
474 timer->DTOGEN = _TIMER_DTOGEN_RESETVALUE; in TIMER_Reset()
475 timer->DTFAULTC = _TIMER_DTFAULTC_MASK; in TIMER_Reset()
478 timer->DTLOCK = TIMER_DTLOCK_LOCKKEY_UNLOCK; in TIMER_Reset()
479 timer->DTCTRL = _TIMER_DTCTRL_RESETVALUE; in TIMER_Reset()
480 timer->DTTIME = _TIMER_DTTIME_RESETVALUE; in TIMER_Reset()
481 timer->DTFC = _TIMER_DTFC_RESETVALUE; in TIMER_Reset()
482 timer->DTOGEN = _TIMER_DTOGEN_RESETVALUE; in TIMER_Reset()
483 timer->DTFAULTC = _TIMER_DTFAULTC_MASK; in TIMER_Reset()
487 TIMER_SyncWait(timer); in TIMER_Reset()
489 timer->EN_CLR = TIMER_EN_EN; in TIMER_Reset()
491 while (timer->EN & _TIMER_EN_DISABLING_MASK) { in TIMER_Reset()
494 timer->CFG = _TIMER_CFG_RESETVALUE; in TIMER_Reset()
495 for (i = 0; TIMER_REF_CH_VALIDATE(timer, i); i++) { in TIMER_Reset()
496 timer->CC[i].CFG = _TIMER_CC_CFG_RESETVALUE; in TIMER_Reset()
498 timer->DTCFG = _TIMER_DTCFG_RESETVALUE; in TIMER_Reset()
499 timer->DTFCFG = _TIMER_DTFCFG_RESETVALUE; in TIMER_Reset()
500 timer->DTTIMECFG = _TIMER_DTTIMECFG_RESETVALUE; in TIMER_Reset()
510 void TIMER_SyncWait(TIMER_TypeDef * timer) in TIMER_SyncWait() argument
512 while (((timer->EN & TIMER_EN_EN) != 0U) in TIMER_SyncWait()
513 && ((timer->STATUS & TIMER_STATUS_SYNCBUSY) != 0U)) { in TIMER_SyncWait()