Fork of https://developer.mbed.org/users/bscott/code/STM32_USBDevice/
Fork of STM32_USBDevice by
USBDescriptor.h
00001 /* Copyright (c) 2010-2011 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 /* Standard descriptor types */ 00020 #define DEVICE_DESCRIPTOR (1) 00021 #define CONFIGURATION_DESCRIPTOR (2) 00022 #define STRING_DESCRIPTOR (3) 00023 #define INTERFACE_DESCRIPTOR (4) 00024 #define ENDPOINT_DESCRIPTOR (5) 00025 #define QUALIFIER_DESCRIPTOR (6) 00026 #define INTERFACE_ASSOCIATION_DESCRIPTOR (11) 00027 #define BOS_DESCRIPTOR (15) 00028 #define DEVICE_CAPABILITY_DESCRIPTOR (16) 00029 00030 /* Standard descriptor lengths */ 00031 #define DEVICE_DESCRIPTOR_LENGTH (0x12) 00032 #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09) 00033 #define INTERFACE_DESCRIPTOR_LENGTH (0x09) 00034 #define ENDPOINT_DESCRIPTOR_LENGTH (0x07) 00035 #define INTERFACE_ASSOCIATION_DESCRIPTOR_LENGTH (0x08) 00036 #define BOS_DESCRIPTOR_LENGTH (0x05) 00037 00038 /*string offset*/ 00039 #define STRING_OFFSET_LANGID (0) 00040 #define STRING_OFFSET_IMANUFACTURER (1) 00041 #define STRING_OFFSET_IPRODUCT (2) 00042 #define STRING_OFFSET_ISERIAL (3) 00043 #define STRING_OFFSET_ICONFIGURATION (4) 00044 #define STRING_OFFSET_IINTERFACE (5) 00045 00046 /* USB Specification Release Number */ 00047 #define USB_VERSION_2_0 (0x0200) 00048 00049 /* Least/Most significant byte of short integer */ 00050 #define LSB(n) ((n)&0xff) 00051 #define MSB(n) (((n)&0xff00)>>8) 00052 00053 /* Convert physical endpoint number to descriptor endpoint number */ 00054 #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0)) 00055 00056 /* bmAttributes in configuration descriptor */ 00057 /* C_RESERVED must always be set */ 00058 #define C_RESERVED (1U<<7) 00059 #define C_SELF_POWERED (1U<<6) 00060 #define C_REMOTE_WAKEUP (1U<<5) 00061 00062 /* bMaxPower in configuration descriptor */ 00063 #define C_POWER(mA) ((mA)/2) 00064 00065 /* bmAttributes in endpoint descriptor */ 00066 #define E_CONTROL (0x00) 00067 #define E_ISOCHRONOUS (0x01) 00068 #define E_BULK (0x02) 00069 #define E_INTERRUPT (0x03) 00070 00071 /* For isochronous endpoints only: */ 00072 #define E_NO_SYNCHRONIZATION (0x00) 00073 #define E_ASYNCHRONOUS (0x04) 00074 #define E_ADAPTIVE (0x08) 00075 #define E_SYNCHRONOUS (0x0C) 00076 #define E_DATA (0x00) 00077 #define E_FEEDBACK (0x10) 00078 #define E_IMPLICIT_FEEDBACK (0x20)
Generated on Wed Jul 13 2022 00:18:45 by 1.7.2