void tmrHw_udelay(tmrHw_ID_t timerId, /* [ IN ] Timer id */ unsigned long usecs /* [ IN ] usec to delay */ ) { tmrHw_RATE_t usec_tick_rate; tmrHw_COUNT_t start_time; tmrHw_COUNT_t delta_time; start_time = tmrHw_GetCurrentCount(timerId); usec_tick_rate = tmrHw_divide(tmrHw_getCountRate(timerId), 1000000); delta_time = usecs * usec_tick_rate; /* Busy wait */ while (delta_time > (tmrHw_GetCurrentCount(timerId) - start_time)) ; }
timer_tick_rate_t timer_get_tick_rate(void) { return tmrHw_getCountRate(PROF_TIMER); }