[U-Boot] [RFC] ARM timing code refactoring

Albert ARIBAUD albert.aribaud at free.fr
Mon Jan 24 13:06:42 CET 2011


Le 24/01/2011 12:58, Albert ARIBAUD a écrit :

> For instance, if at loop entry get_timer() was, say, 10 ticks to
> rollover and the loop timing was 12 ticks, you end up with an end date
> of 2. If your loop body runs long enough, get_timer() may already have
> gone past this and will this stay greater than timeout_end for a very
> long time.

I should always wait for the coffee to produce its effect before 
posting. The right example is having timeout_end *not* have rolled over 
(thus being a very high number) and the loop body being long enough that 
get_timer() is called at the first loop condition test *after* rollover, 
thus being very small.

> OTOH, using get_timer() on entry of loop and subtracting it from
> get_timer() at each loop iteration always yields the time elapsed,
> unaffected by rollover. You can then safely compare this elapsed time
> with the time-out value.
>
> Amicalement,


Amicalement,
-- 
Albert.


More information about the U-Boot mailing list