Embed:
(wiki syntax)
Show/hide line numbers
USBDescriptor.h
00001 /* USBDescriptor.h */ 00002 /* Definitions and macros for constructing USB descriptors */ 00003 /* Copyright (c) 2011 ARM Limited. All rights reserved. */ 00004 00005 /* Standard descriptor types */ 00006 #define DEVICE_DESCRIPTOR (1) 00007 #define CONFIGURATION_DESCRIPTOR (2) 00008 #define STRING_DESCRIPTOR (3) 00009 #define INTERFACE_DESCRIPTOR (4) 00010 #define ENDPOINT_DESCRIPTOR (5) 00011 00012 /* Standard descriptor lengths */ 00013 #define DEVICE_DESCRIPTOR_LENGTH (0x12) 00014 #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09) 00015 #define INTERFACE_DESCRIPTOR_LENGTH (0x09) 00016 #define ENDPOINT_DESCRIPTOR_LENGTH (0x07) 00017 00018 00019 /*string offset*/ 00020 #define STRING_OFFSET_LANGID (0) 00021 #define STRING_OFFSET_IMANUFACTURER (1) 00022 #define STRING_OFFSET_IPRODUCT (2) 00023 #define STRING_OFFSET_ISERIAL (3) 00024 #define STRING_OFFSET_ICONFIGURATION (4) 00025 #define STRING_OFFSET_IINTERFACE (5) 00026 00027 /* USB Specification Release Number */ 00028 #define USB_VERSION_2_0 (0x0200) 00029 00030 /* Least/Most significant byte of short integer */ 00031 #define LSB(n) ((n)&0xff) 00032 #define MSB(n) (((n)&0xff00)>>8) 00033 00034 /* Convert physical endpoint number to descriptor endpoint number */ 00035 #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0)) 00036 00037 /* bmAttributes in configuration descriptor */ 00038 /* C_RESERVED must always be set */ 00039 #define C_RESERVED (1U<<7) 00040 #define C_SELF_POWERED (1U<<6) 00041 #define C_REMOTE_WAKEUP (1U<<5) 00042 00043 /* bMaxPower in configuration descriptor */ 00044 #define C_POWER(mA) ((mA)/2) 00045 00046 /* bmAttributes in endpoint descriptor */ 00047 #define E_CONTROL (0x00) 00048 #define E_ISOCHRONOUS (0x01) 00049 #define E_BULK (0x02) 00050 #define E_INTERRUPT (0x03) 00051 00052 /* For isochronous endpoints only: */ 00053 #define E_NO_SYNCHRONIZATION (0x00) 00054 #define E_ASYNCHRONOUS (0x04) 00055 #define E_ADAPTIVE (0x08) 00056 #define E_SYNCHRONOUS (0x0C) 00057 #define E_DATA (0x00) 00058 #define E_FEEDBACK (0x10) 00059 #define E_IMPLICIT_FEEDBACK (0x20)
Generated on Fri Jul 15 2022 02:22:27 by 1.7.2