Better timing
authorJelmer Vernooij <jelmer@vernstok.nl>
Tue, 5 Aug 2003 14:47:45 +0000 (15:47 +0100)
committerJelmer Vernooij <jelmer@vernstok.nl>
Tue, 5 Aug 2003 14:47:45 +0000 (15:47 +0100)
at89ser.c
prog1.c

index 2c0b75ff8e14a35db634ef4695774b2d39631ff0..126782ecb9c63144819420b13b82f27dabd134db 100644 (file)
--- a/at89ser.c
+++ b/at89ser.c
@@ -17,7 +17,7 @@
 #include <time.h>
 #include "at89ser.h"
 
-int serport = 0x3f8;
+int serport = 0x2f8;
 
 #define INT_PORT   (serport+1)
 #define CONF_PORT  (serport+3)
@@ -26,11 +26,7 @@ int serport = 0x3f8;
 
 #define waitmillisec(n) { struct timespec ts = {0, 1000000ul * n}; /* 0 sec, 1e6 ns = 1ms */ nanosleep(&ts, NULL); }
 
-#ifndef SLOW_COMPUTER
-#define waitmicrosec(n) { struct timespec ts = {0, 1000ul * n}; /* 0 sec, 1e9 ns = 1micros */ nanosleep(&ts, NULL);}
-#else
-#define waitmicrosec(n) { int i; for(i = 0; i < SLOW_COMPUTER * n; i++); }  
-#endif
+#define waitmicrosec(n) { int i; for(i = 0; i < n; i++) outb(0, 0x80); }
        
 inline void SetSCK() 
 { 
diff --git a/prog1.c b/prog1.c
index f0c5af9536a01bfe6d29007862ce2dfd7bb07293..8066368b1976eb4d968159b6574edbd593dcd1ec 100644 (file)
--- a/prog1.c
+++ b/prog1.c
@@ -142,6 +142,12 @@ int main(int argc, const char **argv)
                return 1;
        }
 
+       if(ioperm(0x80, 1, 1) == -1) 
+       {
+               perror("ioperm");
+               return 1;
+       }
+
        signal(SIGINT, quit);
        signal(SIGSEGV, quit);