📄 xxgusb100.lst
字号:
C51 COMPILER V7.02b XXGUSB100 03/17/2005 23:11:26 PAGE 1
C51 COMPILER V7.02b, COMPILATION OF MODULE XXGUSB100
OBJECT MODULE PLACED IN J:\D12\FW\XXGUSB100.OBJ
COMPILER INVOKED BY: C:\keil\c51\bin\C51.EXE J:\D12\FW\XXGUSB100.C DB SB OE
stmt level source
1 #include "xxgmain.h"
2
3 #define MAXIMUM_USB_STRING_LENGTH 255
4
5 // values for the bits returned by the USB GET_STATUS command
6 #define USB_GETSTATUS_SELF_POWERED 0x01
7 #define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02
8
9
10 #define USB_DEVICE_DESCRIPTOR_TYPE 0x01
11 #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
12 #define USB_STRING_DESCRIPTOR_TYPE 0x03
13 #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
14 #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
15 #define USB_POWER_DESCRIPTOR_TYPE 0x06
16
17 #define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT)((USHORT)d<<8 | i))
18
19 //
20 // Values for bmAttributes field of an
21 // endpoint descriptor
22 //
23
24 #define USB_ENDPOINT_TYPE_MASK 0x03
25
26 #define USB_ENDPOINT_TYPE_CONTROL 0x00
27 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
28 #define USB_ENDPOINT_TYPE_BULK 0x02
29 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03
30
31
32 //
33 // definitions for bits in the bmAttributes field of a
34 // configuration descriptor.
35 //
36 #define USB_CONFIG_POWERED_MASK 0xc0
37
38 #define USB_CONFIG_BUS_POWERED 0x80
39 #define USB_CONFIG_SELF_POWERED 0x40
40 #define USB_CONFIG_REMOTE_WAKEUP 0x20
41
42 //
43 // Endpoint direction bit, stored in address
44 //
45
46 #define USB_ENDPOINT_DIRECTION_MASK 0x80
47
48 // test direction bit in the bEndpointAddress field of
49 // an endpoint descriptor.
50 #define USB_ENDPOINT_DIRECTION_OUT(addr) (!((addr) & USB_ENDPOINT_DIRECTION_MASK))
51 #define USB_ENDPOINT_DIRECTION_IN(addr) ((addr) & USB_ENDPOINT_DIRECTION_MASK)
52
53 //
54 // USB defined request codes
55 // see chapter 9 of the USB 1.0 specifcation for
C51 COMPILER V7.02b XXGUSB100 03/17/2005 23:11:26 PAGE 2
56 // more information.
57 //
58
59 // These are the correct values based on the USB 1.0
60 // specification
61
62 #define USB_REQUEST_GET_STATUS 0x00
63 #define USB_REQUEST_CLEAR_FEATURE 0x01
64
65 #define USB_REQUEST_SET_FEATURE 0x03
66
67 #define USB_REQUEST_SET_ADDRESS 0x05
68 #define USB_REQUEST_GET_DESCRIPTOR 0x06
69 #define USB_REQUEST_SET_DESCRIPTOR 0x07
70 #define USB_REQUEST_GET_CONFIGURATION 0x08
71 #define USB_REQUEST_SET_CONFIGURATION 0x09
72 #define USB_REQUEST_GET_INTERFACE 0x0A
73 #define USB_REQUEST_SET_INTERFACE 0x0B
74 #define USB_REQUEST_SYNC_FRAME 0x0C
75
76
77 //
78 // defined USB device classes
79 //
80
81
82 #define USB_DEVICE_CLASS_RESERVED 0x00
83 #define USB_DEVICE_CLASS_AUDIO 0x01
84 #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
85 #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
86 #define USB_DEVICE_CLASS_MONITOR 0x04
87 #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
88 #define USB_DEVICE_CLASS_POWER 0x06
89 #define USB_DEVICE_CLASS_PRINTER 0x07
90 #define USB_DEVICE_CLASS_STORAGE 0x08
91 #define USB_DEVICE_CLASS_HUB 0x09
92 #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
93
94 //
95 // USB defined Feature selectors
96 //
97
98 #define USB_FEATURE_ENDPOINT_STALL 0x0000
99 #define USB_FEATURE_REMOTE_WAKEUP 0x0001
100 #define USB_FEATURE_POWER_D0 0x0002
101 #define USB_FEATURE_POWER_D1 0x0003
102 #define USB_FEATURE_POWER_D2 0x0004
103 #define USB_FEATURE_POWER_D3 0x0005
104
105 typedef struct _USB_DEVICE_DESCRIPTOR {
106 UCHAR bLength;
107 UCHAR bDescriptorType;
108 USHORT bcdUSB;
109 UCHAR bDeviceClass;
110 UCHAR bDeviceSubClass;
111 UCHAR bDeviceProtocol;
112 UCHAR bMaxPacketSize0;
113 USHORT idVendor;
114 USHORT idProduct;
115 USHORT bcdDevice;
116 UCHAR iManufacturer;
117 UCHAR iProduct;
C51 COMPILER V7.02b XXGUSB100 03/17/2005 23:11:26 PAGE 3
118 UCHAR iSerialNumber;
119 UCHAR bNumConfigurations;
120 } USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
121
122 typedef struct _USB_ENDPOINT_DESCRIPTOR {
123 UCHAR bLength;
124 UCHAR bDescriptorType;
125 UCHAR bEndpointAddress;
126 UCHAR bmAttributes;
127 USHORT wMaxPacketSize;
128 UCHAR bInterval;
129 } USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
130
131 //
132 // values for bmAttributes Field in
133 // USB_CONFIGURATION_DESCRIPTOR
134 //
135
136 #define BUS_POWERED 0x80
137 #define SELF_POWERED 0x40
138 #define REMOTE_WAKEUP 0x20
139
140 typedef struct _USB_CONFIGURATION_DESCRIPTOR {
141 UCHAR bLength;
142 UCHAR bDescriptorType;
143 USHORT wTotalLength;
144 UCHAR bNumInterfaces;
145 UCHAR bConfigurationValue;
146 UCHAR iConfiguration;
147 UCHAR bmAttributes;
148 UCHAR MaxPower;
149 } USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
150
151 typedef struct _USB_INTERFACE_DESCRIPTOR {
152 UCHAR bLength;
153 UCHAR bDescriptorType;
154 UCHAR bInterfaceNumber;
155 UCHAR bAlternateSetting;
156 UCHAR bNumEndpoints;
157 UCHAR bInterfaceClass;
158 UCHAR bInterfaceSubClass;
159 UCHAR bInterfaceProtocol;
160 UCHAR iInterface;
161 } USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
162
163 typedef struct _USB_STRING_DESCRIPTOR {
164 UCHAR bLength;
165 UCHAR bDescriptorType;
166 UCHAR bString[1];
167 } USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;
168
169 //
170 // USB power descriptor added to core specification
171 //
172
173 #define USB_SUPPORT_D0_COMMAND 0x01
174 #define USB_SUPPORT_D1_COMMAND 0x02
175 #define USB_SUPPORT_D2_COMMAND 0x04
176 #define USB_SUPPORT_D3_COMMAND 0x08
177
178 #define USB_SUPPORT_D1_WAKEUP 0x10
179 #define USB_SUPPORT_D2_WAKEUP 0x20
C51 COMPILER V7.02b XXGUSB100 03/17/2005 23:11:26 PAGE 4
180
181
182 typedef struct _USB_POWER_DESCRIPTOR {
183 UCHAR bLength;
184 UCHAR bDescriptorType;
185 UCHAR bCapabilitiesFlags;
186 USHORT EventNotification;
187 USHORT D1LatencyTime;
188 USHORT D2LatencyTime;
189 USHORT D3LatencyTime;
190 UCHAR PowerUnit;
191 USHORT D0PowerConsumption;
192 USHORT D1PowerConsumption;
193 USHORT D2PowerConsumption;
194 } USB_POWER_DESCRIPTOR, *PUSB_POWER_DESCRIPTOR;
195
196
197 typedef struct _USB_COMMON_DESCRIPTOR {
198 UCHAR bLength;
199 UCHAR bDescriptorType;
200 } USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;
201
202
203 //
204 // Standard USB HUB definitions
205 //
206 // See Chapter 11
207 //
208
209 typedef struct _USB_HUB_DESCRIPTOR {
210 UCHAR bDescriptorLength; // Length of this descriptor
211 UCHAR bDescriptorType; // Hub configuration type
212 UCHAR bNumberOfPorts; // number of ports on this hub
213 USHORT wHubCharacteristics; // Hub Charateristics
214 UCHAR bPowerOnToPowerGood; // port power on till power good in 2ms
215 UCHAR bHubControlCurrent; // max current in mA
216 //
217 // room for 255 ports power control and removable bitmask
218 UCHAR bRemoveAndPowerMask[64];
219 } USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
220
C51 COMPILER V7.02b XXGUSB100 03/17/2005 23:11:26 PAGE 5
NAME CLASS MSPACE TYPE OFFSET SIZE
==== ===== ====== ==== ====== ====
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -