Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:38

0001 /**
0002   ******************************************************************************
0003   * @file    stm32h7xx_ll_usb.h
0004   * @author  MCD Application Team
0005   * @brief   Header file of USB Low Layer HAL module.
0006   ******************************************************************************
0007   * @attention
0008   *
0009   * Copyright (c) 2017 STMicroelectronics.
0010   * All rights reserved.
0011   *
0012   * This software is licensed under terms that can be found in the LICENSE file
0013   * in the root directory of this software component.
0014   * If no LICENSE file comes with this software, it is provided AS-IS.
0015   *
0016   ******************************************************************************
0017   */
0018 
0019 /* Define to prevent recursive inclusion -------------------------------------*/
0020 #ifndef STM32H7xx_LL_USB_H
0021 #define STM32H7xx_LL_USB_H
0022 
0023 #ifdef __cplusplus
0024 extern "C" {
0025 #endif /* __cplusplus */
0026 
0027 /* Includes ------------------------------------------------------------------*/
0028 #include "stm32h7xx_hal_def.h"
0029 
0030 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
0031 /** @addtogroup STM32H7xx_HAL_Driver
0032   * @{
0033   */
0034 
0035 /** @addtogroup USB_LL
0036   * @{
0037   */
0038 
0039 /* Exported types ------------------------------------------------------------*/
0040 #ifndef HAL_USB_TIMEOUT
0041 #define HAL_USB_TIMEOUT                                       0xF000000U
0042 #endif /* define HAL_USB_TIMEOUT */
0043 
0044 #ifndef HAL_USB_CURRENT_MODE_MAX_DELAY_MS
0045 #define HAL_USB_CURRENT_MODE_MAX_DELAY_MS                           200U
0046 #endif /* define HAL_USB_CURRENT_MODE_MAX_DELAY_MS */
0047 
0048 /**
0049   * @brief  USB Mode definition
0050   */
0051 
0052 typedef enum
0053 {
0054   USB_DEVICE_MODE = 0,
0055   USB_HOST_MODE   = 1,
0056   USB_DRD_MODE    = 2
0057 } USB_ModeTypeDef;
0058 
0059 /**
0060   * @brief  URB States definition
0061   */
0062 typedef enum
0063 {
0064   URB_IDLE = 0,
0065   URB_DONE,
0066   URB_NOTREADY,
0067   URB_NYET,
0068   URB_ERROR,
0069   URB_STALL
0070 } USB_URBStateTypeDef;
0071 
0072 /**
0073   * @brief  Host channel States  definition
0074   */
0075 typedef enum
0076 {
0077   HC_IDLE = 0,
0078   HC_XFRC,
0079   HC_HALTED,
0080   HC_ACK,
0081   HC_NAK,
0082   HC_NYET,
0083   HC_STALL,
0084   HC_XACTERR,
0085   HC_BBLERR,
0086   HC_DATATGLERR
0087 } USB_HCStateTypeDef;
0088 
0089 
0090 /**
0091   * @brief  USB Instance Initialization Structure definition
0092   */
0093 typedef struct
0094 {
0095   uint8_t dev_endpoints;            /*!< Device Endpoints number.
0096                                          This parameter depends on the used USB core.
0097                                          This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
0098 
0099   uint8_t Host_channels;            /*!< Host Channels number.
0100                                          This parameter Depends on the used USB core.
0101                                          This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
0102 
0103   uint8_t dma_enable;              /*!< USB DMA state.
0104                                          If DMA is not supported this parameter shall be set by default to zero */
0105 
0106   uint8_t speed;                   /*!< USB Core speed.
0107                                         This parameter can be any value of @ref PCD_Speed/HCD_Speed
0108                                                                                 (HCD_SPEED_xxx, HCD_SPEED_xxx) */
0109 
0110   uint8_t ep0_mps;                 /*!< Set the Endpoint 0 Max Packet size.                                    */
0111 
0112   uint8_t phy_itface;              /*!< Select the used PHY interface.
0113                                         This parameter can be any value of @ref PCD_PHY_Module/HCD_PHY_Module  */
0114 
0115   uint8_t Sof_enable;              /*!< Enable or disable the output of the SOF signal.                        */
0116 
0117   uint8_t low_power_enable;        /*!< Enable or disable the low Power Mode.                                  */
0118 
0119   uint8_t lpm_enable;              /*!< Enable or disable Link Power Management.                               */
0120 
0121   uint8_t battery_charging_enable; /*!< Enable or disable Battery charging.                                    */
0122 
0123   uint8_t vbus_sensing_enable;     /*!< Enable or disable the VBUS Sensing feature.                            */
0124 
0125   uint8_t use_dedicated_ep1;       /*!< Enable or disable the use of the dedicated EP1 interrupt.              */
0126 
0127   uint8_t use_external_vbus;       /*!< Enable or disable the use of the external VBUS.                        */
0128 
0129 } USB_CfgTypeDef;
0130 
0131 typedef struct
0132 {
0133   uint8_t   num;                  /*!< Endpoint number
0134                                        This parameter must be a number between Min_Data = 1 and Max_Data = 15   */
0135 
0136   uint8_t   is_in;                /*!< Endpoint direction
0137                                        This parameter must be a number between Min_Data = 0 and Max_Data = 1    */
0138 
0139   uint8_t   is_stall;             /*!< Endpoint stall condition
0140                                        This parameter must be a number between Min_Data = 0 and Max_Data = 1    */
0141 
0142   uint8_t   is_iso_incomplete;    /*!< Endpoint isoc condition
0143                                        This parameter must be a number between Min_Data = 0 and Max_Data = 1    */
0144 
0145   uint8_t   type;                 /*!< Endpoint type
0146                                        This parameter can be any value of @ref USB_LL_EP_Type                   */
0147 
0148   uint8_t   data_pid_start;       /*!< Initial data PID
0149                                        This parameter must be a number between Min_Data = 0 and Max_Data = 1    */
0150 
0151   uint32_t  maxpacket;            /*!< Endpoint Max packet size
0152                                        This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
0153 
0154   uint8_t   *xfer_buff;           /*!< Pointer to transfer buffer                                               */
0155 
0156   uint32_t  xfer_len;             /*!< Current transfer length                                                  */
0157 
0158   uint32_t  xfer_count;           /*!< Partial transfer length in case of multi packet transfer                 */
0159 
0160   uint8_t   even_odd_frame;       /*!< IFrame parity
0161                                        This parameter must be a number between Min_Data = 0 and Max_Data = 1    */
0162 
0163   uint16_t  tx_fifo_num;          /*!< Transmission FIFO number
0164                                        This parameter must be a number between Min_Data = 1 and Max_Data = 15   */
0165 
0166   uint32_t  dma_addr;             /*!< 32 bits aligned transfer buffer address                                  */
0167 
0168   uint32_t  xfer_size;            /*!< requested transfer size                                                  */
0169 } USB_EPTypeDef;
0170 
0171 typedef struct
0172 {
0173   uint8_t   dev_addr;           /*!< USB device address.
0174                                      This parameter must be a number between Min_Data = 1 and Max_Data = 255    */
0175 
0176   uint8_t   ch_num;             /*!< Host channel number.
0177                                      This parameter must be a number between Min_Data = 1 and Max_Data = 15     */
0178 
0179   uint8_t   ep_num;             /*!< Endpoint number.
0180                                      This parameter must be a number between Min_Data = 1 and Max_Data = 15     */
0181 
0182   uint8_t   ep_is_in;           /*!< Endpoint direction
0183                                      This parameter must be a number between Min_Data = 0 and Max_Data = 1      */
0184 
0185   uint8_t   speed;              /*!< USB Host Channel speed.
0186                                      This parameter can be any value of @ref HCD_Device_Speed:
0187                                                                              (HCD_DEVICE_SPEED_xxx)             */
0188 
0189   uint8_t   do_ping;            /*!< Enable or disable the use of the PING protocol for HS mode.                */
0190   uint8_t   do_ssplit;          /*!< Enable start split transaction in HS mode.                                 */
0191   uint8_t   do_csplit;          /*!< Enable complete split transaction in HS mode.                              */
0192   uint8_t   ep_ss_schedule;     /*!< Enable periodic endpoint start split schedule .                            */
0193   uint32_t  iso_splt_xactPos;   /*!< iso split transfer transaction position.                                   */
0194 
0195   uint8_t   hub_port_nbr;       /*!< USB HUB port number                                                        */
0196   uint8_t   hub_addr;           /*!< USB HUB address                                                            */
0197 
0198   uint8_t   ep_type;            /*!< Endpoint Type.
0199                                      This parameter can be any value of @ref USB_LL_EP_Type                     */
0200 
0201   uint16_t  max_packet;         /*!< Endpoint Max packet size.
0202                                      This parameter must be a number between Min_Data = 0 and Max_Data = 64KB   */
0203 
0204   uint8_t   data_pid;           /*!< Initial data PID.
0205                                      This parameter must be a number between Min_Data = 0 and Max_Data = 1      */
0206 
0207   uint8_t   *xfer_buff;         /*!< Pointer to transfer buffer.                                                */
0208 
0209   uint32_t  XferSize;           /*!< OTG Channel transfer size.                                                 */
0210 
0211   uint32_t  xfer_len;           /*!< Current transfer length.                                                   */
0212 
0213   uint32_t  xfer_count;         /*!< Partial transfer length in case of multi packet transfer.                  */
0214 
0215   uint8_t   toggle_in;          /*!< IN transfer current toggle flag.
0216                                      This parameter must be a number between Min_Data = 0 and Max_Data = 1      */
0217 
0218   uint8_t   toggle_out;         /*!< OUT transfer current toggle flag
0219                                      This parameter must be a number between Min_Data = 0 and Max_Data = 1      */
0220 
0221   uint32_t  dma_addr;           /*!< 32 bits aligned transfer buffer address.                                   */
0222 
0223   uint32_t  ErrCnt;             /*!< Host channel error count.                                                  */
0224   uint32_t  NyetErrCnt;         /*!< Complete Split NYET Host channel error count.                              */
0225 
0226   USB_URBStateTypeDef urb_state;  /*!< URB state.
0227                                        This parameter can be any value of @ref USB_URBStateTypeDef              */
0228 
0229   USB_HCStateTypeDef state;       /*!< Host Channel state.
0230                                        This parameter can be any value of @ref USB_HCStateTypeDef               */
0231 } USB_HCTypeDef;
0232 
0233 typedef USB_ModeTypeDef     USB_OTG_ModeTypeDef;
0234 typedef USB_CfgTypeDef      USB_OTG_CfgTypeDef;
0235 typedef USB_EPTypeDef       USB_OTG_EPTypeDef;
0236 typedef USB_URBStateTypeDef USB_OTG_URBStateTypeDef;
0237 typedef USB_HCStateTypeDef  USB_OTG_HCStateTypeDef;
0238 typedef USB_HCTypeDef       USB_OTG_HCTypeDef;
0239 
0240 /* Exported constants --------------------------------------------------------*/
0241 
0242 /** @defgroup PCD_Exported_Constants PCD Exported Constants
0243   * @ingroup RTEMSBSPsARMSTM32H7
0244   * @{
0245   */
0246 
0247 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
0248 /** @defgroup USB_OTG_CORE VERSION ID
0249   * @ingroup RTEMSBSPsARMSTM32H7
0250   * @{
0251   */
0252 #define USB_OTG_CORE_ID_300A          0x4F54300AU
0253 #define USB_OTG_CORE_ID_310A          0x4F54310AU
0254 /**
0255   * @}
0256   */
0257 
0258 /** @defgroup USB_Core_Mode_ USB Core Mode
0259   * @ingroup RTEMSBSPsARMSTM32H7
0260   * @{
0261   */
0262 #define USB_OTG_MODE_DEVICE                    0U
0263 #define USB_OTG_MODE_HOST                      1U
0264 #define USB_OTG_MODE_DRD                       2U
0265 /**
0266   * @}
0267   */
0268 
0269 /** @defgroup USB_LL_Core_Speed USB Low Layer Core Speed
0270   * @ingroup RTEMSBSPsARMSTM32H7
0271   * @{
0272   */
0273 #define USB_OTG_SPEED_HIGH                     0U
0274 #define USB_OTG_SPEED_HIGH_IN_FULL             1U
0275 #define USB_OTG_SPEED_FULL                     3U
0276 /**
0277   * @}
0278   */
0279 
0280 /** @defgroup USB_LL_Core_PHY USB Low Layer Core PHY
0281   * @ingroup RTEMSBSPsARMSTM32H7
0282   * @{
0283   */
0284 #define USB_OTG_ULPI_PHY                       1U
0285 #define USB_OTG_EMBEDDED_PHY                   2U
0286 /**
0287   * @}
0288   */
0289 
0290 /** @defgroup USB_LL_Turnaround_Timeout Turnaround Timeout Value
0291   * @ingroup RTEMSBSPsARMSTM32H7
0292   * @{
0293   */
0294 #ifndef USBD_HS_TRDT_VALUE
0295 #define USBD_HS_TRDT_VALUE                     9U
0296 #endif /* USBD_HS_TRDT_VALUE */
0297 #ifndef USBD_FS_TRDT_VALUE
0298 #define USBD_FS_TRDT_VALUE                     5U
0299 #define USBD_DEFAULT_TRDT_VALUE                9U
0300 #endif /* USBD_HS_TRDT_VALUE */
0301 /**
0302   * @}
0303   */
0304 
0305 /** @defgroup USB_LL_Core_MPS USB Low Layer Core MPS
0306   * @ingroup RTEMSBSPsARMSTM32H7
0307   * @{
0308   */
0309 #define USB_OTG_HS_MAX_PACKET_SIZE           512U
0310 #define USB_OTG_FS_MAX_PACKET_SIZE            64U
0311 #define USB_OTG_MAX_EP0_SIZE                  64U
0312 /**
0313   * @}
0314   */
0315 
0316 /** @defgroup USB_LL_Core_PHY_Frequency USB Low Layer Core PHY Frequency
0317   * @ingroup RTEMSBSPsARMSTM32H7
0318   * @{
0319   */
0320 #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ     (0U << 1)
0321 #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ     (1U << 1)
0322 #define DSTS_ENUMSPD_FS_PHY_48MHZ              (3U << 1)
0323 /**
0324   * @}
0325   */
0326 
0327 /** @defgroup USB_LL_CORE_Frame_Interval USB Low Layer Core Frame Interval
0328   * @ingroup RTEMSBSPsARMSTM32H7
0329   * @{
0330   */
0331 #define DCFG_FRAME_INTERVAL_80                 0U
0332 #define DCFG_FRAME_INTERVAL_85                 1U
0333 #define DCFG_FRAME_INTERVAL_90                 2U
0334 #define DCFG_FRAME_INTERVAL_95                 3U
0335 /**
0336   * @}
0337   */
0338 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
0339 /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
0340   * @ingroup RTEMSBSPsARMSTM32H7
0341   * @{
0342   */
0343 #define EP_MPS_64                              0U
0344 #define EP_MPS_32                              1U
0345 #define EP_MPS_16                              2U
0346 #define EP_MPS_8                               3U
0347 /**
0348   * @}
0349   */
0350 
0351 /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
0352   * @ingroup RTEMSBSPsARMSTM32H7
0353   * @{
0354   */
0355 #define EP_TYPE_CTRL                           0U
0356 #define EP_TYPE_ISOC                           1U
0357 #define EP_TYPE_BULK                           2U
0358 #define EP_TYPE_INTR                           3U
0359 #define EP_TYPE_MSK                            3U
0360 /**
0361   * @}
0362   */
0363 
0364 /** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed
0365   * @ingroup RTEMSBSPsARMSTM32H7
0366   * @{
0367   */
0368 #define EP_SPEED_LOW                           0U
0369 #define EP_SPEED_FULL                          1U
0370 #define EP_SPEED_HIGH                          2U
0371 /**
0372   * @}
0373   */
0374 
0375 /** @defgroup USB_LL_CH_PID_Type USB Low Layer Channel PID Type
0376   * @ingroup RTEMSBSPsARMSTM32H7
0377   * @{
0378   */
0379 #define HC_PID_DATA0                           0U
0380 #define HC_PID_DATA2                           1U
0381 #define HC_PID_DATA1                           2U
0382 #define HC_PID_SETUP                           3U
0383 /**
0384   * @}
0385   */
0386 
0387 /** @defgroup USB_LL Device Speed
0388   * @ingroup RTEMSBSPsARMSTM32H7
0389   * @{
0390   */
0391 #define USBD_HS_SPEED                          0U
0392 #define USBD_HSINFS_SPEED                      1U
0393 #define USBH_HS_SPEED                          0U
0394 #define USBD_FS_SPEED                          2U
0395 #define USBH_FSLS_SPEED                        1U
0396 /**
0397   * @}
0398   */
0399 
0400 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
0401 /** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines
0402   * @ingroup RTEMSBSPsARMSTM32H7
0403   * @{
0404   */
0405 #define STS_GOUT_NAK                           1U
0406 #define STS_DATA_UPDT                          2U
0407 #define STS_XFER_COMP                          3U
0408 #define STS_SETUP_COMP                         4U
0409 #define STS_SETUP_UPDT                         6U
0410 /**
0411   * @}
0412   */
0413 
0414 /** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines
0415   * @ingroup RTEMSBSPsARMSTM32H7
0416   * @{
0417   */
0418 #define HCFG_30_60_MHZ                         0U
0419 #define HCFG_48_MHZ                            1U
0420 #define HCFG_6_MHZ                             2U
0421 /**
0422   * @}
0423   */
0424 
0425 /** @defgroup USB_LL_HFIR_Defines USB Low Layer frame interval Defines
0426   * @ingroup RTEMSBSPsARMSTM32H7
0427   * @{
0428   */
0429 #define HFIR_6_MHZ                          6000U
0430 #define HFIR_60_MHZ                        60000U
0431 #define HFIR_48_MHZ                        48000U
0432 /**
0433   * @}
0434   */
0435 
0436 /** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines
0437   * @ingroup RTEMSBSPsARMSTM32H7
0438   * @{
0439   */
0440 #define HPRT0_PRTSPD_HIGH_SPEED                0U
0441 #define HPRT0_PRTSPD_FULL_SPEED                1U
0442 #define HPRT0_PRTSPD_LOW_SPEED                 2U
0443 /**
0444   * @}
0445   */
0446 
0447 #define HCCHAR_CTRL                            0U
0448 #define HCCHAR_ISOC                            1U
0449 #define HCCHAR_BULK                            2U
0450 #define HCCHAR_INTR                            3U
0451 
0452 #define GRXSTS_PKTSTS_IN                       2U
0453 #define GRXSTS_PKTSTS_IN_XFER_COMP             3U
0454 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR          5U
0455 #define GRXSTS_PKTSTS_CH_HALTED                7U
0456 
0457 #define CLEAR_INTERRUPT_MASK          0xFFFFFFFFU
0458 
0459 #define HC_MAX_PKT_CNT                       256U
0460 #define ISO_SPLT_MPS                         188U
0461 
0462 #define HCSPLT_BEGIN                           1U
0463 #define HCSPLT_MIDDLE                          2U
0464 #define HCSPLT_END                             3U
0465 #define HCSPLT_FULL                            4U
0466 
0467 #define TEST_J                                 1U
0468 #define TEST_K                                 2U
0469 #define TEST_SE0_NAK                           3U
0470 #define TEST_PACKET                            4U
0471 #define TEST_FORCE_EN                          5U
0472 
0473 #define USBx_PCGCCTL    *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE)
0474 #define USBx_HPRT0      *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE)
0475 
0476 #define USBx_DEVICE     ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
0477 #define USBx_INEP(i)    ((USB_OTG_INEndpointTypeDef *)(USBx_BASE\
0478                                                        + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
0479 
0480 #define USBx_OUTEP(i)   ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE\
0481                                                         + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
0482 
0483 #define USBx_DFIFO(i)   *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))
0484 
0485 #define USBx_HOST       ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE))
0486 #define USBx_HC(i)      ((USB_OTG_HostChannelTypeDef *)(USBx_BASE\
0487                                                         + USB_OTG_HOST_CHANNEL_BASE\
0488                                                         + ((i) * USB_OTG_HOST_CHANNEL_SIZE)))
0489 
0490 
0491 #define EP_ADDR_MSK                            0xFU
0492 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
0493 /**
0494   * @}
0495   */
0496 
0497 /* Exported macro ------------------------------------------------------------*/
0498 /** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros
0499   * @ingroup RTEMSBSPsARMSTM32H7
0500   * @{
0501   */
0502 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
0503 #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__)     ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
0504 #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__)   ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
0505 
0506 #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__)          (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
0507 #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__)         (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
0508 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
0509 /**
0510   * @}
0511   */
0512 
0513 /* Exported functions --------------------------------------------------------*/
0514 /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions
0515   * @{
0516   */
0517 #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
0518 HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
0519 HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
0520 HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
0521 HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
0522 HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed);
0523 HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_OTG_ModeTypeDef mode);
0524 HAL_StatusTypeDef USB_SetDevSpeed(const USB_OTG_GlobalTypeDef *USBx, uint8_t speed);
0525 HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx);
0526 HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num);
0527 HAL_StatusTypeDef USB_ActivateEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep);
0528 HAL_StatusTypeDef USB_DeactivateEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep);
0529 HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep);
0530 HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep);
0531 HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep, uint8_t dma);
0532 HAL_StatusTypeDef USB_WritePacket(const USB_OTG_GlobalTypeDef *USBx, uint8_t *src,
0533                                   uint8_t ch_ep_num, uint16_t len, uint8_t dma);
0534 
0535 void             *USB_ReadPacket(const USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
0536 HAL_StatusTypeDef USB_EPSetStall(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep);
0537 HAL_StatusTypeDef USB_EPClearStall(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep);
0538 HAL_StatusTypeDef USB_EPStopXfer(const USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
0539 HAL_StatusTypeDef USB_SetDevAddress(const USB_OTG_GlobalTypeDef *USBx, uint8_t address);
0540 HAL_StatusTypeDef USB_DevConnect(const USB_OTG_GlobalTypeDef *USBx);
0541 HAL_StatusTypeDef USB_DevDisconnect(const USB_OTG_GlobalTypeDef *USBx);
0542 HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
0543 HAL_StatusTypeDef USB_ActivateSetup(const USB_OTG_GlobalTypeDef *USBx);
0544 HAL_StatusTypeDef USB_EP0_OutStart(const USB_OTG_GlobalTypeDef *USBx, uint8_t dma, const uint8_t *psetup);
0545 uint8_t           USB_GetDevSpeed(const USB_OTG_GlobalTypeDef *USBx);
0546 uint32_t          USB_GetMode(const USB_OTG_GlobalTypeDef *USBx);
0547 uint32_t          USB_ReadInterrupts(USB_OTG_GlobalTypeDef const *USBx);
0548 uint32_t          USB_ReadChInterrupts(const USB_OTG_GlobalTypeDef *USBx, uint8_t chnum);
0549 uint32_t          USB_ReadDevAllOutEpInterrupt(const USB_OTG_GlobalTypeDef *USBx);
0550 uint32_t          USB_ReadDevOutEPInterrupt(const USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
0551 uint32_t          USB_ReadDevAllInEpInterrupt(const USB_OTG_GlobalTypeDef *USBx);
0552 uint32_t          USB_ReadDevInEPInterrupt(const USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
0553 void              USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
0554 
0555 HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
0556 HAL_StatusTypeDef USB_InitFSLSPClkSel(const USB_OTG_GlobalTypeDef *USBx, uint8_t freq);
0557 HAL_StatusTypeDef USB_ResetPort(const USB_OTG_GlobalTypeDef *USBx);
0558 HAL_StatusTypeDef USB_DriveVbus(const USB_OTG_GlobalTypeDef *USBx, uint8_t state);
0559 uint32_t          USB_GetHostSpeed(USB_OTG_GlobalTypeDef const *USBx);
0560 uint32_t          USB_GetCurrentFrame(USB_OTG_GlobalTypeDef const *USBx);
0561 HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num,
0562                               uint8_t epnum, uint8_t dev_address, uint8_t speed,
0563                               uint8_t ep_type, uint16_t mps);
0564 HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx,
0565                                    USB_OTG_HCTypeDef *hc, uint8_t dma);
0566 
0567 uint32_t          USB_HC_ReadInterrupt(const USB_OTG_GlobalTypeDef *USBx);
0568 HAL_StatusTypeDef USB_HC_Halt(const USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num);
0569 HAL_StatusTypeDef USB_DoPing(const USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num);
0570 HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
0571 HAL_StatusTypeDef USB_ActivateRemoteWakeup(const USB_OTG_GlobalTypeDef *USBx);
0572 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(const USB_OTG_GlobalTypeDef *USBx);
0573 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
0574 
0575 /**
0576   * @}
0577   */
0578 
0579 /**
0580   * @}
0581   */
0582 
0583 /**
0584   * @}
0585   */
0586 
0587 /**
0588   * @}
0589   */
0590 #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
0591 
0592 #ifdef __cplusplus
0593 }
0594 #endif /* __cplusplus */
0595 
0596 
0597 #endif /* STM32H7xx_LL_USB_H */