source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ntdd8042.h@ 1175

Last change on this file since 1175 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 5.6 KB
RevLine 
[1166]1/*
2 * ntdd8042.h
3 *
4 * i8042 IOCTL interface.
5 *
6 * This file is part of the mingw-w64 runtime package.
7 * No warranty is given; refer to the file DISCLAIMER within this package.
8 *
9 * Initial contributor is Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23#ifndef _NTDD8042_
24#define _NTDD8042_
25
26#include <winapifamily.h>
27
28#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
29
30#include "ntddkbd.h"
31#include "ntddmou.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define IOCTL_INTERNAL_I8042_CONTROLLER_WRITE_BUFFER \
38 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF2, METHOD_NEITHER, FILE_ANY_ACCESS)
39
40#define IOCTL_INTERNAL_I8042_HOOK_KEYBOARD \
41 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF0, METHOD_NEITHER, FILE_ANY_ACCESS)
42
43#define IOCTL_INTERNAL_I8042_KEYBOARD_START_INFORMATION \
44 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF3, METHOD_NEITHER, FILE_ANY_ACCESS)
45
46#define IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER \
47 CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0FF1, METHOD_NEITHER, FILE_ANY_ACCESS)
48
49#define IOCTL_INTERNAL_I8042_HOOK_MOUSE \
50 CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF0, METHOD_NEITHER, FILE_ANY_ACCESS)
51
52#define IOCTL_INTERNAL_I8042_MOUSE_START_INFORMATION \
53 CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF3, METHOD_NEITHER, FILE_ANY_ACCESS)
54
55#define IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER \
56 CTL_CODE(FILE_DEVICE_MOUSE, 0x0FF1, METHOD_NEITHER, FILE_ANY_ACCESS)
57
58#define I8042_POWER_SYS_BUTTON 0x0001
59#define I8042_SLEEP_SYS_BUTTON 0x0002
60#define I8042_WAKE_SYS_BUTTON 0x0004
61#define I8042_SYS_BUTTONS (I8042_POWER_SYS_BUTTON | \
62 I8042_SLEEP_SYS_BUTTON | \
63 I8042_WAKE_SYS_BUTTON)
64
65typedef enum _TRANSMIT_STATE {
66 Idle = 0,
67 SendingBytes
68} TRANSMIT_STATE;
69
70typedef struct _OUTPUT_PACKET {
71 PUCHAR Bytes;
72 ULONG CurrentByte;
73 ULONG ByteCount;
74 TRANSMIT_STATE State;
75} OUTPUT_PACKET, *POUTPUT_PACKET;
76
77typedef enum _KEYBOARD_SCAN_STATE {
78 Normal,
79 GotE0,
80 GotE1
81} KEYBOARD_SCAN_STATE, *PKEYBOARD_SCAN_STATE;
82
83typedef enum _MOUSE_STATE {
84 MouseIdle,
85 XMovement,
86 YMovement,
87 ZMovement,
88 MouseExpectingACK,
89 MouseResetting
90} MOUSE_STATE, *PMOUSE_STATE;
91
92typedef enum _MOUSE_RESET_SUBSTATE {
93 ExpectingReset,
94 ExpectingResetId,
95 ExpectingGetDeviceIdACK,
96 ExpectingGetDeviceIdValue,
97 ExpectingSetResolutionDefaultACK,
98 ExpectingSetResolutionDefaultValueACK,
99 ExpectingSetResolutionACK,
100 ExpectingSetResolutionValueACK,
101 ExpectingSetScaling1to1ACK,
102 ExpectingSetScaling1to1ACK2,
103 ExpectingSetScaling1to1ACK3,
104 ExpectingReadMouseStatusACK,
105 ExpectingReadMouseStatusByte1,
106 ExpectingReadMouseStatusByte2,
107 ExpectingReadMouseStatusByte3,
108 StartPnPIdDetection,
109 ExpectingLoopSetSamplingRateACK,
110 ExpectingLoopSetSamplingRateValueACK,
111 ExpectingPnpIdByte1,
112 ExpectingPnpIdByte2,
113 ExpectingPnpIdByte3,
114 ExpectingPnpIdByte4,
115 ExpectingPnpIdByte5,
116 ExpectingPnpIdByte6,
117 ExpectingPnpIdByte7,
118 EnableWheel,
119 Enable5Buttons,
120 ExpectingGetDeviceId2ACK,
121 ExpectingGetDeviceId2Value,
122 ExpectingSetSamplingRateACK,
123 ExpectingSetSamplingRateValueACK,
124 ExpectingEnableACK,
125 ExpectingFinalResolutionACK,
126 ExpectingFinalResolutionValueACK,
127 ExpectingGetDeviceIdDetectACK,
128 ExpectingGetDeviceIdDetectValue,
129 CustomHookStateMinimum = 100,
130 CustomHookStateMaximum = 999,
131 I8042ReservedMinimum = 1000
132} MOUSE_RESET_SUBSTATE, *PMOUSE_RESET_SUBSTATE;
133
134typedef struct _INTERNAL_I8042_START_INFORMATION {
135 ULONG Size;
136 PKINTERRUPT InterruptObject;
137 ULONG Reserved[8];
138} INTERNAL_I8042_START_INFORMATION, *PINTERNAL_I8042_START_INFORMATION;
139
140typedef VOID
141(NTAPI *PI8042_ISR_WRITE_PORT)(
142 PVOID Context,
143 UCHAR Value);
144
145typedef VOID
146(NTAPI *PI8042_QUEUE_PACKET)(
147 PVOID Context);
148
149typedef NTSTATUS
150(NTAPI *PI8042_SYNCH_READ_PORT) (
151 PVOID Context,
152 PUCHAR Value,
153 BOOLEAN WaitForACK);
154
155typedef NTSTATUS
156(NTAPI *PI8042_SYNCH_WRITE_PORT)(
157 PVOID Context,
158 UCHAR Value,
159 BOOLEAN WaitForACK);
160
161
162typedef NTSTATUS
163(NTAPI *PI8042_KEYBOARD_INITIALIZATION_ROUTINE)(
164 PVOID InitializationContext,
165 PVOID SynchFuncContext,
166 PI8042_SYNCH_READ_PORT ReadPort,
167 PI8042_SYNCH_WRITE_PORT WritePort,
168 PBOOLEAN TurnTranslationOn);
169
170typedef BOOLEAN
171(NTAPI *PI8042_KEYBOARD_ISR)(
172 PVOID IsrContext,
173 PKEYBOARD_INPUT_DATA CurrentInput,
174 POUTPUT_PACKET CurrentOutput,
175 UCHAR StatusByte,
176 PUCHAR Byte,
177 PBOOLEAN ContinueProcessing,
178 PKEYBOARD_SCAN_STATE ScanState);
179
180typedef struct _INTERNAL_I8042_HOOK_KEYBOARD {
181 PVOID Context;
182 PI8042_KEYBOARD_INITIALIZATION_ROUTINE InitializationRoutine;
183 PI8042_KEYBOARD_ISR IsrRoutine;
184 PI8042_ISR_WRITE_PORT IsrWritePort;
185 PI8042_QUEUE_PACKET QueueKeyboardPacket;
186 PVOID CallContext;
187} INTERNAL_I8042_HOOK_KEYBOARD, *PINTERNAL_I8042_HOOK_KEYBOARD;
188
189typedef BOOLEAN
190(NTAPI *PI8042_MOUSE_ISR)(
191 PVOID IsrContext,
192 PMOUSE_INPUT_DATA CurrentInput,
193 POUTPUT_PACKET CurrentOutput,
194 UCHAR StatusByte,
195 PUCHAR Byte,
196 PBOOLEAN ContinueProcessing,
197 PMOUSE_STATE MouseState,
198 PMOUSE_RESET_SUBSTATE ResetSubState);
199
200typedef struct _INTERNAL_I8042_HOOK_MOUSE {
201 PVOID Context;
202 PI8042_MOUSE_ISR IsrRoutine;
203 PI8042_ISR_WRITE_PORT IsrWritePort;
204 PI8042_QUEUE_PACKET QueueMousePacket;
205 PVOID CallContext;
206} INTERNAL_I8042_HOOK_MOUSE, *PINTERNAL_I8042_HOOK_MOUSE;
207
208#ifdef __cplusplus
209}
210#endif
211
212#endif
213
214#endif /* _NTDD8042_ */
Note: See TracBrowser for help on using the repository browser.