Messages in this thread | | | From | Arnd Bergmann <> | Subject | Re: [PATCH 16/19] OpenRISC: Headers | Date | Sun, 19 Jun 2011 21:43:08 +0200 |
| |
On Sunday 19 June 2011 21:39:45 Arnd Bergmann wrote: > > + > > +extern inline void __delay(int loops) > > +{ > > + __asm__ __volatile__ ( > > + "l.srli %0,%0,1;" > > + "1: l.sfeqi %0,0;" > > + "l.bnf 1b;" > > + "l.addi %0,%0,-1;" > > + : "=r" (loops): "0" (loops)); > > +} > > + > > If you have an accurate high-resolution time source, better make this compare > the current time in a loop than do a handcoded delay.
Hmm, I just saw that you actually have a better version of this, but since this is marked "extern inline", code probably always gets this version. Better never use extern inline, except when you have a good reason and document it.
Arnd
| |