ulong get_timer_masked(void) { /* current tick value */ ulong now = TICKS_TO_HZ(READ_TIMER()); if (now >= gd->lastinc) /* normal (non rollover) */ gd->tbl += (now - gd->lastinc); else /* rollover */ gd->tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc) + now; gd->lastinc = now; return gd->tbl; }
/* timer without interrupts */ static ulong get_timer_masked(void) { /* current tick value */ ulong now = TICKS_TO_HZ(read_timer()); if (now >= gd->arch.lastinc) /* normal (non rollover) */ gd->arch.tbl += (now - gd->arch.lastinc); else { /* rollover */ gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->arch.lastinc) + now; } gd->arch.lastinc = now; return gd->arch.tbl; }
ulong get_timer_masked(void) { /* current tick value */ ulong now = runtime_tick(); /* notice: this function doesnt consider if the timer count overrage */ #if 0 if (now >= gd->lastinc) /* normal (non rollover) */ gd->tbl += (now - gd->lastinc); else /* rollover */ gd->tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc) + now; gd->lastinc = now; return gd->tbl; #endif return now; }
/* Return how many HZ passed since "base" */ ulong get_timer(ulong base) { return TICKS_TO_HZ(READ_TIMER()) - base; }