[U-Boot] [RFC] Review of U-Boot timer API

Wolfgang Denk
2011-05-25T05:17:23Z

Dear "J. William Campbell",

In message <4DDC31EB.6040609@comcast.net> you wrote:
...
> A tick is defined as the smallest increment of system time as measured by a
> computer system (seehttp://en.wikipedia.org/wiki/System_time):
>
> System time is measured by a system clock, which is typically
> implemented as a simple count of the number of ticks that have
> transpired since some arbitrary starting date, called the
> epoch.
>
> Unfortunately, this definition is obsolete, and has been for quite some

Do you have any proof for such a claim?

> years. When computers had a single timer, the above definition worked,
> but it no longer does, as many (most?) computers have several hardware
> timers. A "tick" today is the time increment of any particular timer of
> a computer system. So, when one writes a function called get_ticks on a
> PPC, does one mean read the decrementer, or does one read the RTC or
> does one read the TB register(s) A similar situation exists on the
> Blackfin BF531/2/3, that has a preformance counter, a real-time clock,
> and three programmable timers. Which tick do you want? For each u-boot

Please re-read the definition. At least as far as U-Boot and Linux
are concerned, there is only a single clock source used to implement
the _system_time_. And I doubt that other OS do different.

> implementation, we can pick one timer as the "master" timer, but it may
> not be the one with the most rapid tick rate. It may be the one with the
> most USEFUL tick rate for get_timer. If you take the above definition at
> face value, only the fastest counter value has ticks, and all other
> counters time increments are not ticks. If they are not ticks, what are
> they?

Clocks, timers?

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
Don't put off for tomorrow what you can do today, because if you
enjoy it today you can do it again tomorrow.