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