From: Wolfgang Denk Date: Tue, 26 Oct 2010 15:05:41 +0200 Subject: [U-Boot] Timer implementations In-Reply-To: <4CC6AADC.8050608@emk-elektronik.de> References: <1288054924-24989-1-git-send-email-nm@ti.com> <4CC62B6C.30601@emk-elektronik.de> <20101026052856.3D467152451@gemini.denx.de> <4CC66A67.4000608@emk-elektronik.de> <20101026054812.60816135DE3@gemini.denx.de> <4CC66ECA.9000106@emk-elektronik.de> <4CC67CA1.9090302@emk-elektronik.de> <20101026074132.8013C152451@gemini.denx.de> <4CC68A07.6050109@emk-elektronik.de> <20101026093355.A73D1152451@gemini.denx.de> <4CC6AADC.8050608@emk-elektronik.de> Message-ID: <20101026130541.C3F0B152451@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 Reinhard Meyer, In message <4CC6AADC.8050608@emk-elektronik.de> you wrote: > > Then the define CONFIG_SYS_HZ should not be in every .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"