-
Notifications
You must be signed in to change notification settings - Fork 34
/
usb_descriptors.c
349 lines (312 loc) · 17.5 KB
/
usb_descriptors.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
/**
* ----------------------------------------------------------------------------
* FILE: usb_descriptors.c
* DESCRIPTION: USB descriptors
* DATE: 2016.10.15
* AUTHOR(s): Lime Microsystems
* REVISION: v0r1
* ----------------------------------------------------------------------------
*/
#include "usb_config.h"
/* Standard device descriptor for USB 3.0 */
const uint8_t CyFxUSB30DeviceDscr[] __attribute__ ((aligned (32))) =
{
0x12, /* Descriptor size */
CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */
0x00,0x03, /* USB 3.0 */
0x00, /* Device class */
0x00, /* Device sub-class */
0x00, /* Device protocol */
0x09, /* Maxpacket size for EP0 : 2^9 */
0x50,0x1D, /* Vendor ID */
0x08,0x61, /* Product ID */
0x00,0x00, /* Device release number */
0x01, /* Manufacture string index */
0x02, /* Product string index */
0x03, /* Serial number string index */
0x01 /* Number of configurations */
};
/* Standard device descriptor for USB 2.0 */
const uint8_t CyFxUSB20DeviceDscr[] __attribute__ ((aligned (32))) =
{
0x12, /* Descriptor size */
CY_U3P_USB_DEVICE_DESCR, /* Device descriptor type */
0x10,0x02, /* USB 2.10 */
0x00, /* Device class */
0x00, /* Device sub-class */
0x00, /* Device protocol */
0x40, /* Maxpacket size for EP0 : 64 bytes */
0x50,0x1D, /* Vendor ID */
0x08,0x61, /* Product ID */
0x00,0x00, /* Device release number */
0x01, /* Manufacture string index */
0x02, /* Product string index */
0x03, /* Serial number string index */
0x01 /* Number of configurations */
};
/* Binary device object store descriptor */
const uint8_t CyFxUSBBOSDscr[] __attribute__ ((aligned (32))) =
{
0x05, /* Descriptor size */
CY_U3P_BOS_DESCR, /* Device descriptor type */
0x16,0x00, /* Length of this descriptor and all sub descriptors */
0x02, /* Number of device capability descriptors */
/* USB 2.0 extension */
0x07, /* Descriptor size */
CY_U3P_DEVICE_CAPB_DESCR, /* Device capability type descriptor */
CY_U3P_USB2_EXTN_CAPB_TYPE, /* USB 2.0 extension capability type */
0x02,0x00,0x00,0x00, /* Supported device level features: LPM support */
/* SuperSpeed device capability */
0x0A, /* Descriptor size */
CY_U3P_DEVICE_CAPB_DESCR, /* Device capability type descriptor */
CY_U3P_SS_USB_CAPB_TYPE, /* SuperSpeed device capability type */
0x00, /* Supported device level features */
0x0E,0x00, /* Speeds supported by the device : SS, HS and FS */
0x03, /* Functionality support */
0x00, /* U1 Device Exit latency */
0x00,0x00 /* U2 Device Exit latency */
};
/* Standard device qualifier descriptor */
const uint8_t CyFxUSBDeviceQualDscr[] __attribute__ ((aligned (32))) =
{
0x0A, /* Descriptor size */
CY_U3P_USB_DEVQUAL_DESCR, /* Device qualifier descriptor type */
0x00,0x02, /* USB 2.0 */
0x00, /* Device class */
0x00, /* Device sub-class */
0x00, /* Device protocol */
0x40, /* Maxpacket size for EP0 : 64 bytes */
0x01, /* Number of configurations */
0x00 /* Reserved */
};
/* Standard super speed configuration descriptor */
const uint8_t CyFxUSBSSConfigDscr[] __attribute__ ((aligned (32))) =
{
/* Configuration descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_CONFIG_DESCR, /* Configuration descriptor type */
0x46,0x00, /* Length of this descriptor and all sub descriptors */
0x01, /* Number of interfaces */
0x01, /* Configuration number */
0x00, /* COnfiguration string index */
0x80, /* Config characteristics - Bus powered */
0x32, /* Max power consumption of device (in 8mA unit) : 400mA */
/* Interface descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */
0x00, /* Interface number */
0x00, /* Alternate setting number */
0x04, /* Number of end points */
0xFF, /* Interface class */
0x00, /* Interface sub class */
0x00, /* Interface protocol code */
0x00, /* Interface descriptor string index */
/* Endpoint descriptor for USB_BULK_STREAM producer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_STREAM_EP_PROD, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers : 0 for bulk */
/* Super speed endpoint companion descriptor for USB_BULK_STREAM producer EP */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
USB_BULK_STREAM_BURST_LEN-1, /* Max no. of packets in a burst : 0: burst 1 packet at a time */
0x00, /* Max streams for bulk EP = 0 (No streams) */
0x00,0x00, /* Service interval for the EP : 0 for bulk */
/* Endpoint descriptor for USB_BULK_STREAM consumer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_STREAM_EP_CONS, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers : 0 for Bulk */
/* Super speed endpoint companion descriptor for USB_BULK_STREAM consumer EP */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
USB_BULK_STREAM_BURST_LEN-1, /* Max no. of packets in a burst : 0: burst 1 packet at a time */
0x00, /* Max streams for bulk EP = 0 (No streams) */
0x00,0x00, /* Service interval for the EP : 0 for bulk */
/* Endpoint descriptor for USB_BULK_CONTROL producer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_CONTROL_EP_PROD, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers : 0 for bulk */
/* Super speed endpoint companion descriptor for USB_BULK_CONTROL producer EP */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a burst : 0: burst 1 packet at a time */
0x00, /* Max streams for bulk EP = 0 (No streams) */
0x00,0x00, /* Service interval for the EP : 0 for bulk */
/* Endpoint descriptor for USB_BULK_CONTROL consumer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_CONTROL_EP_CONS, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x04, /* Max packet size = 1024 bytes */
0x00, /* Servicing interval for data transfers : 0 for Bulk */
/* Super speed endpoint companion descriptor for USB_BULK_CONTROL consumer EP */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS endpoint companion descriptor type */
0x00, /* Max no. of packets in a burst : 0: burst 1 packet at a time */
0x00, /* Max streams for bulk EP = 0 (No streams) */
0x00,0x00, /* Service interval for the EP : 0 for bulk */
};
/* Standard high speed configuration descriptor */
const uint8_t CyFxUSBHSConfigDscr[] __attribute__ ((aligned (32))) =
{
/* Configuration descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_CONFIG_DESCR, /* Configuration descriptor type */
0x2E,0x00, /* Length of this descriptor and all sub descriptors */
0x01, /* Number of interfaces */
0x01, /* Configuration number */
0x00, /* Configuration string index */
0x80, /* Config characteristics - bus powered */
0x32, /* Max power consumption of device (in 2mA unit) : 100mA */
/* Interface descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */
0x00, /* Interface number */
0x00, /* Alternate setting number */
0x04, /* Number of end points */
0xFF, /* Interface class */
0x00, /* Interface sub class */
0x00, /* Interface protocol code */
0x00, /* Interface descriptor string index */
/* Endpoint descriptor for USB_BULK_STREAM producer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_STREAM_EP_PROD, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x02, /* Max packet size = 512 bytes */
0x00, /* Servicing interval for data transfers : 0 for bulk */
/* Endpoint descriptor for USB_BULK_STREAM consumer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_STREAM_EP_CONS, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x02, /* Max packet size = 512 bytes */
0x00, /* Servicing interval for data transfers : 0 for Bulk */
/* Endpoint descriptor for USB_BULK_CONTROL producer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_CONTROL_EP_PROD, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x02, /* Max packet size = 512 bytes */
0x00, /* Servicing interval for data transfers : 0 for bulk */
/* Endpoint descriptor for USB_BULK_CONTROL consumer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_CONTROL_EP_CONS, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x00,0x02, /* Max packet size = 512 bytes */
0x00, /* Servicing interval for data transfers : 0 for Bulk */
};
/* Standard full speed configuration descriptor */
const uint8_t CyFxUSBFSConfigDscr[] __attribute__ ((aligned (32))) =
{
/* Configuration descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_CONFIG_DESCR, /* Configuration descriptor type */
0x2E,0x00, /* Length of this descriptor and all sub descriptors */
0x01, /* Number of interfaces */
0x01, /* Configuration number */
0x00, /* COnfiguration string index */
0x80, /* Config characteristics - bus powered */
0x32, /* Max power consumption of device (in 2mA unit) : 100mA */
/* Interface descriptor */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface descriptor type */
0x00, /* Interface number */
0x00, /* Alternate setting number */
0x04, /* Number of end points */
0xFF, /* Interface class */
0x00, /* Interface sub class */
0x00, /* Interface protocol code */
0x00, /* Interface descriptor string index */
/* Endpoint descriptor for USB_BULK_STREAM producer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_STREAM_EP_PROD, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x40,0x00, /* Max packet size = 512 bytes */
0x00, /* Servicing interval for data transfers : 0 for bulk */
/* Endpoint descriptor for USB_BULK_STREAM consumer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_STREAM_EP_CONS, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x40,0x00, /* Max packet size = 64 bytes */
0x00, /* Servicing interval for data transfers : 0 for Bulk */
/* Endpoint descriptor for USB_BULK_CONTROL producer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_CONTROL_EP_PROD, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x40,0x00, /* Max packet size = 64 bytes */
0x00, /* Servicing interval for data transfers : 0 for bulk */
/* Endpoint descriptor for USB_BULK_CONTROL consumer EP */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint descriptor type */
USB_BULK_CONTROL_EP_CONS, /* Endpoint address and description */
CY_U3P_USB_EP_BULK, /* Bulk endpoint type */
0x40,0x00, /* Max packet size = 64 bytes */
0x00, /* Servicing interval for data transfers : 0 for Bulk */
};
/* Standard language ID string descriptor */
const uint8_t CyFxUSBStringLangIDDscr[] __attribute__ ((aligned (32))) =
{
0x04, /* Descriptor size */
CY_U3P_USB_STRING_DESCR, /* Device descriptor type */
0x09,0x04 /* Language ID supported */
};
/* Standard manufacturer string descriptor: Myriad-RF */
const uint8_t CyFxUSBManufactureDscr[] __attribute__ ((aligned (32))) =
{
0x20, /* Descriptor size */
CY_U3P_USB_STRING_DESCR, /* Device descriptor type */
'M',0x00,
'y',0x00,
'r',0x00,
'i',0x00,
'a',0x00,
'd',0x00,
'-',0x00,
'R',0x00,
'F',0x00,
};
/* Standard product string descriptor: LimeSDR-USB */
const uint8_t CyFxUSBProductDscr[] __attribute__ ((aligned (32))) =
{
0x18, /* Descriptor size */
CY_U3P_USB_STRING_DESCR, /* Device descriptor type */
'L',0x00,
'i',0x00,
'm',0x00,
'e',0x00,
'S',0x00,
'D',0x00,
'R',0x00,
'-',0x00,
'U',0x00,
'S',0x00,
'B',0x00,
};
/* USB serial number */
uint8_t CyFxUSBSerialNumDesc [] __attribute__ ((aligned (32))) =
{
0x22, /* Descriptor size */
CY_U3P_USB_STRING_DESCR, /* Device descriptor type */
'0',0x00,'0',0x00,'0',0x00,'0',0x00,
'0',0x00,'0',0x00,'0',0x00,'0',0x00,
'0',0x00,'0',0x00,'0',0x00,'0',0x00,
'0',0x00,'0',0x00,'0',0x00,'0',0x00,
};
/* Place this buffer as the last buffer so that no other variable / code shares
* the same cache line. Do not add any other variables / arrays in this file.
* This will lead to variables sharing the same cache line. */
const uint8_t CyFxUsbDscrAlignBuffer[32] __attribute__ ((aligned (32)));
/* [ ] */