Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "usbd_msc.h"
USBD_MSC
USBD_MSC_CfgDesc
USBD_MSC_DeviceQualifierDesc
MSCInEpAdd
MSCOutEpAdd
USBD_MSC_Init(USBD_HandleTypeDef *, uint8_t)
USBD_MSC_DeInit(USBD_HandleTypeDef *, uint8_t)
USBD_MSC_Setup(USBD_HandleTypeDef *, USBD_SetupReqTypedef *)
USBD_MSC_DataIn(USBD_HandleTypeDef *, uint8_t)
USBD_MSC_DataOut(USBD_HandleTypeDef *, uint8_t)
USBD_MSC_GetHSCfgDesc(uint16_t *)
USBD_MSC_GetFSCfgDesc(uint16_t *)
USBD_MSC_GetOtherSpeedCfgDesc(uint16_t *)
USBD_MSC_GetDeviceQualifierDescriptor(uint16_t *)
USBD_MSC_RegisterStorage(USBD_HandleTypeDef *, USBD_StorageTypeDef *)
Files
loading...
SourceVuSTM32 Libraries and SamplesSTM32_USB_Device_LibraryClass/MSC/Src/usbd_msc.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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file usbd_msc.c * @author MCD Application Team * @brief This file provides all the MSC core functions. * ****************************************************************************** * @attention * * Copyright (c) 2015 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** * @verbatim * * =================================================================== * MSC Class Description * =================================================================== * This module manages the MSC class V1.0 following the "Universal * Serial Bus Mass Storage Class (MSC) Bulk-Only Transport (BOT) Version 1.0 * Sep. 31, 1999". * This driver implements the following aspects of the specification: * - Bulk-Only Transport protocol * - Subclass : SCSI transparent command set (ref. SCSI Primary Commands - 3 (SPC-3)) * * @endverbatim * ****************************************************************************** *//* ... */ /* BSPDependencies - "stm32xxxxx_{eval}{discovery}{nucleo_144}.c" - "stm32xxxxx_{eval}{discovery}_io.c" - "stm32xxxxx_{eval}{discovery}{adafruit}_sd.c" EndBSPDependencies *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "usbd_msc.h" /** @addtogroup STM32_USB_DEVICE_LIBRARY * @{ *//* ... */ /** @defgroup MSC_CORE * @brief Mass storage core module * @{ *//* ... */ /** @defgroup MSC_CORE_Private_TypesDefinitions * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup MSC_CORE_Private_Defines * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup MSC_CORE_Private_Macros * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup MSC_CORE_Private_FunctionPrototypes * @{ *//* ... */ uint8_t USBD_MSC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx); uint8_t USBD_MSC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx); uint8_t USBD_MSC_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); uint8_t USBD_MSC_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum); uint8_t USBD_MSC_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum); #ifndef USE_USBD_COMPOSITE uint8_t *USBD_MSC_GetHSCfgDesc(uint16_t *length); uint8_t *USBD_MSC_GetFSCfgDesc(uint16_t *length); uint8_t *USBD_MSC_GetOtherSpeedCfgDesc(uint16_t *length); uint8_t *USBD_MSC_GetDeviceQualifierDescriptor(uint16_t *length);/* ... */ #endif /* USE_USBD_COMPOSITE */ /** * @} *//* ... */ /** @defgroup MSC_CORE_Private_Variables * @{ *//* ... */ USBD_ClassTypeDef USBD_MSC = { USBD_MSC_Init, USBD_MSC_DeInit, USBD_MSC_Setup, NULL, /*EP0_TxSent*/ NULL, /*EP0_RxReady*/ USBD_MSC_DataIn, USBD_MSC_DataOut, NULL, /*SOF */ NULL, NULL, #ifdef USE_USBD_COMPOSITE NULL, NULL, NULL, NULL,/* ... */ #else USBD_MSC_GetHSCfgDesc, USBD_MSC_GetFSCfgDesc, USBD_MSC_GetOtherSpeedCfgDesc, USBD_MSC_GetDeviceQualifierDescriptor,/* ... */ #endif /* USE_USBD_COMPOSITE */ ...}; /* USB Mass storage device Configuration Descriptor */ #ifndef USE_USBD_COMPOSITE /* USB Mass storage device Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */ __ALIGN_BEGIN static uint8_t USBD_MSC_CfgDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END = { 0x09, /* bLength: Configuration Descriptor size */ USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */ USB_MSC_CONFIG_DESC_SIZ, 0x00, 0x01, /* bNumInterfaces: 1 interface */ 0x01, /* bConfigurationValue */ 0x04, /* iConfiguration */ #if (USBD_SELF_POWERED == 1U) 0xC0, /* bmAttributes: Bus Powered according to user configuration */ #else 0x80, /* bmAttributes: Bus Powered according to user configuration */ #endif /* USBD_SELF_POWERED */ USBD_MAX_POWER, /* MaxPower (mA) */ /******************** Mass Storage interface ********************/ 0x09, /* bLength: Interface Descriptor size */ 0x04, /* bDescriptorType: */ 0x00, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints */ 0x08, /* bInterfaceClass: MSC Class */ 0x06, /* bInterfaceSubClass : SCSI transparent*/ 0x50, /* nInterfaceProtocol */ 0x05, /* iInterface: */ Mass Storage interface /******************** Mass Storage Endpoints ********************/ 0x07, /* Endpoint descriptor length = 7 */ 0x05, /* Endpoint descriptor type */ MSC_EPIN_ADDR, /* Endpoint address (IN, address 1) */ 0x02, /* Bulk endpoint type */ LOBYTE(MSC_MAX_FS_PACKET), HIBYTE(MSC_MAX_FS_PACKET), 0x00, /* Polling interval in milliseconds */ 0x07, /* Endpoint descriptor length = 7 */ 0x05, /* Endpoint descriptor type */ MSC_EPOUT_ADDR, /* Endpoint address (OUT, address 1) */ 0x02, /* Bulk endpoint type */ LOBYTE(MSC_MAX_FS_PACKET), HIBYTE(MSC_MAX_FS_PACKET), 0x00 /* Polling interval in milliseconds */ ...}; /* USB Standard Device Descriptor */ __ALIGN_BEGIN static uint8_t USBD_MSC_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END = { USB_LEN_DEV_QUALIFIER_DESC, USB_DESC_TYPE_DEVICE_QUALIFIER, 0x00, 0x02, 0x00, 0x00, 0x00, MSC_MAX_FS_PACKET, 0x01, 0x00, ...};/* ... */ #endif /* USE_USBD_COMPOSITE */ uint8_t MSCInEpAdd = MSC_EPIN_ADDR; uint8_t MSCOutEpAdd = MSC_EPOUT_ADDR; /** * @} *//* ... */ /** @defgroup MSC_CORE_Private_Functions * @{ *//* ... */ /** * @brief USBD_MSC_Init * Initialize the mass storage configuration * @param pdev: device instance * @param cfgidx: configuration index * @retval status *//* ... */ uint8_t USBD_MSC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) { UNUSED(cfgidx); USBD_MSC_BOT_HandleTypeDef *hmsc; hmsc = (USBD_MSC_BOT_HandleTypeDef *)USBD_malloc(sizeof(USBD_MSC_BOT_HandleTypeDef)); if (hmsc == NULL) { pdev->pClassDataCmsit[pdev->classId] = NULL; return (uint8_t)USBD_EMEM; }if (hmsc == NULL) { ... } pdev->pClassDataCmsit[pdev->classId] = (void *)hmsc; pdev->pClassData = pdev->pClassDataCmsit[pdev->classId]; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId);/* ... */ #endif /* USE_USBD_COMPOSITE */ if (pdev->dev_speed == USBD_SPEED_HIGH) { /* Open EP OUT */ (void)USBD_LL_OpenEP(pdev, MSCOutEpAdd, USBD_EP_TYPE_BULK, MSC_MAX_HS_PACKET); pdev->ep_out[MSCOutEpAdd & 0xFU].is_used = 1U; /* Open EP IN */ (void)USBD_LL_OpenEP(pdev, MSCInEpAdd, USBD_EP_TYPE_BULK, MSC_MAX_HS_PACKET); pdev->ep_in[MSCInEpAdd & 0xFU].is_used = 1U; }if (pdev->dev_speed == USBD_SPEED_HIGH) { ... } else { /* Open EP OUT */ (void)USBD_LL_OpenEP(pdev, MSCOutEpAdd, USBD_EP_TYPE_BULK, MSC_MAX_FS_PACKET); pdev->ep_out[MSCOutEpAdd & 0xFU].is_used = 1U; /* Open EP IN */ (void)USBD_LL_OpenEP(pdev, MSCInEpAdd, USBD_EP_TYPE_BULK, MSC_MAX_FS_PACKET); pdev->ep_in[MSCInEpAdd & 0xFU].is_used = 1U; }else { ... } /* Init the BOT layer */ MSC_BOT_Init(pdev); return (uint8_t)USBD_OK; }{ ... } /** * @brief USBD_MSC_DeInit * DeInitialize the mass storage configuration * @param pdev: device instance * @param cfgidx: configuration index * @retval status *//* ... */ uint8_t USBD_MSC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx) { UNUSED(cfgidx); #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId);/* ... */ #endif /* USE_USBD_COMPOSITE */ /* Close MSC EPs */ (void)USBD_LL_CloseEP(pdev, MSCOutEpAdd); pdev->ep_out[MSCOutEpAdd & 0xFU].is_used = 0U; /* Close EP IN */ (void)USBD_LL_CloseEP(pdev, MSCInEpAdd); pdev->ep_in[MSCInEpAdd & 0xFU].is_used = 0U; /* Free MSC Class Resources */ if (pdev->pClassDataCmsit[pdev->classId] != NULL) { /* De-Init the BOT layer */ MSC_BOT_DeInit(pdev); (void)USBD_free(pdev->pClassDataCmsit[pdev->classId]); pdev->pClassDataCmsit[pdev->classId] = NULL; pdev->pClassData = NULL; }if (pdev->pClassDataCmsit[pdev->classId] != NULL) { ... } return (uint8_t)USBD_OK; }{ ... } /** * @brief USBD_MSC_Setup * Handle the MSC specific requests * @param pdev: device instance * @param req: USB request * @retval status *//* ... */ uint8_t USBD_MSC_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req) { USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId]; USBD_StatusTypeDef ret = USBD_OK; uint16_t status_info = 0U; #ifdef USE_USBD_COMPOSITE /* Get the Endpoints addresses allocated for this class instance */ MSCInEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId); MSCOutEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_OUT, USBD_EP_TYPE_BULK, (uint8_t)pdev->classId);/* ... */ #endif /* USE_USBD_COMPOSITE */ if (hmsc == NULL) { return (uint8_t)USBD_FAIL; }if (hmsc == NULL) { ... } switch (req->bmRequest & USB_REQ_TYPE_MASK) { /* Class request */ case USB_REQ_TYPE_CLASS: switch (req->bRequest) { case BOT_GET_MAX_LUN: if ((req->wValue == 0U) && (req->wLength == 1U) && ((req->bmRequest & 0x80U) == 0x80U)) { hmsc->max_lun = (uint32_t)((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->GetMaxLun(); (void)USBD_CtlSendData(pdev, (uint8_t *)&hmsc->max_lun, 1U); }if ((req->wValue == 0U) && (req->wLength == 1U) && ((req->bmRequest & 0x80U) == 0x80U)) { ... } else { USBD_CtlError(pdev, req); ret = USBD_FAIL; }else { ... } break; case BOT_GET_MAX_LUN: case BOT_RESET : if ((req->wValue == 0U) && (req->wLength == 0U) && ((req->bmRequest & 0x80U) != 0x80U)) { MSC_BOT_Reset(pdev); }if ((req->wValue == 0U) && (req->wLength == 0U) && ((req->bmRequest & 0x80U) != 0x80U)) { ... } else { USBD_CtlError(pdev, req); ret = USBD_FAIL; }else { ... } break; case BOT_RESET : default: USBD_CtlError(pdev, req); ret = USBD_FAIL; break;default }switch (req->bRequest) { ... } break; /* Interface & Endpoint request */case USB_REQ_TYPE_CLASS: case USB_REQ_TYPE_STANDARD: switch (req->bRequest) { case USB_REQ_GET_STATUS: if (pdev->dev_state == USBD_STATE_CONFIGURED) { (void)USBD_CtlSendData(pdev, (uint8_t *)&status_info, 2U); }if (pdev->dev_state == USBD_STATE_CONFIGURED) { ... } else { USBD_CtlError(pdev, req); ret = USBD_FAIL; }else { ... } break; case USB_REQ_GET_STATUS: case USB_REQ_GET_INTERFACE: if (pdev->dev_state == USBD_STATE_CONFIGURED) { (void)USBD_CtlSendData(pdev, (uint8_t *)&hmsc->interface, 1U); }if (pdev->dev_state == USBD_STATE_CONFIGURED) { ... } else { USBD_CtlError(pdev, req); ret = USBD_FAIL; }else { ... } break; case USB_REQ_GET_INTERFACE: case USB_REQ_SET_INTERFACE: if (pdev->dev_state == USBD_STATE_CONFIGURED) { hmsc->interface = (uint8_t)(req->wValue); }if (pdev->dev_state == USBD_STATE_CONFIGURED) { ... } else { USBD_CtlError(pdev, req); ret = USBD_FAIL; }else { ... } break; case USB_REQ_SET_INTERFACE: case USB_REQ_CLEAR_FEATURE: if (pdev->dev_state == USBD_STATE_CONFIGURED) { if (req->wValue == USB_FEATURE_EP_HALT) { /* Flush the FIFO */ (void)USBD_LL_FlushEP(pdev, (uint8_t)req->wIndex); /* Handle BOT error */ MSC_BOT_CplClrFeature(pdev, (uint8_t)req->wIndex); }if (req->wValue == USB_FEATURE_EP_HALT) { ... } }if (pdev->dev_state == USBD_STATE_CONFIGURED) { ... } break; case USB_REQ_CLEAR_FEATURE: default: USBD_CtlError(pdev, req); ret = USBD_FAIL; break;default }switch (req->bRequest) { ... } break; case USB_REQ_TYPE_STANDARD: default: USBD_CtlError(pdev, req); ret = USBD_FAIL; break;default }switch (req->bmRequest & USB_REQ_TYPE_MASK) { ... } return (uint8_t)ret; }{ ... } /** * @brief USBD_MSC_DataIn * handle data IN Stage * @param pdev: device instance * @param epnum: endpoint index * @retval status *//* ... */ uint8_t USBD_MSC_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum) { MSC_BOT_DataIn(pdev, epnum); return (uint8_t)USBD_OK; }{ ... } /** * @brief USBD_MSC_DataOut * handle data OUT Stage * @param pdev: device instance * @param epnum: endpoint index * @retval status *//* ... */ uint8_t USBD_MSC_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) { MSC_BOT_DataOut(pdev, epnum); return (uint8_t)USBD_OK; }{ ... } #ifndef USE_USBD_COMPOSITE /** * @brief USBD_MSC_GetHSCfgDesc * return configuration descriptor * @param length : pointer data length * @retval pointer to descriptor buffer *//* ... */ uint8_t *USBD_MSC_GetHSCfgDesc(uint16_t *length) { USBD_EpDescTypeDef *pEpInDesc = USBD_GetEpDesc(USBD_MSC_CfgDesc, MSC_EPIN_ADDR); USBD_EpDescTypeDef *pEpOutDesc = USBD_GetEpDesc(USBD_MSC_CfgDesc, MSC_EPOUT_ADDR); if (pEpInDesc != NULL) { pEpInDesc->wMaxPacketSize = MSC_MAX_HS_PACKET; }if (pEpInDesc != NULL) { ... } if (pEpOutDesc != NULL) { pEpOutDesc->wMaxPacketSize = MSC_MAX_HS_PACKET; }if (pEpOutDesc != NULL) { ... } *length = (uint16_t)sizeof(USBD_MSC_CfgDesc); return USBD_MSC_CfgDesc; }{ ... } /** * @brief USBD_MSC_GetFSCfgDesc * return configuration descriptor * @param length : pointer data length * @retval pointer to descriptor buffer *//* ... */ uint8_t *USBD_MSC_GetFSCfgDesc(uint16_t *length) { USBD_EpDescTypeDef *pEpInDesc = USBD_GetEpDesc(USBD_MSC_CfgDesc, MSC_EPIN_ADDR); USBD_EpDescTypeDef *pEpOutDesc = USBD_GetEpDesc(USBD_MSC_CfgDesc, MSC_EPOUT_ADDR); if (pEpInDesc != NULL) { pEpInDesc->wMaxPacketSize = MSC_MAX_FS_PACKET; }if (pEpInDesc != NULL) { ... } if (pEpOutDesc != NULL) { pEpOutDesc->wMaxPacketSize = MSC_MAX_FS_PACKET; }if (pEpOutDesc != NULL) { ... } *length = (uint16_t)sizeof(USBD_MSC_CfgDesc); return USBD_MSC_CfgDesc; }{ ... } /** * @brief USBD_MSC_GetOtherSpeedCfgDesc * return other speed configuration descriptor * @param length : pointer data length * @retval pointer to descriptor buffer *//* ... */ uint8_t *USBD_MSC_GetOtherSpeedCfgDesc(uint16_t *length) { USBD_EpDescTypeDef *pEpInDesc = USBD_GetEpDesc(USBD_MSC_CfgDesc, MSC_EPIN_ADDR); USBD_EpDescTypeDef *pEpOutDesc = USBD_GetEpDesc(USBD_MSC_CfgDesc, MSC_EPOUT_ADDR); if (pEpInDesc != NULL) { pEpInDesc->wMaxPacketSize = MSC_MAX_FS_PACKET; }if (pEpInDesc != NULL) { ... } if (pEpOutDesc != NULL) { pEpOutDesc->wMaxPacketSize = MSC_MAX_FS_PACKET; }if (pEpOutDesc != NULL) { ... } *length = (uint16_t)sizeof(USBD_MSC_CfgDesc); return USBD_MSC_CfgDesc; }{ ... } /** * @brief DeviceQualifierDescriptor * return Device Qualifier descriptor * @param length : pointer data length * @retval pointer to descriptor buffer *//* ... */ uint8_t *USBD_MSC_GetDeviceQualifierDescriptor(uint16_t *length) { *length = (uint16_t)sizeof(USBD_MSC_DeviceQualifierDesc); return USBD_MSC_DeviceQualifierDesc; }{ ... } #endif/* ... */ /* USE_USBD_COMPOSITE */ /** * @brief USBD_MSC_RegisterStorage * @param fops: storage callback * @retval status *//* ... */ uint8_t USBD_MSC_RegisterStorage(USBD_HandleTypeDef *pdev, USBD_StorageTypeDef *fops) { if (fops == NULL) { return (uint8_t)USBD_FAIL; }if (fops == NULL) { ... } pdev->pUserData[pdev->classId] = fops; return (uint8_t)USBD_OK; }{ ... } /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ Includes
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.