1 | /*++
|
---|
2 |
|
---|
3 | Copyright (c) 1990, 1991, 1992, 1993 Microsoft Corporation
|
---|
4 |
|
---|
5 | Module Name:
|
---|
6 |
|
---|
7 | i8042prt.h
|
---|
8 |
|
---|
9 | Abstract:
|
---|
10 |
|
---|
11 | These are the structures and defines that are used in the
|
---|
12 | Intel i8042 port driver.
|
---|
13 |
|
---|
14 | Revision History:
|
---|
15 |
|
---|
16 | --*/
|
---|
17 |
|
---|
18 | #ifndef _I8042PRT_
|
---|
19 | #define _I8042PRT_
|
---|
20 |
|
---|
21 | #include <ntddkbd.h>
|
---|
22 | #include <ntddmou.h>
|
---|
23 | #include "kbdmou.h"
|
---|
24 | #include "i8042cfg.h"
|
---|
25 |
|
---|
26 | #ifdef PNP_IDENTIFY
|
---|
27 | #include "devdesc.h"
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | //VBOX begin
|
---|
31 | #include <VBox/VMMDev.h>
|
---|
32 | #include <VBox/VBoxGuest.h>
|
---|
33 | #include <VBox/VBoxGuestLib.h>
|
---|
34 |
|
---|
35 | /* debug printf */
|
---|
36 | # define OSDBGPRINT(a) DbgPrint a
|
---|
37 |
|
---|
38 | /* dprintf */
|
---|
39 | #if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(LOG_ENABLED)
|
---|
40 | # ifdef LOG_TO_BACKDOOR
|
---|
41 | # include <VBox/log.h>
|
---|
42 | # define dprintf(a) RTLogBackdoorPrintf a
|
---|
43 | # else
|
---|
44 | # define dprintf(a) OSDBGPRINT(a)
|
---|
45 | # endif
|
---|
46 | #else
|
---|
47 | # define dprintf(a) do {} while (0)
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | /* dprintf2 - extended logging. */
|
---|
51 | #if 0
|
---|
52 | # define dprintf2 dprintf
|
---|
53 | #else
|
---|
54 | # define dprintf2(a) do { } while (0)
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | //VBOX end
|
---|
58 |
|
---|
59 | //
|
---|
60 | // Define the timer values.
|
---|
61 | //
|
---|
62 |
|
---|
63 | #define I8042_ASYNC_NO_TIMEOUT -1
|
---|
64 | #define I8042_ASYNC_TIMEOUT 3
|
---|
65 |
|
---|
66 | //
|
---|
67 | // Define the default number of entries in the input data queue.
|
---|
68 | //
|
---|
69 |
|
---|
70 | #define DATA_QUEUE_SIZE 100
|
---|
71 |
|
---|
72 | //
|
---|
73 | // Define the default stall value.
|
---|
74 | //
|
---|
75 |
|
---|
76 | #define I8042_STALL_DEFAULT 50
|
---|
77 |
|
---|
78 | //
|
---|
79 | // Define the default "sync time" used to determine when the start
|
---|
80 | // of a new mouse data packet is expected. The value is in units
|
---|
81 | // of 100 nanoseconds.
|
---|
82 | //
|
---|
83 |
|
---|
84 | #define MOUSE_SYNCH_PACKET_100NS 10000000UL // 1 second, in 100 ns units
|
---|
85 |
|
---|
86 | //
|
---|
87 | // Define booleans.
|
---|
88 | //
|
---|
89 |
|
---|
90 | #define WAIT_FOR_ACKNOWLEDGE TRUE
|
---|
91 | #define NO_WAIT_FOR_ACKNOWLEDGE FALSE
|
---|
92 | #define AND_OPERATION TRUE
|
---|
93 | #define OR_OPERATION FALSE
|
---|
94 | #define ENABLE_OPERATION TRUE
|
---|
95 | #define DISABLE_OPERATION FALSE
|
---|
96 |
|
---|
97 | //
|
---|
98 | // Default keyboard scan code mode.
|
---|
99 | //
|
---|
100 |
|
---|
101 | #define KEYBOARD_SCAN_CODE_SET 0x01
|
---|
102 |
|
---|
103 | //
|
---|
104 | // Default number of function keys, number of LED indicators, and total
|
---|
105 | // number of keys located on the known types of keyboard.
|
---|
106 | //
|
---|
107 |
|
---|
108 | #ifndef JAPAN
|
---|
109 | #define NUM_KNOWN_KEYBOARD_TYPES 4
|
---|
110 | #else
|
---|
111 | // NLS Keyboard Support Code.
|
---|
112 | #define NUM_KNOWN_KEYBOARD_TYPES 16
|
---|
113 | #endif
|
---|
114 | #define KEYBOARD_TYPE_DEFAULT 4
|
---|
115 | #define KEYBOARD_INDICATORS_DEFAULT 0
|
---|
116 |
|
---|
117 | typedef struct _KEYBOARD_TYPE_INFORMATION {
|
---|
118 | USHORT NumberOfFunctionKeys;
|
---|
119 | USHORT NumberOfIndicators;
|
---|
120 | USHORT NumberOfKeysTotal;
|
---|
121 | } KEYBOARD_TYPE_INFORMATION, *PKEYBOARD_TYPE_INFORMATION;
|
---|
122 |
|
---|
123 | static const
|
---|
124 | KEYBOARD_TYPE_INFORMATION KeyboardTypeInformation[NUM_KNOWN_KEYBOARD_TYPES] = {
|
---|
125 | {10, 3, 84}, // PC/XT 83- 84-key keyboard (and compatibles)
|
---|
126 | {12, 3, 102}, // Olivetti M24 102-key keyboard (and compatibles)
|
---|
127 | {10, 3, 84}, // All AT type keyboards (84-86 keys)
|
---|
128 | {12, 3, 101} // Enhanced 101- or 102-key keyboards (and compatibles)
|
---|
129 | #ifdef JAPAN
|
---|
130 | // NLS Keyboard Support Code.
|
---|
131 | ,
|
---|
132 | { 0, 0, 0},
|
---|
133 | { 0, 0, 0},
|
---|
134 | {12, 3, 106}, // TYPE=7 IBM-J 5576-002 keyboard
|
---|
135 | { 0, 0, 0},
|
---|
136 | { 0, 0, 0},
|
---|
137 | { 0, 0, 0},
|
---|
138 | { 0, 0, 0},
|
---|
139 | { 0, 0, 0},
|
---|
140 | { 0, 0, 0},
|
---|
141 | { 0, 0, 0},
|
---|
142 | { 0, 0, 0},
|
---|
143 | {12, 4, 105} // TYPE=16 AX keyboard
|
---|
144 | #endif
|
---|
145 | };
|
---|
146 |
|
---|
147 | //
|
---|
148 | // Minimum, maximum, and default values for keyboard typematic rate and delay.
|
---|
149 | //
|
---|
150 |
|
---|
151 | #define KEYBOARD_TYPEMATIC_RATE_MINIMUM 2
|
---|
152 | #define KEYBOARD_TYPEMATIC_RATE_MAXIMUM 30
|
---|
153 | #define KEYBOARD_TYPEMATIC_RATE_DEFAULT 30
|
---|
154 | #define KEYBOARD_TYPEMATIC_DELAY_MINIMUM 250
|
---|
155 | #define KEYBOARD_TYPEMATIC_DELAY_MAXIMUM 1000
|
---|
156 | #define KEYBOARD_TYPEMATIC_DELAY_DEFAULT 250
|
---|
157 |
|
---|
158 | //
|
---|
159 | // Define the 8042 mouse status bits.
|
---|
160 | //
|
---|
161 |
|
---|
162 | #define LEFT_BUTTON_DOWN 0x01
|
---|
163 | #define RIGHT_BUTTON_DOWN 0x02
|
---|
164 | #define MIDDLE_BUTTON_DOWN 0x04
|
---|
165 | #define X_DATA_SIGN 0x10
|
---|
166 | #define Y_DATA_SIGN 0x20
|
---|
167 | #define X_OVERFLOW 0x40
|
---|
168 | #define Y_OVERFLOW 0x80
|
---|
169 |
|
---|
170 | #define MOUSE_SIGN_OVERFLOW_MASK (X_DATA_SIGN | Y_DATA_SIGN | X_OVERFLOW | Y_OVERFLOW)
|
---|
171 |
|
---|
172 | //
|
---|
173 | // Define the maximum positive and negative values for mouse motion.
|
---|
174 | //
|
---|
175 |
|
---|
176 | #define MOUSE_MAXIMUM_POSITIVE_DELTA 0x000000FF
|
---|
177 | #define MOUSE_MAXIMUM_NEGATIVE_DELTA 0xFFFFFF00
|
---|
178 |
|
---|
179 | //
|
---|
180 | // Default number of buttons and sample rate for the i8042 mouse.
|
---|
181 | //
|
---|
182 |
|
---|
183 | #define MOUSE_NUMBER_OF_BUTTONS 2
|
---|
184 | #define MOUSE_SAMPLE_RATE 60
|
---|
185 |
|
---|
186 | //
|
---|
187 | // Define the mouse resolution specifier. Note that (2**MOUSE_RESOLUTION)
|
---|
188 | // specifies counts-per-millimeter. Counts-per-centimeter is
|
---|
189 | // (counts-per-millimeter * 10).
|
---|
190 | //
|
---|
191 |
|
---|
192 | #define MOUSE_RESOLUTION 3
|
---|
193 |
|
---|
194 | //
|
---|
195 | // Defines for DeviceExtension->HardwarePresent.
|
---|
196 | //
|
---|
197 |
|
---|
198 | #define KEYBOARD_HARDWARE_PRESENT 0x01
|
---|
199 | #define MOUSE_HARDWARE_PRESENT 0x02
|
---|
200 | #define BALLPOINT_HARDWARE_PRESENT 0x04
|
---|
201 | #define WHEELMOUSE_HARDWARE_PRESENT 0x08
|
---|
202 |
|
---|
203 | //
|
---|
204 | // Define macros for performing I/O on the 8042 command/status and data
|
---|
205 | // registers.
|
---|
206 | //
|
---|
207 |
|
---|
208 | #define I8X_PUT_COMMAND_BYTE(Address, Byte) \
|
---|
209 | WRITE_PORT_UCHAR(Address, (UCHAR) Byte)
|
---|
210 | #define I8X_PUT_DATA_BYTE(Address, Byte) \
|
---|
211 | WRITE_PORT_UCHAR(Address, (UCHAR) Byte)
|
---|
212 | #define I8X_GET_STATUS_BYTE(Address) \
|
---|
213 | READ_PORT_UCHAR(Address)
|
---|
214 | #define I8X_GET_DATA_BYTE(Address) \
|
---|
215 | READ_PORT_UCHAR(Address)
|
---|
216 |
|
---|
217 | //
|
---|
218 | // Define commands to the 8042 controller.
|
---|
219 | //
|
---|
220 |
|
---|
221 | #define I8042_READ_CONTROLLER_COMMAND_BYTE 0x20
|
---|
222 | #define I8042_WRITE_CONTROLLER_COMMAND_BYTE 0x60
|
---|
223 | #define I8042_DISABLE_MOUSE_DEVICE 0xA7
|
---|
224 | #define I8042_ENABLE_MOUSE_DEVICE 0xA8
|
---|
225 | #define I8042_AUXILIARY_DEVICE_TEST 0xA9
|
---|
226 | #define I8042_KEYBOARD_DEVICE_TEST 0xAB
|
---|
227 | #define I8042_DISABLE_KEYBOARD_DEVICE 0xAD
|
---|
228 | #define I8042_ENABLE_KEYBOARD_DEVICE 0xAE
|
---|
229 | #define I8042_WRITE_TO_AUXILIARY_DEVICE 0xD4
|
---|
230 |
|
---|
231 | //
|
---|
232 | // Define the 8042 Controller Command Byte.
|
---|
233 | //
|
---|
234 |
|
---|
235 | #define CCB_ENABLE_KEYBOARD_INTERRUPT 0x01
|
---|
236 | #define CCB_ENABLE_MOUSE_INTERRUPT 0x02
|
---|
237 | #define CCB_DISABLE_KEYBOARD_DEVICE 0x10
|
---|
238 | #define CCB_DISABLE_MOUSE_DEVICE 0x20
|
---|
239 | #define CCB_KEYBOARD_TRANSLATE_MODE 0x40
|
---|
240 |
|
---|
241 |
|
---|
242 | //
|
---|
243 | // Define the 8042 Controller Status Register bits.
|
---|
244 | //
|
---|
245 |
|
---|
246 | #define OUTPUT_BUFFER_FULL 0x01
|
---|
247 | #define INPUT_BUFFER_FULL 0x02
|
---|
248 | #define MOUSE_OUTPUT_BUFFER_FULL 0x20
|
---|
249 |
|
---|
250 | //
|
---|
251 | // Define the 8042 responses.
|
---|
252 | //
|
---|
253 |
|
---|
254 | #define ACKNOWLEDGE 0xFA
|
---|
255 | #define RESEND 0xFE
|
---|
256 |
|
---|
257 | //
|
---|
258 | // Define commands to the keyboard (through the 8042 data port).
|
---|
259 | //
|
---|
260 |
|
---|
261 | #define SET_KEYBOARD_INDICATORS 0xED
|
---|
262 | #define SELECT_SCAN_CODE_SET 0xF0
|
---|
263 | #define READ_KEYBOARD_ID 0xF2
|
---|
264 | #define SET_KEYBOARD_TYPEMATIC 0xF3
|
---|
265 | #define SET_ALL_TYPEMATIC_MAKE_BREAK 0xFA
|
---|
266 | #define KEYBOARD_RESET 0xFF
|
---|
267 |
|
---|
268 | //
|
---|
269 | // Define the keyboard responses.
|
---|
270 | //
|
---|
271 |
|
---|
272 | #define KEYBOARD_COMPLETE_SUCCESS 0xAA
|
---|
273 | #define KEYBOARD_COMPLETE_FAILURE 0xFC
|
---|
274 | #define KEYBOARD_BREAK_CODE 0xF0
|
---|
275 | #define KEYBOARD_DEBUG_HOTKEY_ENH 0x37 // SysReq scan code for Enhanced Keyboard
|
---|
276 | #define KEYBOARD_DEBUG_HOTKEY_AT 0x54 // SysReq scan code for 84-key Keyboard
|
---|
277 |
|
---|
278 | //
|
---|
279 | // Define commands to the mouse (through the 8042 data port).
|
---|
280 | //
|
---|
281 |
|
---|
282 | #define SET_MOUSE_RESOLUTION 0xE8
|
---|
283 | #define SET_MOUSE_SAMPLING_RATE 0xF3
|
---|
284 | #define MOUSE_RESET 0xFF
|
---|
285 | #define ENABLE_MOUSE_TRANSMISSION 0xF4
|
---|
286 | #define SET_MOUSE_SCALING_1TO1 0xE6
|
---|
287 | #define READ_MOUSE_STATUS 0xE9
|
---|
288 | #define GET_DEVICE_ID 0xF2
|
---|
289 |
|
---|
290 | //
|
---|
291 | // Define the mouse responses.
|
---|
292 | //
|
---|
293 |
|
---|
294 | #define MOUSE_COMPLETE 0xAA
|
---|
295 | #define MOUSE_ID_BYTE 0x00
|
---|
296 | #define WHEELMOUSE_ID_BYTE 0x03
|
---|
297 |
|
---|
298 | //
|
---|
299 | // Define the i8042 controller input/output ports.
|
---|
300 | //
|
---|
301 |
|
---|
302 | typedef enum _I8042_IO_PORT_TYPE {
|
---|
303 | DataPort = 0,
|
---|
304 | CommandPort,
|
---|
305 | MaximumPortCount
|
---|
306 |
|
---|
307 | } I8042_IO_PORT_TYPE;
|
---|
308 |
|
---|
309 | //
|
---|
310 | // Define the device types attached to the i8042 controller.
|
---|
311 | //
|
---|
312 |
|
---|
313 | typedef enum _I8042_DEVICE_TYPE {
|
---|
314 | ControllerDeviceType,
|
---|
315 | KeyboardDeviceType,
|
---|
316 | MouseDeviceType,
|
---|
317 | UndefinedDeviceType
|
---|
318 | } I8042_DEVICE_TYPE;
|
---|
319 |
|
---|
320 | //
|
---|
321 | // Define the keyboard output states.
|
---|
322 | //
|
---|
323 |
|
---|
324 | typedef enum _KEYBOARD_STATE {
|
---|
325 | Idle,
|
---|
326 | SendFirstByte,
|
---|
327 | SendLastByte
|
---|
328 | } KEYBOARD_STATE;
|
---|
329 |
|
---|
330 | //
|
---|
331 | // Define the keyboard scan code input states.
|
---|
332 | //
|
---|
333 |
|
---|
334 | typedef enum _KEYBOARD_SCAN_STATE {
|
---|
335 | Normal,
|
---|
336 | GotE0,
|
---|
337 | GotE1
|
---|
338 | } KEYBOARD_SCAN_STATE;
|
---|
339 |
|
---|
340 | //
|
---|
341 | // Define the mouse states.
|
---|
342 | //
|
---|
343 |
|
---|
344 | typedef enum _MOUSE_STATE {
|
---|
345 | MouseIdle,
|
---|
346 | XMovement,
|
---|
347 | YMovement,
|
---|
348 | ZMovement,
|
---|
349 | MouseExpectingACK
|
---|
350 | } MOUSE_STATE;
|
---|
351 |
|
---|
352 | //
|
---|
353 | // Define the keyboard set request packet.
|
---|
354 | //
|
---|
355 |
|
---|
356 | typedef struct _KEYBOARD_SET_PACKET {
|
---|
357 | USHORT State;
|
---|
358 | UCHAR FirstByte;
|
---|
359 | UCHAR LastByte;
|
---|
360 | } KEYBOARD_SET_PACKET, *PKEYBOARD_SET_PACKET;
|
---|
361 |
|
---|
362 | //
|
---|
363 | // Intel i8042 configuration information.
|
---|
364 | //
|
---|
365 |
|
---|
366 | typedef struct _I8042_CONFIGURATION_INFORMATION {
|
---|
367 |
|
---|
368 | //
|
---|
369 | // Bus interface type.
|
---|
370 | //
|
---|
371 |
|
---|
372 | INTERFACE_TYPE InterfaceType;
|
---|
373 |
|
---|
374 | //
|
---|
375 | // Bus Number.
|
---|
376 | //
|
---|
377 |
|
---|
378 | ULONG BusNumber;
|
---|
379 |
|
---|
380 | //
|
---|
381 | // The port/register resources used by this device.
|
---|
382 | //
|
---|
383 |
|
---|
384 | CM_PARTIAL_RESOURCE_DESCRIPTOR PortList[MaximumPortCount];
|
---|
385 | ULONG PortListCount;
|
---|
386 |
|
---|
387 | //
|
---|
388 | // Keyboard interrupt resources.
|
---|
389 | //
|
---|
390 |
|
---|
391 | CM_PARTIAL_RESOURCE_DESCRIPTOR KeyboardInterrupt;
|
---|
392 |
|
---|
393 | //
|
---|
394 | // Mouse interrupt resources.
|
---|
395 | //
|
---|
396 |
|
---|
397 | CM_PARTIAL_RESOURCE_DESCRIPTOR MouseInterrupt;
|
---|
398 |
|
---|
399 | //
|
---|
400 | // Flag that indicates whether floating point context should be saved.
|
---|
401 | //
|
---|
402 |
|
---|
403 | BOOLEAN FloatingSave;
|
---|
404 |
|
---|
405 | //
|
---|
406 | // Number of retries allowed.
|
---|
407 | //
|
---|
408 |
|
---|
409 | USHORT ResendIterations;
|
---|
410 |
|
---|
411 | //
|
---|
412 | // Number of polling iterations allowed.
|
---|
413 | //
|
---|
414 |
|
---|
415 | USHORT PollingIterations;
|
---|
416 |
|
---|
417 | //
|
---|
418 | // Maximum number of polling iterations allowed.
|
---|
419 | //
|
---|
420 |
|
---|
421 | USHORT PollingIterationsMaximum;
|
---|
422 |
|
---|
423 | //
|
---|
424 | // Maximum number of times to check the Status register in
|
---|
425 | // the ISR before deciding the interrupt is spurious.
|
---|
426 | //
|
---|
427 |
|
---|
428 | USHORT PollStatusIterations;
|
---|
429 |
|
---|
430 | //
|
---|
431 | // Microseconds to stall in KeStallExecutionProcessor calls.
|
---|
432 | //
|
---|
433 |
|
---|
434 | USHORT StallMicroseconds;
|
---|
435 |
|
---|
436 | //
|
---|
437 | // Keyboard attributes.
|
---|
438 | //
|
---|
439 |
|
---|
440 | KEYBOARD_ATTRIBUTES KeyboardAttributes;
|
---|
441 |
|
---|
442 | //
|
---|
443 | // Initial values of keyboard typematic rate and delay.
|
---|
444 | //
|
---|
445 |
|
---|
446 | KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatCurrent;
|
---|
447 |
|
---|
448 | //
|
---|
449 | // Current indicator (LED) setting.
|
---|
450 | //
|
---|
451 |
|
---|
452 | KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicators;
|
---|
453 |
|
---|
454 | //
|
---|
455 | // Mouse attributes.
|
---|
456 | //
|
---|
457 |
|
---|
458 | MOUSE_ATTRIBUTES MouseAttributes;
|
---|
459 |
|
---|
460 | USHORT MouseResolution;
|
---|
461 |
|
---|
462 | //
|
---|
463 | // Boolean flags determines whether we should try and detect the wheel
|
---|
464 | // on the mouse or not
|
---|
465 | //
|
---|
466 |
|
---|
467 | ULONG EnableWheelDetection;
|
---|
468 |
|
---|
469 | } I8042_CONFIGURATION_INFORMATION, *PI8042_CONFIGURATION_INFORMATION;
|
---|
470 |
|
---|
471 | //
|
---|
472 | // Define the keyboard portion of the port device extension.
|
---|
473 | //
|
---|
474 |
|
---|
475 | typedef struct _PORT_KEYBOARD_EXTENSION {
|
---|
476 |
|
---|
477 | //
|
---|
478 | // Keyboard class connection data.
|
---|
479 | //
|
---|
480 |
|
---|
481 | CONNECT_DATA ConnectData;
|
---|
482 |
|
---|
483 | //
|
---|
484 | // Number of input data items currently in the keyboard InputData queue.
|
---|
485 | //
|
---|
486 |
|
---|
487 | ULONG InputCount;
|
---|
488 |
|
---|
489 | //
|
---|
490 | // Start of the port keyboard input data queue (really a circular buffer).
|
---|
491 | //
|
---|
492 |
|
---|
493 | PKEYBOARD_INPUT_DATA InputData;
|
---|
494 |
|
---|
495 | //
|
---|
496 | // Insertion pointer for keyboard InputData.
|
---|
497 | //
|
---|
498 |
|
---|
499 | PKEYBOARD_INPUT_DATA DataIn;
|
---|
500 |
|
---|
501 | //
|
---|
502 | // Removal pointer for keyboard InputData.
|
---|
503 | //
|
---|
504 |
|
---|
505 | PKEYBOARD_INPUT_DATA DataOut;
|
---|
506 |
|
---|
507 | //
|
---|
508 | // Points one input packet past the end of the InputData buffer.
|
---|
509 | //
|
---|
510 |
|
---|
511 | PKEYBOARD_INPUT_DATA DataEnd;
|
---|
512 |
|
---|
513 | //
|
---|
514 | // Current keyboard input packet.
|
---|
515 | //
|
---|
516 |
|
---|
517 | KEYBOARD_INPUT_DATA CurrentInput;
|
---|
518 |
|
---|
519 | //
|
---|
520 | // Current keyboard scan input state.
|
---|
521 | //
|
---|
522 |
|
---|
523 | KEYBOARD_SCAN_STATE CurrentScanState;
|
---|
524 |
|
---|
525 | //
|
---|
526 | // Current keyboard output packet (for set requests).
|
---|
527 | //
|
---|
528 |
|
---|
529 | KEYBOARD_SET_PACKET CurrentOutput;
|
---|
530 |
|
---|
531 | //
|
---|
532 | // Current resend count.
|
---|
533 | //
|
---|
534 |
|
---|
535 | USHORT ResendCount;
|
---|
536 |
|
---|
537 | //
|
---|
538 | // Request sequence number (used for error logging).
|
---|
539 | //
|
---|
540 |
|
---|
541 | ULONG SequenceNumber;
|
---|
542 |
|
---|
543 | //
|
---|
544 | // Timer used to retry the ISR DPC routine when the class
|
---|
545 | // driver is unable to consume all the port driver's data.
|
---|
546 | //
|
---|
547 |
|
---|
548 | KTIMER DataConsumptionTimer;
|
---|
549 |
|
---|
550 | //
|
---|
551 | // Indicates which keyboard port device this driver created (UnitId
|
---|
552 | // is the suffix appended to the keyboard port basename for the
|
---|
553 | // call to IoCreateDevice).
|
---|
554 | //
|
---|
555 |
|
---|
556 | USHORT UnitId;
|
---|
557 |
|
---|
558 | //
|
---|
559 | // Indicates whether it is okay to log overflow errors.
|
---|
560 | //
|
---|
561 |
|
---|
562 | BOOLEAN OkayToLogOverflow;
|
---|
563 |
|
---|
564 | } PORT_KEYBOARD_EXTENSION, *PPORT_KEYBOARD_EXTENSION;
|
---|
565 |
|
---|
566 | //
|
---|
567 | // Define the mouse portion of the port device extension.
|
---|
568 | //
|
---|
569 |
|
---|
570 | typedef struct _PORT_MOUSE_EXTENSION {
|
---|
571 |
|
---|
572 | //
|
---|
573 | // Mouse class connection data.
|
---|
574 | //
|
---|
575 |
|
---|
576 | CONNECT_DATA ConnectData;
|
---|
577 |
|
---|
578 | //
|
---|
579 | // Number of input data items currently in the mouse InputData queue.
|
---|
580 | //
|
---|
581 |
|
---|
582 | ULONG InputCount;
|
---|
583 |
|
---|
584 | //
|
---|
585 | // Start of the port mouse input data queue (really a circular buffer).
|
---|
586 | //
|
---|
587 |
|
---|
588 | PMOUSE_INPUT_DATA InputData;
|
---|
589 |
|
---|
590 | //
|
---|
591 | // Insertion pointer for mouse InputData.
|
---|
592 | //
|
---|
593 |
|
---|
594 | PMOUSE_INPUT_DATA DataIn;
|
---|
595 |
|
---|
596 | //
|
---|
597 | // Removal pointer for mouse InputData.
|
---|
598 | //
|
---|
599 |
|
---|
600 | PMOUSE_INPUT_DATA DataOut;
|
---|
601 |
|
---|
602 | //
|
---|
603 | // Points one input packet past the end of the InputData buffer.
|
---|
604 | //
|
---|
605 |
|
---|
606 | PMOUSE_INPUT_DATA DataEnd;
|
---|
607 |
|
---|
608 | //
|
---|
609 | // Current mouse input packet.
|
---|
610 | //
|
---|
611 |
|
---|
612 | MOUSE_INPUT_DATA CurrentInput;
|
---|
613 |
|
---|
614 | //
|
---|
615 | // Current mouse input state.
|
---|
616 | //
|
---|
617 |
|
---|
618 | USHORT InputState;
|
---|
619 |
|
---|
620 | //
|
---|
621 | // Current mouse sign and overflow data.
|
---|
622 | //
|
---|
623 |
|
---|
624 | UCHAR CurrentSignAndOverflow;
|
---|
625 |
|
---|
626 | //
|
---|
627 | // Previous mouse sign and overflow data.
|
---|
628 | //
|
---|
629 |
|
---|
630 | UCHAR PreviousSignAndOverflow;
|
---|
631 |
|
---|
632 | //
|
---|
633 | // Previous mouse button data.
|
---|
634 | //
|
---|
635 |
|
---|
636 | UCHAR PreviousButtons;
|
---|
637 |
|
---|
638 | //
|
---|
639 | // Request sequence number (used for error logging).
|
---|
640 | //
|
---|
641 |
|
---|
642 | ULONG SequenceNumber;
|
---|
643 |
|
---|
644 | //
|
---|
645 | // Timer used to retry the ISR DPC routine when the class
|
---|
646 | // driver is unable to consume all the port driver's data.
|
---|
647 | //
|
---|
648 |
|
---|
649 | KTIMER DataConsumptionTimer;
|
---|
650 |
|
---|
651 | //
|
---|
652 | // The tick count (since system boot) at which the mouse last interrupted.
|
---|
653 | // Retrieved via KeQueryTickCount. Used to determine whether a byte of
|
---|
654 | // the mouse data packet has been lost. Allows the driver to synch
|
---|
655 | // up with the true mouse input state.
|
---|
656 | //
|
---|
657 |
|
---|
658 | LARGE_INTEGER PreviousTick;
|
---|
659 |
|
---|
660 | //
|
---|
661 | // Indicates which pointer port device this driver created (UnitId
|
---|
662 | // is the suffix appended to the pointer port basename for the
|
---|
663 | // call to IoCreateDevice).
|
---|
664 | //
|
---|
665 |
|
---|
666 | USHORT UnitId;
|
---|
667 |
|
---|
668 | //
|
---|
669 | // Indicates whether it is okay to log overflow errors.
|
---|
670 | //
|
---|
671 |
|
---|
672 | BOOLEAN OkayToLogOverflow;
|
---|
673 |
|
---|
674 | //
|
---|
675 | // Number of interval timer ticks to wait before deciding that the
|
---|
676 | // next mouse interrupt is for the start of a new packet. Used to
|
---|
677 | // synch up again if a byte of the mouse packet gets lost.
|
---|
678 | //
|
---|
679 |
|
---|
680 | ULONG SynchTickCount;
|
---|
681 |
|
---|
682 | //
|
---|
683 | // Keep track of last byte of data received from mouse so we can detect
|
---|
684 | // the two-byte string which indicates a potential reset
|
---|
685 | //
|
---|
686 |
|
---|
687 | UCHAR LastByteReceived;
|
---|
688 |
|
---|
689 | } PORT_MOUSE_EXTENSION, *PPORT_MOUSE_EXTENSION;
|
---|
690 |
|
---|
691 | //
|
---|
692 | // Port device extension.
|
---|
693 | //
|
---|
694 |
|
---|
695 | typedef struct _DEVICE_EXTENSION {
|
---|
696 |
|
---|
697 | //
|
---|
698 | // Indicate which hardware is actually present (keyboard and/or mouse).
|
---|
699 | //
|
---|
700 |
|
---|
701 | ULONG HardwarePresent;
|
---|
702 |
|
---|
703 | //
|
---|
704 | // Reference count for number of keyboard enables.
|
---|
705 | //
|
---|
706 |
|
---|
707 | LONG KeyboardEnableCount;
|
---|
708 |
|
---|
709 | //
|
---|
710 | // Reference count for number of mouse enables.
|
---|
711 | //
|
---|
712 |
|
---|
713 | LONG MouseEnableCount;
|
---|
714 |
|
---|
715 | //
|
---|
716 | // Pointer to the device object.
|
---|
717 | //
|
---|
718 |
|
---|
719 | PDEVICE_OBJECT DeviceObject;
|
---|
720 |
|
---|
721 | //
|
---|
722 | // The mapped addresses for this device's registers.
|
---|
723 | //
|
---|
724 |
|
---|
725 | PUCHAR DeviceRegisters[MaximumPortCount];
|
---|
726 |
|
---|
727 | //
|
---|
728 | // Keyboard-specific port connection data.
|
---|
729 | //
|
---|
730 |
|
---|
731 | PORT_KEYBOARD_EXTENSION KeyboardExtension;
|
---|
732 |
|
---|
733 | //
|
---|
734 | // Mouse-specific port connection data.
|
---|
735 | //
|
---|
736 |
|
---|
737 | PORT_MOUSE_EXTENSION MouseExtension;
|
---|
738 |
|
---|
739 | //
|
---|
740 | // Port configuration information.
|
---|
741 | //
|
---|
742 |
|
---|
743 | I8042_CONFIGURATION_INFORMATION Configuration;
|
---|
744 |
|
---|
745 | //
|
---|
746 | // i8042 keyboard and mouse interrupt objects.
|
---|
747 | //
|
---|
748 |
|
---|
749 | PKINTERRUPT KeyboardInterruptObject;
|
---|
750 | PKINTERRUPT MouseInterruptObject;
|
---|
751 | KSPIN_LOCK SharedInterruptSpinLock;
|
---|
752 |
|
---|
753 | //
|
---|
754 | // DPC queue for completion of requests that fail by exceeding
|
---|
755 | // the maximum number of retries.
|
---|
756 | //
|
---|
757 |
|
---|
758 | KDPC RetriesExceededDpc;
|
---|
759 |
|
---|
760 | //
|
---|
761 | // DPC queue for logging overrun and internal driver errors.
|
---|
762 | //
|
---|
763 |
|
---|
764 | KDPC ErrorLogDpc;
|
---|
765 |
|
---|
766 | //
|
---|
767 | // Keyboard ISR DPC queue.
|
---|
768 | //
|
---|
769 |
|
---|
770 | KDPC KeyboardIsrDpc;
|
---|
771 |
|
---|
772 | //
|
---|
773 | // Keyboard ISR DPC recall queue.
|
---|
774 | //
|
---|
775 |
|
---|
776 | KDPC KeyboardIsrDpcRetry;
|
---|
777 |
|
---|
778 | //
|
---|
779 | // Used by the ISR and the ISR DPC (in I8xDpcVariableOperation calls)
|
---|
780 | // to control processing by the ISR DPC.
|
---|
781 | //
|
---|
782 |
|
---|
783 | LONG DpcInterlockKeyboard;
|
---|
784 |
|
---|
785 | //
|
---|
786 | // Mouse ISR DPC queue.
|
---|
787 | //
|
---|
788 |
|
---|
789 | KDPC MouseIsrDpc;
|
---|
790 |
|
---|
791 | //
|
---|
792 | // Mouse ISR DPC recall queue.
|
---|
793 | //
|
---|
794 |
|
---|
795 | KDPC MouseIsrDpcRetry;
|
---|
796 |
|
---|
797 | //
|
---|
798 | // Used by the ISR and the ISR DPC (in I8xDpcVariableOperation calls)
|
---|
799 | // to control processing by the ISR DPC.
|
---|
800 | //
|
---|
801 |
|
---|
802 | LONG DpcInterlockMouse;
|
---|
803 |
|
---|
804 | //
|
---|
805 | // DPC queue for command timeouts.
|
---|
806 | //
|
---|
807 |
|
---|
808 | KDPC TimeOutDpc;
|
---|
809 |
|
---|
810 | //
|
---|
811 | // Timer used to timeout i8042 commands.
|
---|
812 | //
|
---|
813 |
|
---|
814 | KTIMER CommandTimer;
|
---|
815 |
|
---|
816 | //
|
---|
817 | // Timer count used by the command time out routine.
|
---|
818 | //
|
---|
819 |
|
---|
820 | LONG TimerCount;
|
---|
821 |
|
---|
822 | //
|
---|
823 | // Set at intialization to indicate that the register
|
---|
824 | // addresses must be unmapped when the driver is unloaded.
|
---|
825 | //
|
---|
826 |
|
---|
827 | BOOLEAN UnmapRegistersRequired;
|
---|
828 |
|
---|
829 | #if defined(JAPAN) && defined(i386)
|
---|
830 | // Fujitsu Sep.08.1994
|
---|
831 | // We want to write debugging information to the file except stop error.
|
---|
832 |
|
---|
833 | LONG Dump1Keys; // CrashDump call first press keys flag
|
---|
834 | // 7 6 5 4 3 2 1 0 bit
|
---|
835 | // | | | | | +--- Right Shift Key
|
---|
836 | // | | | | +----- Right Ctrl Key
|
---|
837 | // | | | +------- Right Alt Key
|
---|
838 | // | | +----------- Left Shift Key
|
---|
839 | // | +------------- Left Ctrl Key
|
---|
840 | // +--------------- Left Alt Key
|
---|
841 | LONG Dump2Key; // CrashDump call second twice press key no
|
---|
842 | LONG DumpFlags; // Key press flags
|
---|
843 |
|
---|
844 | #endif
|
---|
845 |
|
---|
846 | // VBOX begin
|
---|
847 | VMMDevReqMouseStatus *reqIS;
|
---|
848 | // VBOX end
|
---|
849 |
|
---|
850 | } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
---|
851 |
|
---|
852 | //
|
---|
853 | // Temporary structure used during initialization
|
---|
854 | //
|
---|
855 |
|
---|
856 | typedef struct _INIT_EXTENSION {
|
---|
857 |
|
---|
858 | DEVICE_EXTENSION DeviceExtension;
|
---|
859 |
|
---|
860 | #ifdef PNP_IDENTIFY
|
---|
861 | HWDESC_INFO MouseConfig;
|
---|
862 | HWDESC_INFO KeyboardConfig;
|
---|
863 | #endif
|
---|
864 |
|
---|
865 | } INIT_EXTENSION, *PINIT_EXTENSION;
|
---|
866 |
|
---|
867 | //
|
---|
868 | // Define the port InitializeDataQueue context structure.
|
---|
869 | //
|
---|
870 |
|
---|
871 | typedef struct _I8042_INITIALIZE_DATA_CONTEXT {
|
---|
872 | IN PDEVICE_EXTENSION DeviceExtension;
|
---|
873 | IN CCHAR DeviceType;
|
---|
874 | } I8042_INITIALIZE_DATA_CONTEXT, *PI8042_INITIALIZE_DATA_CONTEXT;
|
---|
875 |
|
---|
876 | //
|
---|
877 | // Define the port TransmitControllerCommandByte context structure.
|
---|
878 | //
|
---|
879 |
|
---|
880 | typedef struct _I8042_TRANSMIT_CCB_CONTEXT {
|
---|
881 | IN ULONG HardwareDisableEnableMask;
|
---|
882 | IN BOOLEAN AndOperation;
|
---|
883 | IN UCHAR ByteMask;
|
---|
884 | OUT NTSTATUS Status;
|
---|
885 | } I8042_TRANSMIT_CCB_CONTEXT, *PI8042_TRANSMIT_CCB_CONTEXT;
|
---|
886 |
|
---|
887 | //
|
---|
888 | // Define the port DeviceEnableDisable context structure.
|
---|
889 | //
|
---|
890 |
|
---|
891 | typedef struct _I8042_DEVICE_ENABLE_DISABLE_CONTEXT {
|
---|
892 | IN PDEVICE_EXTENSION DeviceExtension;
|
---|
893 | IN ULONG EnableMask;
|
---|
894 | IN BOOLEAN AndOperation;
|
---|
895 | OUT NTSTATUS Status;
|
---|
896 | } I8042_DEVICE_ENABLE_DISABLE_CONTEXT,
|
---|
897 | *PI8042_DEVICE_ENABLE_DISABLE_CONTEXT;
|
---|
898 |
|
---|
899 | //
|
---|
900 | // Define the port Get/SetDataQueuePointer context structures.
|
---|
901 | //
|
---|
902 |
|
---|
903 | typedef struct _GET_DATA_POINTER_CONTEXT {
|
---|
904 | IN PDEVICE_EXTENSION DeviceExtension;
|
---|
905 | IN CCHAR DeviceType;
|
---|
906 | OUT PVOID DataIn;
|
---|
907 | OUT PVOID DataOut;
|
---|
908 | OUT ULONG InputCount;
|
---|
909 | } GET_DATA_POINTER_CONTEXT, *PGET_DATA_POINTER_CONTEXT;
|
---|
910 |
|
---|
911 | typedef struct _SET_DATA_POINTER_CONTEXT {
|
---|
912 | IN PDEVICE_EXTENSION DeviceExtension;
|
---|
913 | IN CCHAR DeviceType;
|
---|
914 | IN ULONG InputCount;
|
---|
915 | IN PVOID DataOut;
|
---|
916 | } SET_DATA_POINTER_CONTEXT, *PSET_DATA_POINTER_CONTEXT;
|
---|
917 |
|
---|
918 | //
|
---|
919 | // Define the port timer context structure.
|
---|
920 | //
|
---|
921 |
|
---|
922 | typedef struct _TIMER_CONTEXT {
|
---|
923 | IN PDEVICE_OBJECT DeviceObject;
|
---|
924 | IN PLONG TimerCounter;
|
---|
925 | OUT LONG NewTimerCount;
|
---|
926 | } TIMER_CONTEXT, *PTIMER_CONTEXT;
|
---|
927 |
|
---|
928 | //
|
---|
929 | // Define the port KeyboardInitiate context structure.
|
---|
930 | //
|
---|
931 |
|
---|
932 | typedef struct _KEYBOARD_INITIATE_CONTEXT {
|
---|
933 | IN PDEVICE_OBJECT DeviceObject;
|
---|
934 | IN UCHAR FirstByte;
|
---|
935 | IN UCHAR LastByte;
|
---|
936 | } KEYBOARD_INITIATE_CONTEXT, *PKEYBOARD_INITIATE_CONTEXT;
|
---|
937 |
|
---|
938 | //
|
---|
939 | // Statically allocate the (known) scancode-to-indicator-light mapping.
|
---|
940 | // This information is returned by the
|
---|
941 | // IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION device control request.
|
---|
942 | //
|
---|
943 |
|
---|
944 | #define KEYBOARD_NUMBER_OF_INDICATORS 3
|
---|
945 |
|
---|
946 | static const INDICATOR_LIST IndicatorList[KEYBOARD_NUMBER_OF_INDICATORS] = {
|
---|
947 | {0x3A, KEYBOARD_CAPS_LOCK_ON},
|
---|
948 | {0x45, KEYBOARD_NUM_LOCK_ON},
|
---|
949 | {0x46, KEYBOARD_SCROLL_LOCK_ON}};
|
---|
950 |
|
---|
951 | //
|
---|
952 | // Define the context structure and operations for I8xDpcVariableOperation.
|
---|
953 | //
|
---|
954 |
|
---|
955 | typedef enum _OPERATION_TYPE {
|
---|
956 | IncrementOperation,
|
---|
957 | DecrementOperation,
|
---|
958 | WriteOperation,
|
---|
959 | ReadOperation
|
---|
960 | } OPERATION_TYPE;
|
---|
961 |
|
---|
962 | typedef struct _VARIABLE_OPERATION_CONTEXT {
|
---|
963 | IN PLONG VariableAddress;
|
---|
964 | IN OPERATION_TYPE Operation;
|
---|
965 | IN OUT PLONG NewValue;
|
---|
966 | } VARIABLE_OPERATION_CONTEXT, *PVARIABLE_OPERATION_CONTEXT;
|
---|
967 |
|
---|
968 | //
|
---|
969 | // Function prototypes.
|
---|
970 | //
|
---|
971 |
|
---|
972 | |
---|
973 |
|
---|
974 | NTSTATUS
|
---|
975 | DriverEntry(
|
---|
976 | IN PDRIVER_OBJECT DriverObject,
|
---|
977 | IN PUNICODE_STRING RegistryPath
|
---|
978 | );
|
---|
979 |
|
---|
980 | VOID
|
---|
981 | I8042CompletionDpc(
|
---|
982 | IN PKDPC Dpc,
|
---|
983 | IN PDEVICE_OBJECT DeviceObject,
|
---|
984 | IN PIRP Irp,
|
---|
985 | IN PVOID Context
|
---|
986 | );
|
---|
987 |
|
---|
988 | VOID
|
---|
989 | I8042ErrorLogDpc(
|
---|
990 | IN PKDPC Dpc,
|
---|
991 | IN PDEVICE_OBJECT DeviceObject,
|
---|
992 | IN PIRP Irp,
|
---|
993 | IN PVOID Context
|
---|
994 | );
|
---|
995 |
|
---|
996 | NTSTATUS
|
---|
997 | I8042Flush(
|
---|
998 | IN PDEVICE_OBJECT DeviceObject,
|
---|
999 | IN PIRP Irp
|
---|
1000 | );
|
---|
1001 |
|
---|
1002 | NTSTATUS
|
---|
1003 | I8042InternalDeviceControl(
|
---|
1004 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1005 | IN PIRP Irp
|
---|
1006 | );
|
---|
1007 |
|
---|
1008 | BOOLEAN
|
---|
1009 | I8042KeyboardInterruptService(
|
---|
1010 | IN PKINTERRUPT Interrupt,
|
---|
1011 | IN PVOID Context
|
---|
1012 | );
|
---|
1013 |
|
---|
1014 | VOID
|
---|
1015 | I8042KeyboardIsrDpc(
|
---|
1016 | IN PKDPC Dpc,
|
---|
1017 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1018 | IN PIRP Irp,
|
---|
1019 | IN PVOID Context
|
---|
1020 | );
|
---|
1021 |
|
---|
1022 | BOOLEAN
|
---|
1023 | I8042MouseInterruptService(
|
---|
1024 | IN PKINTERRUPT Interrupt,
|
---|
1025 | IN PVOID Context
|
---|
1026 | );
|
---|
1027 |
|
---|
1028 | VOID
|
---|
1029 | I8042MouseIsrDpc(
|
---|
1030 | IN PKDPC Dpc,
|
---|
1031 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1032 | IN PIRP Irp,
|
---|
1033 | IN PVOID Context
|
---|
1034 | );
|
---|
1035 |
|
---|
1036 | NTSTATUS
|
---|
1037 | I8042OpenCloseDispatch(
|
---|
1038 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1039 | IN PIRP Irp
|
---|
1040 | );
|
---|
1041 |
|
---|
1042 | VOID
|
---|
1043 | I8042RetriesExceededDpc(
|
---|
1044 | IN PKDPC Dpc,
|
---|
1045 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1046 | IN PIRP Irp,
|
---|
1047 | IN PVOID Context
|
---|
1048 | );
|
---|
1049 |
|
---|
1050 | VOID
|
---|
1051 | I8042StartIo(
|
---|
1052 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1053 | IN PIRP Irp
|
---|
1054 | );
|
---|
1055 |
|
---|
1056 | VOID
|
---|
1057 | I8042TimeOutDpc(
|
---|
1058 | IN PKDPC Dpc,
|
---|
1059 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1060 | IN PVOID SystemContext1,
|
---|
1061 | IN PVOID SystemContext2
|
---|
1062 | );
|
---|
1063 |
|
---|
1064 | VOID
|
---|
1065 | I8042Unload(
|
---|
1066 | IN PDRIVER_OBJECT DriverObject
|
---|
1067 | );
|
---|
1068 |
|
---|
1069 | VOID
|
---|
1070 | I8xBuildResourceList(
|
---|
1071 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1072 | OUT PCM_RESOURCE_LIST *ResourceList,
|
---|
1073 | OUT PULONG ResourceListSize
|
---|
1074 | );
|
---|
1075 |
|
---|
1076 | UCHAR
|
---|
1077 | I8xConvertTypematicParameters(
|
---|
1078 | IN USHORT Rate,
|
---|
1079 | IN USHORT Delay
|
---|
1080 | );
|
---|
1081 |
|
---|
1082 | #if DBG
|
---|
1083 |
|
---|
1084 | VOID
|
---|
1085 | I8xDebugPrint(
|
---|
1086 | ULONG DebugPrintLevel,
|
---|
1087 | PCCHAR DebugMessage,
|
---|
1088 | ...
|
---|
1089 | );
|
---|
1090 |
|
---|
1091 | extern ULONG i8042Debug;
|
---|
1092 | #define I8xPrint(x) I8xDebugPrint x
|
---|
1093 | #else
|
---|
1094 | #define I8xPrint(x)
|
---|
1095 | #endif
|
---|
1096 |
|
---|
1097 | VOID
|
---|
1098 | I8xDecrementTimer(
|
---|
1099 | IN PTIMER_CONTEXT Context
|
---|
1100 | );
|
---|
1101 |
|
---|
1102 | VOID
|
---|
1103 | I8xDeviceEnableDisable(
|
---|
1104 | IN PVOID Context
|
---|
1105 | );
|
---|
1106 |
|
---|
1107 | VOID
|
---|
1108 | I8xDpcVariableOperation(
|
---|
1109 | IN PVOID Context
|
---|
1110 | );
|
---|
1111 |
|
---|
1112 | VOID
|
---|
1113 | I8xDrainOutputBuffer(
|
---|
1114 | IN PUCHAR DataAddress,
|
---|
1115 | IN PUCHAR CommandAddress
|
---|
1116 | );
|
---|
1117 |
|
---|
1118 | VOID
|
---|
1119 | I8xGetByteAsynchronous(
|
---|
1120 | IN CCHAR DeviceType,
|
---|
1121 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1122 | OUT PUCHAR Byte
|
---|
1123 | );
|
---|
1124 |
|
---|
1125 | NTSTATUS
|
---|
1126 | I8xGetBytePolled(
|
---|
1127 | IN CCHAR DeviceType,
|
---|
1128 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1129 | OUT PUCHAR Byte
|
---|
1130 | );
|
---|
1131 |
|
---|
1132 | NTSTATUS
|
---|
1133 | I8xGetControllerCommand(
|
---|
1134 | IN ULONG HardwareDisableEnableMask,
|
---|
1135 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1136 | OUT PUCHAR Byte
|
---|
1137 | );
|
---|
1138 |
|
---|
1139 | VOID
|
---|
1140 | I8xGetDataQueuePointer(
|
---|
1141 | IN PVOID Context
|
---|
1142 | );
|
---|
1143 |
|
---|
1144 | VOID
|
---|
1145 | I8xInitializeDataQueue(
|
---|
1146 | IN PVOID Context
|
---|
1147 | );
|
---|
1148 |
|
---|
1149 | VOID
|
---|
1150 | I8xInitializeHardware(
|
---|
1151 | IN PDEVICE_OBJECT DeviceObject
|
---|
1152 | );
|
---|
1153 |
|
---|
1154 | NTSTATUS
|
---|
1155 | I8xInitializeKeyboard(
|
---|
1156 | IN PDEVICE_OBJECT DeviceObject
|
---|
1157 | );
|
---|
1158 |
|
---|
1159 | NTSTATUS
|
---|
1160 | I8xInitializeMouse(
|
---|
1161 | IN PDEVICE_OBJECT DeviceObject
|
---|
1162 | );
|
---|
1163 |
|
---|
1164 | VOID
|
---|
1165 | I8xKeyboardConfiguration(
|
---|
1166 | IN PINIT_EXTENSION InitializationData,
|
---|
1167 | IN PUNICODE_STRING RegistryPath,
|
---|
1168 | IN PUNICODE_STRING KeyboardDeviceName,
|
---|
1169 | IN PUNICODE_STRING PointerDeviceName
|
---|
1170 | );
|
---|
1171 |
|
---|
1172 | VOID
|
---|
1173 | I8xKeyboardInitiateIo(
|
---|
1174 | IN PVOID Context
|
---|
1175 | );
|
---|
1176 |
|
---|
1177 | VOID
|
---|
1178 | I8xKeyboardInitiateWrapper(
|
---|
1179 | IN PVOID Context
|
---|
1180 | );
|
---|
1181 |
|
---|
1182 | NTSTATUS
|
---|
1183 | I8xKeyboardPeripheralCallout(
|
---|
1184 | IN PVOID Context,
|
---|
1185 | IN PUNICODE_STRING PathName,
|
---|
1186 | IN INTERFACE_TYPE BusType,
|
---|
1187 | IN ULONG BusNumber,
|
---|
1188 | IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
|
---|
1189 | IN CONFIGURATION_TYPE ControllerType,
|
---|
1190 | IN ULONG ControllerNumber,
|
---|
1191 | IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
|
---|
1192 | IN CONFIGURATION_TYPE PeripheralType,
|
---|
1193 | IN ULONG PeripheralNumber,
|
---|
1194 | IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
|
---|
1195 | );
|
---|
1196 |
|
---|
1197 | VOID
|
---|
1198 | I8xLogError(
|
---|
1199 | IN PDEVICE_OBJECT DeviceObject,
|
---|
1200 | IN NTSTATUS ErrorCode,
|
---|
1201 | IN ULONG UniqueErrorValue,
|
---|
1202 | IN NTSTATUS FinalStatus,
|
---|
1203 | IN PULONG DumpData,
|
---|
1204 | IN ULONG DumpCount
|
---|
1205 | );
|
---|
1206 |
|
---|
1207 | VOID
|
---|
1208 | I8xMouseConfiguration(
|
---|
1209 | IN PINIT_EXTENSION InitializationData,
|
---|
1210 | IN PUNICODE_STRING RegistryPath,
|
---|
1211 | IN PUNICODE_STRING KeyboardDeviceName,
|
---|
1212 | IN PUNICODE_STRING PointerDeviceName
|
---|
1213 | );
|
---|
1214 |
|
---|
1215 | NTSTATUS
|
---|
1216 | I8xMouseEnableTransmission(
|
---|
1217 | IN PDEVICE_OBJECT DeviceObject
|
---|
1218 | );
|
---|
1219 |
|
---|
1220 | NTSTATUS
|
---|
1221 | I8xMousePeripheralCallout(
|
---|
1222 | IN PVOID Context,
|
---|
1223 | IN PUNICODE_STRING PathName,
|
---|
1224 | IN INTERFACE_TYPE BusType,
|
---|
1225 | IN ULONG BusNumber,
|
---|
1226 | IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
|
---|
1227 | IN CONFIGURATION_TYPE ControllerType,
|
---|
1228 | IN ULONG ControllerNumber,
|
---|
1229 | IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
|
---|
1230 | IN CONFIGURATION_TYPE PeripheralType,
|
---|
1231 | IN ULONG PeripheralNumber,
|
---|
1232 | IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
|
---|
1233 | );
|
---|
1234 |
|
---|
1235 | VOID
|
---|
1236 | I8xPutByteAsynchronous(
|
---|
1237 | IN CCHAR PortType,
|
---|
1238 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1239 | IN UCHAR Byte
|
---|
1240 | );
|
---|
1241 |
|
---|
1242 | NTSTATUS
|
---|
1243 | I8xPutBytePolled(
|
---|
1244 | IN CCHAR PortType,
|
---|
1245 | IN BOOLEAN WaitForAcknowledge,
|
---|
1246 | IN CCHAR AckDeviceType,
|
---|
1247 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1248 | IN UCHAR Byte
|
---|
1249 | );
|
---|
1250 |
|
---|
1251 | NTSTATUS
|
---|
1252 | I8xPutControllerCommand(
|
---|
1253 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1254 | IN UCHAR Byte
|
---|
1255 | );
|
---|
1256 |
|
---|
1257 | VOID
|
---|
1258 | I8xServiceParameters(
|
---|
1259 | IN PINIT_EXTENSION InitializationData,
|
---|
1260 | IN PUNICODE_STRING RegistryPath,
|
---|
1261 | IN PUNICODE_STRING KeyboardDeviceName,
|
---|
1262 | IN PUNICODE_STRING PointerDeviceName
|
---|
1263 | );
|
---|
1264 |
|
---|
1265 | VOID
|
---|
1266 | I8xSetDataQueuePointer(
|
---|
1267 | IN PVOID Context
|
---|
1268 | );
|
---|
1269 |
|
---|
1270 | VOID
|
---|
1271 | I8xTransmitControllerCommand(
|
---|
1272 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1273 | IN PVOID Context
|
---|
1274 | );
|
---|
1275 |
|
---|
1276 | BOOLEAN
|
---|
1277 | I8xWriteDataToKeyboardQueue(
|
---|
1278 | IN PPORT_KEYBOARD_EXTENSION KeyboardExtension,
|
---|
1279 | IN PKEYBOARD_INPUT_DATA InputData
|
---|
1280 | );
|
---|
1281 |
|
---|
1282 | BOOLEAN
|
---|
1283 | I8xWriteDataToMouseQueue(
|
---|
1284 | IN PPORT_MOUSE_EXTENSION MouseExtension,
|
---|
1285 | IN PMOUSE_INPUT_DATA InputData
|
---|
1286 | );
|
---|
1287 |
|
---|
1288 | NTSTATUS
|
---|
1289 | I8xFindWheelMouse(
|
---|
1290 | IN PDEVICE_OBJECT DeviceObject
|
---|
1291 | );
|
---|
1292 |
|
---|
1293 | VOID
|
---|
1294 | I8xQueueCurrentInput(
|
---|
1295 | IN PDEVICE_OBJECT DeviceObject
|
---|
1296 | );
|
---|
1297 |
|
---|
1298 | #ifdef JAPAN
|
---|
1299 | NTSTATUS
|
---|
1300 | I8xCreateSymbolicLink(
|
---|
1301 | IN PWCHAR SymbolicLinkName,
|
---|
1302 | IN ULONG SymbolicLinkInteger,
|
---|
1303 | IN PUNICODE_STRING DeviceName
|
---|
1304 | );
|
---|
1305 |
|
---|
1306 | #if defined(i386)
|
---|
1307 | // Fujitsu Sep.08.1994
|
---|
1308 | // We want to write debugging information to the file except stop error.
|
---|
1309 | VOID
|
---|
1310 | I8xServiceCrashDump(
|
---|
1311 | IN PDEVICE_EXTENSION DeviceExtension,
|
---|
1312 | IN PUNICODE_STRING RegistryPath,
|
---|
1313 | IN PUNICODE_STRING KeyboardDeviceName,
|
---|
1314 | IN PUNICODE_STRING PointerDeviceName
|
---|
1315 | );
|
---|
1316 | #endif // i386
|
---|
1317 |
|
---|
1318 | #endif // JAPAN
|
---|
1319 |
|
---|
1320 | #endif // _I8042PRT_
|
---|