From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Mon, 24 Jan 2011 13:06:42 +0100 Subject: [U-Boot] [RFC] ARM timing code refactoring In-Reply-To: <4D3D695A.6060006@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> <5A727AB5-C1C6-46D3-8C0B-A868EC6B1E7A@googlemail.com> <4D3D695A.6060006@free.fr> Message-ID: <4D3D6B52.8040709@free.fr> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Le 24/01/2011 12:58, Albert ARIBAUD a ?crit : > For instance, if at loop entry get_timer() was, say, 10 ticks to > rollover and the loop timing was 12 ticks, you end up with an end date > of 2. If your loop body runs long enough, get_timer() may already have > gone past this and will this stay greater than timeout_end for a very > long time. I should always wait for the coffee to produce its effect before posting. The right example is having timeout_end *not* have rolled over (thus being a very high number) and the loop body being long enough that get_timer() is called at the first loop condition test *after* rollover, thus being very small. > OTOH, using get_timer() on entry of loop and subtracting it from > get_timer() at each loop iteration always yields the time elapsed, > unaffected by rollover. You can then safely compare this elapsed time > with the time-out value. > > Amicalement, Amicalement, -- Albert.