From 44e398ed333f11ad24d1db7785fcc1fc85f3218c Mon Sep 17 00:00:00 2001 From: reinelt Date: Sun, 12 Oct 2003 04:46:19 +0000 Subject: [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 --- udelay.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'udelay.c') 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 -#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)