EFR32 Blue Gecko 1 Software Documentation  efr32bg1-doc-5.1.2
em_usbxpress_descriptors.h
Go to the documentation of this file.
1 /***************************************************************************/
16 #ifndef EM_USBXPRESS_DESCRIPTORS_H
17 #define EM_USBXPRESS_DESCRIPTORS_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 // -----------------------------------------------------------------------------
24 // Constant Definitions
25 
26 // -------------------------------
27 // USB Identification
28 
29 // Initial VID/PID values. Should never be used. VID/PID loaded by USB_Init()
30 #define USB_VENDOR_ID USB_VENDOR_ID_SILICON_LABS
31 #define USB_PRODUCT_ID 0x0000
32 
33 // Interface number for USBXpress
34 #define USBXPRESS_IFC_NUMBER 0
35 
36 #define USBXPRESS_SETUP_EP_ADDR 0x00
37 #define USBXPRESS_IN_EP_ADDR 0x81
38 #define USBXPRESS_OUT_EP_ADDR 0x01
39 
40 // -------------------------------
41 // Extended Compatibility
42 
43 // Microsoft OS Feature Descriptor Indexes
44 #define FEATURE_GENRE 1
45 #define FEATURE_EXTENDED_COMPATIBILITY_ID 4
46 #define FEATURE_EXTENDED_PROPERTIES_ID 5
47 
48 #define EXT_COMP_DESC_SIZE sizeof(USB_ExtendedCompatIdOsFeatureDesc_t)
50 
51 #define EXT_COMP_VENDOR_CODE 1
52 
53 #define NUM_IFCS_WITH_EXT_COMPAT 1
55 
56 // -------------------------------
57 // Extended Properties
58 
59 // Data Types for Microsoft Extended Properties Feature Descriptor
60 #define EXTENDED_PROPERTY_TYPE_REG_SZ 1
61 #define EXTENDED_PROPERTY_TYPE_REG_EXPAND_SZ 2
62 #define EXTENDED_PROPERTY_TYPE_REG_BINARY 3
64 #define EXTENDED_PROPERTY_TYPE_REG_DWORD_LITTLE_ENDIAN 4
65 #define EXTENDED_PROPERTY_TYPE_REG_DWORD_BIG_ENDIAN 5
66 #define EXTENDED_PROPERTY_TYPE_REG_LINK 6
67 #define EXTENDED_PROPERTY_TYPE_MULTI_SZ 7
69 
70 #define GUID_PROPERTY_NAME_LEN sizeof ("DeviceInterfaceGUIDs") * 2
72 
74 #define GUID_PROPERTY_NAME \
75 { \
76  'D', 0, \
77  'e', 0, \
78  'v', 0, \
79  'i', 0, \
80  'c', 0, \
81  'e', 0, \
82  'I', 0, \
83  'n', 0, \
84  't', 0, \
85  'e', 0, \
86  'r', 0, \
87  'f', 0, \
88  'a', 0, \
89  'c', 0, \
90  'e', 0, \
91  'G', 0, \
92  'U', 0, \
93  'I', 0, \
94  'D', 0, \
95  's', 0, \
96  '\0',0, \
97 }
98 
100 #define GUID_PROPERTY_LEN (sizeof("{3C5E1462-5695-4e18-876B-F3F3D08AAF18}\0") * 2)
101 
103 #define GUID_PROPERTY \
104 { \
105  '{', 0, \
106  '3', 0, \
107  'C', 0, \
108  '5', 0, \
109  'E', 0, \
110  '1', 0, \
111  '4', 0, \
112  '6', 0, \
113  '2', 0, \
114  '-', 0, \
115  '5', 0, \
116  '6', 0, \
117  '9', 0, \
118  '5', 0, \
119  '-', 0, \
120  '4', 0, \
121  'e', 0, \
122  '1', 0, \
123  '8', 0, \
124  '-', 0, \
125  '8', 0, \
126  '7', 0, \
127  '6', 0, \
128  'B', 0, \
129  '-', 0, \
130  'F', 0, \
131  '3', 0, \
132  'F', 0, \
133  '3', 0, \
134  'D', 0, \
135  '0', 0, \
136  '8', 0, \
137  'A', 0, \
138  'A', 0, \
139  'F', 0, \
140  '1', 0, \
141  '8', 0, \
142  '}', 0, \
143  '\0',0, \
144  '\0',0, \
145 }
146 
148 #define GUID_PROPERTY_DESCRIPTOR_SIZE (14 + GUID_PROPERTY_NAME_LEN + GUID_PROPERTY_LEN)
149 
151 #define PROPERTIES_DESCRIPTOR_SIZE (10 + GUID_PROPERTY_DESCRIPTOR_SIZE)
152 
153 // -----------------------------------------------------------------------------
154 // Typedef Definitions
155 
157 SL_PACK_START(1)
158 typedef struct
159 {
161  uint8_t reserved1;
163  char compatibleID[8];
164  char subCompatibleID[8];
165  uint8_t reserved2[6];
167 SL_PACK_END()
168 
169 SL_PACK_START(1)
171 typedef struct
172 {
173  uint32_t length;
174  uint16_t bcdVersion;
175  uint16_t index;
176  uint8_t count;
178  uint8_t reserved1[7];
179 
180  const USB_CompatFunctionDesc_t
182 
184 SL_PACK_END()
185 
186 SL_PACK_START(1)
188 typedef struct
189 {
190  uint32_t wLength;
191  uint16_t bcdVersion;
192  uint16_t index;
193  uint16_t count;
194 
195  // GUID Property
196  uint32_t size2;
197  uint32_t propertyDataType;
199  uint8_t propertyName[GUID_PROPERTY_NAME_LEN];
201  uint8_t propertyData2[GUID_PROPERTY_LEN];
203 SL_PACK_END()
204 
205 // -----------------------------------------------------------------------------
206 // Extern Variable Declarations
207 
208 extern const USB_DeviceDescriptor_TypeDef USBXCORE_deviceDescInit;
209 extern const uint8_t USBXCORE_configDescInit[];
210 extern const uint8_t USBXCORE_stringLangDesc[];
211 extern const uint8_t USBXCORE_microsoftOsDesc[];
212 extern const USB_ExtendedCompatIdOsFeatureDesc_t
213  USBXCORE_extendedCompatIdOsFeatureDesc;
214 extern const USB_ExtendedPropertiesDescriptor_t USBXCORE_extendedPropertiesDesc;
215 extern const uint8_t USBXCORE_buffMult[];
216 
217 #ifdef __cplusplus
218 }
219 #endif
220 
221 #endif // EM_USBXPRESS_DESCRIPTORS_H
const uint8_t USBXCORE_configDescInit[]
USB Configuration Descriptor.
#define SL_PACK_END()
Macro for handling packed structs. Use this macro after the struct definition. With GCC...
Definition: em_common.h:157
const uint8_t USBXCORE_stringLangDesc[]
USB Language String Descriptor.
Extended Properties Descriptor Typedef.
uint32_t propertyDataType
Data type of this property.
const uint8_t USBXCORE_buffMult[]
USB Buffer Multiplier.
#define GUID_PROPERTY_NAME_LEN
Length of GUID Property Name.
#define SL_PACK_START(x)
Macro for handling packed structs. Use this macro before the struct definition. X denotes the max...
Definition: em_common.h:150
uint16_t count
Number of properties.
uint32_t wLength
Size of this struct.
Compatible ID Function Descriptor Typedef.
#define GUID_PROPERTY_LEN
Length of GUID Property.
uint32_t length
Size of this struct = 16 + bCount*24.
uint16_t index
0x05 for extended property
#define SL_ATTRIBUTE_PACKED
GCC style macro for handling packed structs.
Definition: em_common.h:143
uint16_t propertyNameLength
Length of the name of this property.
#define NUM_IFCS_WITH_EXT_COMPAT
Number of interfaces with extended compatibility descriptors.
uint32_t propertyDataLength
Length the property data.
Compatible ID Feature Descriptor Typedef.
uint32_t size2
Size of this property descriptor.