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

Wolfgang Denk wd at denx.de
Mon Jan 24 13:54:55 CET 2011


Dear Albert ARIBAUD,

In message <4D3D2942.4060600 at free.fr> you wrote:
>
> - get_timer() works in pure ticks, not ms, and thus does not need
> multiply/divide; it may at most need to implement a carry over from 32
> bit to 64 bits *if* the HW counter is 32 bits *and if* we want a 64-bit
> virtual counter.
> - get_time() works in ms, and thus needs scale conversion, so possibly a
> multiply/divide but possibly some other method, to convert a tick value
> to an ms value.

No.  There is get_ticks(), which operates on ticks, and there is
get_timer(), which returns milliseconds.


> That's where I come back to one point of my proposal: if we can get a
> general framework for get_timer() to return a 64-bit free-running tick
> value, then we might not need a ms-based get_time() at all, because we
> could use get_timer() as well for ms timings, provided we can convert

Then you will always have to use 64 bit variables for all related
operations.  Note that get_timer() returns "unsigned long"", which
allows for smaller code in the majority of use cases.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Program maintenance is an entropy-increasing process,  and  even  its
most skilfull execution only delays the subsidence of the system into
unfixable obsolescence.       - Fred Brooks, "The Mythical Man Month"


More information about the U-Boot mailing list