You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

578 lines
22 KiB

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