1 /**
2   ******************************************************************************
3   * @file    stm32h7xx_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) 2017 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 STM32H7xx_LL_USB_H
21 #define STM32H7xx_LL_USB_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32h7xx_hal_def.h"
29 
30 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
31 /** @addtogroup STM32H7xx_HAL_Driver
32   * @{
33   */
34 
35 /** @addtogroup USB_LL
36   * @{
37   */
38 
39 /* Exported types ------------------------------------------------------------*/
40 
41 /**
42   * @brief  USB Mode definition
43   */
44 
45 typedef enum
46 {
47   USB_DEVICE_MODE = 0,
48   USB_HOST_MODE   = 1,
49   USB_DRD_MODE    = 2
50 } USB_ModeTypeDef;
51 
52 /**
53   * @brief  URB States definition
54   */
55 typedef enum
56 {
57   URB_IDLE = 0,
58   URB_DONE,
59   URB_NOTREADY,
60   URB_NYET,
61   URB_ERROR,
62   URB_STALL
63 } USB_URBStateTypeDef;
64 
65 /**
66   * @brief  Host channel States  definition
67   */
68 typedef enum
69 {
70   HC_IDLE = 0,
71   HC_XFRC,
72   HC_HALTED,
73   HC_ACK,
74   HC_NAK,
75   HC_NYET,
76   HC_STALL,
77   HC_XACTERR,
78   HC_BBLERR,
79   HC_DATATGLERR
80 } USB_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 dma_enable;              /*!< dma_enable state unused, DMA not supported by FS instance              */
97 
98   uint32_t speed;                   /*!< USB Core speed.
99                                          This parameter can be any value of @ref PCD_Speed/HCD_Speed
100                                                                                  (HCD_SPEED_xxx, HCD_SPEED_xxx) */
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_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   uint32_t  maxpacket;            /*!< Endpoint Max packet size
144                                        This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
145 
146   uint8_t   *xfer_buff;           /*!< Pointer to transfer buffer                                               */
147 
148   uint32_t  xfer_len;             /*!< Current transfer length                                                  */
149 
150   uint32_t  xfer_count;           /*!< Partial transfer length in case of multi packet transfer                 */
151 
152   uint8_t   even_odd_frame;       /*!< IFrame parity
153                                        This parameter must be a number between Min_Data = 0 and Max_Data = 1    */
154 
155   uint16_t  tx_fifo_num;          /*!< Transmission FIFO number
156                                        This parameter must be a number between Min_Data = 1 and Max_Data = 15   */
157 
158   uint32_t  dma_addr;             /*!< 32 bits aligned transfer buffer address                                  */
159 
160   uint32_t  xfer_size;            /*!< requested transfer size                                                  */
161 } USB_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_URBStateTypeDef urb_state;  /*!< URB state.
213                                        This parameter can be any value of @ref USB_URBStateTypeDef              */
214 
215   USB_HCStateTypeDef state;       /*!< Host Channel state.
216                                        This parameter can be any value of @ref USB_HCStateTypeDef               */
217 } USB_HCTypeDef;
218 
219 typedef USB_ModeTypeDef     USB_OTG_ModeTypeDef;
220 typedef USB_CfgTypeDef      USB_OTG_CfgTypeDef;
221 typedef USB_EPTypeDef       USB_OTG_EPTypeDef;
222 typedef USB_URBStateTypeDef USB_OTG_URBStateTypeDef;
223 typedef USB_HCStateTypeDef  USB_OTG_HCStateTypeDef;
224 typedef USB_HCTypeDef       USB_OTG_HCTypeDef;
225 
226 /* Exported constants --------------------------------------------------------*/
227 
228 /** @defgroup PCD_Exported_Constants PCD Exported Constants
229   * @{
230   */
231 
232 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
233 /** @defgroup USB_OTG_CORE VERSION ID
234   * @{
235   */
236 #define USB_OTG_CORE_ID_300A          0x4F54300AU
237 #define USB_OTG_CORE_ID_310A          0x4F54310AU
238 /**
239   * @}
240   */
241 
242 /** @defgroup USB_Core_Mode_ USB Core Mode
243   * @{
244   */
245 #define USB_OTG_MODE_DEVICE                    0U
246 #define USB_OTG_MODE_HOST                      1U
247 #define USB_OTG_MODE_DRD                       2U
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 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
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_Type USB Low Layer EP Type
328   * @{
329   */
330 #define EP_TYPE_CTRL                           0U
331 #define EP_TYPE_ISOC                           1U
332 #define EP_TYPE_BULK                           2U
333 #define EP_TYPE_INTR                           3U
334 #define EP_TYPE_MSK                            3U
335 /**
336   * @}
337   */
338 
339 /** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed
340   * @{
341   */
342 #define EP_SPEED_LOW                           0U
343 #define EP_SPEED_FULL                          1U
344 #define EP_SPEED_HIGH                          2U
345 /**
346   * @}
347   */
348 
349 /** @defgroup USB_LL_CH_PID_Type USB Low Layer Channel PID Type
350   * @{
351   */
352 #define HC_PID_DATA0                           0U
353 #define HC_PID_DATA2                           1U
354 #define HC_PID_DATA1                           2U
355 #define HC_PID_SETUP                           3U
356 /**
357   * @}
358   */
359 
360 /** @defgroup USB_LL Device Speed
361   * @{
362   */
363 #define USBD_HS_SPEED                          0U
364 #define USBD_HSINFS_SPEED                      1U
365 #define USBH_HS_SPEED                          0U
366 #define USBD_FS_SPEED                          2U
367 #define USBH_FSLS_SPEED                        1U
368 /**
369   * @}
370   */
371 
372 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
373 /** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines
374   * @{
375   */
376 #define STS_GOUT_NAK                           1U
377 #define STS_DATA_UPDT                          2U
378 #define STS_XFER_COMP                          3U
379 #define STS_SETUP_COMP                         4U
380 #define STS_SETUP_UPDT                         6U
381 /**
382   * @}
383   */
384 
385 /** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines
386   * @{
387   */
388 #define HCFG_30_60_MHZ                         0U
389 #define HCFG_48_MHZ                            1U
390 #define HCFG_6_MHZ                             2U
391 /**
392   * @}
393   */
394 
395 /** @defgroup USB_LL_HFIR_Defines USB Low Layer frame interval Defines
396   * @{
397   */
398 #define HFIR_6_MHZ                          6000U
399 #define HFIR_60_MHZ                        60000U
400 #define HFIR_48_MHZ                        48000U
401 /**
402   * @}
403   */
404 
405 /** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines
406   * @{
407   */
408 #define HPRT0_PRTSPD_HIGH_SPEED                0U
409 #define HPRT0_PRTSPD_FULL_SPEED                1U
410 #define HPRT0_PRTSPD_LOW_SPEED                 2U
411 /**
412   * @}
413   */
414 
415 #define HCCHAR_CTRL                            0U
416 #define HCCHAR_ISOC                            1U
417 #define HCCHAR_BULK                            2U
418 #define HCCHAR_INTR                            3U
419 
420 #define GRXSTS_PKTSTS_IN                       2U
421 #define GRXSTS_PKTSTS_IN_XFER_COMP             3U
422 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR          5U
423 #define GRXSTS_PKTSTS_CH_HALTED                7U
424 
425 #define CLEAR_INTERRUPT_MASK          0xFFFFFFFFU
426 
427 #define HC_MAX_PKT_CNT                       256U
428 
429 #define TEST_J                                 1U
430 #define TEST_K                                 2U
431 #define TEST_SE0_NAK                           3U
432 #define TEST_PACKET                            4U
433 #define TEST_FORCE_EN                          5U
434 
435 #define USBx_PCGCCTL    *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE)
436 #define USBx_HPRT0      *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE)
437 
438 #define USBx_DEVICE     ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
439 #define USBx_INEP(i)    ((USB_OTG_INEndpointTypeDef *)(USBx_BASE\
440                                                        + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
441 
442 #define USBx_OUTEP(i)   ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE\
443                                                         + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
444 
445 #define USBx_DFIFO(i)   *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))
446 
447 #define USBx_HOST       ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE))
448 #define USBx_HC(i)      ((USB_OTG_HostChannelTypeDef *)(USBx_BASE\
449                                                         + USB_OTG_HOST_CHANNEL_BASE\
450                                                         + ((i) * USB_OTG_HOST_CHANNEL_SIZE)))
451 
452 
453 #define EP_ADDR_MSK                            0xFU
454 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
455 /**
456   * @}
457   */
458 
459 /* Exported macro ------------------------------------------------------------*/
460 /** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros
461   * @{
462   */
463 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
464 #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__)     ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
465 #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__)   ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
466 
467 #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__)          (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
468 #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__)         (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
469 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
470 /**
471   * @}
472   */
473 
474 /* Exported functions --------------------------------------------------------*/
475 /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions
476   * @{
477   */
478 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
479 HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
480 HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
481 HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
482 HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
483 HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed);
484 HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_OTG_ModeTypeDef mode);
485 HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx, uint8_t speed);
486 HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx);
487 HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num);
488 HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
489 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
490 HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
491 HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
492 HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep, uint8_t dma);
493 HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src,
494                                   uint8_t ch_ep_num, uint16_t len, uint8_t dma);
495 
496 void             *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
497 HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
498 HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
499 HAL_StatusTypeDef USB_EPStopXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
500 HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address);
501 HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx);
502 HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx);
503 HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
504 HAL_StatusTypeDef USB_ActivateSetup(USB_OTG_GlobalTypeDef *USBx);
505 HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uint8_t *psetup);
506 uint8_t           USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx);
507 uint32_t          USB_GetMode(USB_OTG_GlobalTypeDef *USBx);
508 uint32_t          USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx);
509 uint32_t          USB_ReadChInterrupts(USB_OTG_GlobalTypeDef *USBx, uint8_t chnum);
510 uint32_t          USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
511 uint32_t          USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
512 uint32_t          USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
513 uint32_t          USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
514 void              USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
515 
516 HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
517 HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq);
518 HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx);
519 HAL_StatusTypeDef USB_DriveVbus(USB_OTG_GlobalTypeDef *USBx, uint8_t state);
520 uint32_t          USB_GetHostSpeed(USB_OTG_GlobalTypeDef *USBx);
521 uint32_t          USB_GetCurrentFrame(USB_OTG_GlobalTypeDef *USBx);
522 HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num,
523                               uint8_t epnum, uint8_t dev_address, uint8_t speed,
524                               uint8_t ep_type, uint16_t mps);
525 HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx,
526                                    USB_OTG_HCTypeDef *hc, uint8_t dma);
527 
528 uint32_t          USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx);
529 HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num);
530 HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num);
531 HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
532 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
533 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
534 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
535 
536 /**
537   * @}
538   */
539 
540 /**
541   * @}
542   */
543 
544 /**
545   * @}
546   */
547 
548 /**
549   * @}
550   */
551 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
552 
553 #ifdef __cplusplus
554 }
555 #endif /* __cplusplus */
556 
557 
558 #endif /* STM32H7xx_LL_USB_H */
559