stm32f7xx_ll_usb.h 22 KB

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