[U-Boot] [RFC][Timer API] Revised Specification - Implementation details
Reinhard Meyer
u-boot at emk-elektronik.de
Sat May 28 08:18:30 CEST 2011
Dear Graeme Russ,
> u32 get_timer(u32 base)
> {
> if (base != 0) {
> if (timer - base< (CONFIG_MIN_TIMER_RESOLUTION * 2))
> return 0;
> else
> return timer - base - CONFIG_MIN_TIMER_RESOLUTION;
> } else {
> return timer;
> }
> }
This is not good. get_timer() should not do more than just return the timer
difference since epoch and not contain any funky logic.
I might point again to my futile suggestion of simply calculating the "end tick"
of a timeout loop at begin of the loop and inside the loop just checking whether that
"end tick" has passed.
When that were used, none of those complicated quirks that were devised in this
thread would be needed. Just calculate the "end tick" by rounding it up by one
and all is pretty simple...
Best Regards,
Reinhard
More information about the U-Boot
mailing list