1 | /**
|
---|
2 | ******************************************************************************
|
---|
3 | * @file stm32f4xx_ll_usb.h
|
---|
4 | * @author MCD Application Team
|
---|
5 | * @brief Header file of USB Low Layer HAL module.
|
---|
6 | ******************************************************************************
|
---|
7 | * @attention
|
---|
8 | *
|
---|
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
---|
10 | * All rights reserved.</center></h2>
|
---|
11 | *
|
---|
12 | * This software component is licensed by ST under BSD 3-Clause license,
|
---|
13 | * the "License"; You may not use this file except in compliance with the
|
---|
14 | * License. You may obtain a copy of the License at:
|
---|
15 | * opensource.org/licenses/BSD-3-Clause
|
---|
16 | *
|
---|
17 | ******************************************************************************
|
---|
18 | */
|
---|
19 |
|
---|
20 | /* Define to prevent recursive inclusion -------------------------------------*/
|
---|
21 | #ifndef STM32F4xx_LL_USB_H
|
---|
22 | #define STM32F4xx_LL_USB_H
|
---|
23 |
|
---|
24 | #ifdef __cplusplus
|
---|
25 | extern "C" {
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | /* Includes ------------------------------------------------------------------*/
|
---|
29 | #include "stm32f4xx_hal_def.h"
|
---|
30 |
|
---|
31 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
---|
32 | /** @addtogroup STM32F4xx_HAL_Driver
|
---|
33 | * @{
|
---|
34 | */
|
---|
35 |
|
---|
36 | /** @addtogroup USB_LL
|
---|
37 | * @{
|
---|
38 | */
|
---|
39 |
|
---|
40 | /* Exported types ------------------------------------------------------------*/
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * @brief USB Mode definition
|
---|
44 | */
|
---|
45 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
---|
46 |
|
---|
47 | typedef enum
|
---|
48 | {
|
---|
49 | USB_DEVICE_MODE = 0,
|
---|
50 | USB_HOST_MODE = 1,
|
---|
51 | USB_DRD_MODE = 2
|
---|
52 | } USB_OTG_ModeTypeDef;
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * @brief URB States definition
|
---|
56 | */
|
---|
57 | typedef enum
|
---|
58 | {
|
---|
59 | URB_IDLE = 0,
|
---|
60 | URB_DONE,
|
---|
61 | URB_NOTREADY,
|
---|
62 | URB_NYET,
|
---|
63 | URB_ERROR,
|
---|
64 | URB_STALL
|
---|
65 | } USB_OTG_URBStateTypeDef;
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * @brief Host channel States definition
|
---|
69 | */
|
---|
70 | typedef enum
|
---|
71 | {
|
---|
72 | HC_IDLE = 0,
|
---|
73 | HC_XFRC,
|
---|
74 | HC_HALTED,
|
---|
75 | HC_NAK,
|
---|
76 | HC_NYET,
|
---|
77 | HC_STALL,
|
---|
78 | HC_XACTERR,
|
---|
79 | HC_BBLERR,
|
---|
80 | HC_DATATGLERR
|
---|
81 | } USB_OTG_HCStateTypeDef;
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * @brief USB Instance Initialization Structure definition
|
---|
85 | */
|
---|
86 | typedef struct
|
---|
87 | {
|
---|
88 | uint32_t dev_endpoints; /*!< Device Endpoints number.
|
---|
89 | This parameter depends on the used USB core.
|
---|
90 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
---|
91 |
|
---|
92 | uint32_t Host_channels; /*!< Host Channels number.
|
---|
93 | This parameter Depends on the used USB core.
|
---|
94 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
---|
95 |
|
---|
96 | uint32_t speed; /*!< USB Core speed.
|
---|
97 | This parameter can be any value of @ref USB_Core_Speed */
|
---|
98 |
|
---|
99 | uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA used only for OTG HS. */
|
---|
100 |
|
---|
101 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */
|
---|
102 |
|
---|
103 | uint32_t phy_itface; /*!< Select the used PHY interface.
|
---|
104 | This parameter can be any value of @ref USB_Core_PHY */
|
---|
105 |
|
---|
106 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */
|
---|
107 |
|
---|
108 | uint32_t low_power_enable; /*!< Enable or disable the low power mode. */
|
---|
109 |
|
---|
110 | uint32_t lpm_enable; /*!< Enable or disable Link Power Management. */
|
---|
111 |
|
---|
112 | uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */
|
---|
113 |
|
---|
114 | uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */
|
---|
115 |
|
---|
116 | uint32_t use_dedicated_ep1; /*!< Enable or disable the use of the dedicated EP1 interrupt. */
|
---|
117 |
|
---|
118 | uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */
|
---|
119 |
|
---|
120 | } USB_OTG_CfgTypeDef;
|
---|
121 |
|
---|
122 | typedef struct
|
---|
123 | {
|
---|
124 | uint8_t num; /*!< Endpoint number
|
---|
125 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
---|
126 |
|
---|
127 | uint8_t is_in; /*!< Endpoint direction
|
---|
128 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
129 |
|
---|
130 | uint8_t is_stall; /*!< Endpoint stall condition
|
---|
131 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
132 |
|
---|
133 | uint8_t type; /*!< Endpoint type
|
---|
134 | This parameter can be any value of @ref USB_EP_Type_ */
|
---|
135 |
|
---|
136 | uint8_t data_pid_start; /*!< Initial data PID
|
---|
137 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
138 |
|
---|
139 | uint8_t even_odd_frame; /*!< IFrame parity
|
---|
140 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
141 |
|
---|
142 | uint16_t tx_fifo_num; /*!< Transmission FIFO number
|
---|
143 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
---|
144 |
|
---|
145 | uint32_t maxpacket; /*!< Endpoint Max packet size
|
---|
146 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
|
---|
147 |
|
---|
148 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */
|
---|
149 |
|
---|
150 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */
|
---|
151 |
|
---|
152 | uint32_t xfer_len; /*!< Current transfer length */
|
---|
153 |
|
---|
154 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */
|
---|
155 | } USB_OTG_EPTypeDef;
|
---|
156 |
|
---|
157 | typedef struct
|
---|
158 | {
|
---|
159 | uint8_t dev_addr; /*!< USB device address.
|
---|
160 | This parameter must be a number between Min_Data = 1 and Max_Data = 255 */
|
---|
161 |
|
---|
162 | uint8_t ch_num; /*!< Host channel number.
|
---|
163 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
---|
164 |
|
---|
165 | uint8_t ep_num; /*!< Endpoint number.
|
---|
166 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
---|
167 |
|
---|
168 | uint8_t ep_is_in; /*!< Endpoint direction
|
---|
169 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
170 |
|
---|
171 | uint8_t speed; /*!< USB Host speed.
|
---|
172 | This parameter can be any value of @ref USB_Core_Speed_ */
|
---|
173 |
|
---|
174 | uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */
|
---|
175 |
|
---|
176 | uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */
|
---|
177 |
|
---|
178 | uint8_t ep_type; /*!< Endpoint Type.
|
---|
179 | This parameter can be any value of @ref USB_EP_Type_ */
|
---|
180 |
|
---|
181 | uint16_t max_packet; /*!< Endpoint Max packet size.
|
---|
182 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
|
---|
183 |
|
---|
184 | uint8_t data_pid; /*!< Initial data PID.
|
---|
185 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
186 |
|
---|
187 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */
|
---|
188 |
|
---|
189 | uint32_t XferSize; /*!< OTG Channel transfer size. */
|
---|
190 |
|
---|
191 | uint32_t xfer_len; /*!< Current transfer length. */
|
---|
192 |
|
---|
193 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */
|
---|
194 |
|
---|
195 | uint8_t toggle_in; /*!< IN transfer current toggle flag.
|
---|
196 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
197 |
|
---|
198 | uint8_t toggle_out; /*!< OUT transfer current toggle flag
|
---|
199 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
---|
200 |
|
---|
201 | uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */
|
---|
202 |
|
---|
203 | uint32_t ErrCnt; /*!< Host channel error count. */
|
---|
204 |
|
---|
205 | USB_OTG_URBStateTypeDef urb_state; /*!< URB state.
|
---|
206 | This parameter can be any value of @ref USB_OTG_URBStateTypeDef */
|
---|
207 |
|
---|
208 | USB_OTG_HCStateTypeDef state; /*!< Host Channel state.
|
---|
209 | This parameter can be any value of @ref USB_OTG_HCStateTypeDef */
|
---|
210 | } USB_OTG_HCTypeDef;
|
---|
211 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
---|
212 |
|
---|
213 |
|
---|
214 | /* Exported constants --------------------------------------------------------*/
|
---|
215 |
|
---|
216 | /** @defgroup PCD_Exported_Constants PCD Exported Constants
|
---|
217 | * @{
|
---|
218 | */
|
---|
219 |
|
---|
220 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
---|
221 | /** @defgroup USB_OTG_CORE VERSION ID
|
---|
222 | * @{
|
---|
223 | */
|
---|
224 | #define USB_OTG_CORE_ID_300A 0x4F54300AU
|
---|
225 | #define USB_OTG_CORE_ID_310A 0x4F54310AU
|
---|
226 | /**
|
---|
227 | * @}
|
---|
228 | */
|
---|
229 |
|
---|
230 | /** @defgroup USB_Core_Mode_ USB Core Mode
|
---|
231 | * @{
|
---|
232 | */
|
---|
233 | #define USB_OTG_MODE_DEVICE 0U
|
---|
234 | #define USB_OTG_MODE_HOST 1U
|
---|
235 | #define USB_OTG_MODE_DRD 2U
|
---|
236 | /**
|
---|
237 | * @}
|
---|
238 | */
|
---|
239 |
|
---|
240 | /** @defgroup USB_LL Device Speed
|
---|
241 | * @{
|
---|
242 | */
|
---|
243 | #define USBD_HS_SPEED 0U
|
---|
244 | #define USBD_HSINFS_SPEED 1U
|
---|
245 | #define USBH_HS_SPEED 0U
|
---|
246 | #define USBD_FS_SPEED 2U
|
---|
247 | #define USBH_FSLS_SPEED 1U
|
---|
248 | /**
|
---|
249 | * @}
|
---|
250 | */
|
---|
251 |
|
---|
252 | /** @defgroup USB_LL_Core_Speed USB Low Layer Core Speed
|
---|
253 | * @{
|
---|
254 | */
|
---|
255 | #define USB_OTG_SPEED_HIGH 0U
|
---|
256 | #define USB_OTG_SPEED_HIGH_IN_FULL 1U
|
---|
257 | #define USB_OTG_SPEED_FULL 3U
|
---|
258 | /**
|
---|
259 | * @}
|
---|
260 | */
|
---|
261 |
|
---|
262 | /** @defgroup USB_LL_Core_PHY USB Low Layer Core PHY
|
---|
263 | * @{
|
---|
264 | */
|
---|
265 | #define USB_OTG_ULPI_PHY 1U
|
---|
266 | #define USB_OTG_EMBEDDED_PHY 2U
|
---|
267 | /**
|
---|
268 | * @}
|
---|
269 | */
|
---|
270 |
|
---|
271 | /** @defgroup USB_LL_Turnaround_Timeout Turnaround Timeout Value
|
---|
272 | * @{
|
---|
273 | */
|
---|
274 | #ifndef USBD_HS_TRDT_VALUE
|
---|
275 | #define USBD_HS_TRDT_VALUE 9U
|
---|
276 | #endif /* USBD_HS_TRDT_VALUE */
|
---|
277 | #ifndef USBD_FS_TRDT_VALUE
|
---|
278 | #define USBD_FS_TRDT_VALUE 5U
|
---|
279 | #define USBD_DEFAULT_TRDT_VALUE 9U
|
---|
280 | #endif /* USBD_HS_TRDT_VALUE */
|
---|
281 | /**
|
---|
282 | * @}
|
---|
283 | */
|
---|
284 |
|
---|
285 | /** @defgroup USB_LL_Core_MPS USB Low Layer Core MPS
|
---|
286 | * @{
|
---|
287 | */
|
---|
288 | #define USB_OTG_HS_MAX_PACKET_SIZE 512U
|
---|
289 | #define USB_OTG_FS_MAX_PACKET_SIZE 64U
|
---|
290 | #define USB_OTG_MAX_EP0_SIZE 64U
|
---|
291 | /**
|
---|
292 | * @}
|
---|
293 | */
|
---|
294 |
|
---|
295 | /** @defgroup USB_LL_Core_PHY_Frequency USB Low Layer Core PHY Frequency
|
---|
296 | * @{
|
---|
297 | */
|
---|
298 | #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0U << 1)
|
---|
299 | #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1U << 1)
|
---|
300 | #define DSTS_ENUMSPD_FS_PHY_48MHZ (3U << 1)
|
---|
301 | /**
|
---|
302 | * @}
|
---|
303 | */
|
---|
304 |
|
---|
305 | /** @defgroup USB_LL_CORE_Frame_Interval USB Low Layer Core Frame Interval
|
---|
306 | * @{
|
---|
307 | */
|
---|
308 | #define DCFG_FRAME_INTERVAL_80 0U
|
---|
309 | #define DCFG_FRAME_INTERVAL_85 1U
|
---|
310 | #define DCFG_FRAME_INTERVAL_90 2U
|
---|
311 | #define DCFG_FRAME_INTERVAL_95 3U
|
---|
312 | /**
|
---|
313 | * @}
|
---|
314 | */
|
---|
315 |
|
---|
316 | /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
|
---|
317 | * @{
|
---|
318 | */
|
---|
319 | #define EP_MPS_64 0U
|
---|
320 | #define EP_MPS_32 1U
|
---|
321 | #define EP_MPS_16 2U
|
---|
322 | #define EP_MPS_8 3U
|
---|
323 | /**
|
---|
324 | * @}
|
---|
325 | */
|
---|
326 |
|
---|
327 | /** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed
|
---|
328 | * @{
|
---|
329 | */
|
---|
330 | #define EP_SPEED_LOW 0U
|
---|
331 | #define EP_SPEED_FULL 1U
|
---|
332 | #define EP_SPEED_HIGH 2U
|
---|
333 | /**
|
---|
334 | * @}
|
---|
335 | */
|
---|
336 |
|
---|
337 | /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
|
---|
338 | * @{
|
---|
339 | */
|
---|
340 | #define EP_TYPE_CTRL 0U
|
---|
341 | #define EP_TYPE_ISOC 1U
|
---|
342 | #define EP_TYPE_BULK 2U
|
---|
343 | #define EP_TYPE_INTR 3U
|
---|
344 | #define EP_TYPE_MSK 3U
|
---|
345 | /**
|
---|
346 | * @}
|
---|
347 | */
|
---|
348 |
|
---|
349 | /** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines
|
---|
350 | * @{
|
---|
351 | */
|
---|
352 | #define STS_GOUT_NAK 1U
|
---|
353 | #define STS_DATA_UPDT 2U
|
---|
354 | #define STS_XFER_COMP 3U
|
---|
355 | #define STS_SETUP_COMP 4U
|
---|
356 | #define STS_SETUP_UPDT 6U
|
---|
357 | /**
|
---|
358 | * @}
|
---|
359 | */
|
---|
360 |
|
---|
361 | /** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines
|
---|
362 | * @{
|
---|
363 | */
|
---|
364 | #define HCFG_30_60_MHZ 0U
|
---|
365 | #define HCFG_48_MHZ 1U
|
---|
366 | #define HCFG_6_MHZ 2U
|
---|
367 | /**
|
---|
368 | * @}
|
---|
369 | */
|
---|
370 |
|
---|
371 | /** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines
|
---|
372 | * @{
|
---|
373 | */
|
---|
374 | #define HPRT0_PRTSPD_HIGH_SPEED 0U
|
---|
375 | #define HPRT0_PRTSPD_FULL_SPEED 1U
|
---|
376 | #define HPRT0_PRTSPD_LOW_SPEED 2U
|
---|
377 | /**
|
---|
378 | * @}
|
---|
379 | */
|
---|
380 |
|
---|
381 | #define HCCHAR_CTRL 0U
|
---|
382 | #define HCCHAR_ISOC 1U
|
---|
383 | #define HCCHAR_BULK 2U
|
---|
384 | #define HCCHAR_INTR 3U
|
---|
385 |
|
---|
386 | #define HC_PID_DATA0 0U
|
---|
387 | #define HC_PID_DATA2 1U
|
---|
388 | #define HC_PID_DATA1 2U
|
---|
389 | #define HC_PID_SETUP 3U
|
---|
390 |
|
---|
391 | #define GRXSTS_PKTSTS_IN 2U
|
---|
392 | #define GRXSTS_PKTSTS_IN_XFER_COMP 3U
|
---|
393 | #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5U
|
---|
394 | #define GRXSTS_PKTSTS_CH_HALTED 7U
|
---|
395 |
|
---|
396 | #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE)
|
---|
397 | #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE)
|
---|
398 |
|
---|
399 | #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
|
---|
400 | #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)(USBx_BASE + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
|
---|
401 | #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
|
---|
402 | #define USBx_DFIFO(i) *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))
|
---|
403 |
|
---|
404 | #define USBx_HOST ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE))
|
---|
405 | #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)(USBx_BASE + USB_OTG_HOST_CHANNEL_BASE + ((i) * USB_OTG_HOST_CHANNEL_SIZE)))
|
---|
406 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
---|
407 |
|
---|
408 | #define EP_ADDR_MSK 0xFU
|
---|
409 | /**
|
---|
410 | * @}
|
---|
411 | */
|
---|
412 |
|
---|
413 | /* Exported macro ------------------------------------------------------------*/
|
---|
414 | /** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros
|
---|
415 | * @{
|
---|
416 | */
|
---|
417 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
---|
418 | #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
|
---|
419 | #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
|
---|
420 |
|
---|
421 | #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
|
---|
422 | #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
|
---|
423 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
---|
424 | /**
|
---|
425 | * @}
|
---|
426 | */
|
---|
427 |
|
---|
428 | /* Exported functions --------------------------------------------------------*/
|
---|
429 | /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions
|
---|
430 | * @{
|
---|
431 | */
|
---|
432 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
---|
433 | HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
|
---|
434 | HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
|
---|
435 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
|
---|
436 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
|
---|
437 | HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed);
|
---|
438 | HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_OTG_ModeTypeDef mode);
|
---|
439 | HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx, uint8_t speed);
|
---|
440 | HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx);
|
---|
441 | HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num);
|
---|
442 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
---|
443 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
---|
444 | HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
---|
445 | HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
---|
446 | HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep, uint8_t dma);
|
---|
447 | HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep, uint8_t dma);
|
---|
448 | HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src,
|
---|
449 | uint8_t ch_ep_num, uint16_t len, uint8_t dma);
|
---|
450 |
|
---|
451 | void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
|
---|
452 | HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
---|
453 | HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
---|
454 | HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address);
|
---|
455 | HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx);
|
---|
456 | HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx);
|
---|
457 | HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
|
---|
458 | HAL_StatusTypeDef USB_ActivateSetup(USB_OTG_GlobalTypeDef *USBx);
|
---|
459 | HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uint8_t *psetup);
|
---|
460 | uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx);
|
---|
461 | uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx);
|
---|
462 | uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx);
|
---|
463 | uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
|
---|
464 | uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
|
---|
465 | uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
|
---|
466 | uint32_t USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
|
---|
467 | void USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
|
---|
468 |
|
---|
469 | HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
|
---|
470 | HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq);
|
---|
471 | HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx);
|
---|
472 | HAL_StatusTypeDef USB_DriveVbus(USB_OTG_GlobalTypeDef *USBx, uint8_t state);
|
---|
473 | uint32_t USB_GetHostSpeed(USB_OTG_GlobalTypeDef *USBx);
|
---|
474 | uint32_t USB_GetCurrentFrame(USB_OTG_GlobalTypeDef *USBx);
|
---|
475 | HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num,
|
---|
476 | uint8_t epnum, uint8_t dev_address, uint8_t speed,
|
---|
477 | uint8_t ep_type, uint16_t mps);
|
---|
478 | HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx,
|
---|
479 | USB_OTG_HCTypeDef *hc, uint8_t dma);
|
---|
480 |
|
---|
481 | uint32_t USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx);
|
---|
482 | HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num);
|
---|
483 | HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num);
|
---|
484 | HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
|
---|
485 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
|
---|
486 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
|
---|
487 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
---|
488 |
|
---|
489 | /**
|
---|
490 | * @}
|
---|
491 | */
|
---|
492 |
|
---|
493 | /**
|
---|
494 | * @}
|
---|
495 | */
|
---|
496 |
|
---|
497 | /**
|
---|
498 | * @}
|
---|
499 | */
|
---|
500 |
|
---|
501 | /**
|
---|
502 | * @}
|
---|
503 | */
|
---|
504 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
---|
505 |
|
---|
506 | #ifdef __cplusplus
|
---|
507 | }
|
---|
508 | #endif
|
---|
509 |
|
---|
510 |
|
---|
511 | #endif /* STM32F4xx_LL_USB_H */
|
---|
512 |
|
---|
513 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
---|