1#ifndef _BLACKFIN_DELAY_H 2#define _BLACKFIN_DELAY_H 3 4static inline void __delay(unsigned long loops) 5{ 6 7/* 8 __asm__ __volatile__ ( "\t LSETUP (1f,1f) LC0= %0\n\t" 9 "1:\t NOP;\n\t" 10 : :"a" (loops) 11 : "LT0","LB0","LC0"); 12 13*/ 14 15 __asm__ __volatile__("[--SP] = LC0;\n\t" 16 "[--SP] = LT0;\n\t" 17 "[--SP] = LB0;\n\t" 18 "LSETUP (1f,1f) LC0 = %0;\n\t" 19 "1:\t NOP;\n\t" 20 "LB0 = [SP++];\n\t" 21 "LT0 = [SP++];\n\t" 22 "LC0 = [SP++];\n" 23 : 24 :"a" (loops)); 25} 26 27#include <linux/param.h> /* needed for HZ */ 28 29/* 30 * Use only for very small delays ( < 1 msec). Should probably use a 31 * lookup table, really, as the multiplications take much too long with 32 * short delays. This is a "reasonable" implementation, though (and the 33 * first constant multiplications gets optimized away if the delay is 34 * a constant) 35 */ 36static inline void udelay(unsigned long usecs) 37{ 38 extern unsigned long loops_per_jiffy; 39 __delay(usecs * loops_per_jiffy / (1000000 / HZ)); 40} 41 42#endif /* defined(_BLACKFIN_DELAY_H) */ 43