EZR32 Wonder Gecko Software Documentation  ezr32wg-doc-5.1.2
em_usbxpress_descriptors.c
Go to the documentation of this file.
1 /***************************************************************************/
16 #include "usbconfig.h"
17 #include "em_usbxpress_internal.h"
19 
20 // -----------------------------------------------------------------------------
21 // USB Initial Descriptors
22 
24 SL_ALIGN(4)
26  USBXCORE_deviceDescInit SL_ATTRIBUTE_ALIGN(4) =
27 {
29  .bDescriptorType = USB_DEVICE_DESCRIPTOR,
30  .bcdUSB = 0x0200,
31  .bDeviceClass = 0,
32  .bDeviceSubClass = 0,
33  .bDeviceProtocol = 0,
34  .bMaxPacketSize0 = USB_FS_CTRL_EP_MAXSIZE,
35  .idVendor = 0x10C4,
36  .idProduct = 0x0000,
37  .bcdDevice = 0x0100,
38  .iManufacturer = 1,
39  .iProduct = 2,
40  .iSerialNumber = 3,
41  .bNumConfigurations = 1
42 };
43 
45 SL_ALIGN(4)
47 {
48  // Configuration descriptor
49  USB_CONFIG_DESCSIZE, // bLength
50  USB_CONFIG_DESCRIPTOR, // bDescriptorType
51 
52  USB_CONFIG_DESCSIZE + // wTotalLength (LSB)
54  (USB_ENDPOINT_DESCSIZE * NUM_EP_USED),
55 
56  (USB_CONFIG_DESCSIZE + // wTotalLength (MSB)
58  (USB_ENDPOINT_DESCSIZE * NUM_EP_USED))>>8,
59 
60  1, // bNumInterfaces
61  1, // bConfigurationValue
62  0, // iConfiguration
63 
64 #if defined(SLAB_USB_BUS_POWERED)
65  CONFIG_DESC_BM_RESERVED_D7, // bmAttrib: Bus-powered
66 #else
67  CONFIG_DESC_BM_RESERVED_D7 | // bmAttrib: Self-powered
69 #endif
70  CONFIG_DESC_MAXPOWER_mA(100), // bMaxPower: 100 mA
71 
72  // Interface descriptor
73  USB_INTERFACE_DESCSIZE, // bLength
74  USB_INTERFACE_DESCRIPTOR, // bDescriptorType
75  USBXPRESS_IFC_NUMBER, // bInterfaceNumber
76  0, // bAlternateSetting
77  2, // bNumEndpoints
78  0xFF, // bInterfaceClass (Vendor-Specific)
79  0, // bInterfaceSubClass
80  0, // bInterfaceProtocol
81  0, // iInterface
82 
83  // Endpoint 1 IN descriptor
84  USB_ENDPOINT_DESCSIZE, // bLength
85  USB_ENDPOINT_DESCRIPTOR, // bDescriptorType
86  0x81, // bEndpointAddress (IN)
87  USB_EPTYPE_BULK, // bmAttributes
88  USB_FS_BULK_EP_MAXSIZE, // wMaxPacketSize (LSB)
89  0, // wMaxPacketSize (MSB)
90  0, //bInterval
91 
92  // Endpoint 1 OUT descriptor
93  USB_ENDPOINT_DESCSIZE, // bLength
94  USB_ENDPOINT_DESCRIPTOR, // bDescriptorType
95  0x01, // bEndpointAddress (OUT)
96  USB_EPTYPE_BULK, // bmAttributes
97  USB_FS_BULK_EP_MAXSIZE, // wMaxPacketSize (LSB)
98  0, // wMaxPacketSize (MSB)
99  0, // bInterval
100 };
101 
103 SL_ALIGN(4)
104 const uint8_t USBXCORE_stringLangDesc[] SL_ATTRIBUTE_ALIGN(4) =
105 {
106  // English String Descriptor
107  0x04, 0x03, 0x09, 0x04
108 };
109 
111 // Endpoint buffer sizes
112 // 1 = single buffer, 2 = double buffering, 3 = triple buffering ...
113 SL_ALIGN(4)
114 const uint8_t USBXCORE_buffMult[NUM_EP_USED + 1] SL_ATTRIBUTE_ALIGN(4) =
115  { 1, 2, 2 };
116 
118 #define MSOS_DESC_LEN sizeof ("MSFT100\x01") * 2
119 SL_ALIGN(4)
120 const uint8_t USBXCORE_microsoftOsDesc[] SL_ATTRIBUTE_ALIGN(4) =
121 {
122  MSOS_DESC_LEN, 0x03,
123  'M', 0,
124  'S', 0,
125  'F', 0,
126  'T', 0,
127  '1', 0,
128  '0', 0,
129  '0', 0,
131 };
132 
134 SL_ALIGN(4)
136  USBXCORE_extendedCompatIdOsFeatureDesc SL_ATTRIBUTE_ALIGN(4) =
137 {
138  EXT_COMP_DESC_SIZE, // Size
139  0x0100, // bcdVersion
140  FEATURE_EXTENDED_COMPATIBILITY_ID, // Command Index
141  NUM_IFCS_WITH_EXT_COMPAT, // Number of interfaces with
142  // extended compatibility
143  {0, 0, 0, 0, 0, 0, 0}, // Reserved (unused)
144 
145  { // USB_Extended Compatibility Interface Descriptor
146  {
147  0, // Interface Number
148  1, // Reserved (unused)
149  "WINUSB\0", // Compatible ID String
150  {0, 0, 0, 0, 0, 0, 0, 0}, // Sub-compatible ID String
151  {0, 0, 0, 0, 0, 0}, // Reserved (unused)
152  },
153  }
154 };
155 
157 SL_ALIGN(4)
159  USBXCORE_extendedPropertiesDesc SL_ATTRIBUTE_ALIGN(4) =
160 {
161  // Header
162  PROPERTIES_DESCRIPTOR_SIZE, // dwLength
163  0x0100, // bcdVersion: 1.0
164  FEATURE_EXTENDED_PROPERTIES_ID, // wIndex: Extended Properties ID
165  1, // wCount: 1 Custom Property
166 
167  // GUID Property
169  EXTENDED_PROPERTY_TYPE_MULTI_SZ, // dwPropertyDataType
170  GUID_PROPERTY_NAME_LEN, // wPropertyNameLength
171  GUID_PROPERTY_NAME, // bPropertyName
172  GUID_PROPERTY_LEN, // dwPropertyDataLength
173  GUID_PROPERTY, // bPropertyData
174 };
USB protocol stack library, application supplied configuration options.
#define GUID_PROPERTY
GUID Property (USBXpress Device Interface GUID - {3C5E1462-5695-4e18-876B-F3F3D08AAF18}) ...
#define USB_INTERFACE_DESCSIZE
Definition: em_usb.h:154
const uint8_t USBXCORE_configDescInit[]
USB Configuration Descriptor.
#define CONFIG_DESC_MAXPOWER_mA(x)
Definition: em_usb.h:195
const uint8_t USBXCORE_stringLangDesc[]
USB Language String Descriptor.
#define USB_FS_BULK_EP_MAXSIZE
Definition: em_usb.h:175
Extended Properties Descriptor Typedef.
#define MSOS_DESC_LEN
Microsoft OS Descriptor.
#define USB_FS_CTRL_EP_MAXSIZE
Definition: em_usb.h:173
#define SL_ALIGN(X)
Macro for aligning a variable. Use this macro before the variable definition. X denotes the stora...
Definition: em_common.h:168
const uint8_t USBXCORE_buffMult[]
USB Buffer Multiplier.
#define GUID_PROPERTY_NAME_LEN
Length of GUID Property Name.
#define CONFIG_DESC_BM_RESERVED_D7
Definition: em_usb.h:193
#define FEATURE_EXTENDED_COMPATIBILITY_ID
Extended Compatibility ID Descriptor.
#define USB_DEVICE_DESCRIPTOR
Definition: em_usb.h:124
#define USB_CONFIG_DESCSIZE
Definition: em_usb.h:153
Primary header file. Contains internal global declarations and definitions.
#define USB_DEVICE_DESCSIZE
Definition: em_usb.h:152
#define GUID_PROPERTY_NAME
GUID Property Name (DeviceInterfaceGUIDs)
#define GUID_PROPERTY_DESCRIPTOR_SIZE
Size of Property Descriptor for the GUID Property.
#define EXT_COMP_VENDOR_CODE
Vendor-defined Extended Compatibility Code.
#define USB_INTERFACE_DESCRIPTOR
Definition: em_usb.h:128
#define FEATURE_EXTENDED_PROPERTIES_ID
Extended Properties ID Descriptor.
#define USB_ENDPOINT_DESCSIZE
Definition: em_usb.h:155
#define GUID_PROPERTY_LEN
Length of GUID Property.
#define CONFIG_DESC_BM_SELFPOWERED
Definition: em_usb.h:192
#define USB_CONFIG_DESCRIPTOR
Definition: em_usb.h:125
#define NUM_IFCS_WITH_EXT_COMPAT
Number of interfaces with extended compatibility descriptors.
Header file for USB and VCP Initial Descriptors.
USB Device Descriptor.
Definition: em_usb.h:406
#define EXTENDED_PROPERTY_TYPE_MULTI_SZ
Multiple NUL-terminated Unicode Strings.
#define EXT_COMP_DESC_SIZE
Size of Extended Compatibility Descriptor.
Compatible ID Feature Descriptor Typedef.
#define USB_ENDPOINT_DESCRIPTOR
Definition: em_usb.h:129
#define USB_EPTYPE_BULK
Definition: em_usb.h:179
#define PROPERTIES_DESCRIPTOR_SIZE
Total Size of Extended Properties Descriptor.
const USB_DeviceDescriptor_TypeDef USBXCORE_deviceDescInit SL_ATTRIBUTE_ALIGN(4)
USB Device Descriptor.