ReactOS 0.4.16-dev-125-g798ea90
hardware.c File Reference
#include "inport.h"
#include <debug.h>
Include dependency graph for hardware.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define READ_MOUSE(DeviceExtension, Port)    READ_PORT_UCHAR((DeviceExtension)->IoBase + (Port))
 
#define WRITE_MOUSE(DeviceExtension, Port, Data)    WRITE_PORT_UCHAR((DeviceExtension)->IoBase + (Port), (Data))
 
#define NEC_BM_DATA   0x00
 
#define NEC_BM_CONTROL   0x04
 
#define NEC_INT_ENABLE   0x00
 
#define NEC_INT_DISABLE   0x10
 
#define NEC_READ_X_LOW   0x00
 
#define NEC_READ_X_HIGH   0x20
 
#define NEC_READ_Y_LOW   0x40
 
#define NEC_READ_Y_HIGH   0x60
 
#define NEC_INPUT_CAPTURE   0x00
 
#define NEC_INPUT_HOLD   0x80
 
#define NEC_BM_CONFIG   0x06
 
#define NEC_PPI_INT_ENABLE   0x08
 
#define NEC_PPI_INT_DISABLE   0x09
 
#define NEC_PPI_HC_NO_CLEAR   0x0E
 
#define NEC_PPI_HC_CLEAR   0x0F
 
#define NEC_PPI_DEFAULT_MODE   0x93
 
#define NEC_BM_INT_RATE   0x4002
 
#define NEC_RATE_120_HZ   0x00
 
#define NEC_RATE_60_HZ   0x01
 
#define NEC_RATE_30_HZ   0x02
 
#define NEC_RATE_15_HZ   0x03
 
#define NEC_BM_HIRESO_BASE   (PUCHAR)0x61
 
#define NEC_BUTTON_RIGHT   0x20
 
#define NEC_BUTTON_LEFT   0x80
 
#define MS_INPORT_CONTROL   0x00
 
#define INPORT_REG_BTNS   0x00
 
#define INPORT_REG_X   0x01
 
#define INPORT_REG_Y   0x02
 
#define INPORT_REG_MODE   0x07
 
#define INPORT_RESET   0x80
 
#define MS_INPORT_DATA   0x01
 
#define INPORT_MODE_IRQ   0x01
 
#define INPORT_MODE_BASE   0x10
 
#define INPORT_MODE_HOLD   0x20
 
#define INPORT_HAS_MOVED   0x40
 
#define MS_INPORT_SIGNATURE   0x02
 
#define MS_BUTTON_RIGHT   0x01
 
#define MS_BUTTON_MIDDLE   0x02
 
#define MS_BUTTON_LEFT   0x04
 
#define LOG_BM_DATA   0x00
 
#define LOG_BM_SIGNATURE   0x01
 
#define LOG_SIGNATURE_BYTE   0xA5
 
#define LOG_BM_CONTROL   0x02
 
#define LOG_ENABLE_IRQ   0x00
 
#define LOG_DISABLE_IRQ   0x10
 
#define LOG_READ_X_LOW   0x80
 
#define LOG_READ_X_HIGH   0xA0
 
#define LOG_READ_Y_LOW   0xC0
 
#define LOG_READ_Y_HIGH   0xE0
 
#define LOG_BM_CONFIG   0x03
 
#define LOG_DEFAULT_MODE   0x90
 
#define LOG_CONFIG_BYTE   0x91
 
#define LOG_BUTTON_RIGHT   0x20
 
#define LOG_BUTTON_MIDDLE   0x40
 
#define LOG_BUTTON_LEFT   0x80
 

Functions

VOID NTAPI InPortDpcForIsr (_In_ PKDPC Dpc, _In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _In_opt_ PVOID Context)
 
BOOLEAN NTAPI InPortIsr (_In_ PKINTERRUPT Interrupt, _In_ PVOID Context)
 
VOID NTAPI InPortInitializeMouse (_In_ PINPORT_DEVICE_EXTENSION DeviceExtension)
 
BOOLEAN NTAPI InPortStartMouse (_In_ PVOID SynchronizeContext)
 
BOOLEAN NTAPI InPortStopMouse (_In_ PVOID SynchronizeContext)
 

Macro Definition Documentation

◆ INPORT_HAS_MOVED

#define INPORT_HAS_MOVED   0x40

Definition at line 74 of file hardware.c.

◆ INPORT_MODE_BASE

#define INPORT_MODE_BASE   0x10

Definition at line 72 of file hardware.c.

◆ INPORT_MODE_HOLD

#define INPORT_MODE_HOLD   0x20

Definition at line 73 of file hardware.c.

◆ INPORT_MODE_IRQ

#define INPORT_MODE_IRQ   0x01

Definition at line 71 of file hardware.c.

◆ INPORT_REG_BTNS

#define INPORT_REG_BTNS   0x00

Definition at line 64 of file hardware.c.

◆ INPORT_REG_MODE

#define INPORT_REG_MODE   0x07

Definition at line 67 of file hardware.c.

◆ INPORT_REG_X

#define INPORT_REG_X   0x01

Definition at line 65 of file hardware.c.

◆ INPORT_REG_Y

#define INPORT_REG_Y   0x02

Definition at line 66 of file hardware.c.

◆ INPORT_RESET

#define INPORT_RESET   0x80

Definition at line 68 of file hardware.c.

◆ LOG_BM_CONFIG

#define LOG_BM_CONFIG   0x03

Definition at line 99 of file hardware.c.

◆ LOG_BM_CONTROL

#define LOG_BM_CONTROL   0x02

Definition at line 90 of file hardware.c.

◆ LOG_BM_DATA

#define LOG_BM_DATA   0x00

Definition at line 85 of file hardware.c.

◆ LOG_BM_SIGNATURE

#define LOG_BM_SIGNATURE   0x01

Definition at line 87 of file hardware.c.

◆ LOG_BUTTON_LEFT

#define LOG_BUTTON_LEFT   0x80

Definition at line 105 of file hardware.c.

◆ LOG_BUTTON_MIDDLE

#define LOG_BUTTON_MIDDLE   0x40

Definition at line 104 of file hardware.c.

◆ LOG_BUTTON_RIGHT

#define LOG_BUTTON_RIGHT   0x20

Definition at line 103 of file hardware.c.

◆ LOG_CONFIG_BYTE

#define LOG_CONFIG_BYTE   0x91

Definition at line 101 of file hardware.c.

◆ LOG_DEFAULT_MODE

#define LOG_DEFAULT_MODE   0x90

Definition at line 100 of file hardware.c.

◆ LOG_DISABLE_IRQ

#define LOG_DISABLE_IRQ   0x10

Definition at line 92 of file hardware.c.

◆ LOG_ENABLE_IRQ

#define LOG_ENABLE_IRQ   0x00

Definition at line 91 of file hardware.c.

◆ LOG_READ_X_HIGH

#define LOG_READ_X_HIGH   0xA0

Definition at line 95 of file hardware.c.

◆ LOG_READ_X_LOW

#define LOG_READ_X_LOW   0x80

Definition at line 94 of file hardware.c.

◆ LOG_READ_Y_HIGH

#define LOG_READ_Y_HIGH   0xE0

Definition at line 97 of file hardware.c.

◆ LOG_READ_Y_LOW

#define LOG_READ_Y_LOW   0xC0

Definition at line 96 of file hardware.c.

◆ LOG_SIGNATURE_BYTE

#define LOG_SIGNATURE_BYTE   0xA5

Definition at line 88 of file hardware.c.

◆ MS_BUTTON_LEFT

#define MS_BUTTON_LEFT   0x04

Definition at line 80 of file hardware.c.

◆ MS_BUTTON_MIDDLE

#define MS_BUTTON_MIDDLE   0x02

Definition at line 79 of file hardware.c.

◆ MS_BUTTON_RIGHT

#define MS_BUTTON_RIGHT   0x01

Definition at line 78 of file hardware.c.

◆ MS_INPORT_CONTROL

#define MS_INPORT_CONTROL   0x00

Definition at line 63 of file hardware.c.

◆ MS_INPORT_DATA

#define MS_INPORT_DATA   0x01

Definition at line 70 of file hardware.c.

◆ MS_INPORT_SIGNATURE

#define MS_INPORT_SIGNATURE   0x02

Definition at line 76 of file hardware.c.

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file hardware.c.

◆ NEC_BM_CONFIG

#define NEC_BM_CONFIG   0x06

Definition at line 42 of file hardware.c.

◆ NEC_BM_CONTROL

#define NEC_BM_CONTROL   0x04

Definition at line 30 of file hardware.c.

◆ NEC_BM_DATA

#define NEC_BM_DATA   0x00

Definition at line 28 of file hardware.c.

◆ NEC_BM_HIRESO_BASE

#define NEC_BM_HIRESO_BASE   (PUCHAR)0x61

Definition at line 55 of file hardware.c.

◆ NEC_BM_INT_RATE

#define NEC_BM_INT_RATE   0x4002

Definition at line 49 of file hardware.c.

◆ NEC_BUTTON_LEFT

#define NEC_BUTTON_LEFT   0x80

Definition at line 58 of file hardware.c.

◆ NEC_BUTTON_RIGHT

#define NEC_BUTTON_RIGHT   0x20

Definition at line 57 of file hardware.c.

◆ NEC_INPUT_CAPTURE

#define NEC_INPUT_CAPTURE   0x00

Definition at line 39 of file hardware.c.

◆ NEC_INPUT_HOLD

#define NEC_INPUT_HOLD   0x80

Definition at line 40 of file hardware.c.

◆ NEC_INT_DISABLE

#define NEC_INT_DISABLE   0x10

Definition at line 32 of file hardware.c.

◆ NEC_INT_ENABLE

#define NEC_INT_ENABLE   0x00

Definition at line 31 of file hardware.c.

◆ NEC_PPI_DEFAULT_MODE

#define NEC_PPI_DEFAULT_MODE   0x93

Definition at line 47 of file hardware.c.

◆ NEC_PPI_HC_CLEAR

#define NEC_PPI_HC_CLEAR   0x0F

Definition at line 46 of file hardware.c.

◆ NEC_PPI_HC_NO_CLEAR

#define NEC_PPI_HC_NO_CLEAR   0x0E

Definition at line 45 of file hardware.c.

◆ NEC_PPI_INT_DISABLE

#define NEC_PPI_INT_DISABLE   0x09

Definition at line 44 of file hardware.c.

◆ NEC_PPI_INT_ENABLE

#define NEC_PPI_INT_ENABLE   0x08

Definition at line 43 of file hardware.c.

◆ NEC_RATE_120_HZ

#define NEC_RATE_120_HZ   0x00

Definition at line 50 of file hardware.c.

◆ NEC_RATE_15_HZ

#define NEC_RATE_15_HZ   0x03

Definition at line 53 of file hardware.c.

◆ NEC_RATE_30_HZ

#define NEC_RATE_30_HZ   0x02

Definition at line 52 of file hardware.c.

◆ NEC_RATE_60_HZ

#define NEC_RATE_60_HZ   0x01

Definition at line 51 of file hardware.c.

◆ NEC_READ_X_HIGH

#define NEC_READ_X_HIGH   0x20

Definition at line 35 of file hardware.c.

◆ NEC_READ_X_LOW

#define NEC_READ_X_LOW   0x00

Definition at line 34 of file hardware.c.

◆ NEC_READ_Y_HIGH

#define NEC_READ_Y_HIGH   0x60

Definition at line 37 of file hardware.c.

◆ NEC_READ_Y_LOW

#define NEC_READ_Y_LOW   0x40

Definition at line 36 of file hardware.c.

◆ READ_MOUSE

#define READ_MOUSE (   DeviceExtension,
  Port 
)     READ_PORT_UCHAR((DeviceExtension)->IoBase + (Port))

Definition at line 19 of file hardware.c.

◆ WRITE_MOUSE

#define WRITE_MOUSE (   DeviceExtension,
  Port,
  Data 
)     WRITE_PORT_UCHAR((DeviceExtension)->IoBase + (Port), (Data))

Definition at line 22 of file hardware.c.

Function Documentation

◆ InPortDpcForIsr()

VOID NTAPI InPortDpcForIsr ( _In_ PKDPC  Dpc,
_In_ PDEVICE_OBJECT  DeviceObject,
_Inout_ PIRP  Irp,
_In_opt_ PVOID  Context 
)

Definition at line 111 of file hardware.c.

116{
117 PINPORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
119 ULONG DummyInputDataConsumed;
120 INPORT_RAW_DATA RawData;
121
125
126 /* Copy raw data */
128 RawData = DeviceExtension->RawData;
130
131 /* Fill out fields */
132 DeviceExtension->MouseInputData.LastX = RawData.DeltaX;
133 DeviceExtension->MouseInputData.LastY = RawData.DeltaY;
134 DeviceExtension->MouseInputData.ButtonFlags = 0;
135 if (RawData.ButtonDiff != 0)
136 {
137 switch (DeviceExtension->MouseType)
138 {
139 case NecBusMouse:
140 {
141 if (RawData.ButtonDiff & NEC_BUTTON_LEFT)
142 {
143 if (RawData.Buttons & NEC_BUTTON_LEFT)
145 else
147 }
148 if (RawData.ButtonDiff & NEC_BUTTON_RIGHT)
149 {
150 if (RawData.Buttons & NEC_BUTTON_RIGHT)
152 else
154 }
155
156 break;
157 }
158
159 case MsInPortMouse:
160 {
161 /* Button flags have to be inverted */
162 if (RawData.ButtonDiff & MS_BUTTON_LEFT)
163 {
164 if (RawData.Buttons & MS_BUTTON_LEFT)
166 else
168 }
169 if (RawData.ButtonDiff & MS_BUTTON_RIGHT)
170 {
171 if (RawData.Buttons & MS_BUTTON_RIGHT)
173 else
175 }
176 if (RawData.ButtonDiff & MS_BUTTON_MIDDLE)
177 {
178 if (RawData.Buttons & MS_BUTTON_MIDDLE)
180 else
182 }
183
184 break;
185 }
186
187 case LogitechBusMouse:
188 {
189 if (RawData.ButtonDiff & LOG_BUTTON_LEFT)
190 {
191 if (RawData.Buttons & LOG_BUTTON_LEFT)
193 else
195 }
196 if (RawData.ButtonDiff & LOG_BUTTON_RIGHT)
197 {
198 if (RawData.Buttons & LOG_BUTTON_RIGHT)
200 else
202 }
203 if (RawData.ButtonDiff & LOG_BUTTON_MIDDLE)
204 {
205 if (RawData.Buttons & LOG_BUTTON_MIDDLE)
207 else
209 }
210
211 break;
212 }
213 }
214 }
215
216 /* Send mouse packet */
217 (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassService)(
218 DeviceExtension->ClassDeviceObject,
219 &DeviceExtension->MouseInputData,
220 &DeviceExtension->MouseInputData + 1,
221 &DummyInputDataConsumed);
222}
_In_ PIRP Irp
Definition: csq.h:116
#define LOG_BUTTON_LEFT
Definition: hardware.c:105
#define NEC_BUTTON_RIGHT
Definition: hardware.c:57
#define NEC_BUTTON_LEFT
Definition: hardware.c:58
#define LOG_BUTTON_RIGHT
Definition: hardware.c:103
#define LOG_BUTTON_MIDDLE
Definition: hardware.c:104
#define MS_BUTTON_MIDDLE
Definition: hardware.c:79
#define MS_BUTTON_RIGHT
Definition: hardware.c:78
#define MS_BUTTON_LEFT
Definition: hardware.c:80
UCHAR KIRQL
Definition: env_spec_w32.h:591
@ NecBusMouse
Definition: inport.h:29
@ MsInPortMouse
Definition: inport.h:30
@ LogitechBusMouse
Definition: inport.h:31
VOID(STDAPICALLTYPE * PSERVICE_CALLBACK_ROUTINE)(IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN OUT PVOID SystemArgument3)
Definition: kbdmou.h:86
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define MOUSE_LEFT_BUTTON_DOWN
Definition: ntddmou.h:46
#define MOUSE_LEFT_BUTTON_UP
Definition: ntddmou.h:47
#define MOUSE_MIDDLE_BUTTON_DOWN
Definition: ntddmou.h:50
#define MOUSE_RIGHT_BUTTON_UP
Definition: ntddmou.h:49
#define MOUSE_MIDDLE_BUTTON_UP
Definition: ntddmou.h:51
#define MOUSE_RIGHT_BUTTON_DOWN
Definition: ntddmou.h:48
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:154
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:171
INPORT_MOUSE_TYPE MouseType
Definition: inport.h:51
MOUSE_INPUT_DATA MouseInputData
Definition: inport.h:70
INPORT_RAW_DATA RawData
Definition: inport.h:62
PDEVICE_OBJECT ClassDeviceObject
Definition: inport.h:66
PKINTERRUPT InterruptObject
Definition: inport.h:54
UCHAR Buttons
Definition: inport.h:38
ULONG ButtonDiff
Definition: inport.h:39
USHORT ButtonFlags
Definition: ntddmou.h:82
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

◆ InPortInitializeMouse()

VOID NTAPI InPortInitializeMouse ( _In_ PINPORT_DEVICE_EXTENSION  DeviceExtension)

Definition at line 350 of file hardware.c.

352{
353 PAGED_CODE();
354
355 /* Initialize mouse and disable interrupts */
356 switch (DeviceExtension->MouseType)
357 {
358 case NecBusMouse:
360
361 /* Setup interrupt rate (unavailable on hireso machines) */
362 if (DeviceExtension->IoBase != NEC_BM_HIRESO_BASE)
363 WRITE_MOUSE(DeviceExtension, NEC_BM_INT_RATE, NEC_RATE_60_HZ);
364
367 WRITE_MOUSE(DeviceExtension, NEC_BM_CONFIG, NEC_PPI_HC_CLEAR);
368 break;
369
370 case MsInPortMouse:
371 WRITE_MOUSE(DeviceExtension, MS_INPORT_CONTROL, INPORT_RESET);
374 break;
375
376 case LogitechBusMouse:
377 WRITE_MOUSE(DeviceExtension, LOG_BM_CONFIG, LOG_DEFAULT_MODE);
378 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_DISABLE_IRQ);
379 break;
380 }
381}
#define PAGED_CODE()
#define MS_INPORT_CONTROL
Definition: hardware.c:63
#define WRITE_MOUSE(DeviceExtension, Port, Data)
Definition: hardware.c:22
#define LOG_BM_CONFIG
Definition: hardware.c:99
#define INPORT_MODE_BASE
Definition: hardware.c:72
#define LOG_DEFAULT_MODE
Definition: hardware.c:100
#define NEC_RATE_60_HZ
Definition: hardware.c:51
#define NEC_PPI_INT_DISABLE
Definition: hardware.c:44
#define LOG_BM_CONTROL
Definition: hardware.c:90
#define NEC_BM_HIRESO_BASE
Definition: hardware.c:55
#define NEC_PPI_HC_NO_CLEAR
Definition: hardware.c:45
#define MS_INPORT_DATA
Definition: hardware.c:70
#define NEC_BM_CONFIG
Definition: hardware.c:42
#define INPORT_REG_MODE
Definition: hardware.c:67
#define NEC_PPI_DEFAULT_MODE
Definition: hardware.c:47
#define NEC_BM_INT_RATE
Definition: hardware.c:49
#define INPORT_RESET
Definition: hardware.c:68
#define NEC_PPI_HC_CLEAR
Definition: hardware.c:46
#define LOG_DISABLE_IRQ
Definition: hardware.c:92

Referenced by InPortStartDevice().

◆ InPortIsr()

BOOLEAN NTAPI InPortIsr ( _In_ PKINTERRUPT  Interrupt,
_In_ PVOID  Context 
)

Definition at line 226 of file hardware.c.

229{
231 ULONG ButtonDiff;
232 CHAR DeltaX, DeltaY;
233 PINPORT_DEVICE_EXTENSION DeviceExtension = Context;
234
236
237 switch (DeviceExtension->MouseType)
238 {
239 case NecBusMouse:
240 {
241 WRITE_MOUSE(DeviceExtension, NEC_BM_CONTROL,
243
244 WRITE_MOUSE(DeviceExtension, NEC_BM_CONTROL,
246 DeltaX = READ_MOUSE(DeviceExtension, NEC_BM_DATA) & 0x0F;
247
248 WRITE_MOUSE(DeviceExtension, NEC_BM_CONTROL,
250 DeltaX |= READ_MOUSE(DeviceExtension, NEC_BM_DATA) << 4;
251
252 WRITE_MOUSE(DeviceExtension, NEC_BM_CONTROL,
254 DeltaY = READ_MOUSE(DeviceExtension, NEC_BM_DATA) & 0x0F;
255
256 WRITE_MOUSE(DeviceExtension, NEC_BM_CONTROL,
258 Buttons = READ_MOUSE(DeviceExtension, NEC_BM_DATA);
259 DeltaY |= Buttons << 4;
261
262 WRITE_MOUSE(DeviceExtension, NEC_BM_CONTROL,
264
265 break;
266 }
267
268 case MsInPortMouse:
269 {
271 WRITE_MOUSE(DeviceExtension, MS_INPORT_DATA,
273
275 Buttons = READ_MOUSE(DeviceExtension, MS_INPORT_DATA);
276
278 {
279 WRITE_MOUSE(DeviceExtension, MS_INPORT_CONTROL, INPORT_REG_X);
280 DeltaX = READ_MOUSE(DeviceExtension, MS_INPORT_DATA);
281
282 WRITE_MOUSE(DeviceExtension, MS_INPORT_CONTROL, INPORT_REG_Y);
283 DeltaY = READ_MOUSE(DeviceExtension, MS_INPORT_DATA);
284 }
285 else
286 {
287 DeltaX = 0;
288 DeltaY = 0;
289 }
290
292
294 WRITE_MOUSE(DeviceExtension, MS_INPORT_DATA,
296
297 break;
298 }
299
300 case LogitechBusMouse:
301 {
302 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_READ_X_LOW);
303 DeltaX = READ_MOUSE(DeviceExtension, LOG_BM_DATA) & 0x0F;
304
305 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_READ_X_HIGH);
306 DeltaX |= READ_MOUSE(DeviceExtension, LOG_BM_DATA) << 4;
307
308 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_READ_Y_LOW);
309 DeltaY = READ_MOUSE(DeviceExtension, LOG_BM_DATA) & 0x0F;
310
311 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_READ_Y_HIGH);
312 Buttons = READ_MOUSE(DeviceExtension, LOG_BM_DATA);
313 DeltaY |= Buttons << 4;
315
316 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_ENABLE_IRQ);
317
318 break;
319 }
320 }
321
322 ButtonDiff = DeviceExtension->MouseButtonState ^ Buttons;
323 DeviceExtension->MouseButtonState = Buttons;
324
325 /*
326 * Bus mouse devices don't have a status register to check
327 * whether this interrupt is indeed for us.
328 */
329 if ((DeltaX == 0) && (DeltaY == 0) && (ButtonDiff == 0))
330 {
331 /* We just pretend that the interrupt is not ours */
332 return FALSE;
333 }
334 else
335 {
336 DeviceExtension->RawData.DeltaX = DeltaX;
337 DeviceExtension->RawData.DeltaY = DeltaY;
338 DeviceExtension->RawData.Buttons = Buttons;
339 DeviceExtension->RawData.ButtonDiff = ButtonDiff;
340
341 IoRequestDpc(DeviceExtension->Self, NULL, NULL);
342
343 return TRUE;
344 }
345}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define LOG_READ_Y_HIGH
Definition: hardware.c:97
#define NEC_INT_ENABLE
Definition: hardware.c:31
#define LOG_READ_X_HIGH
Definition: hardware.c:95
#define LOG_ENABLE_IRQ
Definition: hardware.c:91
#define NEC_READ_Y_LOW
Definition: hardware.c:36
#define INPORT_REG_Y
Definition: hardware.c:66
#define INPORT_REG_X
Definition: hardware.c:65
#define INPORT_MODE_IRQ
Definition: hardware.c:71
#define READ_MOUSE(DeviceExtension, Port)
Definition: hardware.c:19
#define NEC_BM_CONTROL
Definition: hardware.c:30
#define NEC_READ_X_HIGH
Definition: hardware.c:35
#define LOG_BM_DATA
Definition: hardware.c:85
#define NEC_INPUT_CAPTURE
Definition: hardware.c:39
#define NEC_READ_Y_HIGH
Definition: hardware.c:37
#define INPORT_HAS_MOVED
Definition: hardware.c:74
#define LOG_READ_Y_LOW
Definition: hardware.c:96
#define NEC_READ_X_LOW
Definition: hardware.c:34
#define LOG_READ_X_LOW
Definition: hardware.c:94
#define NEC_BM_DATA
Definition: hardware.c:28
#define INPORT_REG_BTNS
Definition: hardware.c:64
#define NEC_INPUT_HOLD
Definition: hardware.c:40
#define NEC_INT_DISABLE
Definition: hardware.c:32
#define INPORT_MODE_HOLD
Definition: hardware.c:73
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
PDEVICE_OBJECT Self
Definition: inport.h:44
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:379
FORCEINLINE VOID IoRequestDpc(_Inout_ PDEVICE_OBJECT DeviceObject, _In_opt_ PIRP Irp, _In_opt_ __drv_aliasesMem PVOID Context)
Definition: iofuncs.h:2750
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175

◆ InPortStartMouse()

BOOLEAN NTAPI InPortStartMouse ( _In_ PVOID  SynchronizeContext)

Definition at line 385 of file hardware.c.

387{
389
390 /* Enable interrupts */
391 switch (DeviceExtension->MouseType)
392 {
393 case NecBusMouse:
396 WRITE_MOUSE(DeviceExtension, NEC_BM_CONFIG, NEC_PPI_HC_CLEAR);
397 break;
398
399 case MsInPortMouse:
401 WRITE_MOUSE(DeviceExtension, MS_INPORT_DATA,
403 break;
404
405 case LogitechBusMouse:
406 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_ENABLE_IRQ);
407 break;
408 }
409
410 return TRUE;
411}
#define NEC_PPI_INT_ENABLE
Definition: hardware.c:43
_In_ PKSYNCHRONIZE_ROUTINE _In_opt_ __drv_aliasesMem PVOID SynchronizeContext
Definition: kefuncs.h:525

◆ InPortStopMouse()

BOOLEAN NTAPI InPortStopMouse ( _In_ PVOID  SynchronizeContext)

Definition at line 415 of file hardware.c.

417{
419
420 /* Disable interrupts */
421 switch (DeviceExtension->MouseType)
422 {
423 case NecBusMouse:
426 WRITE_MOUSE(DeviceExtension, NEC_BM_CONFIG, NEC_PPI_HC_CLEAR);
427 break;
428
429 case MsInPortMouse:
432 break;
433
434 case LogitechBusMouse:
435 WRITE_MOUSE(DeviceExtension, LOG_BM_CONTROL, LOG_DISABLE_IRQ);
436 break;
437 }
438
439 return TRUE;
440}