Skip to content

Commit d5b769c

Browse files
committed
[USB] Update STM32 USB Device library to v2.5.1
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent d555758 commit d5b769c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4089
-3379
lines changed

system/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Inc/usbd_audio.h

Lines changed: 80 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,21 @@
22
******************************************************************************
33
* @file usbd_audio.h
44
* @author MCD Application Team
5-
* @version V2.4.2
6-
* @date 11-December-2015
75
* @brief header file for the usbd_audio.c file.
86
******************************************************************************
97
* @attention
108
*
11-
* <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
9+
* <h2><center>&copy; Copyright (c) 2015 STMicroelectronics.
10+
* All rights reserved.</center></h2>
1211
*
13-
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14-
* You may not use this file except in compliance with the License.
15-
* You may obtain a copy of the License at:
16-
*
17-
* http://www.st.com/software_license_agreement_liberty_v2
18-
*
19-
* Unless required by applicable law or agreed to in writing, software
20-
* distributed under the License is distributed on an "AS IS" BASIS,
21-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22-
* See the License for the specific language governing permissions and
23-
* limitations under the License.
12+
* This software component is licensed by ST under Ultimate Liberty license
13+
* SLA0044, the "License"; You may not use this file except in compliance with
14+
* the License. You may obtain a copy of the License at:
15+
* http://www.st.com/SLA0044
2416
*
2517
******************************************************************************
2618
*/
27-
19+
2820
/* Define to prevent recursive inclusion -------------------------------------*/
2921
#ifndef __USB_AUDIO_H
3022
#define __USB_AUDIO_H
@@ -39,67 +31,76 @@
3931
/** @addtogroup STM32_USB_DEVICE_LIBRARY
4032
* @{
4133
*/
42-
34+
4335
/** @defgroup USBD_AUDIO
4436
* @brief This file is the Header file for usbd_audio.c
4537
* @{
46-
*/
38+
*/
4739

4840

4941
/** @defgroup USBD_AUDIO_Exported_Defines
5042
* @{
51-
*/
52-
#define AUDIO_OUT_EP 0x01
53-
#define USB_AUDIO_CONFIG_DESC_SIZ 109
54-
#define AUDIO_INTERFACE_DESC_SIZE 9
55-
#define USB_AUDIO_DESC_SIZ 0x09
56-
#define AUDIO_STANDARD_ENDPOINT_DESC_SIZE 0x09
57-
#define AUDIO_STREAMING_ENDPOINT_DESC_SIZE 0x07
58-
59-
#define AUDIO_DESCRIPTOR_TYPE 0x21
60-
#define USB_DEVICE_CLASS_AUDIO 0x01
61-
#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01
62-
#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
63-
#define AUDIO_PROTOCOL_UNDEFINED 0x00
64-
#define AUDIO_STREAMING_GENERAL 0x01
65-
#define AUDIO_STREAMING_FORMAT_TYPE 0x02
43+
*/
44+
#ifndef USBD_AUDIO_FREQ
45+
/* AUDIO Class Config */
46+
#define USBD_AUDIO_FREQ 48000U
47+
#endif /* USBD_AUDIO_FREQ */
48+
49+
#ifndef USBD_MAX_NUM_INTERFACES
50+
#define USBD_MAX_NUM_INTERFACES 1U
51+
#endif /* USBD_AUDIO_FREQ */
52+
53+
#define AUDIO_OUT_EP 0x01U
54+
#define USB_AUDIO_CONFIG_DESC_SIZ 0x6DU
55+
#define AUDIO_INTERFACE_DESC_SIZE 0x09U
56+
#define USB_AUDIO_DESC_SIZ 0x09U
57+
#define AUDIO_STANDARD_ENDPOINT_DESC_SIZE 0x09U
58+
#define AUDIO_STREAMING_ENDPOINT_DESC_SIZE 0x07U
59+
60+
#define AUDIO_DESCRIPTOR_TYPE 0x21U
61+
#define USB_DEVICE_CLASS_AUDIO 0x01U
62+
#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01U
63+
#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02U
64+
#define AUDIO_PROTOCOL_UNDEFINED 0x00U
65+
#define AUDIO_STREAMING_GENERAL 0x01U
66+
#define AUDIO_STREAMING_FORMAT_TYPE 0x02U
6667

6768
/* Audio Descriptor Types */
68-
#define AUDIO_INTERFACE_DESCRIPTOR_TYPE 0x24
69-
#define AUDIO_ENDPOINT_DESCRIPTOR_TYPE 0x25
69+
#define AUDIO_INTERFACE_DESCRIPTOR_TYPE 0x24U
70+
#define AUDIO_ENDPOINT_DESCRIPTOR_TYPE 0x25U
7071

7172
/* Audio Control Interface Descriptor Subtypes */
72-
#define AUDIO_CONTROL_HEADER 0x01
73-
#define AUDIO_CONTROL_INPUT_TERMINAL 0x02
74-
#define AUDIO_CONTROL_OUTPUT_TERMINAL 0x03
75-
#define AUDIO_CONTROL_FEATURE_UNIT 0x06
73+
#define AUDIO_CONTROL_HEADER 0x01U
74+
#define AUDIO_CONTROL_INPUT_TERMINAL 0x02U
75+
#define AUDIO_CONTROL_OUTPUT_TERMINAL 0x03U
76+
#define AUDIO_CONTROL_FEATURE_UNIT 0x06U
77+
78+
#define AUDIO_INPUT_TERMINAL_DESC_SIZE 0x0CU
79+
#define AUDIO_OUTPUT_TERMINAL_DESC_SIZE 0x09U
80+
#define AUDIO_STREAMING_INTERFACE_DESC_SIZE 0x07U
7681

77-
#define AUDIO_INPUT_TERMINAL_DESC_SIZE 0x0C
78-
#define AUDIO_OUTPUT_TERMINAL_DESC_SIZE 0x09
79-
#define AUDIO_STREAMING_INTERFACE_DESC_SIZE 0x07
82+
#define AUDIO_CONTROL_MUTE 0x0001U
8083

81-
#define AUDIO_CONTROL_MUTE 0x0001
84+
#define AUDIO_FORMAT_TYPE_I 0x01U
85+
#define AUDIO_FORMAT_TYPE_III 0x03U
8286

83-
#define AUDIO_FORMAT_TYPE_I 0x01
84-
#define AUDIO_FORMAT_TYPE_III 0x03
87+
#define AUDIO_ENDPOINT_GENERAL 0x01U
8588

86-
#define AUDIO_ENDPOINT_GENERAL 0x01
89+
#define AUDIO_REQ_GET_CUR 0x81U
90+
#define AUDIO_REQ_SET_CUR 0x01U
8791

88-
#define AUDIO_REQ_GET_CUR 0x81
89-
#define AUDIO_REQ_SET_CUR 0x01
92+
#define AUDIO_OUT_STREAMING_CTRL 0x02U
9093

91-
#define AUDIO_OUT_STREAMING_CTRL 0x02
9294

95+
#define AUDIO_OUT_PACKET (uint16_t)(((USBD_AUDIO_FREQ * 2U * 2U) / 1000U))
96+
#define AUDIO_DEFAULT_VOLUME 70U
9397

94-
#define AUDIO_OUT_PACKET (uint32_t)(((USBD_AUDIO_FREQ * 2 * 2) /1000))
95-
#define AUDIO_DEFAULT_VOLUME 70
96-
9798
/* Number of sub-packets in the audio transfer buffer. You can modify this value but always make sure
9899
that it is an even number and higher than 3 */
99-
#define AUDIO_OUT_PACKET_NUM 80
100+
#define AUDIO_OUT_PACKET_NUM 80U
100101
/* Total size of the audio transfer buffer */
101-
#define AUDIO_TOTAL_BUF_SIZE ((uint32_t)(AUDIO_OUT_PACKET * AUDIO_OUT_PACKET_NUM))
102-
102+
#define AUDIO_TOTAL_BUF_SIZE ((uint16_t)(AUDIO_OUT_PACKET * AUDIO_OUT_PACKET_NUM))
103+
103104
/* Audio Commands enumeration */
104105
typedef enum
105106
{
@@ -113,40 +114,40 @@ typedef enum
113114
{
114115
AUDIO_OFFSET_NONE = 0,
115116
AUDIO_OFFSET_HALF,
116-
AUDIO_OFFSET_FULL,
117-
AUDIO_OFFSET_UNKNOWN,
117+
AUDIO_OFFSET_FULL,
118+
AUDIO_OFFSET_UNKNOWN,
118119
}
119120
AUDIO_OffsetTypeDef;
120121
/**
121122
* @}
122-
*/
123+
*/
123124

124125

125126
/** @defgroup USBD_CORE_Exported_TypesDefinitions
126127
* @{
127128
*/
128129
typedef struct
129130
{
130-
uint8_t cmd;
131-
uint8_t data[USB_MAX_EP0_SIZE];
132-
uint8_t len;
133-
uint8_t unit;
131+
uint8_t cmd;
132+
uint8_t data[USB_MAX_EP0_SIZE];
133+
uint8_t len;
134+
uint8_t unit;
134135
}
135-
USBD_AUDIO_ControlTypeDef;
136+
USBD_AUDIO_ControlTypeDef;
136137

137138

138139

139140
typedef struct
140141
{
141-
__IO uint32_t alt_setting;
142+
uint32_t alt_setting;
142143
uint8_t buffer[AUDIO_TOTAL_BUF_SIZE];
143144
AUDIO_OffsetTypeDef offset;
144-
uint8_t rd_enable;
145-
uint16_t rd_ptr;
146-
uint16_t wr_ptr;
147-
USBD_AUDIO_ControlTypeDef control;
145+
uint8_t rd_enable;
146+
uint16_t rd_ptr;
147+
uint16_t wr_ptr;
148+
USBD_AUDIO_ControlTypeDef control;
148149
}
149-
USBD_AUDIO_HandleTypeDef;
150+
USBD_AUDIO_HandleTypeDef;
150151

151152

152153
typedef struct
@@ -161,38 +162,38 @@ typedef struct
161162
}USBD_AUDIO_ItfTypeDef;
162163
/**
163164
* @}
164-
*/
165+
*/
165166

166167

167168

168169
/** @defgroup USBD_CORE_Exported_Macros
169170
* @{
170-
*/
171+
*/
171172

172173
/**
173174
* @}
174-
*/
175+
*/
175176

176177
/** @defgroup USBD_CORE_Exported_Variables
177178
* @{
178-
*/
179+
*/
179180

180181
extern USBD_ClassTypeDef USBD_AUDIO;
181182
#define USBD_AUDIO_CLASS &USBD_AUDIO
182183
/**
183184
* @}
184-
*/
185+
*/
185186

186187
/** @defgroup USB_CORE_Exported_Functions
187188
* @{
188-
*/
189-
uint8_t USBD_AUDIO_RegisterInterface (USBD_HandleTypeDef *pdev,
189+
*/
190+
uint8_t USBD_AUDIO_RegisterInterface (USBD_HandleTypeDef *pdev,
190191
USBD_AUDIO_ItfTypeDef *fops);
191192

192193
void USBD_AUDIO_Sync (USBD_HandleTypeDef *pdev, AUDIO_OffsetTypeDef offset);
193194
/**
194195
* @}
195-
*/
196+
*/
196197

197198
#ifdef __cplusplus
198199
}
@@ -201,10 +202,10 @@ void USBD_AUDIO_Sync (USBD_HandleTypeDef *pdev, AUDIO_OffsetTypeDef offset);
201202
#endif /* __USB_AUDIO_H */
202203
/**
203204
* @}
204-
*/
205+
*/
205206

206207
/**
207208
* @}
208-
*/
209-
209+
*/
210+
210211
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

system/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Inc/usbd_audio_if_template.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,17 @@
22
******************************************************************************
33
* @file usbd_audio_if_template.h
44
* @author MCD Application Team
5-
* @version V2.4.2
6-
* @date 11-December-2015
75
* @brief Header for usbd_audio_if_template.c file.
86
******************************************************************************
97
* @attention
108
*
11-
* <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
9+
* <h2><center>&copy; Copyright (c) 2015 STMicroelectronics.
10+
* All rights reserved.</center></h2>
1211
*
13-
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14-
* You may not use this file except in compliance with the License.
15-
* You may obtain a copy of the License at:
16-
*
17-
* http://www.st.com/software_license_agreement_liberty_v2
18-
*
19-
* Unless required by applicable law or agreed to in writing, software
20-
* distributed under the License is distributed on an "AS IS" BASIS,
21-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22-
* See the License for the specific language governing permissions and
23-
* limitations under the License.
12+
* This software component is licensed by ST under Ultimate Liberty license
13+
* SLA0044, the "License"; You may not use this file except in compliance with
14+
* the License. You may obtain a copy of the License at:
15+
* http://www.st.com/SLA0044
2416
*
2517
******************************************************************************
2618
*/

0 commit comments

Comments
 (0)