From mboxrd@z Thu Jan 1 00:00:00 1970 From: J. William Campbell Date: Tue, 24 May 2011 08:41:06 -0700 Subject: [U-Boot] [PATCH] [Timer]Remove calls to [get, reset]_timer outside arch/ In-Reply-To: References: <1306151649-25640-1-git-send-email-graeme.russ@gmail.com> <4DDA50D8.6060601@psyent.com> <4DDA53C0.9090508@gmail.com> <4DDA5D24.2060200@psyent.com> <4DDA9CDA.1080401@comcast.net> <4DDAA77F.7020708@psyent.com> <4DDABF48.5020000@gmail.com> <4DDAC866.1050508@comcast.net> <4DDACB4C.6040001@gmail.com> Message-ID: <4DDBD192.2030303@comcast.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 5/23/2011 10:13 PM, Graeme Russ wrote: > On Tue, May 24, 2011 at 7:02 AM, Graeme Russ wrote: > > [snip] >> Well, we have no control over the argument in cfi driver (unless you plan >> to put #ifdef NIOS all over the place) >> >> Maybe we could round up the parameter inside get_timer() itself? > Wow, what was I on! - Oh, thats right, no coffee ;) > > The parameter to get_timer() is not a timeout, it is a reference epoch Hi Graeme, No, you were not on drugs. If base != 0 then { if (timer - base < 20) return 0; return timer - base -10} return timer. That will make the subsequent comparison do what you wanted. Differences of less than 20 are unreliable because of quantization, so we return 0. If the difference was > 20, return a conservative number, the difference -10. If the input base was 0, return the timer, the user is just trying to read it. Best Regards Bill Campbell > So I think adding reset_timer() to the NIOS get_timer() when the parameter > is zero is the only option > > Regards, > > Graeme > >