[U-Boot] [PATCH 2/2] ep93xx: Refactoring of timer code
Matthias Kaehlcke
matthias at kaehlcke.net
Tue Feb 23 23:44:02 CET 2010
Hi Wolfgang,
El Tue, Feb 23, 2010 at 11:23:42PM +0100 Wolfgang Denk ha dit:
> In message <20100223220421.GK20201 at darwin> you wrote:
> > ep93xx: Refactoring of the timer code, including the following changes
> ...
> > +#define TIMER_FREQ 508469
> > +#define CLK_TICKS_PER_SYS_TICK (TIMER_FREQ / CONFIG_SYS_HZ)
> ...
> > + ticks *= (CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ);
> ...
> > + ticks = usecs * CLK_TICKS_PER_SYS_TICK * CONFIG_SYS_HZ;
>
> Why don't you use
>
> ticks *= TIMER_FREQ;
> resp.
> ticks = usecs * TIMER_FREQ;
>
> The combination of " / CONFIG_SYS_HZ * CONFIG_SYS_HZ" is just a bad
> NO-OP (with rounding errors).
you certainly have a point, i'm going to change this as you proposed
> Hm... re-reading the optimized code makes me wonder if the variable
> really should be called "ticks" - looks more as a frequency to me?
here i disagree, the function returns the number of ticks that pass in
a certain number of microseconds, so i think 'ticks' is an appropiate
name
thanks for your review!
--
Matthias Kaehlcke
Embedded Linux Developer
Barcelona
I cannot say whether things will get better if we change,
what I can say is they must change if they are to get better
(Georg Christoph Lichtenberg)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
More information about the U-Boot
mailing list