STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_ll_usb.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32L4xx_LL_USB_H
22 #define STM32L4xx_LL_USB_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32l4xx_hal_def.h"
30 
31 #if defined (USB) || defined (USB_OTG_FS)
32 
40 /* Exported types ------------------------------------------------------------*/
41 
45 #if defined (USB_OTG_FS)
46 
47 typedef enum
48 {
53 
57 typedef enum
58 {
59  URB_IDLE = 0,
66 
70 typedef enum
71 {
72  HC_IDLE = 0,
82 
86 typedef struct
87 {
88  uint32_t dev_endpoints;
92  uint32_t Host_channels;
96  uint32_t speed;
99  uint32_t dma_enable;
101  uint32_t ep0_mps;
103  uint32_t phy_itface;
106  uint32_t Sof_enable;
108  uint32_t low_power_enable;
110  uint32_t lpm_enable;
116  uint32_t use_dedicated_ep1;
118  uint32_t use_external_vbus;
120 
121 typedef struct
122 {
123  uint8_t num;
126  uint8_t is_in;
129  uint8_t is_stall;
132  uint8_t type;
135  uint8_t data_pid_start;
138  uint8_t even_odd_frame;
141  uint16_t tx_fifo_num;
144  uint32_t maxpacket;
147  uint8_t *xfer_buff;
149  uint32_t dma_addr;
151  uint32_t xfer_len;
153  uint32_t xfer_count;
155 
156 typedef struct
157 {
158  uint8_t dev_addr ;
161  uint8_t ch_num;
164  uint8_t ep_num;
167  uint8_t ep_is_in;
170  uint8_t speed;
173  uint8_t do_ping;
175  uint8_t process_ping;
177  uint8_t ep_type;
180  uint16_t max_packet;
183  uint8_t data_pid;
186  uint8_t *xfer_buff;
188  uint32_t xfer_len;
190  uint32_t xfer_count;
192  uint8_t toggle_in;
195  uint8_t toggle_out;
198  uint32_t dma_addr;
200  uint32_t ErrCnt;
202  USB_OTG_URBStateTypeDef urb_state;
205  USB_OTG_HCStateTypeDef state;
208 #endif /* defined (USB_OTG_FS) */
209 
210 #if defined (USB)
211 
212 typedef enum
213 {
214  USB_DEVICE_MODE = 0
216 
220 typedef struct
221 {
222  uint32_t dev_endpoints;
226  uint32_t speed;
229  uint32_t ep0_mps;
231  uint32_t phy_itface;
234  uint32_t Sof_enable;
236  uint32_t low_power_enable;
238  uint32_t lpm_enable;
242 
243 typedef struct
244 {
245  uint8_t num;
248  uint8_t is_in;
251  uint8_t is_stall;
254  uint8_t type;
257  uint8_t data_pid_start;
260  uint16_t pmaadress;
263  uint16_t pmaaddr0;
266  uint16_t pmaaddr1;
269  uint8_t doublebuffer;
272  uint16_t tx_fifo_num;
276  uint32_t maxpacket;
279  uint8_t *xfer_buff;
281  uint32_t xfer_len;
283  uint32_t xfer_count;
285 } USB_EPTypeDef;
286 #endif /* defined (USB) */
287 
288 /* Exported constants --------------------------------------------------------*/
289 
294 #if defined (USB_OTG_FS)
295 
298 #define USB_OTG_CORE_ID_300A 0x4F54300AU
299 #define USB_OTG_CORE_ID_310A 0x4F54310AU
300 
307 #define USB_OTG_MODE_DEVICE 0U
308 #define USB_OTG_MODE_HOST 1U
309 #define USB_OTG_MODE_DRD 2U
310 
317 #define USBD_FS_SPEED 2U
318 #define USBH_FS_SPEED 1U
319 
326 #define USB_OTG_SPEED_FULL 3U
327 
334 #define USB_OTG_ULPI_PHY 1U
335 #define USB_OTG_EMBEDDED_PHY 2U
336 
343 #ifndef USBD_FS_TRDT_VALUE
344 #define USBD_FS_TRDT_VALUE 5U
345 #define USBD_DEFAULT_TRDT_VALUE 9U
346 #endif /* USBD_HS_TRDT_VALUE */
347 
354 #define USB_OTG_FS_MAX_PACKET_SIZE 64U
355 #define USB_OTG_MAX_EP0_SIZE 64U
356 
363 #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0U << 1)
364 #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1U << 1)
365 #define DSTS_ENUMSPD_LS_PHY_6MHZ (2U << 1)
366 #define DSTS_ENUMSPD_FS_PHY_48MHZ (3U << 1)
367 
374 #define DCFG_FRAME_INTERVAL_80 0U
375 #define DCFG_FRAME_INTERVAL_85 1U
376 #define DCFG_FRAME_INTERVAL_90 2U
377 #define DCFG_FRAME_INTERVAL_95 3U
378 
385 #define DEP0CTL_MPS_64 0U
386 #define DEP0CTL_MPS_32 1U
387 #define DEP0CTL_MPS_16 2U
388 #define DEP0CTL_MPS_8 3U
389 
396 #define EP_SPEED_LOW 0U
397 #define EP_SPEED_FULL 1U
398 #define EP_SPEED_HIGH 2U
399 
406 #define EP_TYPE_CTRL 0U
407 #define EP_TYPE_ISOC 1U
408 #define EP_TYPE_BULK 2U
409 #define EP_TYPE_INTR 3U
410 #define EP_TYPE_MSK 3U
411 
418 #define STS_GOUT_NAK 1U
419 #define STS_DATA_UPDT 2U
420 #define STS_XFER_COMP 3U
421 #define STS_SETUP_COMP 4U
422 #define STS_SETUP_UPDT 6U
423 
430 #define HCFG_30_60_MHZ 0U
431 #define HCFG_48_MHZ 1U
432 #define HCFG_6_MHZ 2U
433 
440 #define HPRT0_PRTSPD_HIGH_SPEED 0U
441 #define HPRT0_PRTSPD_FULL_SPEED 1U
442 #define HPRT0_PRTSPD_LOW_SPEED 2U
443 
447 #define HCCHAR_CTRL 0U
448 #define HCCHAR_ISOC 1U
449 #define HCCHAR_BULK 2U
450 #define HCCHAR_INTR 3U
451 
452 #define HC_PID_DATA0 0U
453 #define HC_PID_DATA2 1U
454 #define HC_PID_DATA1 2U
455 #define HC_PID_SETUP 3U
456 
457 #define GRXSTS_PKTSTS_IN 2U
458 #define GRXSTS_PKTSTS_IN_XFER_COMP 3U
459 #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5U
460 #define GRXSTS_PKTSTS_CH_HALTED 7U
461 
462 #define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE)
463 #define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE)
464 
465 #define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
466 #define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)(USBx_BASE + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
467 #define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
468 #define USBx_DFIFO(i) *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))
469 
470 #define USBx_HOST ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE))
471 #define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)(USBx_BASE + USB_OTG_HOST_CHANNEL_BASE + ((i) * USB_OTG_HOST_CHANNEL_SIZE)))
472 #endif /* defined (USB_OTG_FS) */
473 
474 #if defined (USB)
475 
478 #define DEP0CTL_MPS_64 0U
479 #define DEP0CTL_MPS_32 1U
480 #define DEP0CTL_MPS_16 2U
481 #define DEP0CTL_MPS_8 3U
482 
489 #define EP_TYPE_CTRL 0U
490 #define EP_TYPE_ISOC 1U
491 #define EP_TYPE_BULK 2U
492 #define EP_TYPE_INTR 3U
493 #define EP_TYPE_MSK 3U
494 
501 #define USBD_FS_SPEED 2U
502 
506 #define BTABLE_ADDRESS 0x000U
507 #define PMA_ACCESS 1U
508 #endif /* defined (USB) */
509 #if defined (USB_OTG_FS)
510 #define EP_ADDR_MSK 0xFU
511 #endif /* defined (USB_OTG_FS) */
512 #if defined (USB)
513 #define EP_ADDR_MSK 0x7U
514 #endif /* defined (USB) */
515 
519 /* Exported macro ------------------------------------------------------------*/
523 #if defined (USB_OTG_FS)
524 #define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
525 #define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
526 
527 #define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
528 #define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
529 #endif /* defined (USB_OTG_FS) */
530 
534 /* Exported functions --------------------------------------------------------*/
538 #if defined (USB_OTG_FS)
539 HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
540 HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
541 HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
542 HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
543 HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed);
544 HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_ModeTypeDef mode);
545 HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx, uint8_t speed);
546 HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx);
547 HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num);
548 HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
549 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
550 HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
551 HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
552 HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
553 HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
554 HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len);
555 void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
556 HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
557 HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
558 HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address);
559 HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx);
560 HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx);
561 HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
562 HAL_StatusTypeDef USB_ActivateSetup(USB_OTG_GlobalTypeDef *USBx);
563 HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t *psetup);
564 uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx);
565 uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx);
566 uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx);
567 uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
568 uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
569 uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
570 uint32_t USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
571 void USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
572 
573 HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
574 HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq);
575 HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx);
576 HAL_StatusTypeDef USB_DriveVbus(USB_OTG_GlobalTypeDef *USBx, uint8_t state);
577 uint32_t USB_GetHostSpeed(USB_OTG_GlobalTypeDef *USBx);
578 uint32_t USB_GetCurrentFrame(USB_OTG_GlobalTypeDef *USBx);
579 HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx,
580  uint8_t ch_num,
581  uint8_t epnum,
582  uint8_t dev_address,
583  uint8_t speed,
584  uint8_t ep_type,
585  uint16_t mps);
586 HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc);
587 uint32_t USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx);
588 HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num);
589 HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num);
590 HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
591 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
592 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
593 #endif /* defined (USB_OTG_FS) */
594 
595 #if defined (USB)
596 HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
597 HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
598 HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx);
599 HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx);
600 HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode);
601 HAL_StatusTypeDef USB_SetDevSpeed(USB_TypeDef *USBx, uint8_t speed);
602 HAL_StatusTypeDef USB_FlushRxFifo(USB_TypeDef *USBx);
603 HAL_StatusTypeDef USB_FlushTxFifo(USB_TypeDef *USBx, uint32_t num);
604 HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
605 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep);
606 HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep);
607 HAL_StatusTypeDef USB_WritePacket(USB_TypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len);
608 void *USB_ReadPacket(USB_TypeDef *USBx, uint8_t *dest, uint16_t len);
609 HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep);
610 HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep);
611 HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address);
612 HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx);
613 HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx);
614 HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx);
615 HAL_StatusTypeDef USB_EP0_OutStart(USB_TypeDef *USBx, uint8_t *psetup);
616 uint32_t USB_ReadInterrupts(USB_TypeDef *USBx);
617 uint32_t USB_ReadDevAllOutEpInterrupt(USB_TypeDef *USBx);
618 uint32_t USB_ReadDevOutEPInterrupt(USB_TypeDef *USBx, uint8_t epnum);
619 uint32_t USB_ReadDevAllInEpInterrupt(USB_TypeDef *USBx);
620 uint32_t USB_ReadDevInEPInterrupt(USB_TypeDef *USBx, uint8_t epnum);
621 void USB_ClearInterrupts(USB_TypeDef *USBx, uint32_t interrupt);
622 
623 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx);
624 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx);
625 void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
626 void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes);
627 #endif /* defined (USB) */
628 
643 #endif /* defined (USB) || defined (USB_OTG_FS) */
644 
645 #ifdef __cplusplus
646 }
647 #endif
648 
649 
650 #endif /* STM32L4xx_LL_USB_H */
651 
652 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
USB_ModeTypeDef
USB Mode definition.
HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
Initialize a host channel.
uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum)
Returns Device OUT EP Interrupt register.
HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address)
USB_SetDevAddress : Stop the usb device mode.
USB_OTG_URBStateTypeDef
URB States definition.
uint32_t USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx)
Read all host channel interrupts status.
HAL_StatusTypeDef USB_DriveVbus(USB_OTG_GlobalTypeDef *USBx, uint8_t state)
USB_DriveVbus : activate or de-activate vbus.
uint8_t data_pid_start
HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx)
USB_DeActivateRemoteWakeup de-active remote wakeup signalling.
HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EPStartXfer : setup and starts a transfer over an EP.
HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx)
USB_EnableGlobalInt Enables the controller&#39;s Global Int in the AHB Config reg.
HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
Activate and configure an endpoint.
void * USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len)
USB_ReadPacket : read a packet from the RX FIFO.
HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg)
USB_DevInit : Initializes the USB_OTG controller registers for device mode.
HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx)
USB_OTG_ResetPort : Reset Host Port.
USB_OTG_HCStateTypeDef state
HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t *psetup)
Prepare the EP0 to start the first control setup.
HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num)
Initiate Do Ping protocol.
HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
De-activate and de-initialize a dedicated endpoint.
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq)
USB_InitFSLSPClkSel : Initializes the FSLSPClkSel field of the HCFG register on the PHY type and set ...
HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len)
USB_WritePacket : Writes a packet into the Tx FIFO associated with the EP/channel.
HAL_StatusTypeDef USB_ActivateSetup(USB_OTG_GlobalTypeDef *USBx)
Activate EP0 for Setup transactions.
HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx)
USB_ActivateRemoteWakeup active remote wakeup signalling.
uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx)
USB_ReadDevAllOutEpInterrupt: return the USB device OUT endpoints interrupt status.
HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx)
USB_DisableGlobalInt Disable the controller&#39;s Global Int in the AHB Config reg.
HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc)
Start a transfer over a host channel.
HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EP0StartXfer : setup and starts a transfer over the EP 0.
uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx)
USB_ReadInterrupts: return the global USB interrupt status.
HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EPClearStall : Clear a stall condition over an EP.
HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx, uint8_t speed)
USB_SetDevSpeed Initializes the DevSpd field of DCFG register depending the PHY type and the enumerat...
uint16_t tx_fifo_num
HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx)
USB_StopDevice : Stop the usb device mode.
uint32_t USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum)
Returns Device IN EP Interrupt register.
HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num)
Halt a host channel.
HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg)
Initializes the USB Core.
USB_OTG_URBStateTypeDef urb_state
void USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt)
USB_ClearInterrupts: clear a USB interrupt.
USB OTG Initialization Structure definition.
USB Initialization Structure definition.
uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx)
USB_ReadDevAllInEpInterrupt: return the USB device IN endpoints interrupt status. ...
HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
Activate and configure a dedicated endpoint.
uint32_t low_power_enable
uint32_t USB_GetCurrentFrame(USB_OTG_GlobalTypeDef *USBx)
Return Host Current Frame number.
uint32_t battery_charging_enable
void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes)
Copy a buffer from user memory area to packet memory area (PMA)
uint8_t * xfer_buff
HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed)
Set the USB turnaround time.
HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx)
USB_FlushRxFifo : Flush Rx FIFO.
HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx)
USB_DevDisconnect : Disconnect the USB device by disabling the pull-up/pull-down. ...
USB_OTG_HCStateTypeDef
Host channel States definition.
HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx)
Stop Host Core.
uint32_t battery_charging_enable
uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx)
USB_GetDevSpeed Return the Dev Speed.
HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx)
USB_DevConnect : Connect the USB device by enabling the pull-up/pull-down.
HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_ModeTypeDef mode)
USB_SetCurrentMode : Set functional mode.
HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num)
USB_OTG_FlushTxFifo : Flush a Tx FIFO.
void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes)
Copy a buffer from user memory area to packet memory area (PMA)
HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg)
USB_HostInit : Initializes the USB OTG controller registers for Host mode.
HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
De-activate and de-initialize an endpoint.
HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep)
USB_EPSetStall : set a stall condition over an EP.
uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx)
Returns USB core mode.
uint32_t USB_GetHostSpeed(USB_OTG_GlobalTypeDef *USBx)
Return Host Core speed.
uint32_t dev_endpoints