9
9
* ===================================================================
10
10
* AUDIO Class Description
11
11
* ===================================================================
12
- * This driver manages the Audio Class 1.0 following the "USB Device Class Definition for
12
+ * This driver manages the Audio Class 1.0 following the "USB Device Class Definition for
13
13
* Audio Devices V1.0 Mar 18, 98".
14
14
* This driver implements the following aspects of the specification:
15
15
* - Device descriptor management
48
48
* This software component is licensed by ST under Ultimate Liberty license
49
49
* SLA0044, the "License"; You may not use this file except in compliance with
50
50
* the License. You may obtain a copy of the License at:
51
- * http:// www.st.com/SLA0044
51
+ * www.st.com/SLA0044
52
52
*
53
53
******************************************************************************
54
54
*/
@@ -93,7 +93,7 @@ EndBSPDependencies */
93
93
/** @defgroup USBD_AUDIO_Private_Macros
94
94
* @{
95
95
*/
96
- #define AUDIO_SAMPLE_FREQ (frq ) (uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))
96
+ #define AUDIO_SAMPLE_FREQ (frq ) (uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))
97
97
98
98
#define AUDIO_PACKET_SZE (frq ) (uint8_t)(((frq * 2U * 2U)/1000U) & 0xFFU), \
99
99
(uint8_t)((((frq * 2U * 2U)/1000U) >> 8) & 0xFFU)
@@ -103,42 +103,26 @@ EndBSPDependencies */
103
103
*/
104
104
105
105
106
-
107
-
108
106
/** @defgroup USBD_AUDIO_Private_FunctionPrototypes
109
107
* @{
110
108
*/
111
-
112
-
113
- static uint8_t USBD_AUDIO_Init (USBD_HandleTypeDef * pdev ,
114
- uint8_t cfgidx );
115
-
116
- static uint8_t USBD_AUDIO_DeInit (USBD_HandleTypeDef * pdev ,
117
- uint8_t cfgidx );
118
-
119
- static uint8_t USBD_AUDIO_Setup (USBD_HandleTypeDef * pdev ,
120
- USBD_SetupReqTypedef * req );
121
-
122
- static uint8_t * USBD_AUDIO_GetCfgDesc (uint16_t * length );
123
-
124
- static uint8_t * USBD_AUDIO_GetDeviceQualifierDesc (uint16_t * length );
125
-
126
- static uint8_t USBD_AUDIO_DataIn (USBD_HandleTypeDef * pdev , uint8_t epnum );
127
-
128
- static uint8_t USBD_AUDIO_DataOut (USBD_HandleTypeDef * pdev , uint8_t epnum );
129
-
130
- static uint8_t USBD_AUDIO_EP0_RxReady (USBD_HandleTypeDef * pdev );
131
-
132
- static uint8_t USBD_AUDIO_EP0_TxReady (USBD_HandleTypeDef * pdev );
133
-
134
- static uint8_t USBD_AUDIO_SOF (USBD_HandleTypeDef * pdev );
135
-
136
- static uint8_t USBD_AUDIO_IsoINIncomplete (USBD_HandleTypeDef * pdev , uint8_t epnum );
137
-
138
- static uint8_t USBD_AUDIO_IsoOutIncomplete (USBD_HandleTypeDef * pdev , uint8_t epnum );
139
-
109
+ static uint8_t USBD_AUDIO_Init (USBD_HandleTypeDef * pdev , uint8_t cfgidx );
110
+ static uint8_t USBD_AUDIO_DeInit (USBD_HandleTypeDef * pdev , uint8_t cfgidx );
111
+
112
+ static uint8_t USBD_AUDIO_Setup (USBD_HandleTypeDef * pdev ,
113
+ USBD_SetupReqTypedef * req );
114
+
115
+ static uint8_t * USBD_AUDIO_GetCfgDesc (uint16_t * length );
116
+ static uint8_t * USBD_AUDIO_GetDeviceQualifierDesc (uint16_t * length );
117
+ static uint8_t USBD_AUDIO_DataIn (USBD_HandleTypeDef * pdev , uint8_t epnum );
118
+ static uint8_t USBD_AUDIO_DataOut (USBD_HandleTypeDef * pdev , uint8_t epnum );
119
+ static uint8_t USBD_AUDIO_EP0_RxReady (USBD_HandleTypeDef * pdev );
120
+ static uint8_t USBD_AUDIO_EP0_TxReady (USBD_HandleTypeDef * pdev );
121
+ static uint8_t USBD_AUDIO_SOF (USBD_HandleTypeDef * pdev );
122
+
123
+ static uint8_t USBD_AUDIO_IsoINIncomplete (USBD_HandleTypeDef * pdev , uint8_t epnum );
124
+ static uint8_t USBD_AUDIO_IsoOutIncomplete (USBD_HandleTypeDef * pdev , uint8_t epnum );
140
125
static void AUDIO_REQ_GetCurrent (USBD_HandleTypeDef * pdev , USBD_SetupReqTypedef * req );
141
-
142
126
static void AUDIO_REQ_SetCurrent (USBD_HandleTypeDef * pdev , USBD_SetupReqTypedef * req );
143
127
144
128
/**
@@ -374,6 +358,7 @@ static uint8_t USBD_AUDIO_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
374
358
USBD_LL_PrepareReceive (pdev , AUDIO_OUT_EP , haudio -> buffer ,
375
359
AUDIO_OUT_PACKET );
376
360
}
361
+
377
362
return USBD_OK ;
378
363
}
379
364
@@ -387,7 +372,6 @@ static uint8_t USBD_AUDIO_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
387
372
static uint8_t USBD_AUDIO_DeInit (USBD_HandleTypeDef * pdev ,
388
373
uint8_t cfgidx )
389
374
{
390
-
391
375
/* Open EP OUT */
392
376
USBD_LL_CloseEP (pdev , AUDIO_OUT_EP );
393
377
pdev -> ep_out [AUDIO_OUT_EP & 0xFU ].is_used = 0U ;
@@ -418,7 +402,7 @@ static uint8_t USBD_AUDIO_Setup(USBD_HandleTypeDef *pdev,
418
402
uint16_t status_info = 0U ;
419
403
uint8_t ret = USBD_OK ;
420
404
421
- haudio = (USBD_AUDIO_HandleTypeDef * ) pdev -> pClassData ;
405
+ haudio = (USBD_AUDIO_HandleTypeDef * )pdev -> pClassData ;
422
406
423
407
switch (req -> bmRequest & USB_REQ_TYPE_MASK ) {
424
408
case USB_REQ_TYPE_CLASS :
@@ -508,6 +492,7 @@ static uint8_t USBD_AUDIO_Setup(USBD_HandleTypeDef *pdev,
508
492
static uint8_t * USBD_AUDIO_GetCfgDesc (uint16_t * length )
509
493
{
510
494
* length = sizeof (USBD_AUDIO_CfgDesc );
495
+
511
496
return USBD_AUDIO_CfgDesc ;
512
497
}
513
498
@@ -518,10 +503,8 @@ static uint8_t *USBD_AUDIO_GetCfgDesc(uint16_t *length)
518
503
* @param epnum: endpoint index
519
504
* @retval status
520
505
*/
521
- static uint8_t USBD_AUDIO_DataIn (USBD_HandleTypeDef * pdev ,
522
- uint8_t epnum )
506
+ static uint8_t USBD_AUDIO_DataIn (USBD_HandleTypeDef * pdev , uint8_t epnum )
523
507
{
524
-
525
508
/* Only OUT data are processed */
526
509
return USBD_OK ;
527
510
}
@@ -629,7 +612,6 @@ void USBD_AUDIO_Sync(USBD_HandleTypeDef *pdev, AUDIO_OffsetTypeDef offset)
629
612
*/
630
613
static uint8_t USBD_AUDIO_IsoINIncomplete (USBD_HandleTypeDef * pdev , uint8_t epnum )
631
614
{
632
-
633
615
return USBD_OK ;
634
616
}
635
617
/**
@@ -641,7 +623,6 @@ static uint8_t USBD_AUDIO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epn
641
623
*/
642
624
static uint8_t USBD_AUDIO_IsoOutIncomplete (USBD_HandleTypeDef * pdev , uint8_t epnum )
643
625
{
644
-
645
626
return USBD_OK ;
646
627
}
647
628
/**
@@ -651,8 +632,7 @@ static uint8_t USBD_AUDIO_IsoOutIncomplete(USBD_HandleTypeDef *pdev, uint8_t ep
651
632
* @param epnum: endpoint index
652
633
* @retval status
653
634
*/
654
- static uint8_t USBD_AUDIO_DataOut (USBD_HandleTypeDef * pdev ,
655
- uint8_t epnum )
635
+ static uint8_t USBD_AUDIO_DataOut (USBD_HandleTypeDef * pdev , uint8_t epnum )
656
636
{
657
637
USBD_AUDIO_HandleTypeDef * haudio ;
658
638
haudio = (USBD_AUDIO_HandleTypeDef * ) pdev -> pClassData ;
@@ -720,9 +700,7 @@ static void AUDIO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
720
700
721
701
if (req -> wLength ) {
722
702
/* Prepare the reception of the buffer over EP0 */
723
- USBD_CtlPrepareRx (pdev ,
724
- haudio -> control .data ,
725
- req -> wLength );
703
+ USBD_CtlPrepareRx (pdev , haudio -> control .data , req -> wLength );
726
704
727
705
haudio -> control .cmd = AUDIO_REQ_SET_CUR ; /* Set the request value */
728
706
haudio -> control .len = (uint8_t )req -> wLength ; /* Set the request data length */
@@ -740,6 +718,7 @@ static void AUDIO_REQ_SetCurrent(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
740
718
static uint8_t * USBD_AUDIO_GetDeviceQualifierDesc (uint16_t * length )
741
719
{
742
720
* length = sizeof (USBD_AUDIO_DeviceQualifierDesc );
721
+
743
722
return USBD_AUDIO_DeviceQualifierDesc ;
744
723
}
745
724
@@ -748,12 +727,13 @@ static uint8_t *USBD_AUDIO_GetDeviceQualifierDesc(uint16_t *length)
748
727
* @param fops: Audio interface callback
749
728
* @retval status
750
729
*/
751
- uint8_t USBD_AUDIO_RegisterInterface (USBD_HandleTypeDef * pdev ,
730
+ uint8_t USBD_AUDIO_RegisterInterface (USBD_HandleTypeDef * pdev ,
752
731
USBD_AUDIO_ItfTypeDef * fops )
753
732
{
754
733
if (fops != NULL ) {
755
734
pdev -> pUserData = fops ;
756
735
}
736
+
757
737
return USBD_OK ;
758
738
}
759
739
/**
0 commit comments