From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Mon, 24 Jan 2011 13:54:55 +0100 Subject: [U-Boot] [RFC] ARM timing code refactoring In-Reply-To: <4D3D2942.4060600@free.fr> References: <4D3AAF63.1030600@free.fr> <20110122191928.49E141365DB@gemini.denx.de> <4D3B3B5C.2060205@free.fr> <20110122212601.9C8A2B187@gemini.denx.de> <4D3B5171.7090700@emk-elektronik.de> <20110123101217.E31DFB335@gemini.denx.de> <4D3C0271.4070306@emk-elektronik.de> <20110123162312.CDEDE1365DB@gemini.denx.de> <4D3C77BC.50006@emk-elektronik.de> <20110123193502.3F2484B6@gemini.denx.de> <4D3C96A9.7030402@free.fr> <4D3C9BFC.1010907@emk-elektronik.de> <20110123225758.222691365DB@gemini.denx.de> <4D3CD8FE.4040006@comcast.net> <4D3D2942.4060600@free.fr> Message-ID: <20110124125455.F1E871365DB@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 Albert ARIBAUD, In message <4D3D2942.4060600@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"