1 // All or parts of this file are from CHAOS (http://www.se.chaosdev.org/).
2 // CHAOS is also under the GNU General Public License.
7 #define MOUSE_SET_RESOLUTION 0xE8
11 #define MOUSE_SET_SCALE11 0xE6
13 /* Set 2:1 scaling. */
15 #define MOUSE_SET_SCALE21 0xE7
17 /* Get scaling factor. */
19 #define MOUSE_GET_SCALE 0xE9
21 /* Set stream mode. */
23 #define MOUSE_SET_STREAM 0xEA
25 /* Set sample rate (number of times the controller will poll the port
28 #define MOUSE_SET_SAMPLE_RATE 0xF3
30 /* Enable mouse device. */
32 #define MOUSE_ENABLE_DEVICE 0xF4
34 /* Disable mouse device. */
36 #define MOUSE_DISABLE_DEVICE 0xF5
38 /* Reset aux device. */
40 #define MOUSE_RESET 0xFF
42 /* Command byte ACK. */
44 #define MOUSE_ACK 0xFA
46 #define MOUSE_INTERRUPTS_OFF (CONTROLLER_MODE_KCC | \
47 CONTROLLER_MODE_DISABLE_MOUSE | \
48 CONTROLLER_MODE_SYS | \
49 CONTROLLER_MODE_KEYBOARD_INTERRUPT)
51 #define MOUSE_INTERRUPTS_ON (CONTROLLER_MODE_KCC | \
52 CONTROLLER_MODE_SYS | \
53 CONTROLLER_MODE_MOUSE_INTERRUPT | \
54 CONTROLLER_MODE_KEYBOARD_INTERRUPT)
56 /* Used with mouse buttons */
59 #define GPM_B_MIDDLE 2
62 /* Some aux operations take long time. */
64 #define MAX_RETRIES 60
66 /* Hardware defines. */
69 #define MOUSE_WRAP_MASK 0x1F
71 static PIRP CurrentIrp;
72 static ULONG MouseDataRead;
73 static ULONG MouseDataRequired;
74 static BOOLEAN AlreadyOpened = FALSE;
77 static VOID MouseDpcRoutine(PKDPC Dpc,
78 PVOID DeferredContext,
79 PVOID SystemArgument1,
80 PVOID SystemArgument2);