From: Wolfgang Denk Date: Wed, 25 May 2011 07:17:23 +0200 Subject: [U-Boot] [RFC] Review of U-Boot timer API In-Reply-To: <4DDC31EB.6040609@comcast.net> References: <4DD7B245.5000008@gmail.com> <201105240024.26511.vapier@gentoo.org> <4DDB42B1.2010206@emk-elektronik.de> <4DDBB29D.2050102@psyent.com> <20110524141950.2AB1CCF5DBF@gemini.denx.de> <4DDBE22D.6050806@gmail.com> <20110524191948.401CBCF5DBF@gemini.denx.de> <4DDC31EB.6040609@comcast.net> Message-ID: <20110525051723.09F99CF5DBF@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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.