Fork of official USB device library just changed PID (Product ID) in constructor in USBMSD.h to be different for USBMSD_AT45_HelloWorld program

Dependents:   USBMSD_AT45_HelloWorld

Fork of USBDevice by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers USBDescriptor.h Source File

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 
00027 /* Standard descriptor lengths */
00028 #define DEVICE_DESCRIPTOR_LENGTH        (0x12)
00029 #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09)
00030 #define INTERFACE_DESCRIPTOR_LENGTH     (0x09)
00031 #define ENDPOINT_DESCRIPTOR_LENGTH      (0x07)
00032 
00033 
00034 /*string offset*/
00035 #define STRING_OFFSET_LANGID            (0) 
00036 #define STRING_OFFSET_IMANUFACTURER     (1)
00037 #define STRING_OFFSET_IPRODUCT          (2)
00038 #define STRING_OFFSET_ISERIAL           (3)
00039 #define STRING_OFFSET_ICONFIGURATION    (4)
00040 #define STRING_OFFSET_IINTERFACE        (5)
00041 
00042 /* USB Specification Release Number */
00043 #define USB_VERSION_2_0 (0x0200)
00044 
00045 /* Least/Most significant byte of short integer */
00046 #define LSB(n)  ((n)&0xff)
00047 #define MSB(n)  (((n)&0xff00)>>8)
00048 
00049 /* Convert physical endpoint number to descriptor endpoint number */
00050 #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0))
00051 
00052 /* bmAttributes in configuration descriptor */
00053 /* C_RESERVED must always be set */
00054 #define C_RESERVED      (1U<<7)
00055 #define C_SELF_POWERED  (1U<<6)
00056 #define C_REMOTE_WAKEUP (1U<<5)
00057 
00058 /* bMaxPower in configuration descriptor */
00059 #define C_POWER(mA)     ((mA)/2)
00060 
00061 /* bmAttributes in endpoint descriptor */
00062 #define E_CONTROL       (0x00)
00063 #define E_ISOCHRONOUS   (0x01)
00064 #define E_BULK          (0x02)
00065 #define E_INTERRUPT     (0x03)
00066 
00067 /* For isochronous endpoints only: */
00068 #define E_NO_SYNCHRONIZATION    (0x00)
00069 #define E_ASYNCHRONOUS          (0x04)
00070 #define E_ADAPTIVE              (0x08)
00071 #define E_SYNCHRONOUS           (0x0C)
00072 #define E_DATA                  (0x00)
00073 #define E_FEEDBACK              (0x10)
00074 #define E_IMPLICIT_FEEDBACK     (0x20)