2 ******************************************************************************
3 * @file stm32f1xx_ll_usb.h
4 * @author MCD Application Team
7 * @brief Header file of USB Low Layer HAL module.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F1xx_LL_USB_H
40 #define __STM32F1xx_LL_USB_H
46 #if defined(STM32F102x6) || defined(STM32F102xB) || \
47 defined(STM32F103x6) || defined(STM32F103xB) || \
48 defined(STM32F103xE) || defined(STM32F103xG) || \
49 defined(STM32F105xC) || defined(STM32F107xC)
51 /* Includes ------------------------------------------------------------------*/
52 #include "stm32f1xx_hal_def.h"
54 /** @addtogroup STM32F1xx_HAL_Driver
58 /** @addtogroup USB_LL
62 /* Exported types ------------------------------------------------------------*/
63 /** @defgroup USB_LL_Exported_Types USB Low Layer Exported Types
67 * @brief USB Mode definition
76 #if defined (USB_OTG_FS)
78 * @brief URB States definition
87 }USB_OTG_URBStateTypeDef
;
90 * @brief Host channel States definition
102 }USB_OTG_HCStateTypeDef
;
105 * @brief USB OTG Initialization Structure definition
109 uint32_t dev_endpoints
; /*!< Device Endpoints number.
110 This parameter depends on the used USB core.
111 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
113 uint32_t Host_channels
; /*!< Host Channels number.
114 This parameter Depends on the used USB core.
115 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
117 uint32_t speed
; /*!< USB Core speed.
118 This parameter can be any value of @ref USB_Core_Speed_ */
120 uint32_t ep0_mps
; /*!< Set the Endpoint 0 Max Packet size.
121 This parameter can be any value of @ref USB_EP0_MPS_ */
123 uint32_t Sof_enable
; /*!< Enable or disable the output of the SOF signal. */
125 uint32_t low_power_enable
; /*!< Enable or disable the low power mode. */
127 uint32_t vbus_sensing_enable
; /*!< Enable or disable the VBUS Sensing feature. */
129 uint32_t use_external_vbus
; /*!< Enable or disable the use of the external VBUS. */
134 uint8_t num
; /*!< Endpoint number
135 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
137 uint8_t is_in
; /*!< Endpoint direction
138 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
140 uint8_t is_stall
; /*!< Endpoint stall condition
141 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
143 uint8_t type
; /*!< Endpoint type
144 This parameter can be any value of @ref USB_EP_Type_ */
146 uint8_t data_pid_start
; /*!< Initial data PID
147 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
149 uint8_t even_odd_frame
; /*!< IFrame parity
150 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
152 uint16_t tx_fifo_num
; /*!< Transmission FIFO number
153 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
155 uint32_t maxpacket
; /*!< Endpoint Max packet size
156 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
158 uint8_t *xfer_buff
; /*!< Pointer to transfer buffer */
160 uint32_t dma_addr
; /*!< 32 bits aligned transfer buffer address */
162 uint32_t xfer_len
; /*!< Current transfer length */
164 uint32_t xfer_count
; /*!< Partial transfer length in case of multi packet transfer */
169 uint8_t dev_addr
; /*!< USB device address.
170 This parameter must be a number between Min_Data = 1 and Max_Data = 255 */
172 uint8_t ch_num
; /*!< Host channel number.
173 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
175 uint8_t ep_num
; /*!< Endpoint number.
176 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
178 uint8_t ep_is_in
; /*!< Endpoint direction
179 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
181 uint8_t speed
; /*!< USB Host speed.
182 This parameter can be any value of @ref USB_Core_Speed_ */
184 uint8_t do_ping
; /*!< Enable or disable the use of the PING protocol for HS mode. */
186 uint8_t process_ping
; /*!< Execute the PING protocol for HS mode. */
188 uint8_t ep_type
; /*!< Endpoint Type.
189 This parameter can be any value of @ref USB_EP_Type_ */
191 uint16_t max_packet
; /*!< Endpoint Max packet size.
192 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
194 uint8_t data_pid
; /*!< Initial data PID.
195 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
197 uint8_t *xfer_buff
; /*!< Pointer to transfer buffer. */
199 uint32_t xfer_len
; /*!< Current transfer length. */
201 uint32_t xfer_count
; /*!< Partial transfer length in case of multi packet transfer. */
203 uint8_t toggle_in
; /*!< IN transfer current toggle flag.
204 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
206 uint8_t toggle_out
; /*!< OUT transfer current toggle flag
207 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
209 uint32_t dma_addr
; /*!< 32 bits aligned transfer buffer address. */
211 uint32_t ErrCnt
; /*!< Host channel error count.*/
213 USB_OTG_URBStateTypeDef urb_state
; /*!< URB state.
214 This parameter can be any value of @ref USB_OTG_URBStateTypeDef */
216 USB_OTG_HCStateTypeDef state
; /*!< Host Channel state.
217 This parameter can be any value of @ref USB_OTG_HCStateTypeDef */
219 #endif /* USB_OTG_FS */
223 * @brief USB Initialization Structure definition
227 uint32_t dev_endpoints
; /*!< Device Endpoints number.
228 This parameter depends on the used USB core.
229 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
231 uint32_t speed
; /*!< USB Core speed.
232 This parameter can be any value of @ref USB_Core_Speed */
234 uint32_t ep0_mps
; /*!< Set the Endpoint 0 Max Packet size.
235 This parameter can be any value of @ref USB_EP0_MPS */
237 uint32_t phy_itface
; /*!< Select the used PHY interface.
238 This parameter can be any value of @ref USB_Core_PHY */
240 uint32_t Sof_enable
; /*!< Enable or disable the output of the SOF signal. */
242 uint32_t low_power_enable
; /*!< Enable or disable Low Power mode */
244 uint32_t lpm_enable
; /*!< Enable or disable Battery charging. */
246 uint32_t battery_charging_enable
; /*!< Enable or disable Battery charging. */
251 uint8_t num
; /*!< Endpoint number
252 This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
254 uint8_t is_in
; /*!< Endpoint direction
255 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
257 uint8_t is_stall
; /*!< Endpoint stall condition
258 This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
260 uint8_t type
; /*!< Endpoint type
261 This parameter can be any value of @ref USB_EP_Type */
263 uint16_t pmaadress
; /*!< PMA Address
264 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
266 uint16_t pmaaddr0
; /*!< PMA Address0
267 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
269 uint16_t pmaaddr1
; /*!< PMA Address1
270 This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
272 uint8_t doublebuffer
; /*!< Double buffer enable
273 This parameter can be 0 or 1 */
275 uint16_t tx_fifo_num
; /*!< This parameter is not required by USB Device FS peripheral, it is used
276 only by USB OTG FS peripheral
277 This parameter is added to ensure compatibility across USB peripherals */
279 uint32_t maxpacket
; /*!< Endpoint Max packet size
280 This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
282 uint8_t *xfer_buff
; /*!< Pointer to transfer buffer */
284 uint32_t xfer_len
; /*!< Current transfer length */
286 uint32_t xfer_count
; /*!< Partial transfer length in case of multi packet transfer */
294 /* Exported constants --------------------------------------------------------*/
295 /** @defgroup USB_LL_Exported_Constants USB Low Layer Exported Constants
298 #if defined (USB_OTG_FS)
299 /** @defgroup USB_LL_Core_Mode USB Low Layer Core Mode
302 #define USB_OTG_MODE_DEVICE 0
303 #define USB_OTG_MODE_HOST 1
304 #define USB_OTG_MODE_DRD 2
309 /** @defgroup USB_LL_Core_Speed USB Low Layer Core Speed
312 #define USB_OTG_SPEED_LOW 2
313 #define USB_OTG_SPEED_FULL 3
319 /** @defgroup USB_LL_Core_PHY USB Low Layer Core PHY
322 #define USB_OTG_ULPI_PHY 1
323 #define USB_OTG_EMBEDDED_PHY 2
328 /** @defgroup USB_LL_Core_MPS USB Low Layer Core MPS
331 #define USB_OTG_FS_MAX_PACKET_SIZE 64
332 #define USB_OTG_MAX_EP0_SIZE 64
337 /** @defgroup USB_LL_Core_PHY_Frequency USB Low Layer Core PHY Frequency
340 #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1 << 1)
341 #define DSTS_ENUMSPD_LS_PHY_6MHZ (2 << 1)
342 #define DSTS_ENUMSPD_FS_PHY_48MHZ (3 << 1)
347 /** @defgroup USB_LL_CORE_Frame_Interval USB Low Layer Core Frame Interval
350 #define DCFG_FRAME_INTERVAL_80 0
351 #define DCFG_FRAME_INTERVAL_85 1
352 #define DCFG_FRAME_INTERVAL_90 2
353 #define DCFG_FRAME_INTERVAL_95 3
358 /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
361 #define DEP0CTL_MPS_64 0
362 #define DEP0CTL_MPS_32 1
363 #define DEP0CTL_MPS_16 2
364 #define DEP0CTL_MPS_8 3
369 /** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed
372 #define EP_SPEED_LOW 0
373 #define EP_SPEED_FULL 1
374 #define EP_SPEED_HIGH 2
379 /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
382 #define EP_TYPE_CTRL 0
383 #define EP_TYPE_ISOC 1
384 #define EP_TYPE_BULK 2
385 #define EP_TYPE_INTR 3
386 #define EP_TYPE_MSK 3
391 /** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines
394 #define STS_GOUT_NAK 1
395 #define STS_DATA_UPDT 2
396 #define STS_XFER_COMP 3
397 #define STS_SETUP_COMP 4
398 #define STS_SETUP_UPDT 6
403 /** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines
406 #define HCFG_30_60_MHZ 0
407 #define HCFG_48_MHZ 1
413 /** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines
416 #define HPRT0_PRTSPD_HIGH_SPEED 0
417 #define HPRT0_PRTSPD_FULL_SPEED 1
418 #define HPRT0_PRTSPD_LOW_SPEED 2
423 #define HCCHAR_CTRL 0
424 #define HCCHAR_ISOC 1
425 #define HCCHAR_BULK 2
426 #define HCCHAR_INTR 3
428 #define HC_PID_DATA0 0
429 #define HC_PID_DATA2 1
430 #define HC_PID_DATA1 2
431 #define HC_PID_SETUP 3
433 #define GRXSTS_PKTSTS_IN 2
434 #define GRXSTS_PKTSTS_IN_XFER_COMP 3
435 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5
436 #define GRXSTS_PKTSTS_CH_HALTED 7
438 #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_PCGCCTL_BASE)
439 #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_HOST_PORT_BASE)
441 #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)((uint32_t )USBx + USB_OTG_DEVICE_BASE))
442 #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)((uint32_t)USBx + USB_OTG_IN_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE))
443 #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)((uint32_t)USBx + USB_OTG_OUT_ENDPOINT_BASE + (i)*USB_OTG_EP_REG_SIZE))
444 #define USBx_DFIFO(i) *(__IO uint32_t *)((uint32_t)USBx + USB_OTG_FIFO_BASE + (i) * USB_OTG_FIFO_SIZE)
446 #define USBx_HOST ((USB_OTG_HostTypeDef *)((uint32_t )USBx + USB_OTG_HOST_BASE))
447 #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)((uint32_t)USBx + USB_OTG_HOST_CHANNEL_BASE + (i)*USB_OTG_HOST_CHANNEL_SIZE))
448 #endif /* USB_OTG_FS */
451 /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
454 #define DEP0CTL_MPS_64 0
455 #define DEP0CTL_MPS_32 1
456 #define DEP0CTL_MPS_16 2
457 #define DEP0CTL_MPS_8 3
462 /** @defgroup USB_LL_EP_Type USB Low Layer EP Type
465 #define EP_TYPE_CTRL 0
466 #define EP_TYPE_ISOC 1
467 #define EP_TYPE_BULK 2
468 #define EP_TYPE_INTR 3
469 #define EP_TYPE_MSK 3
474 #define BTABLE_ADDRESS (0x000)
480 /* Exported macros -----------------------------------------------------------*/
481 /** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros
484 #if defined (USB_OTG_FS)
485 #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
486 #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
488 #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
489 #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
490 #endif /* USB_OTG_FS */
495 /* Exported functions --------------------------------------------------------*/
496 /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions
499 /** @addtogroup USB_LL_Exported_Functions_Group1 Peripheral Control functions
502 #if defined (USB_OTG_FS)
503 HAL_StatusTypeDef
USB_CoreInit(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_CfgTypeDef Init
);
504 HAL_StatusTypeDef
USB_DevInit(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_CfgTypeDef Init
);
505 HAL_StatusTypeDef
USB_EnableGlobalInt(USB_OTG_GlobalTypeDef
*USBx
);
506 HAL_StatusTypeDef
USB_DisableGlobalInt(USB_OTG_GlobalTypeDef
*USBx
);
507 HAL_StatusTypeDef
USB_SetCurrentMode(USB_OTG_GlobalTypeDef
*USBx
, USB_ModeTypeDef mode
);
508 HAL_StatusTypeDef
USB_SetDevSpeed(USB_OTG_GlobalTypeDef
*USBx
, uint8_t speed
);
509 HAL_StatusTypeDef
USB_FlushRxFifo (USB_OTG_GlobalTypeDef
*USBx
);
510 HAL_StatusTypeDef
USB_FlushTxFifo (USB_OTG_GlobalTypeDef
*USBx
, uint32_t num
);
511 HAL_StatusTypeDef
USB_ActivateEndpoint(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_EPTypeDef
*ep
);
512 HAL_StatusTypeDef
USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_EPTypeDef
*ep
);
513 HAL_StatusTypeDef
USB_EPStartXfer(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_EPTypeDef
*ep
);
514 HAL_StatusTypeDef
USB_EP0StartXfer(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_EPTypeDef
*ep
);
515 HAL_StatusTypeDef
USB_WritePacket(USB_OTG_GlobalTypeDef
*USBx
, uint8_t *src
, uint8_t ch_ep_num
, uint16_t len
);
516 void * USB_ReadPacket(USB_OTG_GlobalTypeDef
*USBx
, uint8_t *dest
, uint16_t len
);
517 HAL_StatusTypeDef
USB_EPSetStall(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_EPTypeDef
*ep
);
518 HAL_StatusTypeDef
USB_EPClearStall(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_EPTypeDef
*ep
);
519 HAL_StatusTypeDef
USB_SetDevAddress (USB_OTG_GlobalTypeDef
*USBx
, uint8_t address
);
520 HAL_StatusTypeDef
USB_DevConnect (USB_OTG_GlobalTypeDef
*USBx
);
521 HAL_StatusTypeDef
USB_DevDisconnect (USB_OTG_GlobalTypeDef
*USBx
);
522 HAL_StatusTypeDef
USB_StopDevice(USB_OTG_GlobalTypeDef
*USBx
);
523 HAL_StatusTypeDef
USB_ActivateSetup (USB_OTG_GlobalTypeDef
*USBx
);
524 HAL_StatusTypeDef
USB_EP0_OutStart(USB_OTG_GlobalTypeDef
*USBx
, uint8_t *psetup
);
525 uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef
*USBx
);
526 uint32_t USB_GetMode(USB_OTG_GlobalTypeDef
*USBx
);
527 uint32_t USB_ReadInterrupts (USB_OTG_GlobalTypeDef
*USBx
);
528 uint32_t USB_ReadDevAllOutEpInterrupt (USB_OTG_GlobalTypeDef
*USBx
);
529 uint32_t USB_ReadDevOutEPInterrupt (USB_OTG_GlobalTypeDef
*USBx
, uint8_t epnum
);
530 uint32_t USB_ReadDevAllInEpInterrupt (USB_OTG_GlobalTypeDef
*USBx
);
531 uint32_t USB_ReadDevInEPInterrupt (USB_OTG_GlobalTypeDef
*USBx
, uint8_t epnum
);
532 void USB_ClearInterrupts (USB_OTG_GlobalTypeDef
*USBx
, uint32_t interrupt
);
534 HAL_StatusTypeDef
USB_HostInit (USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_CfgTypeDef cfg
);
535 HAL_StatusTypeDef
USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef
*USBx
, uint8_t freq
);
536 HAL_StatusTypeDef
USB_ResetPort(USB_OTG_GlobalTypeDef
*USBx
);
537 HAL_StatusTypeDef
USB_DriveVbus (USB_OTG_GlobalTypeDef
*USBx
, uint8_t state
);
538 uint32_t USB_GetHostSpeed (USB_OTG_GlobalTypeDef
*USBx
);
539 uint32_t USB_GetCurrentFrame (USB_OTG_GlobalTypeDef
*USBx
);
540 HAL_StatusTypeDef
USB_HC_Init(USB_OTG_GlobalTypeDef
*USBx
,
547 HAL_StatusTypeDef
USB_HC_StartXfer(USB_OTG_GlobalTypeDef
*USBx
, USB_OTG_HCTypeDef
*hc
);
548 uint32_t USB_HC_ReadInterrupt (USB_OTG_GlobalTypeDef
*USBx
);
549 HAL_StatusTypeDef
USB_HC_Halt(USB_OTG_GlobalTypeDef
*USBx
, uint8_t hc_num
);
550 HAL_StatusTypeDef
USB_DoPing(USB_OTG_GlobalTypeDef
*USBx
, uint8_t ch_num
);
551 HAL_StatusTypeDef
USB_StopHost(USB_OTG_GlobalTypeDef
*USBx
);
552 HAL_StatusTypeDef
USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef
*USBx
);
553 HAL_StatusTypeDef
USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef
*USBx
);
554 #endif /* USB_OTG_FS */
557 HAL_StatusTypeDef
USB_CoreInit(USB_TypeDef
*USBx
, USB_CfgTypeDef Init
);
558 HAL_StatusTypeDef
USB_DevInit(USB_TypeDef
*USBx
, USB_CfgTypeDef Init
);
559 HAL_StatusTypeDef
USB_EnableGlobalInt(USB_TypeDef
*USBx
);
560 HAL_StatusTypeDef
USB_DisableGlobalInt(USB_TypeDef
*USBx
);
561 HAL_StatusTypeDef
USB_SetCurrentMode(USB_TypeDef
*USBx
, USB_ModeTypeDef mode
);
562 HAL_StatusTypeDef
USB_SetDevSpeed(USB_TypeDef
*USBx
, uint8_t speed
);
563 HAL_StatusTypeDef
USB_FlushRxFifo (USB_TypeDef
*USBx
);
564 HAL_StatusTypeDef
USB_FlushTxFifo (USB_TypeDef
*USBx
, uint32_t num
);
565 HAL_StatusTypeDef
USB_ActivateEndpoint(USB_TypeDef
*USBx
, USB_EPTypeDef
*ep
);
566 HAL_StatusTypeDef
USB_DeactivateEndpoint(USB_TypeDef
*USBx
, USB_EPTypeDef
*ep
);
567 HAL_StatusTypeDef
USB_EPStartXfer(USB_TypeDef
*USBx
, USB_EPTypeDef
*ep
);
568 HAL_StatusTypeDef
USB_WritePacket(USB_TypeDef
*USBx
, uint8_t *src
, uint8_t ch_ep_num
, uint16_t len
);
569 void * USB_ReadPacket(USB_TypeDef
*USBx
, uint8_t *dest
, uint16_t len
);
570 HAL_StatusTypeDef
USB_EPSetStall(USB_TypeDef
*USBx
, USB_EPTypeDef
*ep
);
571 HAL_StatusTypeDef
USB_EPClearStall(USB_TypeDef
*USBx
, USB_EPTypeDef
*ep
);
572 HAL_StatusTypeDef
USB_SetDevAddress (USB_TypeDef
*USBx
, uint8_t address
);
573 HAL_StatusTypeDef
USB_DevConnect (USB_TypeDef
*USBx
);
574 HAL_StatusTypeDef
USB_DevDisconnect (USB_TypeDef
*USBx
);
575 HAL_StatusTypeDef
USB_StopDevice(USB_TypeDef
*USBx
);
576 HAL_StatusTypeDef
USB_EP0_OutStart(USB_TypeDef
*USBx
, uint8_t *psetup
);
577 uint32_t USB_ReadInterrupts (USB_TypeDef
*USBx
);
578 uint32_t USB_ReadDevAllOutEpInterrupt (USB_TypeDef
*USBx
);
579 uint32_t USB_ReadDevOutEPInterrupt (USB_TypeDef
*USBx
, uint8_t epnum
);
580 uint32_t USB_ReadDevAllInEpInterrupt (USB_TypeDef
*USBx
);
581 uint32_t USB_ReadDevInEPInterrupt (USB_TypeDef
*USBx
, uint8_t epnum
);
582 void USB_ClearInterrupts (USB_TypeDef
*USBx
, uint32_t interrupt
);
584 HAL_StatusTypeDef
USB_ActivateRemoteWakeup(USB_TypeDef
*USBx
);
585 HAL_StatusTypeDef
USB_DeActivateRemoteWakeup(USB_TypeDef
*USBx
);
586 void USB_WritePMA(USB_TypeDef
*USBx
, uint8_t *pbUsrBuf
, uint16_t wPMABufAddr
, uint16_t wNBytes
);
587 void USB_ReadPMA(USB_TypeDef
*USBx
, uint8_t *pbUsrBuf
, uint16_t wPMABufAddr
, uint16_t wNBytes
);
604 #endif /* STM32F102x6 || STM32F102xB || */
605 /* STM32F103x6 || STM32F103xB || */
606 /* STM32F103xE || STM32F103xG || */
607 /* STM32F105xC || STM32F107xC */
614 #endif /* __STM32F1xx_LL_USB_H */
616 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/