2 ******************************************************************************
\r
3 * @file stm32l4xx_ll_usb.h
\r
4 * @author MCD Application Team
\r
5 * @brief Header file of USB Low Layer HAL module.
\r
6 ******************************************************************************
\r
9 * <h2><center>© Copyright (c) 2017 STMicroelectronics.
\r
10 * All rights reserved.</center></h2>
\r
12 * This software component is licensed by ST under BSD 3-Clause license,
\r
13 * the "License"; You may not use this file except in compliance with the
\r
14 * License. You may obtain a copy of the License at:
\r
15 * opensource.org/licenses/BSD-3-Clause
\r
17 ******************************************************************************
\r
20 /* Define to prevent recursive inclusion -------------------------------------*/
\r
21 #ifndef STM32L4xx_LL_USB_H
\r
22 #define STM32L4xx_LL_USB_H
\r
28 /* Includes ------------------------------------------------------------------*/
\r
29 #include "stm32l4xx_hal_def.h"
\r
31 #if defined (USB) || defined (USB_OTG_FS)
\r
32 /** @addtogroup STM32L4xx_HAL_Driver
\r
36 /** @addtogroup USB_LL
\r
40 /* Exported types ------------------------------------------------------------*/
\r
43 * @brief USB Mode definition
\r
45 #if defined (USB_OTG_FS)
\r
49 USB_DEVICE_MODE = 0,
\r
55 * @brief URB States definition
\r
65 } USB_OTG_URBStateTypeDef;
\r
68 * @brief Host channel States definition
\r
81 } USB_OTG_HCStateTypeDef;
\r
84 * @brief USB OTG Initialization Structure definition
\r
88 uint32_t dev_endpoints; /*!< Device Endpoints number.
\r
89 This parameter depends on the used USB core.
\r
90 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
92 uint32_t Host_channels; /*!< Host Channels number.
\r
93 This parameter Depends on the used USB core.
\r
94 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
96 uint32_t speed; /*!< USB Core speed.
\r
97 This parameter can be any value of @ref USB_Core_Speed_ */
\r
99 uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA used only for OTG HS. */
\r
101 uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */
\r
103 uint32_t phy_itface; /*!< Select the used PHY interface.
\r
104 This parameter can be any value of @ref USB_Core_PHY_ */
\r
106 uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */
\r
108 uint32_t low_power_enable; /*!< Enable or disable the low power mode. */
\r
110 uint32_t lpm_enable; /*!< Enable or disable Link Power Management. */
\r
112 uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */
\r
114 uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */
\r
116 uint32_t use_dedicated_ep1; /*!< Enable or disable the use of the dedicated EP1 interrupt. */
\r
118 uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */
\r
119 } USB_OTG_CfgTypeDef;
\r
123 uint8_t num; /*!< Endpoint number
\r
124 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
126 uint8_t is_in; /*!< Endpoint direction
\r
127 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
129 uint8_t is_stall; /*!< Endpoint stall condition
\r
130 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
132 uint8_t type; /*!< Endpoint type
\r
133 This parameter can be any value of @ref USB_EP_Type_ */
\r
135 uint8_t data_pid_start; /*!< Initial data PID
\r
136 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
138 uint8_t even_odd_frame; /*!< IFrame parity
\r
139 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
141 uint16_t tx_fifo_num; /*!< Transmission FIFO number
\r
142 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
144 uint32_t maxpacket; /*!< Endpoint Max packet size
\r
145 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
\r
147 uint8_t *xfer_buff; /*!< Pointer to transfer buffer */
\r
149 uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */
\r
151 uint32_t xfer_len; /*!< Current transfer length */
\r
153 uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */
\r
154 } USB_OTG_EPTypeDef;
\r
158 uint8_t dev_addr ; /*!< USB device address.
\r
159 This parameter must be a number between Min_Data = 1 and Max_Data = 255 */
\r
161 uint8_t ch_num; /*!< Host channel number.
\r
162 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
164 uint8_t ep_num; /*!< Endpoint number.
\r
165 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
167 uint8_t ep_is_in; /*!< Endpoint direction
\r
168 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
170 uint8_t speed; /*!< USB Host speed.
\r
171 This parameter can be any value of @ref USB_Core_Speed_ */
\r
173 uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */
\r
175 uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */
\r
177 uint8_t ep_type; /*!< Endpoint Type.
\r
178 This parameter can be any value of @ref USB_EP_Type_ */
\r
180 uint16_t max_packet; /*!< Endpoint Max packet size.
\r
181 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
\r
183 uint8_t data_pid; /*!< Initial data PID.
\r
184 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
186 uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */
\r
188 uint32_t xfer_len; /*!< Current transfer length. */
\r
190 uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */
\r
192 uint8_t toggle_in; /*!< IN transfer current toggle flag.
\r
193 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
195 uint8_t toggle_out; /*!< OUT transfer current toggle flag
\r
196 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
198 uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */
\r
200 uint32_t ErrCnt; /*!< Host channel error count.*/
\r
202 USB_OTG_URBStateTypeDef urb_state; /*!< URB state.
\r
203 This parameter can be any value of @ref USB_OTG_URBStateTypeDef */
\r
205 USB_OTG_HCStateTypeDef state; /*!< Host Channel state.
\r
206 This parameter can be any value of @ref USB_OTG_HCStateTypeDef */
\r
207 } USB_OTG_HCTypeDef;
\r
208 #endif /* defined (USB_OTG_FS) */
\r
214 USB_DEVICE_MODE = 0
\r
218 * @brief USB Initialization Structure definition
\r
222 uint32_t dev_endpoints; /*!< Device Endpoints number.
\r
223 This parameter depends on the used USB core.
\r
224 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
226 uint32_t speed; /*!< USB Core speed.
\r
227 This parameter can be any value of @ref USB_Core_Speed */
\r
229 uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */
\r
231 uint32_t phy_itface; /*!< Select the used PHY interface.
\r
232 This parameter can be any value of @ref USB_Core_PHY */
\r
234 uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */
\r
236 uint32_t low_power_enable; /*!< Enable or disable Low Power mode */
\r
238 uint32_t lpm_enable; /*!< Enable or disable Battery charging. */
\r
240 uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */
\r
245 uint8_t num; /*!< Endpoint number
\r
246 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
\r
248 uint8_t is_in; /*!< Endpoint direction
\r
249 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
251 uint8_t is_stall; /*!< Endpoint stall condition
\r
252 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
254 uint8_t type; /*!< Endpoint type
\r
255 This parameter can be any value of @ref USB_EP_Type */
\r
257 uint8_t data_pid_start; /*!< Initial data PID
\r
258 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
\r
260 uint16_t pmaadress; /*!< PMA Address
\r
261 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
\r
263 uint16_t pmaaddr0; /*!< PMA Address0
\r
264 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
\r
266 uint16_t pmaaddr1; /*!< PMA Address1
\r
267 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
\r
269 uint8_t doublebuffer; /*!< Double buffer enable
\r
270 This parameter can be 0 or 1 */
\r
272 uint16_t tx_fifo_num; /*!< This parameter is not required by USB Device FS peripheral, it is used
\r
273 only by USB OTG FS peripheral
\r
274 This parameter is added to ensure compatibility across USB peripherals */
\r
276 uint32_t maxpacket; /*!< Endpoint Max packet size
\r
277 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
\r
279 uint8_t *xfer_buff; /*!< Pointer to transfer buffer */
\r
281 uint32_t xfer_len; /*!< Current transfer length */
\r
283 uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */
\r
286 #endif /* defined (USB) */
\r
288 /* Exported constants --------------------------------------------------------*/
\r
290 /** @defgroup PCD_Exported_Constants PCD Exported Constants
\r
294 #if defined (USB_OTG_FS)
\r
295 /** @defgroup USB_OTG_CORE VERSION ID
\r
298 #define USB_OTG_CORE_ID_300A 0x4F54300AU
\r
299 #define USB_OTG_CORE_ID_310A 0x4F54310AU
\r
304 /** @defgroup USB_Core_Mode_ USB Core Mode
\r
307 #define USB_OTG_MODE_DEVICE 0U
\r
308 #define USB_OTG_MODE_HOST 1U
\r
309 #define USB_OTG_MODE_DRD 2U
\r
314 /** @defgroup USB_LL Device Speed
\r
317 #define USBD_FS_SPEED 2U
\r
318 #define USBH_FS_SPEED 1U
\r
323 /** @defgroup USB_LL_Core_Speed USB Low Layer Core Speed
\r
326 #define USB_OTG_SPEED_FULL 3U
\r
331 /** @defgroup USB_LL_Core_PHY USB Low Layer Core PHY
\r
334 #define USB_OTG_ULPI_PHY 1U
\r
335 #define USB_OTG_EMBEDDED_PHY 2U
\r
340 /** @defgroup USB_LL_Turnaround_Timeout Turnaround Timeout Value
\r
343 #ifndef USBD_FS_TRDT_VALUE
\r
344 #define USBD_FS_TRDT_VALUE 5U
\r
345 #define USBD_DEFAULT_TRDT_VALUE 9U
\r
346 #endif /* USBD_HS_TRDT_VALUE */
\r
351 /** @defgroup USB_LL_Core_MPS USB Low Layer Core MPS
\r
354 #define USB_OTG_FS_MAX_PACKET_SIZE 64U
\r
355 #define USB_OTG_MAX_EP0_SIZE 64U
\r
360 /** @defgroup USB_LL_Core_PHY_Frequency USB Low Layer Core PHY Frequency
\r
363 #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0U << 1)
\r
364 #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1U << 1)
\r
365 #define DSTS_ENUMSPD_LS_PHY_6MHZ (2U << 1)
\r
366 #define DSTS_ENUMSPD_FS_PHY_48MHZ (3U << 1)
\r
371 /** @defgroup USB_LL_CORE_Frame_Interval USB Low Layer Core Frame Interval
\r
374 #define DCFG_FRAME_INTERVAL_80 0U
\r
375 #define DCFG_FRAME_INTERVAL_85 1U
\r
376 #define DCFG_FRAME_INTERVAL_90 2U
\r
377 #define DCFG_FRAME_INTERVAL_95 3U
\r
382 /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
\r
385 #define DEP0CTL_MPS_64 0U
\r
386 #define DEP0CTL_MPS_32 1U
\r
387 #define DEP0CTL_MPS_16 2U
\r
388 #define DEP0CTL_MPS_8 3U
\r
393 /** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed
\r
396 #define EP_SPEED_LOW 0U
\r
397 #define EP_SPEED_FULL 1U
\r
398 #define EP_SPEED_HIGH 2U
\r
403 /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
\r
406 #define EP_TYPE_CTRL 0U
\r
407 #define EP_TYPE_ISOC 1U
\r
408 #define EP_TYPE_BULK 2U
\r
409 #define EP_TYPE_INTR 3U
\r
410 #define EP_TYPE_MSK 3U
\r
415 /** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines
\r
418 #define STS_GOUT_NAK 1U
\r
419 #define STS_DATA_UPDT 2U
\r
420 #define STS_XFER_COMP 3U
\r
421 #define STS_SETUP_COMP 4U
\r
422 #define STS_SETUP_UPDT 6U
\r
427 /** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines
\r
430 #define HCFG_30_60_MHZ 0U
\r
431 #define HCFG_48_MHZ 1U
\r
432 #define HCFG_6_MHZ 2U
\r
437 /** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines
\r
440 #define HPRT0_PRTSPD_HIGH_SPEED 0U
\r
441 #define HPRT0_PRTSPD_FULL_SPEED 1U
\r
442 #define HPRT0_PRTSPD_LOW_SPEED 2U
\r
447 #define HCCHAR_CTRL 0U
\r
448 #define HCCHAR_ISOC 1U
\r
449 #define HCCHAR_BULK 2U
\r
450 #define HCCHAR_INTR 3U
\r
452 #define HC_PID_DATA0 0U
\r
453 #define HC_PID_DATA2 1U
\r
454 #define HC_PID_DATA1 2U
\r
455 #define HC_PID_SETUP 3U
\r
457 #define GRXSTS_PKTSTS_IN 2U
\r
458 #define GRXSTS_PKTSTS_IN_XFER_COMP 3U
\r
459 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5U
\r
460 #define GRXSTS_PKTSTS_CH_HALTED 7U
\r
462 #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE)
\r
463 #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE)
\r
465 #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
\r
466 #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)(USBx_BASE + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
\r
467 #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
\r
468 #define USBx_DFIFO(i) *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))
\r
470 #define USBx_HOST ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE))
\r
471 #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)(USBx_BASE + USB_OTG_HOST_CHANNEL_BASE + ((i) * USB_OTG_HOST_CHANNEL_SIZE)))
\r
472 #endif /* defined (USB_OTG_FS) */
\r
475 /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
\r
478 #define DEP0CTL_MPS_64 0U
\r
479 #define DEP0CTL_MPS_32 1U
\r
480 #define DEP0CTL_MPS_16 2U
\r
481 #define DEP0CTL_MPS_8 3U
\r
486 /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
\r
489 #define EP_TYPE_CTRL 0U
\r
490 #define EP_TYPE_ISOC 1U
\r
491 #define EP_TYPE_BULK 2U
\r
492 #define EP_TYPE_INTR 3U
\r
493 #define EP_TYPE_MSK 3U
\r
498 /** @defgroup USB_LL Device Speed
\r
501 #define USBD_FS_SPEED 2U
\r
506 #define BTABLE_ADDRESS 0x000U
\r
507 #define PMA_ACCESS 1U
\r
508 #endif /* defined (USB) */
\r
509 #if defined (USB_OTG_FS)
\r
510 #define EP_ADDR_MSK 0xFU
\r
511 #endif /* defined (USB_OTG_FS) */
\r
513 #define EP_ADDR_MSK 0x7U
\r
514 #endif /* defined (USB) */
\r
519 /* Exported macro ------------------------------------------------------------*/
\r
520 /** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros
\r
523 #if defined (USB_OTG_FS)
\r
524 #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
\r
525 #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
\r
527 #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
\r
528 #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
\r
529 #endif /* defined (USB_OTG_FS) */
\r
534 /* Exported functions --------------------------------------------------------*/
\r
535 /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions
\r
538 #if defined (USB_OTG_FS)
\r
539 HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
\r
540 HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
\r
541 HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
\r
542 HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
\r
543 HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed);
\r
544 HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_ModeTypeDef mode);
\r
545 HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx, uint8_t speed);
\r
546 HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx);
\r
547 HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num);
\r
548 HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
549 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
550 HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
551 HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
552 HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
553 HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
554 HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len);
\r
555 void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
\r
556 HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
557 HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
\r
558 HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address);
\r
559 HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx);
\r
560 HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx);
\r
561 HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
\r
562 HAL_StatusTypeDef USB_ActivateSetup(USB_OTG_GlobalTypeDef *USBx);
\r
563 HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t *psetup);
\r
564 uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx);
\r
565 uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx);
\r
566 uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx);
\r
567 uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
\r
568 uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
\r
569 uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
\r
570 uint32_t USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
\r
571 void USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
\r
573 HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
\r
574 HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq);
\r
575 HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx);
\r
576 HAL_StatusTypeDef USB_DriveVbus(USB_OTG_GlobalTypeDef *USBx, uint8_t state);
\r
577 uint32_t USB_GetHostSpeed(USB_OTG_GlobalTypeDef *USBx);
\r
578 uint32_t USB_GetCurrentFrame(USB_OTG_GlobalTypeDef *USBx);
\r
579 HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx,
\r
582 uint8_t dev_address,
\r
586 HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc);
\r
587 uint32_t USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx);
\r
588 HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num);
\r
589 HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num);
\r
590 HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
\r
591 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
\r
592 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
\r
593 #endif /* defined (USB_OTG_FS) */
\r
596 HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
\r
597 HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
\r
598 HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx);
\r
599 HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx);
\r
600 HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode);
\r
601 HAL_StatusTypeDef USB_SetDevSpeed(USB_TypeDef *USBx, uint8_t speed);
\r
602 HAL_StatusTypeDef USB_FlushRxFifo(USB_TypeDef *USBx);
\r
603 HAL_StatusTypeDef USB_FlushTxFifo(USB_TypeDef *USBx, uint32_t num);
\r
604 HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
\r
605 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
\r
606 HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep);
\r
607 HAL_StatusTypeDef USB_WritePacket(USB_TypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len);
\r
608 void *USB_ReadPacket(USB_TypeDef *USBx, uint8_t *dest, uint16_t len);
\r
609 HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep);
\r
610 HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep);
\r
611 HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address);
\r
612 HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx);
\r
613 HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx);
\r
614 HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx);
\r
615 HAL_StatusTypeDef USB_EP0_OutStart(USB_TypeDef *USBx, uint8_t *psetup);
\r
616 uint32_t USB_ReadInterrupts(USB_TypeDef *USBx);
\r
617 uint32_t USB_ReadDevAllOutEpInterrupt(USB_TypeDef *USBx);
\r
618 uint32_t USB_ReadDevOutEPInterrupt(USB_TypeDef *USBx, uint8_t epnum);
\r
619 uint32_t USB_ReadDevAllInEpInterrupt(USB_TypeDef *USBx);
\r
620 uint32_t USB_ReadDevInEPInterrupt(USB_TypeDef *USBx, uint8_t epnum);
\r
621 void USB_ClearInterrupts(USB_TypeDef *USBx, uint32_t interrupt);
\r
623 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx);
\r
624 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx);
\r
625 void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
\r
626 void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
\r
627 #endif /* defined (USB) */
\r
643 #endif /* defined (USB) || defined (USB_OTG_FS) */
\r
650 #endif /* STM32L4xx_LL_USB_H */
\r
652 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
\r