- Update to r53061
[reactos.git] / drivers / input / sermouse / sermouse.h
1 #include <ntifs.h>
2 #include <kbdmou.h>
3 #include <ntddser.h>
4 #include <ntddmou.h>
5 #include <debug.h>
6
7 #define SERMOUSE_TAG 'uoMS'
8
9 typedef enum
10 {
11 dsStopped,
12 dsStarted,
13 dsPaused,
14 dsRemoved,
15 dsSurpriseRemoved
16 } SERMOUSE_DEVICE_STATE;
17
18 typedef enum
19 {
20 mtNone, /* No Mouse */
21 mtMicrosoft, /* Microsoft Mouse with 2 buttons */
22 mtLogitech, /* Logitech Mouse with 3 buttons */
23 mtWheelZ /* Microsoft Wheel Mouse (aka Z Mouse) */
24 } SERMOUSE_MOUSE_TYPE;
25
26 /* Size for packet buffer used in interrupt routine */
27 #define PACKET_BUFFER_SIZE 4
28
29 /* Hardware byte mask for left button */
30 #define LEFT_BUTTON_MASK 0x20
31 /* Hardware to Microsoft specific code byte shift for left button */
32 #define LEFT_BUTTON_SHIFT 5
33 /* Hardware byte mask for right button */
34 #define RIGHT_BUTTON_MASK 0x10
35 /* Hardware to Microsoft specific code byte shift for right button */
36 #define RIGHT_BUTTON_SHIFT 3
37 /* Hardware byte mask for middle button */
38 #define MIDDLE_BUTTON_MASK 0x20
39 /* Hardware to Microsoft specific code byte shift for middle button */
40 #define MIDDLE_BUTTON_SHIFT 3
41
42 /* Microsoft byte mask for left button */
43 #define MOUSE_BUTTON_LEFT 0x01
44 /* Microsoft byte mask for right button */
45 #define MOUSE_BUTTON_RIGHT 0x02
46 /* Microsoft byte mask for middle button */
47 #define MOUSE_BUTTON_MIDDLE 0x04
48
49 typedef struct _SERMOUSE_DRIVER_EXTENSION
50 {
51 USHORT NumberOfButtons;
52 } SERMOUSE_DRIVER_EXTENSION, *PSERMOUSE_DRIVER_EXTENSION;
53
54 typedef struct _SERMOUSE_DEVICE_EXTENSION
55 {
56 PDEVICE_OBJECT LowerDevice;
57 SERMOUSE_DEVICE_STATE PnpState;
58 SERMOUSE_MOUSE_TYPE MouseType;
59 PSERMOUSE_DRIVER_EXTENSION DriverExtension;
60
61 HANDLE WorkerThreadHandle;
62 KEVENT StopWorkerThreadEvent;
63
64 ULONG ActiveQueue;
65 ULONG InputDataCount[2];
66 CONNECT_DATA ConnectData;
67 MOUSE_INPUT_DATA MouseInputData[2];
68 UCHAR PacketBuffer[PACKET_BUFFER_SIZE];
69 ULONG PacketBufferPosition;
70 ULONG PreviousButtons;
71 MOUSE_ATTRIBUTES AttributesInformation;
72 } SERMOUSE_DEVICE_EXTENSION, *PSERMOUSE_DEVICE_EXTENSION;
73
74 /************************************ createclose.c */
75
76 DRIVER_DISPATCH SermouseCreate;
77
78 DRIVER_DISPATCH SermouseClose;
79
80 DRIVER_DISPATCH SermouseCleanup;
81
82 /************************************ detect.c */
83
84 SERMOUSE_MOUSE_TYPE
85 SermouseDetectLegacyDevice(
86 IN PDEVICE_OBJECT LowerDevice);
87
88 /************************************ fdo.c */
89
90 DRIVER_ADD_DEVICE SermouseAddDevice;
91
92 DRIVER_DISPATCH SermousePnp;
93
94 /************************************ internaldevctl.c */
95
96 DRIVER_DISPATCH SermouseInternalDeviceControl;
97
98 /************************************ misc.c */
99
100 NTSTATUS
101 ForwardIrpAndWait(
102 IN PDEVICE_OBJECT DeviceObject,
103 IN PIRP Irp);
104
105 NTSTATUS NTAPI
106 ForwardIrpAndForget(
107 IN PDEVICE_OBJECT DeviceObject,
108 IN PIRP Irp);
109
110 /************************************ readmouse.c */
111
112 VOID NTAPI
113 SermouseDeviceWorker(
114 PVOID Context);