Rev 61 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 61 | Rev 77 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32l1xx_ll_usb.c |
3 | * @file stm32l1xx_ll_usb.c |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief USB Low Layer HAL module driver. |
5 | * @brief USB Low Layer HAL module driver. |
6 | * |
6 | * |
7 | * This file provides firmware functions to manage the following |
7 | * This file provides firmware functions to manage the following |
8 | * functionalities of the USB Peripheral Controller: |
8 | * functionalities of the USB Peripheral Controller: |
9 | * + Initialization/de-initialization functions |
9 | * + Initialization/de-initialization functions |
10 | * + I/O operation functions |
10 | * + I/O operation functions |
11 | * + Peripheral Control functions |
11 | * + Peripheral Control functions |
12 | * + Peripheral State functions |
12 | * + Peripheral State functions |
13 | * |
13 | * |
14 | @verbatim |
14 | ****************************************************************************** |
15 | ============================================================================== |
15 | * @attention |
16 | ##### How to use this driver ##### |
16 | * |
17 | ============================================================================== |
17 | * Copyright (c) 2016 STMicroelectronics. |
18 | [..] |
18 | * All rights reserved. |
19 | (#) Fill parameters of Init structure in USB_OTG_CfgTypeDef structure. |
19 | * |
20 | 20 | * This software is licensed under terms that can be found in the LICENSE file |
|
21 | (#) Call USB_CoreInit() API to initialize the USB Core peripheral. |
21 | * in the root directory of this software component. |
22 | 22 | * If no LICENSE file comes with this software, it is provided AS-IS. |
|
23 | (#) The upper HAL HCD/PCD driver will call the right routines for its internal processes. |
23 | * |
24 | 24 | ****************************************************************************** |
|
25 | @endverbatim |
25 | @verbatim |
26 | ****************************************************************************** |
26 | ============================================================================== |
27 | * @attention |
27 | ##### How to use this driver ##### |
28 | * |
28 | ============================================================================== |
29 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
29 | [..] |
30 | * All rights reserved.</center></h2> |
30 | (#) Fill parameters of Init structure in USB_CfgTypeDef structure. |
31 | * |
31 | |
32 | * This software component is licensed by ST under BSD 3-Clause license, |
32 | (#) Call USB_CoreInit() API to initialize the USB Core peripheral. |
33 | * the "License"; You may not use this file except in compliance with the |
33 | |
34 | * License. You may obtain a copy of the License at: |
34 | (#) The upper HAL HCD/PCD driver will call the right routines for its internal processes. |
35 | * opensource.org/licenses/BSD-3-Clause |
35 | |
36 | * |
36 | @endverbatim |
37 | ****************************************************************************** |
37 | |
38 | */ |
38 | ****************************************************************************** |
39 | 39 | */ |
|
40 | /* Includes ------------------------------------------------------------------*/ |
40 | |
41 | #include "stm32l1xx_hal.h" |
41 | /* Includes ------------------------------------------------------------------*/ |
42 | 42 | #include "stm32l1xx_hal.h" |
|
43 | /** @addtogroup STM32L1xx_LL_USB_DRIVER |
43 | |
44 | * @{ |
44 | /** @addtogroup STM32L1xx_LL_USB_DRIVER |
45 | */ |
45 | * @{ |
46 | 46 | */ |
|
47 | #if defined (HAL_PCD_MODULE_ENABLED) || defined (HAL_HCD_MODULE_ENABLED) |
47 | |
48 | #if defined (USB) |
48 | #if defined (HAL_PCD_MODULE_ENABLED) || defined (HAL_HCD_MODULE_ENABLED) |
49 | /* Private typedef -----------------------------------------------------------*/ |
49 | #if defined (USB) |
50 | /* Private define ------------------------------------------------------------*/ |
50 | /* Private typedef -----------------------------------------------------------*/ |
51 | /* Private macro -------------------------------------------------------------*/ |
51 | /* Private define ------------------------------------------------------------*/ |
52 | /* Private variables ---------------------------------------------------------*/ |
52 | /* Private macro -------------------------------------------------------------*/ |
53 | /* Private function prototypes -----------------------------------------------*/ |
53 | /* Private variables ---------------------------------------------------------*/ |
54 | /* Private functions ---------------------------------------------------------*/ |
54 | /* Private function prototypes -----------------------------------------------*/ |
55 | 55 | /* Private functions ---------------------------------------------------------*/ |
|
56 | 56 | ||
57 | /** |
57 | /** |
58 | * @brief Initializes the USB Core |
58 | * @brief Initializes the USB Core |
59 | * @param USBx USB Instance |
59 | * @param USBx USB Instance |
60 | * @param cfg pointer to a USB_CfgTypeDef structure that contains |
60 | * @param cfg pointer to a USB_CfgTypeDef structure that contains |
61 | * the configuration information for the specified USBx peripheral. |
61 | * the configuration information for the specified USBx peripheral. |
62 | * @retval HAL status |
62 | * @retval HAL status |
63 | */ |
63 | */ |
64 | HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) |
64 | HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) |
65 | { |
65 | { |
66 | /* Prevent unused argument(s) compilation warning */ |
66 | /* Prevent unused argument(s) compilation warning */ |
67 | UNUSED(USBx); |
67 | UNUSED(USBx); |
68 | UNUSED(cfg); |
68 | UNUSED(cfg); |
69 | 69 | ||
70 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
70 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
71 | only by USB OTG FS peripheral. |
71 | only by USB OTG FS peripheral. |
72 | - This function is added to ensure compatibility across platforms. |
72 | - This function is added to ensure compatibility across platforms. |
73 | */ |
73 | */ |
74 | 74 | ||
75 | return HAL_OK; |
75 | return HAL_OK; |
76 | } |
76 | } |
77 | 77 | ||
78 | /** |
78 | /** |
79 | * @brief USB_EnableGlobalInt |
79 | * @brief USB_EnableGlobalInt |
80 | * Enables the controller's Global Int in the AHB Config reg |
80 | * Enables the controller's Global Int in the AHB Config reg |
81 | * @param USBx Selected device |
81 | * @param USBx Selected device |
82 | * @retval HAL status |
82 | * @retval HAL status |
83 | */ |
83 | */ |
84 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx) |
84 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx) |
85 | { |
85 | { |
86 | uint32_t winterruptmask; |
86 | uint32_t winterruptmask; |
87 | 87 | ||
88 | /* Clear pending interrupts */ |
88 | /* Clear pending interrupts */ |
89 | USBx->ISTR = 0U; |
89 | USBx->ISTR = 0U; |
90 | 90 | ||
91 | /* Set winterruptmask variable */ |
91 | /* Set winterruptmask variable */ |
92 | winterruptmask = USB_CNTR_CTRM | USB_CNTR_WKUPM | |
92 | winterruptmask = USB_CNTR_CTRM | USB_CNTR_WKUPM | |
93 | USB_CNTR_SUSPM | USB_CNTR_ERRM | |
93 | USB_CNTR_SUSPM | USB_CNTR_ERRM | |
94 | USB_CNTR_SOFM | USB_CNTR_ESOFM | |
94 | USB_CNTR_SOFM | USB_CNTR_ESOFM | |
95 | USB_CNTR_RESETM; |
95 | USB_CNTR_RESETM; |
96 | 96 | ||
97 | /* Set interrupt mask */ |
97 | /* Set interrupt mask */ |
98 | USBx->CNTR = (uint16_t)winterruptmask; |
98 | USBx->CNTR = (uint16_t)winterruptmask; |
99 | 99 | ||
100 | return HAL_OK; |
100 | return HAL_OK; |
101 | } |
101 | } |
102 | 102 | ||
103 | /** |
103 | /** |
104 | * @brief USB_DisableGlobalInt |
104 | * @brief USB_DisableGlobalInt |
105 | * Disable the controller's Global Int in the AHB Config reg |
105 | * Disable the controller's Global Int in the AHB Config reg |
106 | * @param USBx Selected device |
106 | * @param USBx Selected device |
107 | * @retval HAL status |
107 | * @retval HAL status |
108 | */ |
108 | */ |
109 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx) |
109 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx) |
110 | { |
110 | { |
111 | uint32_t winterruptmask; |
111 | uint32_t winterruptmask; |
112 | 112 | ||
113 | /* Set winterruptmask variable */ |
113 | /* Set winterruptmask variable */ |
114 | winterruptmask = USB_CNTR_CTRM | USB_CNTR_WKUPM | |
114 | winterruptmask = USB_CNTR_CTRM | USB_CNTR_WKUPM | |
115 | USB_CNTR_SUSPM | USB_CNTR_ERRM | |
115 | USB_CNTR_SUSPM | USB_CNTR_ERRM | |
116 | USB_CNTR_SOFM | USB_CNTR_ESOFM | |
116 | USB_CNTR_SOFM | USB_CNTR_ESOFM | |
117 | USB_CNTR_RESETM; |
117 | USB_CNTR_RESETM; |
118 | 118 | ||
119 | /* Clear interrupt mask */ |
119 | /* Clear interrupt mask */ |
120 | USBx->CNTR &= (uint16_t)(~winterruptmask); |
120 | USBx->CNTR &= (uint16_t)(~winterruptmask); |
121 | 121 | ||
122 | return HAL_OK; |
122 | return HAL_OK; |
123 | } |
123 | } |
124 | 124 | ||
125 | /** |
125 | /** |
126 | * @brief USB_SetCurrentMode Set functional mode |
126 | * @brief USB_SetCurrentMode Set functional mode |
127 | * @param USBx Selected device |
127 | * @param USBx Selected device |
128 | * @param mode current core mode |
128 | * @param mode current core mode |
129 | * This parameter can be one of the these values: |
129 | * This parameter can be one of the these values: |
130 | * @arg USB_DEVICE_MODE Peripheral mode |
130 | * @arg USB_DEVICE_MODE Peripheral mode |
131 | * @retval HAL status |
131 | * @retval HAL status |
132 | */ |
132 | */ |
133 | HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode) |
133 | HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode) |
134 | { |
134 | { |
135 | /* Prevent unused argument(s) compilation warning */ |
135 | /* Prevent unused argument(s) compilation warning */ |
136 | UNUSED(USBx); |
136 | UNUSED(USBx); |
137 | UNUSED(mode); |
137 | UNUSED(mode); |
138 | 138 | ||
139 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
139 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
140 | only by USB OTG FS peripheral. |
140 | only by USB OTG FS peripheral. |
141 | - This function is added to ensure compatibility across platforms. |
141 | - This function is added to ensure compatibility across platforms. |
142 | */ |
142 | */ |
143 | return HAL_OK; |
143 | return HAL_OK; |
144 | } |
144 | } |
145 | 145 | ||
146 | /** |
146 | /** |
147 | * @brief USB_DevInit Initializes the USB controller registers |
147 | * @brief USB_DevInit Initializes the USB controller registers |
148 | * for device mode |
148 | * for device mode |
149 | * @param USBx Selected device |
149 | * @param USBx Selected device |
150 | * @param cfg pointer to a USB_CfgTypeDef structure that contains |
150 | * @param cfg pointer to a USB_CfgTypeDef structure that contains |
151 | * the configuration information for the specified USBx peripheral. |
151 | * the configuration information for the specified USBx peripheral. |
152 | * @retval HAL status |
152 | * @retval HAL status |
153 | */ |
153 | */ |
154 | HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) |
154 | HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) |
155 | { |
155 | { |
156 | /* Prevent unused argument(s) compilation warning */ |
156 | /* Prevent unused argument(s) compilation warning */ |
157 | UNUSED(cfg); |
157 | UNUSED(cfg); |
158 | 158 | ||
159 | /* Init Device */ |
159 | /* Init Device */ |
160 | /* CNTR_FRES = 1 */ |
160 | /* CNTR_FRES = 1 */ |
161 | USBx->CNTR = (uint16_t)USB_CNTR_FRES; |
161 | USBx->CNTR = (uint16_t)USB_CNTR_FRES; |
162 | 162 | ||
163 | /* CNTR_FRES = 0 */ |
163 | /* CNTR_FRES = 0 */ |
164 | USBx->CNTR = 0U; |
164 | USBx->CNTR = 0U; |
165 | 165 | ||
166 | /* Clear pending interrupts */ |
166 | /* Clear pending interrupts */ |
167 | USBx->ISTR = 0U; |
167 | USBx->ISTR = 0U; |
168 | 168 | ||
169 | /*Set Btable Address*/ |
169 | /*Set Btable Address*/ |
170 | USBx->BTABLE = BTABLE_ADDRESS; |
170 | USBx->BTABLE = BTABLE_ADDRESS; |
171 | 171 | ||
172 | return HAL_OK; |
172 | return HAL_OK; |
173 | } |
173 | } |
174 | 174 | ||
175 | #if defined (HAL_PCD_MODULE_ENABLED) |
175 | /** |
176 | /** |
176 | * @brief USB_FlushTxFifo : Flush a Tx FIFO |
177 | * @brief Activate and configure an endpoint |
177 | * @param USBx : Selected device |
178 | * @param USBx Selected device |
178 | * @param num : FIFO number |
179 | * @param ep pointer to endpoint structure |
179 | * This parameter can be a value from 1 to 15 |
180 | * @retval HAL status |
180 | 15 means Flush all Tx FIFOs |
181 | */ |
181 | * @retval HAL status |
182 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
182 | */ |
183 | { |
183 | HAL_StatusTypeDef USB_FlushTxFifo(USB_TypeDef const *USBx, uint32_t num) |
184 | HAL_StatusTypeDef ret = HAL_OK; |
184 | { |
185 | uint16_t wEpRegVal; |
185 | /* Prevent unused argument(s) compilation warning */ |
186 | 186 | UNUSED(USBx); |
|
187 | wEpRegVal = PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_T_MASK; |
187 | UNUSED(num); |
188 | 188 | ||
189 | /* initialize Endpoint */ |
189 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
190 | switch (ep->type) |
190 | only by USB OTG FS peripheral. |
191 | { |
191 | - This function is added to ensure compatibility across platforms. |
192 | case EP_TYPE_CTRL: |
192 | */ |
193 | wEpRegVal |= USB_EP_CONTROL; |
193 | |
194 | break; |
194 | return HAL_OK; |
195 | 195 | } |
|
196 | case EP_TYPE_BULK: |
196 | |
197 | wEpRegVal |= USB_EP_BULK; |
197 | /** |
198 | break; |
198 | * @brief USB_FlushRxFifo : Flush Rx FIFO |
199 | 199 | * @param USBx : Selected device |
|
200 | case EP_TYPE_INTR: |
200 | * @retval HAL status |
201 | wEpRegVal |= USB_EP_INTERRUPT; |
201 | */ |
202 | break; |
202 | HAL_StatusTypeDef USB_FlushRxFifo(USB_TypeDef const *USBx) |
203 | 203 | { |
|
204 | case EP_TYPE_ISOC: |
204 | /* Prevent unused argument(s) compilation warning */ |
205 | wEpRegVal |= USB_EP_ISOCHRONOUS; |
205 | UNUSED(USBx); |
206 | break; |
206 | |
207 | 207 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
|
208 | default: |
208 | only by USB OTG FS peripheral. |
209 | ret = HAL_ERROR; |
209 | - This function is added to ensure compatibility across platforms. |
210 | break; |
210 | */ |
211 | } |
211 | |
212 | 212 | return HAL_OK; |
|
213 | PCD_SET_ENDPOINT(USBx, ep->num, (wEpRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); |
213 | } |
214 | 214 | ||
215 | PCD_SET_EP_ADDRESS(USBx, ep->num, ep->num); |
215 | |
216 | 216 | #if defined (HAL_PCD_MODULE_ENABLED) |
|
217 | if (ep->doublebuffer == 0U) |
217 | /** |
218 | { |
218 | * @brief Activate and configure an endpoint |
219 | if (ep->is_in != 0U) |
219 | * @param USBx Selected device |
220 | { |
220 | * @param ep pointer to endpoint structure |
221 | /*Set the endpoint Transmit buffer address */ |
221 | * @retval HAL status |
222 | PCD_SET_EP_TX_ADDRESS(USBx, ep->num, ep->pmaadress); |
222 | */ |
223 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
223 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
224 | 224 | { |
|
225 | if (ep->type != EP_TYPE_ISOC) |
225 | HAL_StatusTypeDef ret = HAL_OK; |
226 | { |
226 | uint16_t wEpRegVal; |
227 | /* Configure NAK status for the Endpoint */ |
227 | |
228 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); |
228 | wEpRegVal = PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_T_MASK; |
229 | } |
229 | |
230 | else |
230 | /* initialize Endpoint */ |
231 | { |
231 | switch (ep->type) |
232 | /* Configure TX Endpoint to disabled state */ |
232 | { |
233 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
233 | case EP_TYPE_CTRL: |
234 | } |
234 | wEpRegVal |= USB_EP_CONTROL; |
235 | } |
235 | break; |
236 | else |
236 | |
237 | { |
237 | case EP_TYPE_BULK: |
238 | /*Set the endpoint Receive buffer address */ |
238 | wEpRegVal |= USB_EP_BULK; |
239 | PCD_SET_EP_RX_ADDRESS(USBx, ep->num, ep->pmaadress); |
239 | break; |
240 | 240 | ||
241 | /*Set the endpoint Receive buffer counter*/ |
241 | case EP_TYPE_INTR: |
242 | PCD_SET_EP_RX_CNT(USBx, ep->num, ep->maxpacket); |
242 | wEpRegVal |= USB_EP_INTERRUPT; |
243 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
243 | break; |
244 | 244 | ||
245 | /* Configure VALID status for the Endpoint*/ |
245 | case EP_TYPE_ISOC: |
246 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
246 | wEpRegVal |= USB_EP_ISOCHRONOUS; |
247 | } |
247 | break; |
248 | } |
248 | |
249 | /*Double Buffer*/ |
249 | default: |
250 | else |
250 | ret = HAL_ERROR; |
251 | { |
251 | break; |
252 | /* Set the endpoint as double buffered */ |
252 | } |
253 | PCD_SET_EP_DBUF(USBx, ep->num); |
253 | |
254 | 254 | PCD_SET_ENDPOINT(USBx, ep->num, (wEpRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); |
|
255 | /* Set buffer address for double buffered mode */ |
255 | |
256 | PCD_SET_EP_DBUF_ADDR(USBx, ep->num, ep->pmaaddr0, ep->pmaaddr1); |
256 | PCD_SET_EP_ADDRESS(USBx, ep->num, ep->num); |
257 | 257 | ||
258 | if (ep->is_in == 0U) |
258 | if (ep->doublebuffer == 0U) |
259 | { |
259 | { |
260 | /* Clear the data toggle bits for the endpoint IN/OUT */ |
260 | if (ep->is_in != 0U) |
261 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
261 | { |
262 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
262 | /*Set the endpoint Transmit buffer address */ |
263 | 263 | PCD_SET_EP_TX_ADDRESS(USBx, ep->num, ep->pmaadress); |
|
264 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
264 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
265 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
265 | |
266 | } |
266 | if (ep->type != EP_TYPE_ISOC) |
267 | else |
267 | { |
268 | { |
268 | /* Configure NAK status for the Endpoint */ |
269 | /* Clear the data toggle bits for the endpoint IN/OUT */ |
269 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); |
270 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
270 | } |
271 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
271 | else |
272 | 272 | { |
|
273 | if (ep->type != EP_TYPE_ISOC) |
273 | /* Configure TX Endpoint to disabled state */ |
274 | { |
274 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
275 | /* Configure NAK status for the Endpoint */ |
275 | } |
276 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); |
276 | } |
277 | } |
277 | else |
278 | else |
278 | { |
279 | { |
279 | /* Set the endpoint Receive buffer address */ |
280 | /* Configure TX Endpoint to disabled state */ |
280 | PCD_SET_EP_RX_ADDRESS(USBx, ep->num, ep->pmaadress); |
281 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
281 | |
282 | } |
282 | /* Set the endpoint Receive buffer counter */ |
283 | 283 | PCD_SET_EP_RX_CNT(USBx, ep->num, ep->maxpacket); |
|
284 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
284 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
285 | } |
285 | |
286 | } |
286 | if (ep->num == 0U) |
287 | 287 | { |
|
288 | return ret; |
288 | /* Configure VALID status for EP0 */ |
289 | } |
289 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
290 | 290 | } |
|
291 | /** |
291 | else |
292 | * @brief De-activate and de-initialize an endpoint |
292 | { |
293 | * @param USBx Selected device |
293 | /* Configure NAK status for OUT Endpoint */ |
294 | * @param ep pointer to endpoint structure |
294 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_NAK); |
295 | * @retval HAL status |
295 | } |
296 | */ |
296 | } |
297 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
297 | } |
298 | { |
298 | #if (USE_USB_DOUBLE_BUFFER == 1U) |
299 | if (ep->doublebuffer == 0U) |
299 | /* Double Buffer */ |
300 | { |
300 | else |
301 | if (ep->is_in != 0U) |
301 | { |
302 | { |
302 | if (ep->type == EP_TYPE_BULK) |
303 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
303 | { |
304 | 304 | /* Set bulk endpoint as double buffered */ |
|
305 | /* Configure DISABLE status for the Endpoint*/ |
305 | PCD_SET_BULK_EP_DBUF(USBx, ep->num); |
306 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
306 | } |
307 | } |
307 | else |
308 | else |
308 | { |
309 | { |
309 | /* Set the ISOC endpoint in double buffer mode */ |
310 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
310 | PCD_CLEAR_EP_KIND(USBx, ep->num); |
311 | 311 | } |
|
312 | /* Configure DISABLE status for the Endpoint*/ |
312 | |
313 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
313 | /* Set buffer address for double buffered mode */ |
314 | } |
314 | PCD_SET_EP_DBUF_ADDR(USBx, ep->num, ep->pmaaddr0, ep->pmaaddr1); |
315 | } |
315 | |
316 | /*Double Buffer*/ |
316 | if (ep->is_in == 0U) |
317 | else |
317 | { |
318 | { |
318 | /* Clear the data toggle bits for the endpoint IN/OUT */ |
319 | if (ep->is_in == 0U) |
319 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
320 | { |
320 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
321 | /* Clear the data toggle bits for the endpoint IN/OUT*/ |
321 | |
322 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
322 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
323 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
323 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
324 | 324 | } |
|
325 | /* Reset value of the data toggle bits for the endpoint out*/ |
325 | else |
326 | PCD_TX_DTOG(USBx, ep->num); |
326 | { |
327 | 327 | /* Clear the data toggle bits for the endpoint IN/OUT */ |
|
328 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
328 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
329 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
329 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
330 | } |
330 | |
331 | else |
331 | if (ep->type != EP_TYPE_ISOC) |
332 | { |
332 | { |
333 | /* Clear the data toggle bits for the endpoint IN/OUT*/ |
333 | /* Configure NAK status for the Endpoint */ |
334 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
334 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); |
335 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
335 | } |
336 | PCD_RX_DTOG(USBx, ep->num); |
336 | else |
337 | 337 | { |
|
338 | /* Configure DISABLE status for the Endpoint*/ |
338 | /* Configure TX Endpoint to disabled state */ |
339 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
339 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
340 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
340 | } |
341 | } |
341 | |
342 | } |
342 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
343 | 343 | } |
|
344 | return HAL_OK; |
344 | } |
345 | } |
345 | #endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ |
346 | 346 | ||
347 | /** |
347 | return ret; |
348 | * @brief USB_EPStartXfer setup and starts a transfer over an EP |
348 | } |
349 | * @param USBx Selected device |
349 | |
350 | * @param ep pointer to endpoint structure |
350 | /** |
351 | * @retval HAL status |
351 | * @brief De-activate and de-initialize an endpoint |
352 | */ |
352 | * @param USBx Selected device |
353 | HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
353 | * @param ep pointer to endpoint structure |
354 | { |
354 | * @retval HAL status |
355 | uint32_t len; |
355 | */ |
356 | uint16_t pmabuffer; |
356 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
357 | uint16_t wEPVal; |
357 | { |
358 | 358 | if (ep->doublebuffer == 0U) |
|
359 | /* IN endpoint */ |
359 | { |
360 | if (ep->is_in == 1U) |
360 | if (ep->is_in != 0U) |
361 | { |
361 | { |
362 | /*Multi packet transfer*/ |
362 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
363 | if (ep->xfer_len > ep->maxpacket) |
363 | |
364 | { |
364 | /* Configure DISABLE status for the Endpoint */ |
365 | len = ep->maxpacket; |
365 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
366 | } |
366 | } |
367 | else |
367 | |
368 | { |
368 | else |
369 | len = ep->xfer_len; |
369 | { |
370 | } |
370 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
371 | 371 | ||
372 | /* configure and validate Tx endpoint */ |
372 | /* Configure DISABLE status for the Endpoint */ |
373 | if (ep->doublebuffer == 0U) |
373 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
374 | { |
374 | } |
375 | USB_WritePMA(USBx, ep->xfer_buff, ep->pmaadress, (uint16_t)len); |
375 | } |
376 | PCD_SET_EP_TX_CNT(USBx, ep->num, len); |
376 | #if (USE_USB_DOUBLE_BUFFER == 1U) |
377 | } |
377 | /* Double Buffer */ |
378 | else |
378 | else |
379 | { |
379 | { |
380 | /* double buffer bulk management */ |
380 | if (ep->is_in == 0U) |
381 | if (ep->type == EP_TYPE_BULK) |
381 | { |
382 | { |
382 | /* Clear the data toggle bits for the endpoint IN/OUT*/ |
383 | if (ep->xfer_len_db > ep->maxpacket) |
383 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
384 | { |
384 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
385 | /* enable double buffer */ |
385 | |
386 | PCD_SET_EP_DBUF(USBx, ep->num); |
386 | /* Reset value of the data toggle bits for the endpoint out*/ |
387 | 387 | PCD_TX_DTOG(USBx, ep->num); |
|
388 | /* each Time to write in PMA xfer_len_db will */ |
388 | |
389 | ep->xfer_len_db -= len; |
389 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
390 | 390 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
|
391 | /* Fill the two first buffer in the Buffer0 & Buffer1 */ |
391 | } |
392 | if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) |
392 | else |
393 | { |
393 | { |
394 | /* Set the Double buffer counter for pmabuffer1 */ |
394 | /* Clear the data toggle bits for the endpoint IN/OUT*/ |
395 | PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); |
395 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
396 | pmabuffer = ep->pmaaddr1; |
396 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
397 | 397 | PCD_RX_DTOG(USBx, ep->num); |
|
398 | /* Write the user buffer to USB PMA */ |
398 | |
399 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
399 | /* Configure DISABLE status for the Endpoint*/ |
400 | ep->xfer_buff += len; |
400 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
401 | 401 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
|
402 | if (ep->xfer_len_db > ep->maxpacket) |
402 | } |
403 | { |
403 | } |
404 | ep->xfer_len_db -= len; |
404 | #endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ |
405 | } |
405 | |
406 | else |
406 | return HAL_OK; |
407 | { |
407 | } |
408 | len = ep->xfer_len_db; |
408 | |
409 | ep->xfer_len_db = 0U; |
409 | /** |
410 | } |
410 | * @brief USB_EPStartXfer setup and starts a transfer over an EP |
411 | 411 | * @param USBx Selected device |
|
412 | /* Set the Double buffer counter for pmabuffer0 */ |
412 | * @param ep pointer to endpoint structure |
413 | PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); |
413 | * @retval HAL status |
414 | pmabuffer = ep->pmaaddr0; |
414 | */ |
415 | 415 | HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
|
416 | /* Write the user buffer to USB PMA */ |
416 | { |
417 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
417 | uint32_t len; |
418 | } |
418 | #if (USE_USB_DOUBLE_BUFFER == 1U) |
419 | else |
419 | uint16_t pmabuffer; |
420 | { |
420 | uint16_t wEPVal; |
421 | /* Set the Double buffer counter for pmabuffer0 */ |
421 | #endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ |
422 | PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); |
422 | |
423 | pmabuffer = ep->pmaaddr0; |
423 | /* IN endpoint */ |
424 | 424 | if (ep->is_in == 1U) |
|
425 | /* Write the user buffer to USB PMA */ |
425 | { |
426 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
426 | /*Multi packet transfer*/ |
427 | ep->xfer_buff += len; |
427 | if (ep->xfer_len > ep->maxpacket) |
428 | 428 | { |
|
429 | if (ep->xfer_len_db > ep->maxpacket) |
429 | len = ep->maxpacket; |
430 | { |
430 | } |
431 | ep->xfer_len_db -= len; |
431 | else |
432 | } |
432 | { |
433 | else |
433 | len = ep->xfer_len; |
434 | { |
434 | } |
435 | len = ep->xfer_len_db; |
435 | |
436 | ep->xfer_len_db = 0U; |
436 | /* configure and validate Tx endpoint */ |
437 | } |
437 | if (ep->doublebuffer == 0U) |
438 | 438 | { |
|
439 | /* Set the Double buffer counter for pmabuffer1 */ |
439 | USB_WritePMA(USBx, ep->xfer_buff, ep->pmaadress, (uint16_t)len); |
440 | PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); |
440 | PCD_SET_EP_TX_CNT(USBx, ep->num, len); |
441 | pmabuffer = ep->pmaaddr1; |
441 | } |
442 | 442 | #if (USE_USB_DOUBLE_BUFFER == 1U) |
|
443 | /* Write the user buffer to USB PMA */ |
443 | else |
444 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
444 | { |
445 | } |
445 | /* double buffer bulk management */ |
446 | } |
446 | if (ep->type == EP_TYPE_BULK) |
447 | /* auto Switch to single buffer mode when transfer <Mps no need to manage in double buffer */ |
447 | { |
448 | else |
448 | if (ep->xfer_len_db > ep->maxpacket) |
449 | { |
449 | { |
450 | len = ep->xfer_len_db; |
450 | /* enable double buffer */ |
451 | 451 | PCD_SET_BULK_EP_DBUF(USBx, ep->num); |
|
452 | /* disable double buffer mode */ |
452 | |
453 | PCD_CLEAR_EP_DBUF(USBx, ep->num); |
453 | /* each Time to write in PMA xfer_len_db will */ |
454 | 454 | ep->xfer_len_db -= len; |
|
455 | /* Set Tx count with nbre of byte to be transmitted */ |
455 | |
456 | PCD_SET_EP_TX_CNT(USBx, ep->num, len); |
456 | /* Fill the two first buffer in the Buffer0 & Buffer1 */ |
457 | pmabuffer = ep->pmaaddr0; |
457 | if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) |
458 | 458 | { |
|
459 | /* Write the user buffer to USB PMA */ |
459 | /* Set the Double buffer counter for pmabuffer1 */ |
460 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
460 | PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); |
461 | } |
461 | pmabuffer = ep->pmaaddr1; |
462 | }/* end if bulk double buffer */ |
462 | |
463 | 463 | /* Write the user buffer to USB PMA */ |
|
464 | /* manage isochronous double buffer IN mode */ |
464 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
465 | else |
465 | ep->xfer_buff += len; |
466 | { |
466 | |
467 | /* enable double buffer */ |
467 | if (ep->xfer_len_db > ep->maxpacket) |
468 | PCD_SET_EP_DBUF(USBx, ep->num); |
468 | { |
469 | 469 | ep->xfer_len_db -= len; |
|
470 | /* each Time to write in PMA xfer_len_db will */ |
470 | } |
471 | ep->xfer_len_db -= len; |
471 | else |
472 | 472 | { |
|
473 | /* Fill the data buffer */ |
473 | len = ep->xfer_len_db; |
474 | if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) |
474 | ep->xfer_len_db = 0U; |
475 | { |
475 | } |
476 | /* Set the Double buffer counter for pmabuffer1 */ |
476 | |
477 | PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); |
477 | /* Set the Double buffer counter for pmabuffer0 */ |
478 | pmabuffer = ep->pmaaddr1; |
478 | PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); |
479 | 479 | pmabuffer = ep->pmaaddr0; |
|
480 | /* Write the user buffer to USB PMA */ |
480 | |
481 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
481 | /* Write the user buffer to USB PMA */ |
482 | ep->xfer_buff += len; |
482 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
483 | 483 | } |
|
484 | if (ep->xfer_len_db > ep->maxpacket) |
484 | else |
485 | { |
485 | { |
486 | ep->xfer_len_db -= len; |
486 | /* Set the Double buffer counter for pmabuffer0 */ |
487 | } |
487 | PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); |
488 | else |
488 | pmabuffer = ep->pmaaddr0; |
489 | { |
489 | |
490 | len = ep->xfer_len_db; |
490 | /* Write the user buffer to USB PMA */ |
491 | ep->xfer_len_db = 0U; |
491 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
492 | } |
492 | ep->xfer_buff += len; |
493 | 493 | ||
494 | if (len > 0U) |
494 | if (ep->xfer_len_db > ep->maxpacket) |
495 | { |
495 | { |
496 | /* Set the Double buffer counter for pmabuffer0 */ |
496 | ep->xfer_len_db -= len; |
497 | PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); |
497 | } |
498 | pmabuffer = ep->pmaaddr0; |
498 | else |
499 | 499 | { |
|
500 | /* Write the user buffer to USB PMA */ |
500 | len = ep->xfer_len_db; |
501 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
501 | ep->xfer_len_db = 0U; |
502 | } |
502 | } |
503 | } |
503 | |
504 | else |
504 | /* Set the Double buffer counter for pmabuffer1 */ |
505 | { |
505 | PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); |
506 | /* Set the Double buffer counter for pmabuffer0 */ |
506 | pmabuffer = ep->pmaaddr1; |
507 | PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); |
507 | |
508 | pmabuffer = ep->pmaaddr0; |
508 | /* Write the user buffer to USB PMA */ |
509 | 509 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
|
510 | /* Write the user buffer to USB PMA */ |
510 | } |
511 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
511 | } |
512 | ep->xfer_buff += len; |
512 | /* auto Switch to single buffer mode when transfer <Mps no need to manage in double buffer */ |
513 | 513 | else |
|
514 | if (ep->xfer_len_db > ep->maxpacket) |
514 | { |
515 | { |
515 | len = ep->xfer_len_db; |
516 | ep->xfer_len_db -= len; |
516 | |
517 | } |
517 | /* disable double buffer mode for Bulk endpoint */ |
518 | else |
518 | PCD_CLEAR_BULK_EP_DBUF(USBx, ep->num); |
519 | { |
519 | |
520 | len = ep->xfer_len_db; |
520 | /* Set Tx count with nbre of byte to be transmitted */ |
521 | ep->xfer_len_db = 0U; |
521 | PCD_SET_EP_TX_CNT(USBx, ep->num, len); |
522 | } |
522 | pmabuffer = ep->pmaaddr0; |
523 | 523 | ||
524 | if (len > 0U) |
524 | /* Write the user buffer to USB PMA */ |
525 | { |
525 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
526 | /* Set the Double buffer counter for pmabuffer1 */ |
526 | } |
527 | PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); |
527 | } |
528 | pmabuffer = ep->pmaaddr1; |
528 | else /* manage isochronous double buffer IN mode */ |
529 | 529 | { |
|
530 | /* Write the user buffer to USB PMA */ |
530 | /* each Time to write in PMA xfer_len_db will */ |
531 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
531 | ep->xfer_len_db -= len; |
532 | } |
532 | |
533 | } |
533 | /* Fill the data buffer */ |
534 | } |
534 | if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) |
535 | } |
535 | { |
536 | 536 | /* Set the Double buffer counter for pmabuffer1 */ |
|
537 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_VALID); |
537 | PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); |
538 | } |
538 | pmabuffer = ep->pmaaddr1; |
539 | else /* OUT endpoint */ |
539 | |
540 | { |
540 | /* Write the user buffer to USB PMA */ |
541 | if (ep->doublebuffer == 0U) |
541 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
542 | { |
542 | } |
543 | /* Multi packet transfer */ |
543 | else |
544 | if (ep->xfer_len > ep->maxpacket) |
544 | { |
545 | { |
545 | /* Set the Double buffer counter for pmabuffer0 */ |
546 | len = ep->maxpacket; |
546 | PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); |
547 | ep->xfer_len -= len; |
547 | pmabuffer = ep->pmaaddr0; |
548 | } |
548 | |
549 | else |
549 | /* Write the user buffer to USB PMA */ |
550 | { |
550 | USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); |
551 | len = ep->xfer_len; |
551 | } |
552 | ep->xfer_len = 0U; |
552 | } |
553 | } |
553 | } |
554 | /* configure and validate Rx endpoint */ |
554 | #endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ |
555 | PCD_SET_EP_RX_CNT(USBx, ep->num, len); |
555 | |
556 | } |
556 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_VALID); |
557 | else |
557 | } |
558 | { |
558 | else /* OUT endpoint */ |
559 | /* First Transfer Coming From HAL_PCD_EP_Receive & From ISR */ |
559 | { |
560 | /* Set the Double buffer counter */ |
560 | if (ep->doublebuffer == 0U) |
561 | if (ep->type == EP_TYPE_BULK) |
561 | { |
562 | { |
562 | /* Multi packet transfer */ |
563 | PCD_SET_EP_DBUF_CNT(USBx, ep->num, ep->is_in, ep->maxpacket); |
563 | if (ep->xfer_len > ep->maxpacket) |
564 | 564 | { |
|
565 | /* Coming from ISR */ |
565 | len = ep->maxpacket; |
566 | if (ep->xfer_count != 0U) |
566 | ep->xfer_len -= len; |
567 | { |
567 | } |
568 | /* update last value to check if there is blocking state */ |
568 | else |
569 | wEPVal = PCD_GET_ENDPOINT(USBx, ep->num); |
569 | { |
570 | 570 | len = ep->xfer_len; |
|
571 | /*Blocking State */ |
571 | ep->xfer_len = 0U; |
572 | if ((((wEPVal & USB_EP_DTOG_RX) != 0U) && ((wEPVal & USB_EP_DTOG_TX) != 0U)) || |
572 | } |
573 | (((wEPVal & USB_EP_DTOG_RX) == 0U) && ((wEPVal & USB_EP_DTOG_TX) == 0U))) |
573 | /* configure and validate Rx endpoint */ |
574 | { |
574 | PCD_SET_EP_RX_CNT(USBx, ep->num, len); |
575 | PCD_FreeUserBuffer(USBx, ep->num, 0U); |
575 | } |
576 | } |
576 | #if (USE_USB_DOUBLE_BUFFER == 1U) |
577 | } |
577 | else |
578 | } |
578 | { |
579 | /* iso out double */ |
579 | /* First Transfer Coming From HAL_PCD_EP_Receive & From ISR */ |
580 | else if (ep->type == EP_TYPE_ISOC) |
580 | /* Set the Double buffer counter */ |
581 | { |
581 | if (ep->type == EP_TYPE_BULK) |
582 | /* Multi packet transfer */ |
582 | { |
583 | if (ep->xfer_len > ep->maxpacket) |
583 | PCD_SET_EP_DBUF_CNT(USBx, ep->num, ep->is_in, ep->maxpacket); |
584 | { |
584 | |
585 | len = ep->maxpacket; |
585 | /* Coming from ISR */ |
586 | ep->xfer_len -= len; |
586 | if (ep->xfer_count != 0U) |
587 | } |
587 | { |
588 | else |
588 | /* update last value to check if there is blocking state */ |
589 | { |
589 | wEPVal = PCD_GET_ENDPOINT(USBx, ep->num); |
590 | len = ep->xfer_len; |
590 | |
591 | ep->xfer_len = 0U; |
591 | /*Blocking State */ |
592 | } |
592 | if ((((wEPVal & USB_EP_DTOG_RX) != 0U) && ((wEPVal & USB_EP_DTOG_TX) != 0U)) || |
593 | PCD_SET_EP_DBUF_CNT(USBx, ep->num, ep->is_in, len); |
593 | (((wEPVal & USB_EP_DTOG_RX) == 0U) && ((wEPVal & USB_EP_DTOG_TX) == 0U))) |
594 | } |
594 | { |
595 | else |
595 | PCD_FREE_USER_BUFFER(USBx, ep->num, 0U); |
596 | { |
596 | } |
597 | return HAL_ERROR; |
597 | } |
598 | } |
598 | } |
599 | } |
599 | /* iso out double */ |
600 | 600 | else if (ep->type == EP_TYPE_ISOC) |
|
601 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
601 | { |
602 | } |
602 | /* Multi packet transfer */ |
603 | 603 | if (ep->xfer_len > ep->maxpacket) |
|
604 | return HAL_OK; |
604 | { |
605 | } |
605 | len = ep->maxpacket; |
606 | 606 | ep->xfer_len -= len; |
|
607 | 607 | } |
|
608 | /** |
608 | else |
609 | * @brief USB_EPSetStall set a stall condition over an EP |
609 | { |
610 | * @param USBx Selected device |
610 | len = ep->xfer_len; |
611 | * @param ep pointer to endpoint structure |
611 | ep->xfer_len = 0U; |
612 | * @retval HAL status |
612 | } |
613 | */ |
613 | PCD_SET_EP_DBUF_CNT(USBx, ep->num, ep->is_in, len); |
614 | HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
614 | } |
615 | { |
615 | else |
616 | if (ep->is_in != 0U) |
616 | { |
617 | { |
617 | return HAL_ERROR; |
618 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_STALL); |
618 | } |
619 | } |
619 | } |
620 | else |
620 | #endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ |
621 | { |
621 | |
622 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_STALL); |
622 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
623 | } |
623 | } |
624 | 624 | ||
625 | return HAL_OK; |
625 | return HAL_OK; |
626 | } |
626 | } |
627 | 627 | ||
628 | /** |
628 | |
629 | * @brief USB_EPClearStall Clear a stall condition over an EP |
629 | /** |
630 | * @param USBx Selected device |
630 | * @brief USB_EPSetStall set a stall condition over an EP |
631 | * @param ep pointer to endpoint structure |
631 | * @param USBx Selected device |
632 | * @retval HAL status |
632 | * @param ep pointer to endpoint structure |
633 | */ |
633 | * @retval HAL status |
634 | HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
634 | */ |
635 | { |
635 | HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
636 | if (ep->doublebuffer == 0U) |
636 | { |
637 | { |
637 | if (ep->is_in != 0U) |
638 | if (ep->is_in != 0U) |
638 | { |
639 | { |
639 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_STALL); |
640 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
640 | } |
641 | 641 | else |
|
642 | if (ep->type != EP_TYPE_ISOC) |
642 | { |
643 | { |
643 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_STALL); |
644 | /* Configure NAK status for the Endpoint */ |
644 | } |
645 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); |
645 | |
646 | } |
646 | return HAL_OK; |
647 | } |
647 | } |
648 | else |
648 | |
649 | { |
649 | /** |
650 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
650 | * @brief USB_EPClearStall Clear a stall condition over an EP |
651 | 651 | * @param USBx Selected device |
|
652 | /* Configure VALID status for the Endpoint */ |
652 | * @param ep pointer to endpoint structure |
653 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
653 | * @retval HAL status |
654 | } |
654 | */ |
655 | } |
655 | HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
656 | 656 | { |
|
657 | return HAL_OK; |
657 | if (ep->doublebuffer == 0U) |
658 | } |
658 | { |
659 | #endif |
659 | if (ep->is_in != 0U) |
660 | 660 | { |
|
661 | /** |
661 | PCD_CLEAR_TX_DTOG(USBx, ep->num); |
662 | * @brief USB_StopDevice Stop the usb device mode |
662 | |
663 | * @param USBx Selected device |
663 | if (ep->type != EP_TYPE_ISOC) |
664 | * @retval HAL status |
664 | { |
665 | */ |
665 | /* Configure NAK status for the Endpoint */ |
666 | HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx) |
666 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); |
667 | { |
667 | } |
668 | /* disable all interrupts and force USB reset */ |
668 | } |
669 | USBx->CNTR = (uint16_t)USB_CNTR_FRES; |
669 | else |
670 | 670 | { |
|
671 | /* clear interrupt status register */ |
671 | PCD_CLEAR_RX_DTOG(USBx, ep->num); |
672 | USBx->ISTR = 0U; |
672 | |
673 | 673 | /* Configure VALID status for the Endpoint */ |
|
674 | /* switch-off device */ |
674 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); |
675 | USBx->CNTR = (uint16_t)(USB_CNTR_FRES | USB_CNTR_PDWN); |
675 | } |
676 | 676 | } |
|
677 | return HAL_OK; |
677 | |
678 | } |
678 | return HAL_OK; |
679 | 679 | } |
|
680 | /** |
680 | |
681 | * @brief USB_SetDevAddress Stop the usb device mode |
681 | /** |
682 | * @param USBx Selected device |
682 | * @brief USB_EPStoptXfer Stop transfer on an EP |
683 | * @param address new device address to be assigned |
683 | * @param USBx usb device instance |
684 | * This parameter can be a value from 0 to 255 |
684 | * @param ep pointer to endpoint structure |
685 | * @retval HAL status |
685 | * @retval HAL status |
686 | */ |
686 | */ |
687 | HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address) |
687 | HAL_StatusTypeDef USB_EPStopXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep) |
688 | { |
688 | { |
689 | if (address == 0U) |
689 | /* IN endpoint */ |
690 | { |
690 | if (ep->is_in == 1U) |
691 | /* set device address and enable function */ |
691 | { |
692 | USBx->DADDR = (uint16_t)USB_DADDR_EF; |
692 | if (ep->doublebuffer == 0U) |
693 | } |
693 | { |
694 | 694 | if (ep->type != EP_TYPE_ISOC) |
|
695 | return HAL_OK; |
695 | { |
696 | } |
696 | /* Configure NAK status for the Endpoint */ |
697 | 697 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); |
|
698 | /** |
698 | } |
699 | * @brief USB_DevConnect Connect the USB device by enabling the pull-up/pull-down |
699 | else |
700 | * @param USBx Selected device |
700 | { |
701 | * @retval HAL status |
701 | /* Configure TX Endpoint to disabled state */ |
702 | */ |
702 | PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); |
703 | HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx) |
703 | } |
704 | { |
704 | } |
705 | /* Prevent unused argument(s) compilation warning */ |
705 | } |
706 | UNUSED(USBx); |
706 | else /* OUT endpoint */ |
707 | 707 | { |
|
708 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
708 | if (ep->doublebuffer == 0U) |
709 | only by USB OTG FS peripheral. |
709 | { |
710 | - This function is added to ensure compatibility across platforms. |
710 | if (ep->type != EP_TYPE_ISOC) |
711 | */ |
711 | { |
712 | 712 | /* Configure NAK status for the Endpoint */ |
|
713 | return HAL_OK; |
713 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_NAK); |
714 | } |
714 | } |
715 | 715 | else |
|
716 | /** |
716 | { |
717 | * @brief USB_DevDisconnect Disconnect the USB device by disabling the pull-up/pull-down |
717 | /* Configure RX Endpoint to disabled state */ |
718 | * @param USBx Selected device |
718 | PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); |
719 | * @retval HAL status |
719 | } |
720 | */ |
720 | } |
721 | HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx) |
721 | } |
722 | { |
722 | |
723 | /* Prevent unused argument(s) compilation warning */ |
723 | return HAL_OK; |
724 | UNUSED(USBx); |
724 | } |
725 | 725 | #endif /* defined (HAL_PCD_MODULE_ENABLED) */ |
|
726 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
726 | |
727 | only by USB OTG FS peripheral. |
727 | /** |
728 | - This function is added to ensure compatibility across platforms. |
728 | * @brief USB_StopDevice Stop the usb device mode |
729 | */ |
729 | * @param USBx Selected device |
730 | 730 | * @retval HAL status |
|
731 | return HAL_OK; |
731 | */ |
732 | } |
732 | HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx) |
733 | 733 | { |
|
734 | /** |
734 | /* disable all interrupts and force USB reset */ |
735 | * @brief USB_ReadInterrupts return the global USB interrupt status |
735 | USBx->CNTR = (uint16_t)USB_CNTR_FRES; |
736 | * @param USBx Selected device |
736 | |
737 | * @retval HAL status |
737 | /* clear interrupt status register */ |
738 | */ |
738 | USBx->ISTR = 0U; |
739 | uint32_t USB_ReadInterrupts(USB_TypeDef *USBx) |
739 | |
740 | { |
740 | /* switch-off device */ |
741 | uint32_t tmpreg; |
741 | USBx->CNTR = (uint16_t)(USB_CNTR_FRES | USB_CNTR_PDWN); |
742 | 742 | ||
743 | tmpreg = USBx->ISTR; |
743 | return HAL_OK; |
744 | return tmpreg; |
744 | } |
745 | } |
745 | |
746 | 746 | /** |
|
747 | /** |
747 | * @brief USB_SetDevAddress Stop the usb device mode |
748 | * @brief USB_ActivateRemoteWakeup : active remote wakeup signalling |
748 | * @param USBx Selected device |
749 | * @param USBx Selected device |
749 | * @param address new device address to be assigned |
750 | * @retval HAL status |
750 | * This parameter can be a value from 0 to 255 |
751 | */ |
751 | * @retval HAL status |
752 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx) |
752 | */ |
753 | { |
753 | HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address) |
754 | USBx->CNTR |= (uint16_t)USB_CNTR_RESUME; |
754 | { |
755 | 755 | if (address == 0U) |
|
756 | return HAL_OK; |
756 | { |
757 | } |
757 | /* set device address and enable function */ |
758 | 758 | USBx->DADDR = (uint16_t)USB_DADDR_EF; |
|
759 | /** |
759 | } |
760 | * @brief USB_DeActivateRemoteWakeup de-active remote wakeup signalling |
760 | |
761 | * @param USBx Selected device |
761 | return HAL_OK; |
762 | * @retval HAL status |
762 | } |
763 | */ |
763 | |
764 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx) |
764 | /** |
765 | { |
765 | * @brief USB_DevConnect Connect the USB device by enabling the pull-up/pull-down |
766 | USBx->CNTR &= (uint16_t)(~USB_CNTR_RESUME); |
766 | * @param USBx Selected device |
767 | 767 | * @retval HAL status |
|
768 | return HAL_OK; |
768 | */ |
769 | } |
769 | HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx) |
770 | 770 | { |
|
771 | /** |
771 | /* Prevent unused argument(s) compilation warning */ |
772 | * @brief Copy a buffer from user memory area to packet memory area (PMA) |
772 | UNUSED(USBx); |
773 | * @param USBx USB peripheral instance register address. |
773 | |
774 | * @param pbUsrBuf pointer to user memory area. |
774 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
775 | * @param wPMABufAddr address into PMA. |
775 | only by USB OTG FS peripheral. |
776 | * @param wNBytes no. of bytes to be copied. |
776 | - This function is added to ensure compatibility across platforms. |
777 | * @retval None |
777 | */ |
778 | */ |
778 | |
779 | void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) |
779 | return HAL_OK; |
780 | { |
780 | } |
781 | uint32_t n = ((uint32_t)wNBytes + 1U) >> 1; |
781 | |
782 | uint32_t BaseAddr = (uint32_t)USBx; |
782 | /** |
783 | uint32_t i, temp1, temp2; |
783 | * @brief USB_DevDisconnect Disconnect the USB device by disabling the pull-up/pull-down |
784 | __IO uint16_t *pdwVal; |
784 | * @param USBx Selected device |
785 | uint8_t *pBuf = pbUsrBuf; |
785 | * @retval HAL status |
786 | 786 | */ |
|
787 | pdwVal = (__IO uint16_t *)(BaseAddr + 0x400U + ((uint32_t)wPMABufAddr * PMA_ACCESS)); |
787 | HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx) |
788 | 788 | { |
|
789 | for (i = n; i != 0U; i--) |
789 | /* Prevent unused argument(s) compilation warning */ |
790 | { |
790 | UNUSED(USBx); |
791 | temp1 = *pBuf; |
791 | |
792 | pBuf++; |
792 | /* NOTE : - This function is not required by USB Device FS peripheral, it is used |
793 | temp2 = temp1 | ((uint16_t)((uint16_t) *pBuf << 8)); |
793 | only by USB OTG FS peripheral. |
794 | *pdwVal = (uint16_t)temp2; |
794 | - This function is added to ensure compatibility across platforms. |
795 | pdwVal++; |
795 | */ |
796 | 796 | ||
797 | #if PMA_ACCESS > 1U |
797 | return HAL_OK; |
798 | pdwVal++; |
798 | } |
799 | #endif |
799 | |
800 | 800 | /** |
|
801 | pBuf++; |
801 | * @brief USB_ReadInterrupts return the global USB interrupt status |
802 | } |
802 | * @param USBx Selected device |
803 | } |
803 | * @retval USB Global Interrupt status |
804 | 804 | */ |
|
805 | /** |
805 | uint32_t USB_ReadInterrupts(USB_TypeDef const *USBx) |
806 | * @brief Copy data from packet memory area (PMA) to user memory buffer |
806 | { |
807 | * @param USBx USB peripheral instance register address. |
807 | uint32_t tmpreg; |
808 | * @param pbUsrBuf pointer to user memory area. |
808 | |
809 | * @param wPMABufAddr address into PMA. |
809 | tmpreg = USBx->ISTR; |
810 | * @param wNBytes no. of bytes to be copied. |
810 | return tmpreg; |
811 | * @retval None |
811 | } |
812 | */ |
812 | |
813 | void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) |
813 | /** |
814 | { |
814 | * @brief USB_ActivateRemoteWakeup : active remote wakeup signalling |
815 | uint32_t n = (uint32_t)wNBytes >> 1; |
815 | * @param USBx Selected device |
816 | uint32_t BaseAddr = (uint32_t)USBx; |
816 | * @retval HAL status |
817 | uint32_t i, temp; |
817 | */ |
818 | __IO uint16_t *pdwVal; |
818 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx) |
819 | uint8_t *pBuf = pbUsrBuf; |
819 | { |
820 | 820 | USBx->CNTR |= (uint16_t)USB_CNTR_RESUME; |
|
821 | pdwVal = (__IO uint16_t *)(BaseAddr + 0x400U + ((uint32_t)wPMABufAddr * PMA_ACCESS)); |
821 | |
822 | 822 | return HAL_OK; |
|
823 | for (i = n; i != 0U; i--) |
823 | } |
824 | { |
824 | |
825 | temp = *(__IO uint16_t *)pdwVal; |
825 | /** |
826 | pdwVal++; |
826 | * @brief USB_DeActivateRemoteWakeup de-active remote wakeup signalling |
827 | *pBuf = (uint8_t)((temp >> 0) & 0xFFU); |
827 | * @param USBx Selected device |
828 | pBuf++; |
828 | * @retval HAL status |
829 | *pBuf = (uint8_t)((temp >> 8) & 0xFFU); |
829 | */ |
830 | pBuf++; |
830 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx) |
831 | 831 | { |
|
832 | #if PMA_ACCESS > 1U |
832 | USBx->CNTR &= (uint16_t)(~USB_CNTR_RESUME); |
833 | pdwVal++; |
833 | |
834 | #endif |
834 | return HAL_OK; |
835 | } |
835 | } |
836 | 836 | ||
837 | if ((wNBytes % 2U) != 0U) |
837 | /** |
838 | { |
838 | * @brief Copy a buffer from user memory area to packet memory area (PMA) |
839 | temp = *pdwVal; |
839 | * @param USBx USB peripheral instance register address. |
840 | *pBuf = (uint8_t)((temp >> 0) & 0xFFU); |
840 | * @param pbUsrBuf pointer to user memory area. |
841 | } |
841 | * @param wPMABufAddr address into PMA. |
842 | } |
842 | * @param wNBytes no. of bytes to be copied. |
843 | 843 | * @retval None |
|
844 | 844 | */ |
|
845 | /** |
845 | void USB_WritePMA(USB_TypeDef const *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) |
846 | * @} |
846 | { |
847 | */ |
847 | uint32_t n = ((uint32_t)wNBytes + 1U) >> 1; |
848 | 848 | uint32_t BaseAddr = (uint32_t)USBx; |
|
849 | /** |
849 | uint32_t count; |
850 | * @} |
850 | uint16_t WrVal; |
851 | */ |
851 | __IO uint16_t *pdwVal; |
852 | #endif /* defined (USB) */ |
852 | uint8_t *pBuf = pbUsrBuf; |
853 | #endif /* defined (HAL_PCD_MODULE_ENABLED) || defined (HAL_HCD_MODULE_ENABLED) */ |
853 | |
854 | 854 | pdwVal = (__IO uint16_t *)(BaseAddr + 0x400U + ((uint32_t)wPMABufAddr * PMA_ACCESS)); |
|
855 | /** |
855 | |
856 | * @} |
856 | for (count = n; count != 0U; count--) |
857 | */ |
857 | { |
858 | 858 | WrVal = pBuf[0]; |
|
859 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
859 | WrVal |= (uint16_t)pBuf[1] << 8; |
- | 860 | *pdwVal = (WrVal & 0xFFFFU); |
|
- | 861 | pdwVal++; |
|
- | 862 | ||
- | 863 | #if PMA_ACCESS > 1U |
|
- | 864 | pdwVal++; |
|
- | 865 | #endif /* PMA_ACCESS */ |
|
- | 866 | ||
- | 867 | pBuf++; |
|
- | 868 | pBuf++; |
|
- | 869 | } |
|
- | 870 | } |
|
- | 871 | ||
- | 872 | /** |
|
- | 873 | * @brief Copy data from packet memory area (PMA) to user memory buffer |
|
- | 874 | * @param USBx USB peripheral instance register address. |
|
- | 875 | * @param pbUsrBuf pointer to user memory area. |
|
- | 876 | * @param wPMABufAddr address into PMA. |
|
- | 877 | * @param wNBytes no. of bytes to be copied. |
|
- | 878 | * @retval None |
|
- | 879 | */ |
|
- | 880 | void USB_ReadPMA(USB_TypeDef const *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) |
|
- | 881 | { |
|
- | 882 | uint32_t n = (uint32_t)wNBytes >> 1; |
|
- | 883 | uint32_t BaseAddr = (uint32_t)USBx; |
|
- | 884 | uint32_t count; |
|
- | 885 | uint32_t RdVal; |
|
- | 886 | __IO uint16_t *pdwVal; |
|
- | 887 | uint8_t *pBuf = pbUsrBuf; |
|
- | 888 | ||
- | 889 | pdwVal = (__IO uint16_t *)(BaseAddr + 0x400U + ((uint32_t)wPMABufAddr * PMA_ACCESS)); |
|
- | 890 | ||
- | 891 | for (count = n; count != 0U; count--) |
|
- | 892 | { |
|
- | 893 | RdVal = *(__IO uint16_t *)pdwVal; |
|
- | 894 | pdwVal++; |
|
- | 895 | *pBuf = (uint8_t)((RdVal >> 0) & 0xFFU); |
|
- | 896 | pBuf++; |
|
- | 897 | *pBuf = (uint8_t)((RdVal >> 8) & 0xFFU); |
|
- | 898 | pBuf++; |
|
- | 899 | ||
- | 900 | #if PMA_ACCESS > 1U |
|
- | 901 | pdwVal++; |
|
- | 902 | #endif /* PMA_ACCESS */ |
|
- | 903 | } |
|
- | 904 | ||
- | 905 | if ((wNBytes % 2U) != 0U) |
|
- | 906 | { |
|
- | 907 | RdVal = *pdwVal; |
|
- | 908 | *pBuf = (uint8_t)((RdVal >> 0) & 0xFFU); |
|
- | 909 | } |
|
- | 910 | } |
|
- | 911 | ||
- | 912 | ||
- | 913 | /** |
|
- | 914 | * @} |
|
- | 915 | */ |
|
- | 916 | ||
- | 917 | /** |
|
- | 918 | * @} |
|
- | 919 | */ |
|
- | 920 | #endif /* defined (USB) */ |
|
- | 921 | #endif /* defined (HAL_PCD_MODULE_ENABLED) || defined (HAL_HCD_MODULE_ENABLED) */ |
|
- | 922 | ||
- | 923 | /** |
|
- | 924 | * @} |
|
- | 925 | */ |