aboutsummaryrefslogtreecommitdiffstats
path: root/udelay.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-10-12 04:46:19 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-10-12 04:46:19 +0000
commit44e398ed333f11ad24d1db7785fcc1fc85f3218c (patch)
tree03acecc10efdb73d19bb15257a5f47b21169c7c8 /udelay.c
parent3f0c098296f4b06e72a1f69cecafc33482cbceb2 (diff)
downloadlcd4linux-44e398ed333f11ad24d1db7785fcc1fc85f3218c.tar.gz
[lcd4linux @ 2003-10-12 04:46:19 by reinelt]
first try to integrate the Evaluator into a display driver (MatrixOrbital here) small warning in processor.c fixed (thanks to Zachary Giles) workaround for udelay() on alpha (no msr.h avaliable) (thanks to Zachary Giles) git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@265 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'udelay.c')
-rw-r--r--udelay.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/udelay.c b/udelay.c
index 8f5fe28..d728039 100644
--- a/udelay.c
+++ b/udelay.c
@@ -1,4 +1,4 @@
-/* $Id: udelay.c,v 1.13 2003/10/05 17:58:50 reinelt Exp $
+/* $Id: udelay.c,v 1.14 2003/10/12 04:46:19 reinelt Exp $
*
* short delays
*
@@ -22,6 +22,13 @@
*
*
* $Log: udelay.c,v $
+ * Revision 1.14 2003/10/12 04:46:19 reinelt
+ *
+ *
+ * first try to integrate the Evaluator into a display driver (MatrixOrbital here)
+ * small warning in processor.c fixed (thanks to Zachary Giles)
+ * workaround for udelay() on alpha (no msr.h avaliable) (thanks to Zachary Giles)
+ *
* Revision 1.13 2003/10/05 17:58:50 reinelt
* libtool junk; copyright messages cleaned up
*
@@ -120,12 +127,8 @@
#ifdef HAVE_ASM_MSR_H
#include <asm/msr.h>
-#else
-#warning asm/msr.h not found.
-#warning using hard-coded definition.
-#define rdtscl(low) \
- __asm__ __volatile__("rdtsc" : "=a" (low) : : "edx")
#endif
+
#endif
@@ -231,15 +234,21 @@ static void getCPUinfo (int *hasTSC, double *MHz)
void udelay_init (void)
{
+#ifdef HAVE_ASM_MSR_H
+
int tsc;
double mhz;
-
+
getCPUinfo (&tsc, &mhz);
if (tsc && mhz>0.0) {
ticks_per_usec=ceil(mhz);
debug ("using TSC delay loop, %u ticks per microsecond", ticks_per_usec);
- } else {
+ } else
+
+#endif
+
+ {
ticks_per_usec=0;
debug ("using gettimeofday() delay loop");
}
@@ -249,6 +258,8 @@ void udelay_init (void)
void ndelay (unsigned long nsec)
{
+#ifdef HAVE_ASM_MSR_H
+
if (ticks_per_usec) {
unsigned int t1, t2;
@@ -261,8 +272,11 @@ void ndelay (unsigned long nsec)
rdtscl(t2);
} while ((t2-t1)<nsec);
- } else {
-
+ } else
+
+#endif
+
+ {
struct timeval now, end;
gettimeofday (&end, NULL);