[U-Boot] Timer implementations (was: Re: [PATCH v2] mmc: omap: timeout counter fix)
Wolfgang Denk
wd at denx.de
Tue Oct 26 09:41:32 CEST 2010
Dear Reinhard Meyer,
In message <4CC67CA1.9090302 at emk-elektronik.de> you wrote:
>
> If implemented with true 64 bits for get_ticks() that function is useable
> for timeout programming:
>
> ulong timeval = get_timer (0);
>
> do {
> ...
> } while (get_timer (timeval) < TIMEOUT);
>
> It appears that the "base" parameter and return value is in CONFIG_SYS_HZ
> units, and not in native ticks. That causes 64 bit mul/div every
> time get_timer() is called. Won't hurt in a timeout loop, though.
But it will hurt in othe rplaces.
Also, this code _is_ a bit different, as "get_timer(0)" makes sure
the counter starts ticking again at 0, and get_timer() is defined to
have millisecond resolution. So you have a guaranteed 2^32
milliseconds or 4294967 seconds or about 3.3 years available which
indeed should be sufficient to implement standard timeouts.
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
(null cookie; hope that's ok)
More information about the U-Boot
mailing list