?? usbdcore.lst
字號:
*** WARNING C318 IN LINE 79 OF usbdescriptors.h: can't open file 'asm/types.h'
*** ERROR C304 IN LINE 42 OF usbdcore.h: bad macro parameter list
*** ERROR C304 IN LINE 50 OF usbdcore.h: bad macro parameter list
*** ERROR C304 IN LINE 56 OF usbdcore.h: bad macro parameter list
34
35 #define MAX_INTERFACES 2
36
37
38 int maxstrings = 20;
39
40 /* Global variables ************************************************************************** */
41
42 struct usb_string_descriptor **usb_strings;
43
44 int usb_devices;
45
46 extern struct usb_function_driver ep0_driver;
47
48 int registered_functions;
49 int registered_devices;
50
51 char *usbd_device_events[] = {
52 "DEVICE_UNKNOWN",
53 "DEVICE_INIT",
54 "DEVICE_CREATE",
C51 COMPILER V8.09 USBDCORE 05/05/2008 19:48:28 PAGE 5
55 "DEVICE_HUB_CONFIGURED",
56 "DEVICE_RESET",
57 "DEVICE_ADDRESS_ASSIGNED",
58 "DEVICE_CONFIGURED",
59 "DEVICE_SET_INTERFACE",
60 "DEVICE_SET_FEATURE",
61 "DEVICE_CLEAR_FEATURE",
62 "DEVICE_DE_CONFIGURED",
63 "DEVICE_BUS_INACTIVE",
64 "DEVICE_BUS_ACTIVITY",
65 "DEVICE_POWER_INTERRUPTION",
66 "DEVICE_HUB_RESET",
67 "DEVICE_DESTROY",
68 "DEVICE_FUNCTION_PRIVATE",
69 };
70
71 char *usbd_device_states[] = {
72 "STATE_INIT",
73 "STATE_CREATED",
74 "STATE_ATTACHED",
75 "STATE_POWERED",
76 "STATE_DEFAULT",
77 "STATE_ADDRESSED",
78 "STATE_CONFIGURED",
79 "STATE_UNKNOWN",
80 };
81
82 char *usbd_device_requests[] = {
83 "GET STATUS", /* 0 */
84 "CLEAR FEATURE", /* 1 */
85 "RESERVED", /* 2 */
86 "SET FEATURE", /* 3 */
87 "RESERVED", /* 4 */
88 "SET ADDRESS", /* 5 */
89 "GET DESCRIPTOR", /* 6 */
90 "SET DESCRIPTOR", /* 7 */
91 "GET CONFIGURATION", /* 8 */
92 "SET CONFIGURATION", /* 9 */
93 "GET INTERFACE", /* 10 */
94 "SET INTERFACE", /* 11 */
95 "SYNC FRAME", /* 12 */
96 };
97
98 char *usbd_device_descriptors[] = {
99 "UNKNOWN", /* 0 */
100 "DEVICE", /* 1 */
101 "CONFIG", /* 2 */
102 "STRING", /* 3 */
103 "INTERFACE", /* 4 */
104 "ENDPOINT", /* 5 */
105 "DEVICE QUALIFIER", /* 6 */
106 "OTHER SPEED", /* 7 */
107 "INTERFACE POWER", /* 8 */
108 };
109
110 char *usbd_device_status[] = {
111 "USBD_OPENING",
112 "USBD_OK",
113 "USBD_SUSPENDED",
114 "USBD_CLOSING",
115 };
116
C51 COMPILER V8.09 USBDCORE 05/05/2008 19:48:28 PAGE 6
117
118 /* Descriptor support functions ************************************************************** */
119
120
121 /**
122 * usbd_get_string - find and return a string descriptor
123 * @index: string index to return
124 *
125 * Find an indexed string and return a pointer to a it.
126 */
127 struct usb_string_descriptor *usbd_get_string (__u8 index)
128 {
129 if (index >= maxstrings) {
130 return NULL;
131 }
132 return usb_strings[index];
133 }
134
135
136 /* Access to device descriptor functions ***************************************************** */
137
138
139 /* *
140 * usbd_device_configuration_instance - find a configuration instance for this device
141 * @device:
142 * @configuration: index to configuration, 0 - N-1
143 *
144 * Get specifed device configuration. Index should be bConfigurationValue-1.
145 */
146 static struct usb_configuration_instance *usbd_device_configuration_instance (struct usb_device_instance *
-device,
147 unsigned int port, unsigned int configuration)
148 {
149 /* XXX */
150 configuration = configuration ? configuration - 1 : 0;
151
152 if (configuration >= device->configurations) {
153 return NULL;
154 }
155 return device->configuration_instance_array + configuration;
156 }
157
158
159 /* *
160 * usbd_device_interface_instance
161 * @device:
162 * @configuration: index to configuration, 0 - N-1
163 * @interface: index to interface
164 *
165 * Return the specified interface descriptor for the specified device.
166 */
167 struct usb_interface_instance *usbd_device_interface_instance (struct usb_device_instance *device, int por
-t, int configuration, int interface)
168 {
169 struct usb_configuration_instance *configuration_instance;
170
171 if ((configuration_instance = usbd_device_configuration_instance (device, port, configuration)) == NULL)
-{
172 return NULL;
173 }
174 if (interface >= configuration_instance->interfaces) {
175 return NULL;
C51 COMPILER V8.09 USBDCORE 05/05/2008 19:48:28 PAGE 7
176 }
177 return configuration_instance->interface_instance_array + interface;
178 }
179
180 /* *
181 * usbd_device_alternate_descriptor_list
182 * @device:
183 * @configuration: index to configuration, 0 - N-1
184 * @interface: index to interface
185 * @alternate: alternate setting
186 *
187 * Return the specified alternate descriptor for the specified device.
188 */
189 struct usb_alternate_instance *usbd_device_alternate_instance (struct usb_device_instance *device, int por
-t, int configuration, int interface, int alternate)
190 {
191 struct usb_interface_instance *interface_instance;
192
193 if ((interface_instance = usbd_device_interface_instance (device, port, configuration, interface)) == NUL
-L) {
194 return NULL;
195 }
196
197 if (alternate >= interface_instance->alternates) {
198 return NULL;
199 }
200
201 return interface_instance->alternates_instance_array + alternate;
202 }
203
204
205 /* *
206 * usbd_device_device_descriptor
207 * @device: which device
208 * @configuration: index to configuration, 0 - N-1
209 * @port: which port
210 *
211 * Return the specified configuration descriptor for the specified device.
212 */
213 struct usb_device_descriptor *usbd_device_device_descriptor (struct usb_device_instance *device, int port)
214 {
215 return (device->device_descriptor);
216 }
217
218
219 /**
220 * usbd_device_configuration_descriptor
221 * @device: which device
222 * @port: which port
223 * @configuration: index to configuration, 0 - N-1
224 *
225 * Return the specified configuration descriptor for the specified device.
226 */
227 struct usb_configuration_descriptor *usbd_device_configuration_descriptor (struct
228 usb_device_instance
229 *device, int port, int configuration)
230 {
231 struct usb_configuration_instance *configuration_instance;
232 if (!(configuration_instance = usbd_device_configuration_instance (device, port, configuration))) {
233 return NULL;
234 }
235 return (configuration_instance->configuration_descriptor);
C51 COMPILER V8.09 USBDCORE 05/05/2008 19:48:28 PAGE 8
236 }
237
238
239 /**
240 * usbd_device_interface_descriptor
241 * @device: which device
242 * @port: which port
243 * @configuration: index to configuration, 0 - N-1
244 * @interface: index to interface
245 * @alternate: alternate setting
246 *
247 * Return the specified interface descriptor for the specified device.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -