5 * Copyright (c) 1999-2002 Vojtech Pavlik
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
13 #include <linux/input.h>
14 #include <linux/list.h>
20 void *private; /* Private pointer for joystick drivers */
21 void *driver; /* Private pointer for gameport drivers */
31 void (*trigger)(struct gameport *);
32 unsigned char (*read)(struct gameport *);
33 int (*cooked_read)(struct gameport *, int *, int *);
34 int (*calibrate)(struct gameport *, int *, int *);
35 int (*open)(struct gameport *, int);
36 void (*close)(struct gameport *);
38 struct gameport_dev *dev;
40 struct list_head node;
48 void (*connect)(struct gameport *, struct gameport_dev *dev);
49 void (*disconnect)(struct gameport *);
51 struct list_head node;
54 int gameport_open(struct gameport *gameport, struct gameport_dev *dev, int mode);
55 void gameport_close(struct gameport *gameport);
56 void gameport_rescan(struct gameport *gameport);
58 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
59 void gameport_register_port(struct gameport *gameport);
60 void gameport_unregister_port(struct gameport *gameport);
62 static inline void gameport_register_port(struct gameport *gameport) { return; }
63 static inline void gameport_unregister_port(struct gameport *gameport) { return; }
66 void gameport_register_device(struct gameport_dev *dev);
67 void gameport_unregister_device(struct gameport_dev *dev);
69 #define GAMEPORT_MODE_DISABLED 0
70 #define GAMEPORT_MODE_RAW 1
71 #define GAMEPORT_MODE_COOKED 2
73 #define GAMEPORT_ID_VENDOR_ANALOG 0x0001
74 #define GAMEPORT_ID_VENDOR_MADCATZ 0x0002
75 #define GAMEPORT_ID_VENDOR_LOGITECH 0x0003
76 #define GAMEPORT_ID_VENDOR_CREATIVE 0x0004
77 #define GAMEPORT_ID_VENDOR_GENIUS 0x0005
78 #define GAMEPORT_ID_VENDOR_INTERACT 0x0006
79 #define GAMEPORT_ID_VENDOR_MICROSOFT 0x0007
80 #define GAMEPORT_ID_VENDOR_THRUSTMASTER 0x0008
81 #define GAMEPORT_ID_VENDOR_GRAVIS 0x0009
82 #define GAMEPORT_ID_VENDOR_GUILLEMOT 0x000a
84 static __inline__ void gameport_trigger(struct gameport *gameport)
86 if (gameport->trigger)
87 gameport->trigger(gameport);
89 outb(0xff, gameport->io);
92 static __inline__ unsigned char gameport_read(struct gameport *gameport)
95 return gameport->read(gameport);
97 return inb(gameport->io);
100 static __inline__ int gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
102 if (gameport->cooked_read)
103 return gameport->cooked_read(gameport, axes, buttons);
108 static __inline__ int gameport_calibrate(struct gameport *gameport, int *axes, int *max)
110 if (gameport->calibrate)
111 return gameport->calibrate(gameport, axes, max);
116 static __inline__ int gameport_time(struct gameport *gameport, int time)
118 return (time * gameport->speed) / 1000;