1 /* $FreeBSD: src/lib/libusb/libusb20_desc.h,v 1.2 2011/11/09 19:03:26 hselasky Exp $ */
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 * Copyright (c) 2007-2008 Daniel Drake. All rights reserved.
5 * Copyright (c) 2001 Johannes Erdfelt. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * NOTE: This file contains the definition of some standard USB
31 * structures. All structures which name ends by *DECODED use host byte
36 * NOTE: This file uses a lot of macros. If you want to see what the
37 * macros become when they are expanded then run the following
38 * commands from your shell:
40 * cpp libusb20_desc.h > temp.h
45 #ifndef _LIBUSB20_DESC_H_
46 #define _LIBUSB20_DESC_H_
57 #define LIBUSB20__NOT(...) __VA_ARGS__
58 #define LIBUSB20_NOT(arg) LIBUSB20__NOT(LIBUSB20_YES arg(() LIBUSB20_NO))
59 #define LIBUSB20_YES(...) __VA_ARGS__
60 #define LIBUSB20_NO(...)
61 #define LIBUSB20_END(...) __VA_ARGS__
62 #define LIBUSB20_MAX(a,b) (((a) > (b)) ? (a) : (b))
63 #define LIBUSB20_MIN(a,b) (((a) < (b)) ? (a) : (b))
65 #define LIBUSB20_ADD_BYTES(ptr,off) \
66 ((void *)(((const uint8_t *)(ptr)) + (off) - ((const uint8_t *)0)))
68 /* basic message elements */
75 LIBUSB20_ME_MAX, /* used to indicate end */
78 /* basic message element modifiers */
80 LIBUSB20_ME_IS_UNSIGNED = 0x00,
81 LIBUSB20_ME_IS_SIGNED = 0x80,
82 LIBUSB20_ME_MASK = 0x7F,
86 LIBUSB20_ME_IS_RAW, /* structure excludes length field
87 * (hardcoded value) */
88 LIBUSB20_ME_IS_ENCODED, /* structure includes length field */
89 LIBUSB20_ME_IS_EMPTY, /* no structure */
90 LIBUSB20_ME_IS_DECODED, /* structure is recursive */
93 /* basic helper structures and macros */
95 #define LIBUSB20_ME_STRUCT_ALIGN sizeof(void *)
97 struct libusb20_me_struct {
98 void *ptr; /* data pointer */
99 uint16_t len; /* defaults to zero */
100 uint16_t type; /* defaults to LIBUSB20_ME_IS_EMPTY */
101 } __aligned(LIBUSB20_ME_STRUCT_ALIGN);
103 struct libusb20_me_format {
104 const uint8_t *format; /* always set */
105 const char *desc; /* optionally set */
106 const char *fields; /* optionally set */
109 #define LIBUSB20_ME_STRUCT(n, field, arg, ismeta) \
110 ismeta ( LIBUSB20_ME_STRUCT, 1, 0, ) \
111 LIBUSB20_NOT(ismeta) ( struct libusb20_me_struct field; )
113 #define LIBUSB20_ME_STRUCT_ARRAY(n, field, arg, ismeta) \
114 ismeta ( LIBUSB20_ME_STRUCT , (arg) & 0xFF, \
115 ((arg) / 0x100) & 0xFF, ) \
116 LIBUSB20_NOT(ismeta) ( struct libusb20_me_struct field [arg]; )
118 #define LIBUSB20_ME_INTEGER(n, field, ismeta, un, u, bits, a, size) \
119 ismeta ( LIBUSB20_ME_INT##bits | \
120 LIBUSB20_ME_IS_##un##SIGNED , \
121 (size) & 0xFF, ((size) / 0x100) & 0xFF, ) \
122 LIBUSB20_NOT(ismeta) ( u##int##bits##_t \
123 __aligned((bits) / 8) field a; )
125 #define LIBUSB20_ME_UINT8_T(n, field, arg, ismeta) \
126 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 8, , 1)
128 #define LIBUSB20_ME_UINT8_ARRAY_T(n, field, arg, ismeta) \
129 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 8, [arg], arg)
131 #define LIBUSB20_ME_SINT8_T(n, field, arg, ismeta) \
132 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 8, , 1)
134 #define LIBUSB20_ME_SINT8_ARRAY_T(n, field, arg, ismeta) \
135 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 8, [arg], arg)
137 #define LIBUSB20_ME_UINT16_T(n, field, arg, ismeta) \
138 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 16, , 1)
140 #define LIBUSB20_ME_UINT16_ARRAY_T(n, field, arg, ismeta) \
141 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 16, [arg], arg)
143 #define LIBUSB20_ME_SINT16_T(n, field, arg, ismeta) \
144 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 16, , 1)
146 #define LIBUSB20_ME_SINT16_ARRAY_T(n, field, arg, ismeta) \
147 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 16, [arg], arg)
149 #define LIBUSB20_ME_UINT32_T(n, field, arg, ismeta) \
150 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 32, , 1)
152 #define LIBUSB20_ME_UINT32_ARRAY_T(n, field, arg, ismeta) \
153 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 32, [arg], arg)
155 #define LIBUSB20_ME_SINT32_T(n, field, arg, ismeta) \
156 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 32, , 1)
158 #define LIBUSB20_ME_SINT32_ARRAY_T(n, field, arg, ismeta) \
159 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 32, [arg], arg)
161 #define LIBUSB20_ME_UINT64_T(n, field, arg, ismeta) \
162 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 64, , 1)
164 #define LIBUSB20_ME_UINT64_ARRAY_T(n, field, arg, ismeta) \
165 LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 64, [arg], arg)
167 #define LIBUSB20_ME_SINT64_T(n, field, arg, ismeta) \
168 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 64, , 1)
170 #define LIBUSB20_ME_SINT64_ARRAY_T(n, field, arg, ismeta) \
171 LIBUSB20_ME_INTEGER(n, field, ismeta,,, 64, [arg], arg)
173 #define LIBUSB20_MAKE_DECODED_FIELD(n, type, field, arg) \
174 LIBUSB20_ME_##type (n, field, arg, LIBUSB20_NO)
176 #define LIBUSB20_MAKE_STRUCT(name) \
177 extern const struct libusb20_me_format \
179 struct name##_DECODED { \
180 const struct libusb20_me_format *name##_FORMAT; \
181 name (LIBUSB20_MAKE_DECODED_FIELD,) \
184 #define LIBUSB20_MAKE_STRUCT_FORMAT(name) \
185 const struct libusb20_me_format \
186 name##_FORMAT[1] = {{ \
187 .format = LIBUSB20_MAKE_FORMAT(name), \
192 #define LIBUSB20_MAKE_FORMAT_SUB(n, type, field, arg) \
193 LIBUSB20_ME_##type (n, field, arg, LIBUSB20_YES)
195 #define LIBUSB20_MAKE_FORMAT(what) (const uint8_t []) \
196 { what (LIBUSB20_MAKE_FORMAT_SUB, ) LIBUSB20_ME_MAX, 0, 0 }
198 #define LIBUSB20_INIT(what, ptr) do { \
199 memset(ptr, 0, sizeof(*(ptr))); \
200 (ptr)->what##_FORMAT = what##_FORMAT; \
203 #define LIBUSB20_DEVICE_DESC(m,n) \
204 m(n, UINT8_T, bLength, ) \
205 m(n, UINT8_T, bDescriptorType, ) \
206 m(n, UINT16_T, bcdUSB, ) \
207 m(n, UINT8_T, bDeviceClass, ) \
208 m(n, UINT8_T, bDeviceSubClass, ) \
209 m(n, UINT8_T, bDeviceProtocol, ) \
210 m(n, UINT8_T, bMaxPacketSize0, ) \
211 m(n, UINT16_T, idVendor, ) \
212 m(n, UINT16_T, idProduct, ) \
213 m(n, UINT16_T, bcdDevice, ) \
214 m(n, UINT8_T, iManufacturer, ) \
215 m(n, UINT8_T, iProduct, ) \
216 m(n, UINT8_T, iSerialNumber, ) \
217 m(n, UINT8_T, bNumConfigurations, ) \
219 LIBUSB20_MAKE_STRUCT(LIBUSB20_DEVICE_DESC);
221 #define LIBUSB20_ENDPOINT_DESC(m,n) \
222 m(n, UINT8_T, bLength, ) \
223 m(n, UINT8_T, bDescriptorType, ) \
224 m(n, UINT8_T, bEndpointAddress, ) \
225 m(n, UINT8_T, bmAttributes, ) \
226 m(n, UINT16_T, wMaxPacketSize, ) \
227 m(n, UINT8_T, bInterval, ) \
228 m(n, UINT8_T, bRefresh, ) \
229 m(n, UINT8_T, bSynchAddress, ) \
231 LIBUSB20_MAKE_STRUCT(LIBUSB20_ENDPOINT_DESC);
233 #define LIBUSB20_INTERFACE_DESC(m,n) \
234 m(n, UINT8_T, bLength, ) \
235 m(n, UINT8_T, bDescriptorType, ) \
236 m(n, UINT8_T, bInterfaceNumber, ) \
237 m(n, UINT8_T, bAlternateSetting, ) \
238 m(n, UINT8_T, bNumEndpoints, ) \
239 m(n, UINT8_T, bInterfaceClass, ) \
240 m(n, UINT8_T, bInterfaceSubClass, ) \
241 m(n, UINT8_T, bInterfaceProtocol, ) \
242 m(n, UINT8_T, iInterface, ) \
244 LIBUSB20_MAKE_STRUCT(LIBUSB20_INTERFACE_DESC);
246 #define LIBUSB20_CONFIG_DESC(m,n) \
247 m(n, UINT8_T, bLength, ) \
248 m(n, UINT8_T, bDescriptorType, ) \
249 m(n, UINT16_T, wTotalLength, ) \
250 m(n, UINT8_T, bNumInterfaces, ) \
251 m(n, UINT8_T, bConfigurationValue, ) \
252 m(n, UINT8_T, iConfiguration, ) \
253 m(n, UINT8_T, bmAttributes, ) \
254 m(n, UINT8_T, bMaxPower, ) \
256 LIBUSB20_MAKE_STRUCT(LIBUSB20_CONFIG_DESC);
258 #define LIBUSB20_CONTROL_SETUP(m,n) \
259 m(n, UINT8_T, bmRequestType, ) \
260 m(n, UINT8_T, bRequest, ) \
261 m(n, UINT16_T, wValue, ) \
262 m(n, UINT16_T, wIndex, ) \
263 m(n, UINT16_T, wLength, ) \
265 LIBUSB20_MAKE_STRUCT(LIBUSB20_CONTROL_SETUP);
267 #define LIBUSB20_SS_ENDPT_COMP_DESC(m,n) \
268 m(n, UINT8_T, bLength, ) \
269 m(n, UINT8_T, bDescriptorType, ) \
270 m(n, UINT8_T, bMaxBurst, ) \
271 m(n, UINT8_T, bmAttributes, ) \
272 m(n, UINT16_T, wBytesPerInterval, ) \
274 LIBUSB20_MAKE_STRUCT(LIBUSB20_SS_ENDPT_COMP_DESC);
276 #define LIBUSB20_USB_20_DEVCAP_DESC(m,n) \
277 m(n, UINT8_T, bLength, ) \
278 m(n, UINT8_T, bDescriptorType, ) \
279 m(n, UINT8_T, bDevCapabilityType, ) \
280 m(n, UINT32_T, bmAttributes, ) \
282 LIBUSB20_MAKE_STRUCT(LIBUSB20_USB_20_DEVCAP_DESC);
284 #define LIBUSB20_SS_USB_DEVCAP_DESC(m,n) \
285 m(n, UINT8_T, bLength, ) \
286 m(n, UINT8_T, bDescriptorType, ) \
287 m(n, UINT8_T, bDevCapabilityType, ) \
288 m(n, UINT8_T, bmAttributes, ) \
289 m(n, UINT16_T, wSpeedSupported, ) \
290 m(n, UINT8_T, bFunctionalitySupport, ) \
291 m(n, UINT8_T, bU1DevExitLat, ) \
292 m(n, UINT16_T, wU2DevExitLat, ) \
294 LIBUSB20_MAKE_STRUCT(LIBUSB20_SS_USB_DEVCAP_DESC);
296 #define LIBUSB20_BOS_DESCRIPTOR(m,n) \
297 m(n, UINT8_T, bLength, ) \
298 m(n, UINT8_T, bDescriptorType, ) \
299 m(n, UINT16_T, wTotalLength, ) \
300 m(n, UINT8_T, bNumDeviceCapabilities, ) \
302 LIBUSB20_MAKE_STRUCT(LIBUSB20_BOS_DESCRIPTOR);
304 /* standard USB stuff */
307 * Device and/or Interface Class codes */
308 enum libusb20_class_code {
309 /** In the context of a \ref LIBUSB20_DEVICE_DESC "device
310 * descriptor", this bDeviceClass value indicates that each
311 * interface specifies its own class information and all
312 * interfaces operate independently.
314 LIBUSB20_CLASS_PER_INTERFACE = 0,
317 LIBUSB20_CLASS_AUDIO = 1,
319 /** Communications class */
320 LIBUSB20_CLASS_COMM = 2,
322 /** Human Interface Device class */
323 LIBUSB20_CLASS_HID = 3,
325 /** Printer dclass */
326 LIBUSB20_CLASS_PRINTER = 7,
328 /** Picture transfer protocol class */
329 LIBUSB20_CLASS_PTP = 6,
331 /** Mass storage class */
332 LIBUSB20_CLASS_MASS_STORAGE = 8,
335 LIBUSB20_CLASS_HUB = 9,
338 LIBUSB20_CLASS_DATA = 10,
340 /** Class is vendor-specific */
341 LIBUSB20_CLASS_VENDOR_SPEC = 0xff,
345 * Descriptor types as defined by the USB specification. */
346 enum libusb20_descriptor_type {
347 /** Device descriptor. See LIBUSB20_DEVICE_DESC. */
348 LIBUSB20_DT_DEVICE = 0x01,
350 /** Configuration descriptor. See LIBUSB20_CONFIG_DESC. */
351 LIBUSB20_DT_CONFIG = 0x02,
353 /** String descriptor */
354 LIBUSB20_DT_STRING = 0x03,
356 /** Interface descriptor. See LIBUSB20_INTERFACE_DESC. */
357 LIBUSB20_DT_INTERFACE = 0x04,
359 /** Endpoint descriptor. See LIBUSB20_ENDPOINT_DESC. */
360 LIBUSB20_DT_ENDPOINT = 0x05,
362 /** HID descriptor */
363 LIBUSB20_DT_HID = 0x21,
365 /** HID report descriptor */
366 LIBUSB20_DT_REPORT = 0x22,
368 /** Physical descriptor */
369 LIBUSB20_DT_PHYSICAL = 0x23,
371 /** Hub descriptor */
372 LIBUSB20_DT_HUB = 0x29,
374 /** Binary Object Store, BOS */
375 LIBUSB20_DT_BOS = 0x0f,
377 /** Device Capability */
378 LIBUSB20_DT_DEVICE_CAPABILITY = 0x10,
380 /** SuperSpeed endpoint companion */
381 LIBUSB20_DT_SS_ENDPOINT_COMPANION = 0x30,
385 * Device capability types as defined by the USB specification. */
386 enum libusb20_device_capability_type {
387 LIBUSB20_WIRELESS_USB_DEVICE_CAPABILITY = 0x1,
388 LIBUSB20_USB_2_0_EXTENSION_DEVICE_CAPABILITY = 0x2,
389 LIBUSB20_SS_USB_DEVICE_CAPABILITY = 0x3,
390 LIBUSB20_CONTAINER_ID_DEVICE_CAPABILITY = 0x4,
393 /* Descriptor sizes per descriptor type */
394 #define LIBUSB20_DT_DEVICE_SIZE 18
395 #define LIBUSB20_DT_CONFIG_SIZE 9
396 #define LIBUSB20_DT_INTERFACE_SIZE 9
397 #define LIBUSB20_DT_ENDPOINT_SIZE 7
398 #define LIBUSB20_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
399 #define LIBUSB20_DT_HUB_NONVAR_SIZE 7
400 #define LIBUSB20_DT_SS_ENDPOINT_COMPANION_SIZE 6
401 #define LIBUSB20_DT_BOS_SIZE 5
402 #define LIBUSB20_USB_2_0_EXTENSION_DEVICE_CAPABILITY_SIZE 7
403 #define LIBUSB20_SS_USB_DEVICE_CAPABILITY_SIZE 10
405 #define LIBUSB20_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */
406 #define LIBUSB20_ENDPOINT_DIR_MASK 0x80
409 * Endpoint direction. Values for bit 7 of the
410 * \ref LIBUSB20_ENDPOINT_DESC::bEndpointAddress "endpoint address" scheme.
412 enum libusb20_endpoint_direction {
413 /** In: device-to-host */
414 LIBUSB20_ENDPOINT_IN = 0x80,
416 /** Out: host-to-device */
417 LIBUSB20_ENDPOINT_OUT = 0x00,
420 #define LIBUSB20_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */
423 * Endpoint transfer type. Values for bits 0:1 of the
424 * \ref LIBUSB20_ENDPOINT_DESC::bmAttributes "endpoint attributes" field.
426 enum libusb20_transfer_type {
427 /** Control endpoint */
428 LIBUSB20_TRANSFER_TYPE_CONTROL = 0,
430 /** Isochronous endpoint */
431 LIBUSB20_TRANSFER_TYPE_ISOCHRONOUS = 1,
434 LIBUSB20_TRANSFER_TYPE_BULK = 2,
436 /** Interrupt endpoint */
437 LIBUSB20_TRANSFER_TYPE_INTERRUPT = 3,
441 * Standard requests, as defined in table 9-3 of the USB2 specifications */
442 enum libusb20_standard_request {
443 /** Request status of the specific recipient */
444 LIBUSB20_REQUEST_GET_STATUS = 0x00,
446 /** Clear or disable a specific feature */
447 LIBUSB20_REQUEST_CLEAR_FEATURE = 0x01,
449 /* 0x02 is reserved */
451 /** Set or enable a specific feature */
452 LIBUSB20_REQUEST_SET_FEATURE = 0x03,
454 /* 0x04 is reserved */
456 /** Set device address for all future accesses */
457 LIBUSB20_REQUEST_SET_ADDRESS = 0x05,
459 /** Get the specified descriptor */
460 LIBUSB20_REQUEST_GET_DESCRIPTOR = 0x06,
462 /** Used to update existing descriptors or add new descriptors */
463 LIBUSB20_REQUEST_SET_DESCRIPTOR = 0x07,
465 /** Get the current device configuration value */
466 LIBUSB20_REQUEST_GET_CONFIGURATION = 0x08,
468 /** Set device configuration */
469 LIBUSB20_REQUEST_SET_CONFIGURATION = 0x09,
471 /** Return the selected alternate setting for the specified
473 LIBUSB20_REQUEST_GET_INTERFACE = 0x0A,
475 /** Select an alternate interface for the specified interface */
476 LIBUSB20_REQUEST_SET_INTERFACE = 0x0B,
478 /** Set then report an endpoint's synchronization frame */
479 LIBUSB20_REQUEST_SYNCH_FRAME = 0x0C,
483 * Request type bits of the
484 * \ref libusb20_control_setup::bmRequestType "bmRequestType" field in
485 * control transfers. */
486 enum libusb20_request_type {
488 LIBUSB20_REQUEST_TYPE_STANDARD = (0x00 << 5),
491 LIBUSB20_REQUEST_TYPE_CLASS = (0x01 << 5),
494 LIBUSB20_REQUEST_TYPE_VENDOR = (0x02 << 5),
497 LIBUSB20_REQUEST_TYPE_RESERVED = (0x03 << 5),
501 * Recipient bits of the
502 * \ref libusb20_control_setup::bmRequestType "bmRequestType" field in
503 * control transfers. Values 4 through 31 are reserved. */
504 enum libusb20_request_recipient {
506 LIBUSB20_RECIPIENT_DEVICE = 0x00,
509 LIBUSB20_RECIPIENT_INTERFACE = 0x01,
512 LIBUSB20_RECIPIENT_ENDPOINT = 0x02,
515 LIBUSB20_RECIPIENT_OTHER = 0x03,
518 #define LIBUSB20_ISO_SYNC_TYPE_MASK 0x0C
521 * Synchronization type for isochronous endpoints. Values for bits 2:3
522 * of the \ref LIBUSB20_ENDPOINT_DESC::bmAttributes "bmAttributes"
523 * field in LIBUSB20_ENDPOINT_DESC.
525 enum libusb20_iso_sync_type {
526 /** No synchronization */
527 LIBUSB20_ISO_SYNC_TYPE_NONE = 0,
530 LIBUSB20_ISO_SYNC_TYPE_ASYNC = 1,
533 LIBUSB20_ISO_SYNC_TYPE_ADAPTIVE = 2,
536 LIBUSB20_ISO_SYNC_TYPE_SYNC = 3,
539 #define LIBUSB20_ISO_USAGE_TYPE_MASK 0x30
542 * Usage type for isochronous endpoints. Values for bits 4:5 of the
543 * \ref LIBUSB20_ENDPOINT_DESC::bmAttributes "bmAttributes" field in
544 * LIBUSB20_ENDPOINT_DESC.
546 enum libusb20_iso_usage_type {
548 LIBUSB20_ISO_USAGE_TYPE_DATA = 0,
550 /** Feedback endpoint */
551 LIBUSB20_ISO_USAGE_TYPE_FEEDBACK = 1,
553 /** Implicit feedback Data endpoint */
554 LIBUSB20_ISO_USAGE_TYPE_IMPLICIT = 2,
557 struct libusb20_endpoint {
558 struct LIBUSB20_ENDPOINT_DESC_DECODED desc;
559 struct libusb20_me_struct extra;
560 } __aligned(sizeof(void *));
562 struct libusb20_interface {
563 struct LIBUSB20_INTERFACE_DESC_DECODED desc;
564 struct libusb20_me_struct extra;
565 struct libusb20_interface *altsetting;
566 struct libusb20_endpoint *endpoints;
567 uint8_t num_altsetting;
568 uint8_t num_endpoints;
569 } __aligned(sizeof(void *));
571 struct libusb20_config {
572 struct LIBUSB20_CONFIG_DESC_DECODED desc;
573 struct libusb20_me_struct extra;
574 struct libusb20_interface *interface;
575 uint8_t num_interface;
576 } __aligned(sizeof(void *));
578 uint8_t libusb20_me_get_1(const struct libusb20_me_struct *ie, uint16_t offset);
579 uint16_t libusb20_me_get_2(const struct libusb20_me_struct *ie, uint16_t offset);
580 uint16_t libusb20_me_encode(void *ptr, uint16_t len, const void *pd);
581 uint16_t libusb20_me_decode(const void *ptr, uint16_t len, void *pd);
582 const uint8_t *libusb20_desc_foreach(const struct libusb20_me_struct *pdesc, const uint8_t *psubdesc);
583 struct libusb20_config *libusb20_parse_config_desc(const void *config_desc);
593 #endif /* _LIBUSB20_DESC_H_ */