Suga koubou / Mbed 2 deprecated USB_CDC_MSD_Hello

Dependencies:   ChaNFSSD mbed ChaNFS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers USBDescriptor.h Source File

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