Lines Matching defs:timerId
52 static void ResetTimer(tmrHw_ID_t timerId)
67 uint32_t tmrHw_getTimerCapability(tmrHw_ID_t timerId, /* [ IN ] Timer Id */
72 return (timerId <=
93 static void ResetTimer(tmrHw_ID_t timerId /* [ IN ] Timer Id */
96 pTmrHw[timerId].LoadValue = 0;
97 pTmrHw[timerId].CurrentValue = 0xFFFFFFFF;
98 pTmrHw[timerId].Control = 0;
99 pTmrHw[timerId].BackgroundLoad = 0;
101 pTmrHw[timerId].Control |= tmrHw_CONTROL_32BIT;
103 if (pTmrHw[timerId].RawInterruptStatus) {
104 pTmrHw[timerId].InterruptClear = 0xFFFFFFFF;
117 static tmrHw_INTERVAL_t SetTimerPeriod(tmrHw_ID_t timerId, /* [ IN ] Timer Id */
123 if (timerId == 0 || timerId == 1) {
125 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1;
128 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_16;
131 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_256;
139 pTmrHw[timerId].LoadValue = count;
140 pTmrHw[timerId].BackgroundLoad = count;
142 } else if (timerId == 2 || timerId == 3) {
144 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1;
147 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_16;
150 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_256;
158 pTmrHw[timerId].LoadValue = count;
159 pTmrHw[timerId].BackgroundLoad = count;
176 tmrHw_RATE_t tmrHw_setPeriodicTimerRate(tmrHw_ID_t timerId, /* [ IN ] Timer Id */
181 ResetTimer(timerId);
184 pTmrHw[timerId].Control |= tmrHw_CONTROL_PERIODIC;
185 pTmrHw[timerId].Control &= ~tmrHw_CONTROL_ONESHOT;
187 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1;
189 if (rate && (timerId == 0 || timerId == 1)) {
194 } else if (rate && (timerId == 2 || timerId == 3)) {
206 pTmrHw[timerId].LoadValue = count;
207 pTmrHw[timerId].BackgroundLoad = count;
225 tmrHw_INTERVAL_t tmrHw_setPeriodicTimerInterval(tmrHw_ID_t timerId, /* [ IN ] Timer Id */
228 ResetTimer(timerId);
231 pTmrHw[timerId].Control |= tmrHw_CONTROL_PERIODIC;
232 pTmrHw[timerId].Control &= ~tmrHw_CONTROL_ONESHOT;
234 return SetTimerPeriod(timerId, msec);
250 tmrHw_INTERVAL_t tmrHw_setOneshotTimerInterval(tmrHw_ID_t timerId, /* [ IN ] Timer Id */
253 ResetTimer(timerId);
256 pTmrHw[timerId].Control |= tmrHw_CONTROL_PERIODIC;
257 pTmrHw[timerId].Control |= tmrHw_CONTROL_ONESHOT;
259 return SetTimerPeriod(timerId, msec);
272 tmrHw_RATE_t tmrHw_setFreeRunningTimer(tmrHw_ID_t timerId, /* [ IN ] Timer Id */
277 ResetTimer(timerId);
279 pTmrHw[timerId].Control &= ~tmrHw_CONTROL_PERIODIC;
280 pTmrHw[timerId].Control &= ~tmrHw_CONTROL_ONESHOT;
283 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_256;
286 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_16;
289 pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1;
293 if (timerId == 0 || timerId == 1) {
295 } else if (timerId == 2 || timerId == 3) {
313 int tmrHw_startTimer(tmrHw_ID_t timerId /* [ IN ] Timer id */
315 pTmrHw[timerId].Control |= tmrHw_CONTROL_TIMER_ENABLE;
330 int tmrHw_stopTimer(tmrHw_ID_t timerId /* [ IN ] Timer id */
332 pTmrHw[timerId].Control &= ~tmrHw_CONTROL_TIMER_ENABLE;
346 uint32_t tmrHw_GetCurrentCount(tmrHw_ID_t timerId /* [ IN ] Timer id */
349 switch (pTmrHw[timerId].Control & tmrHw_CONTROL_MODE_MASK) {
351 if (pTmrHw[timerId].CurrentValue) {
352 return tmrHw_MAX_COUNT - pTmrHw[timerId].CurrentValue;
357 return pTmrHw[timerId].BackgroundLoad -
358 pTmrHw[timerId].CurrentValue;
373 tmrHw_RATE_t tmrHw_getCountRate(tmrHw_ID_t timerId /* [ IN ] Timer id */
377 switch (pTmrHw[timerId].Control & tmrHw_CONTROL_PRESCALE_MASK) {
391 if (timerId == 0 || timerId == 1) {
409 void tmrHw_enableInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */
411 pTmrHw[timerId].Control |= tmrHw_CONTROL_INTERRUPT_ENABLE;
424 void tmrHw_disableInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */
426 pTmrHw[timerId].Control &= ~tmrHw_CONTROL_INTERRUPT_ENABLE;
441 void tmrHw_clearInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */
443 pTmrHw[timerId].InterruptClear = 0x1;
455 tmrHw_INTERRUPT_STATUS_e tmrHw_getInterruptStatus(tmrHw_ID_t timerId /* [ IN ] Timer id */
457 if (pTmrHw[timerId].InterruptStatus) {
498 void tmrHw_printDebugInfo(tmrHw_ID_t timerId, /* [ IN ] Timer id */
502 (*fpPrint) ("Timer %d: Load value 0x%X\n", timerId,
503 pTmrHw[timerId].LoadValue);
504 (*fpPrint) ("Timer %d: Background load value 0x%X\n", timerId,
505 pTmrHw[timerId].BackgroundLoad);
506 (*fpPrint) ("Timer %d: Control 0x%X\n", timerId,
507 pTmrHw[timerId].Control);
508 (*fpPrint) ("Timer %d: Interrupt clear 0x%X\n", timerId,
509 pTmrHw[timerId].InterruptClear);
510 (*fpPrint) ("Timer %d: Interrupt raw interrupt 0x%X\n", timerId,
511 pTmrHw[timerId].RawInterruptStatus);
512 (*fpPrint) ("Timer %d: Interrupt status 0x%X\n", timerId,
513 pTmrHw[timerId].InterruptStatus);
523 void tmrHw_udelay(tmrHw_ID_t timerId, /* [ IN ] Timer id */
530 start_time = tmrHw_GetCurrentCount(timerId);
531 usec_tick_rate = tmrHw_divide(tmrHw_getCountRate(timerId), 1000000);
535 while (delta_time > (tmrHw_GetCurrentCount(timerId) - start_time))