]> git.neil.brown.name Git - history.git/commitdiff
Update the gameport drivers to Dave Jones's tree.
authorVojtech Pavlik <vojtech@twilight.ucw.cz>
Wed, 3 Jul 2002 16:36:11 +0000 (18:36 +0200)
committerVojtech Pavlik <vojtech@twilight.ucw.cz>
Wed, 3 Jul 2002 16:36:11 +0000 (18:36 +0200)
drivers/input/gameport/gameport.c

index 01542530e6e45fd029f1b91e452ed8c33e89a8a2..4ade83a2db99fc52c40b6c994f1ae9cf620c392e 100644 (file)
@@ -54,16 +54,36 @@ EXPORT_SYMBOL(gameport_cooked_read);
 static struct gameport *gameport_list;
 static struct gameport_dev *gameport_dev;
 
+
+#ifdef __i386__
+
+#define DELTA(x,y)      ((y)-(x)+((y)<(x)?1193180/HZ:0))
+#define GET_TIME(x)     do { x = get_time_pit(); } while (0)
+
+static unsigned int get_time_pit(void)
+{
+       extern spinlock_t i8253_lock;
+       unsigned long flags;
+       unsigned int count;
+
+       spin_lock_irqsave(&i8253_lock, flags);
+       outb_p(0x00, 0x43);
+       count = inb_p(0x40);
+       count |= inb_p(0x40) << 8;
+       spin_unlock_irqrestore(&i8253_lock, flags);
+
+       return count;
+}
+
+#endif
+
 /*
  * gameport_measure_speed() measures the gameport i/o speed.
  */
 
 static int gameport_measure_speed(struct gameport *gameport)
 {
-#if defined(__i386__) || defined(__x86_64__)
-
-#define GET_TIME(x)     do { outb(0, 0x43); x = inb(0x40); x |= inb(0x40) << 8; } while (0)
-#define DELTA(x,y)      ((y)-(x)+((y)<(x)?1193180L/HZ:0))
+#ifdef __i386__
 
        unsigned int i, t, t1, t2, t3, tx;
        unsigned long flags;