From: Wolfgang Denk Date: Mon, 23 May 2011 23:53:23 +0200 Subject: [U-Boot] [PATCH] [Timer]Remove calls to [get, reset]_timer outside arch/ In-Reply-To: <4DDAC866.1050508@comcast.net> 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> Message-ID: <20110523215323.448EECF5CA6@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 <4DDAC866.1050508@comcast.net> you wrote: > > > Is there any reason why we cannot silently perform a reset_timer() any time > > set_timer() is called with a parameter of 0? > Hi All, > I assume you mean get_timer(0)? In principle, you cannot do this > because it could be inside another get_timer(0) loop that has already > some time elapsed before you hit the inner get_timer(0). I think what > needs to happen on the old NIOS with 10 ms resolution on the interrupt > times is that all timer intervals must have 10 ms added and then rounded > up to the nearest multiple of 10. Thus, if you wanted to wait for 1 > millisecond, you must use an argument of 20 ms to be sure you wait at > all! If you use an argument of 10, it won't help because you could get > an interrupt right away and exit. If these routines are nios2 specific, > you could add a local reset_timer, but I assume they are generic. . Note > that if these routines are not nios2 specific, is there any harm in > waiting "too long"? I think in the context of this rework get_timer() should be changed to take no argumen. Actually noe is needed, and if used as is now it can only cuse harm. 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 Hindsight is an exact science.