From: Wolfgang Denk Date: Tue, 17 Mar 2009 09:54:27 +0100 Subject: [U-Boot] [PATCH 1/1] The GP timer is fixed for 1msec and CONFIG_SYS_HZ to 1000. In-Reply-To: <19F8576C6E063C45BE387C64729E73940427CBF3D2@dbde02.ent.ti.com> References: <1236935820-31677-1-git-send-email-mani.pillai@ti.com> <49BE9E1A.4000307@googlemail.com> <19F8576C6E063C45BE387C64729E73940427CBF3D2@dbde02.ent.ti.com> Message-ID: <20090317085427.07408832C2FD@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 "Pillai, Manikandan", In message <19F8576C6E063C45BE387C64729E73940427CBF3D2@dbde02.ent.ti.com> you wrote: > > > > - ulong now = readl(&timer_base->tcrr); /* current tick value */ > > > - > > > - if (now >= lastinc) /* normal mode (non roll) */ > > > - /* move stamp fordward with absoulte diff ticks */ > > > - timestamp += (now - lastinc); > > > - else /* we have rollover of incrementer */ > > > - timestamp += (0xFFFFFFFF - lastinc) + now; > > > - lastinc = now; > > > - return timestamp; > > > > As already mentioned in > > > > http://lists.denx.de/pipermail/u-boot/2009-March/048842.html > > > > I don't understand why you remove the overflow handling here? > [Pillai, Manikandan] Is overflow handling really required here ??? What makes you sure it is NOT needed? > > With '>> 6' this will result in 793.457Hz, with '>> 5' we will get > > 1586.914Hz. Correct? > > > > Both doesn't fit > [Pillai, Manikandan] I knew it doesn't give the correct values. This was tested > using sleep() function. Since 5 gives a > time than 1 second, I picked up 5 here. Argh... We don't need realy high precision, but I think we should attempt to not worse than +/- 2% or so. THis implementation is not acceptable. 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 "I can call spirits from the vasty deep." "Why so can I, or so can any man; but will they come when you do call for them?" - Shakespeare, 1 King Henry IV, Act III, Scene I.