On Wed, 4 May 2011 14:15:58 -0500
Andy Fleming <aflem...@gmail.com> wrote:

> >> >> +
> >> >> +#define udelay(x) {int i, j; for (i = 0; i < x; i++) for (j = 0; j < 
> >> >> 10000; j++); }
> >> > There were many comments on this udelay before, we should not use this
> >> > define, but use the udelay() which u-boot provides.
> >> >
> >>
> >> Is there a udelay that is defined for the nand_spl build?  The problem is 
> >> doing proper time based delay in nand_spl would require a lot more code.
> >
> > This loop is similar to what nand_spl/nand_boot.c is using.  It's ugly, but
> > the goal here is small code rather than cleanliness.  Is the timebase
> > running at this point?  How much code is required to get the timebase
> > frequency?
> 
> 
> Is it possible to compromise and not call it udelay? udelay(x) is
> supposed to delay for x microseconds, but clearly this delays for
> x*10000 iterations through a loop. Also, are we sure that such a macro
> works at all? It looks like the sort of thing compilers optimize away
> all the time.

I think it used to special-case such empty-body loops, but apparently not
anymore.  I did some test-compiles and such constructs are optimized away.

-Scott

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to