63ed4d922fe89e46f42a05b7aadcce0aedfe6e33
[reactos.git] / reactos / sdk / include / psdk / usb200.h
1 /*
2 * usb200.h
3 *
4 * This file is part of the ReactOS PSDK package.
5 *
6 * Contributors:
7 * Magnus Olsen.
8 *
9 * THIS SOFTWARE IS NOT COPYRIGHTED
10 *
11 * This source code is offered for use in the public domain. You may
12 * use, modify or distribute it freely.
13 *
14 * This code is distributed in the hope that it will be useful but
15 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16 * DISCLAIMED. This includes but is not limited to warranties of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 */
20
21 #pragma once
22
23 /* Helper macro to enable gcc's extension. */
24 #ifndef __GNU_EXTENSION
25 #ifdef __GNUC__
26 #define __GNU_EXTENSION __extension__
27 #else
28 #define __GNU_EXTENSION
29 #endif
30 #endif
31
32 #include "usb100.h"
33
34 #include <pshpack1.h>
35
36 typedef enum _USB_DEVICE_TYPE {
37 Usb11Device = 0,
38 Usb20Device
39 } USB_DEVICE_TYPE;
40
41 typedef enum _USB_DEVICE_SPEED {
42 UsbLowSpeed = 0,
43 UsbFullSpeed,
44 UsbHighSpeed
45 } USB_DEVICE_SPEED;
46
47 #define USB_PORT_STATUS_CONNECT 0x0001
48 #define USB_PORT_STATUS_ENABLE 0x0002
49 #define USB_PORT_STATUS_SUSPEND 0x0004
50 #define USB_PORT_STATUS_OVER_CURRENT 0x0008
51 #define USB_PORT_STATUS_RESET 0x0010
52 #define USB_PORT_STATUS_POWER 0x0100
53 #define USB_PORT_STATUS_LOW_SPEED 0x0200
54 #define USB_PORT_STATUS_HIGH_SPEED 0x0400
55
56
57 typedef union _BM_REQUEST_TYPE {
58 #ifdef __cplusplus
59 struct {
60 #else
61 struct _BM {
62 #endif
63 UCHAR Recipient:2;
64 UCHAR Reserved:3;
65 UCHAR Type:2;
66 UCHAR Dir:1;
67 };
68 UCHAR B;
69 } BM_REQUEST_TYPE, *PBM_REQUEST_TYPE;
70
71 typedef struct _USB_DEFAULT_PIPE_SETUP_PACKET {
72 BM_REQUEST_TYPE bmRequestType;
73 UCHAR bRequest;
74 union _wValue {
75 __GNU_EXTENSION struct {
76 UCHAR LowByte;
77 UCHAR HiByte;
78 };
79 USHORT W;
80 } wValue;
81 union _wIndex {
82 __GNU_EXTENSION struct {
83 UCHAR LowByte;
84 UCHAR HiByte;
85 };
86 USHORT W;
87 } wIndex;
88 USHORT wLength;
89 } USB_DEFAULT_PIPE_SETUP_PACKET, *PUSB_DEFAULT_PIPE_SETUP_PACKET;
90
91 C_ASSERT(sizeof(USB_DEFAULT_PIPE_SETUP_PACKET) == 8);
92
93 #define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 0x06
94 #define USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE 0x07
95
96 typedef struct _USB_DEVICE_QUALIFIER_DESCRIPTOR {
97 UCHAR bLength;
98 UCHAR bDescriptorType;
99 USHORT bcdUSB;
100 UCHAR bDeviceClass;
101 UCHAR bDeviceSubClass;
102 UCHAR bDeviceProtocol;
103 UCHAR bMaxPacketSize0;
104 UCHAR bNumConfigurations;
105 UCHAR bReserved;
106 } USB_DEVICE_QUALIFIER_DESCRIPTOR, *PUSB_DEVICE_QUALIFIER_DESCRIPTOR;
107
108 typedef union _USB_HIGH_SPEED_MAXPACKET {
109 struct _MP {
110 USHORT MaxPacket:11;
111 USHORT HSmux:2;
112 USHORT Reserved:3;
113 } _MP;
114 USHORT us;
115 } USB_HIGH_SPEED_MAXPACKET, *PUSB_HIGH_SPEED_MAXPACKET;
116
117 #define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 0x0B
118
119 typedef struct _USB_INTERFACE_ASSOCIATION_DESCRIPTOR {
120 UCHAR bLength;
121 UCHAR bDescriptorType;
122 UCHAR bFirstInterface;
123 UCHAR bInterfaceCount;
124 UCHAR bFunctionClass;
125 UCHAR bFunctionSubClass;
126 UCHAR bFunctionProtocol;
127 UCHAR iFunction;
128 } USB_INTERFACE_ASSOCIATION_DESCRIPTOR, *PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR;
129
130 typedef union _USB_20_PORT_CHANGE {
131 USHORT AsUshort16;
132 struct {
133 USHORT ConnectStatusChange:1;
134 USHORT PortEnableDisableChange:1;
135 USHORT SuspendChange:1;
136 USHORT OverCurrentIndicatorChange:1;
137 USHORT ResetChange:1;
138 USHORT Reserved2:11;
139 };
140 } USB_20_PORT_CHANGE, *PUSB_20_PORT_CHANGE;
141
142 C_ASSERT(sizeof(USB_20_PORT_CHANGE) == sizeof(USHORT));
143
144 typedef union _USB_20_PORT_STATUS {
145 USHORT AsUshort16;
146 struct {
147 USHORT CurrentConnectStatus:1;
148 USHORT PortEnabledDisabled:1;
149 USHORT Suspend:1;
150 USHORT OverCurrent:1;
151 USHORT Reset:1;
152 USHORT L1:1;
153 USHORT Reserved0:2;
154 USHORT PortPower:1;
155 USHORT LowSpeedDeviceAttached:1;
156 USHORT HighSpeedDeviceAttached:1;
157 USHORT PortTestMode:1;
158 USHORT PortIndicatorControl:1;
159 USHORT Reserved1:3;
160 };
161 } USB_20_PORT_STATUS, *PUSB_20_PORT_STATUS;
162
163 C_ASSERT(sizeof(USB_20_PORT_STATUS) == sizeof(USHORT));
164
165 typedef union _USB_30_PORT_STATUS {
166 USHORT AsUshort16;
167 struct {
168 USHORT CurrentConnectStatus:1;
169 USHORT PortEnabledDisabled:1;
170 USHORT Reserved0:1;
171 USHORT OverCurrent:1;
172 USHORT Reset:1;
173 USHORT PortLinkState:4;
174 USHORT PortPower:1;
175 USHORT NegotiatedDeviceSpeed:3;
176 USHORT Reserved1:3;
177 };
178 } USB_30_PORT_STATUS, *PUSB_30_PORT_STATUS;
179
180 C_ASSERT(sizeof(USB_30_PORT_STATUS) == sizeof(USHORT));
181
182 typedef union _USB_PORT_STATUS {
183 USHORT AsUshort16;
184 USB_20_PORT_STATUS Usb20PortStatus;
185 USB_30_PORT_STATUS Usb30PortStatus;
186 } USB_PORT_STATUS, *PUSB_PORT_STATUS;
187
188 typedef union _USB_HUB_STATUS {
189 USHORT AsUshort16;
190 struct {
191 USHORT LocalPowerLost:1;
192 USHORT OverCurrent:1;
193 USHORT Reserved:14;
194 };
195 } USB_HUB_STATUS, *PUSB_HUB_STATUS;
196
197 C_ASSERT(sizeof(USB_HUB_STATUS) == sizeof(USHORT));
198
199 #define USB_DEVICE_CLASS_RESERVED 0x00
200 #define USB_DEVICE_CLASS_AUDIO 0x01
201 #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
202 #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
203 #define USB_DEVICE_CLASS_MONITOR 0x04
204 #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
205 #define USB_DEVICE_CLASS_POWER 0x06
206 #define USB_DEVICE_CLASS_IMAGE 0x06
207 #define USB_DEVICE_CLASS_PRINTER 0x07
208 #define USB_DEVICE_CLASS_STORAGE 0x08
209 #define USB_DEVICE_CLASS_HUB 0x09
210 #define USB_DEVICE_CLASS_CDC_DATA 0x0A
211 #define USB_DEVICE_CLASS_SMART_CARD 0x0B
212 #define USB_DEVICE_CLASS_CONTENT_SECURITY 0x0D
213 #define USB_DEVICE_CLASS_VIDEO 0x0E
214 #define USB_DEVICE_CLASS_PERSONAL_HEALTHCARE 0x0F
215 #define USB_DEVICE_CLASS_DIAGNOSTIC_DEVICE 0xDC
216 #define USB_DEVICE_CLASS_WIRELESS_CONTROLLER 0xE0
217 #define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF
218 #define USB_DEVICE_CLASS_APPLICATION_SPECIFIC 0xFE
219 #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
220
221 #include <poppack.h>