On Friday 01 February 2008, Bryan Wu wrote: > > > > > + while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) > > > > + cpu_relax(); > > > > > > I'd suggest that this commonly-occurring code sequence be implemented in a > > > standalone function. > > > > The bitmask to check can be a parameter too, as well as the > > termination result after the mask. That will allow other loops > > to get properly limited too -- e.g. wait till RXS or TXS clears, > > not just SPIF getting set. > > > > Before SPIF getting set, we do wait for RXS or TXS clears in the code, > right?
Sure, but it's the same kind of loop-forever thing. All "loop-forever" primitives should be replaced by ones that have some kind of ceiling, since it's far from unheard-of that hardware glitch. My observation was that the standalone function can trivially handle "loop-till-set" as well as "loop-till-clear". - Dave ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ spi-devel-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spi-devel-general
