[U-Boot] Timer implementations

Wolfgang Denk wd at denx.de
Tue Oct 26 15:05:41 CEST 2010


Dear Reinhard Meyer,

In message <4CC6AADC.8050608 at emk-elektronik.de> you wrote:
> 
> Then the define CONFIG_SYS_HZ should not be in every <board>.h since that
> suggests that a board developer has some freedom there...

Agreed - there are historical reasons this has ever been changable at
all.

> and MOST IMPORTANT that some implementations of udelay() might
> call reset_timer() and therefore break an outer timeout loop !!!

Such implementations are inherently broken and need to be fixed.

> It is also open if reset_timer() does actually reset the hardware timer
> (e.g. tbu/tbl at PPC) - which would be messing up any time difference
> calculation using get_ticks() - or does emulate that by remembering
> the hardware value and subtracting it later in every subsequent
> get_timer() call?

This is an implementation detail.

> 2. get_ticks() and friends operate at a higher rate (tbu/tbl for PPC).
> Since they are defined as having 64 bits they MUST not wrap at 32 bits,
> i.e. if the hardware provides only 32 bits, the upper 32 bits must be
> emulated by software.

Right.

> Otherwise we have to document that get_ticks() cannot be used to get
> 64 bit time differences.

No. Such an implementation is broken and needs fixing.

> If you really closely look at the various implementations of those
> timers, you will easyly see the wide variations implemented there.

Yes, I am aware of this :-(

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
...though his invention worked superbly -- his theory was a crock  of
sewage from beginning to end.         - Vernor Vinge, "The Peace War"


More information about the U-Boot mailing list