:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / drivers / input / psaux / mouse.h
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.
3
4 /* Mouse commands. */
5 /* Set resolution. */
6
7 #define MOUSE_SET_RESOLUTION            0xE8
8
9 /* Set 1:1 scaling. */
10
11 #define MOUSE_SET_SCALE11               0xE6
12
13 /* Set 2:1 scaling. */
14
15 #define MOUSE_SET_SCALE21               0xE7
16
17 /* Get scaling factor. */
18
19 #define MOUSE_GET_SCALE                 0xE9
20
21 /* Set stream mode. */
22
23 #define MOUSE_SET_STREAM                0xEA
24
25 /* Set sample rate (number of times the controller will poll the port
26    per second). */
27
28 #define MOUSE_SET_SAMPLE_RATE           0xF3
29
30 /* Enable mouse device. */
31
32 #define MOUSE_ENABLE_DEVICE             0xF4
33
34 /* Disable mouse device. */
35
36 #define MOUSE_DISABLE_DEVICE            0xF5
37
38 /* Reset aux device. */
39
40 #define MOUSE_RESET                     0xFF
41
42 /* Command byte ACK. */
43
44 #define MOUSE_ACK                       0xFA
45
46 #define MOUSE_INTERRUPTS_OFF            (CONTROLLER_MODE_KCC | \
47                                          CONTROLLER_MODE_DISABLE_MOUSE | \
48                                          CONTROLLER_MODE_SYS | \
49                                          CONTROLLER_MODE_KEYBOARD_INTERRUPT)
50
51 #define MOUSE_INTERRUPTS_ON             (CONTROLLER_MODE_KCC | \
52                                          CONTROLLER_MODE_SYS | \
53                                          CONTROLLER_MODE_MOUSE_INTERRUPT | \
54                                          CONTROLLER_MODE_KEYBOARD_INTERRUPT)
55
56 /* Used with mouse buttons */
57
58 #define GPM_B_LEFT      4
59 #define GPM_B_MIDDLE    2
60 #define GPM_B_RIGHT     1
61
62 /* Some aux operations take long time. */
63
64 #define MAX_RETRIES          60
65
66 /* Hardware defines. */
67
68 #define MOUSE_IRQ            12
69 #define MOUSE_WRAP_MASK      0x1F
70
71 static PIRP  CurrentIrp;
72 static ULONG MouseDataRead;
73 static ULONG MouseDataRequired;
74 static BOOLEAN AlreadyOpened = FALSE;
75 static KDPC MouseDpc;
76
77 static VOID MouseDpcRoutine(PKDPC Dpc,
78                           PVOID DeferredContext,
79                           PVOID SystemArgument1,
80                           PVOID SystemArgument2);