patch-2.4.22 linux-2.4.22/include/asm-mips/delay.h
Next file: linux-2.4.22/include/asm-mips/div64.h
Previous file: linux-2.4.22/include/asm-mips/dec/prom.h
Back to the patch index
Back to the overall index
- Lines: 54
- Date:
2003-08-25 04:44:43.000000000 -0700
- Orig file:
linux-2.4.21/include/asm-mips/delay.h
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.21/include/asm-mips/delay.h linux-2.4.22/include/asm-mips/delay.h
@@ -27,7 +27,7 @@
}
/*
- * division by multiplication: you don't have to worry about
+ * Division by multiplication: you don't have to worry about
* loss of precision.
*
* Use only for very small delays ( < 1 msec). Should probably use a
@@ -40,17 +40,32 @@
{
unsigned long lo;
-#if (HZ == 100)
- usecs *= 0x00068db8; /* 2**32 / (1000000 / HZ) */
-#elif (HZ == 128)
- usecs *= 0x0008637b; /* 2**32 / (1000000 / HZ) */
-#endif
+ /*
+ * Excessive precission? Probably ...
+ */
+ usecs *= (unsigned long) (((0x8000000000000000ULL / (500000 / HZ)) +
+ 0x80000000ULL) >> 32);
__asm__("multu\t%2,%3"
:"=h" (usecs), "=l" (lo)
:"r" (usecs),"r" (lpj));
__delay(usecs);
}
+extern __inline__ void __ndelay(unsigned long nsecs, unsigned long lpj)
+{
+ unsigned long lo;
+
+ /*
+ * Excessive precission? Probably ...
+ */
+ nsecs *= (unsigned long) (((0x8000000000000000ULL / (500000000 / HZ)) +
+ 0x80000000ULL) >> 32);
+ __asm__("multu\t%2,%3"
+ :"=h" (nsecs), "=l" (lo)
+ :"r" (nsecs),"r" (lpj));
+ __delay(nsecs);
+}
+
#ifdef CONFIG_SMP
#define __udelay_val cpu_data[smp_processor_id()].udelay_val
#else
@@ -58,5 +73,6 @@
#endif
#define udelay(usecs) __udelay((usecs),__udelay_val)
+#define ndelay(nsecs) __ndelay((nsecs),__udelay_val)
#endif /* _ASM_DELAY_H */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)