#include "stm32f4xx_hal.h"
USB_CoreInit(USB_OTG_GlobalTypeDef *, USB_OTG_CfgTypeDef)
if
(cfg.phy_itface == USB_OTG_ULPI_PHY)
if
(cfg.use_external_vbus == 1U)
else
if
(cfg.battery_charging_enable == 0U)
else
if
(cfg.dma_enable == 1U)
USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *, uint32_t, uint8_t)
if
(speed == USBD_FS_SPEED)
if
((hclk >= 14200000U) && (hclk < 15000000U))
else if
((hclk >= 15000000U) && (hclk < 16000000U))
else if
((hclk >= 16000000U) && (hclk < 17200000U))
else if
((hclk >= 17200000U) && (hclk < 18500000U))
else if
((hclk >= 18500000U) && (hclk < 20000000U))
else if
((hclk >= 20000000U) && (hclk < 21800000U))
else if
((hclk >= 21800000U) && (hclk < 24000000U))
else if
((hclk >= 24000000U) && (hclk < 27700000U))
else if
((hclk >= 27700000U) && (hclk < 32000000U))
else
else if
(speed == USBD_HS_SPEED)
else
USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *)
USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *)
USB_SetCurrentMode(USB_OTG_GlobalTypeDef *, USB_OTG_ModeTypeDef)
if
(mode == USB_HOST_MODE)
else if
(mode == USB_DEVICE_MODE)
else
if
(ms == HAL_USB_CURRENT_MODE_MAX_DELAY_MS)
USB_DevInit(USB_OTG_GlobalTypeDef *, USB_OTG_CfgTypeDef)
for
(i = 0U; i < 15U; i++)
if
(cfg.vbus_sensing_enable == 0U)
else
if
(cfg.vbus_sensing_enable == 0U)
else
if
(cfg.phy_itface == USB_OTG_ULPI_PHY)
if
(cfg.speed == USBD_HS_SPEED)
else
else
if
(USB_FlushRxFifo(USBx) != HAL_OK)
for
(i = 0U; i < cfg.dev_endpoints; i++)
if
((USBx_INEP(i)->DIEPCTL & USB_OTG_DIEPCTL_EPENA) == USB_OTG_DIEPCTL_EPENA)
if
(i == 0U)
else
else
for
(i = 0U; i < cfg.dev_endpoints; i++)
if
((USBx_OUTEP(i)->DOEPCTL & USB_OTG_DOEPCTL_EPENA) == USB_OTG_DOEPCTL_EPENA)
if
(i == 0U)
else
else
if
(cfg.dma_enable == 0U)
if
(cfg.Sof_enable != 0U)
if
(cfg.vbus_sensing_enable == 1U)
USB_FlushTxFifo(USB_OTG_GlobalTypeDef *, uint32_t)
if
(count > HAL_USB_TIMEOUT)
if
(count > HAL_USB_TIMEOUT)
USB_FlushRxFifo(USB_OTG_GlobalTypeDef *)
if
(count > HAL_USB_TIMEOUT)
if
(count > HAL_USB_TIMEOUT)
USB_SetDevSpeed(const USB_OTG_GlobalTypeDef *, uint8_t)
USB_GetDevSpeed(const USB_OTG_GlobalTypeDef *)
if
(DevEnumSpeed == DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ)
else if
((DevEnumSpeed == DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ) || (DevEnumSpeed == DSTS_ENUMSPD_FS_PHY_48MHZ))
else
USB_ActivateEndpoint(const USB_OTG_GlobalTypeDef *, const USB_OTG_EPTypeDef *)
if
(ep->is_in == 1U)
if
((USBx_INEP(epnum)->DIEPCTL & USB_OTG_DIEPCTL_USBAEP) == 0U)
else
if
(((USBx_OUTEP(epnum)->DOEPCTL) & USB_OTG_DOEPCTL_USBAEP) == 0U)
USB_ActivateDedicatedEndpoint(const USB_OTG_GlobalTypeDef *, const USB_OTG_EPTypeDef *)
if
(ep->is_in == 1U)
if
(((USBx_INEP(epnum)->DIEPCTL) & USB_OTG_DIEPCTL_USBAEP) == 0U)
else
if
(((USBx_OUTEP(epnum)->DOEPCTL) & USB_OTG_DOEPCTL_USBAEP) == 0U)
USB_DeactivateEndpoint(const USB_OTG_GlobalTypeDef *, const USB_OTG_EPTypeDef *)
if
(ep->is_in == 1U)
if
((USBx_INEP(epnum)->DIEPCTL & USB_OTG_DIEPCTL_EPENA) == USB_OTG_DIEPCTL_EPENA)
else
if
((USBx_OUTEP(epnum)->DOEPCTL & USB_OTG_DOEPCTL_EPENA) == USB_OTG_DOEPCTL_EPENA)
USB_DeactivateDedicatedEndpoint(const USB_OTG_GlobalTypeDef *, const USB_OTG_EPTypeDef *)
if
(ep->is_in == 1U)
if
((USBx_INEP(epnum)->DIEPCTL & USB_OTG_DIEPCTL_EPENA) == USB_OTG_DIEPCTL_EPENA)
else
if
((USBx_OUTEP(epnum)->DOEPCTL & USB_OTG_DOEPCTL_EPENA) == USB_OTG_DOEPCTL_EPENA)
USB_EPStartXfer(USB_OTG_GlobalTypeDef *, USB_OTG_EPTypeDef *, uint8_t)
if
(ep->is_in == 1U)
if
(ep->xfer_len == 0U)
else
if
(epnum == 0U)
if
(ep->xfer_len > ep->maxpacket)
else
if
(ep->type == EP_TYPE_ISOC)
if
(dma == 1U)
if
((uint32_t)ep->dma_addr != 0U)
if
(ep->type == EP_TYPE_ISOC)
if
((USBx_DEVICE->DSTS & (1U << 8)) == 0U)
else
else
if
(ep->type != EP_TYPE_ISOC)
if
(ep->xfer_len > 0U)
else
if
((USBx_DEVICE->DSTS & (1U << 8)) == 0U)
else
else
if
(epnum == 0U)
if
(ep->xfer_len > 0U)
else
if
(ep->xfer_len == 0U)
else
if
(dma == 1U)
if
((uint32_t)ep->xfer_buff != 0U)
if
(ep->type == EP_TYPE_ISOC)
if
((USBx_DEVICE->DSTS & (1U << 8)) == 0U)
else
USB_EPStopXfer(const USB_OTG_GlobalTypeDef *, USB_OTG_EPTypeDef *)
if
(ep->is_in == 1U)
if
(((USBx_INEP(ep->num)->DIEPCTL) & USB_OTG_DIEPCTL_EPENA) == USB_OTG_DIEPCTL_EPENA)
if
(count > 10000U)
else
if
(((USBx_OUTEP(ep->num)->DOEPCTL) & USB_OTG_DOEPCTL_EPENA) == USB_OTG_DOEPCTL_EPENA)
if
(count > 10000U)
USB_WritePacket(const USB_OTG_GlobalTypeDef *, uint8_t *, uint8_t, uint16_t, uint8_t)
if
(dma == 0U)
for
(i = 0U; i < count32b; i++)
USB_ReadPacket(const USB_OTG_GlobalTypeDef *, uint8_t *, uint16_t)
for
(i = 0U; i < count32b; i++)
if
(remaining_bytes != 0U)
USB_EPSetStall(const USB_OTG_GlobalTypeDef *, const USB_OTG_EPTypeDef *)
if
(ep->is_in == 1U)
if
(((USBx_INEP(epnum)->DIEPCTL & USB_OTG_DIEPCTL_EPENA) == 0U) && (epnum != 0U))
else
if
(((USBx_OUTEP(epnum)->DOEPCTL & USB_OTG_DOEPCTL_EPENA) == 0U) && (epnum != 0U))
USB_EPClearStall(const USB_OTG_GlobalTypeDef *, const USB_OTG_EPTypeDef *)
if
(ep->is_in == 1U)
if
((ep->type == EP_TYPE_INTR) || (ep->type == EP_TYPE_BULK))
else
if
((ep->type == EP_TYPE_INTR) || (ep->type == EP_TYPE_BULK))
USB_StopDevice(USB_OTG_GlobalTypeDef *)
for
(i = 0U; i < 15U; i++)
if
(ret != HAL_OK)
if
(ret != HAL_OK)
USB_SetDevAddress(const USB_OTG_GlobalTypeDef *, uint8_t)
USB_DevConnect(const USB_OTG_GlobalTypeDef *)
USB_DevDisconnect(const USB_OTG_GlobalTypeDef *)
USB_ReadInterrupts(const USB_OTG_GlobalTypeDef *)
USB_ReadChInterrupts(const USB_OTG_GlobalTypeDef *, uint8_t)
USB_ReadDevAllOutEpInterrupt(const USB_OTG_GlobalTypeDef *)
USB_ReadDevAllInEpInterrupt(const USB_OTG_GlobalTypeDef *)
USB_ReadDevOutEPInterrupt(const USB_OTG_GlobalTypeDef *, uint8_t)
USB_ReadDevInEPInterrupt(const USB_OTG_GlobalTypeDef *, uint8_t)
USB_ClearInterrupts(USB_OTG_GlobalTypeDef *, uint32_t)
USB_GetMode(const USB_OTG_GlobalTypeDef *)
USB_ActivateSetup(const USB_OTG_GlobalTypeDef *)
USB_EP0_OutStart(const USB_OTG_GlobalTypeDef *, uint8_t, const uint8_t *)
if
(gSNPSiD > USB_OTG_CORE_ID_300A)
if
((USBx_OUTEP(0U)->DOEPCTL & USB_OTG_DOEPCTL_EPENA) == USB_OTG_DOEPCTL_EPENA)
if
(dma == 1U)
USB_CoreReset(USB_OTG_GlobalTypeDef *)
if
(count > HAL_USB_TIMEOUT)
if
(count > HAL_USB_TIMEOUT)
USB_HostInit(USB_OTG_GlobalTypeDef *, USB_OTG_CfgTypeDef)
if
((USBx->GUSBCFG & USB_OTG_GUSBCFG_PHYSEL) == 0U)
if
(cfg.speed == USBH_FSLS_SPEED)
else
else
if
(USB_FlushRxFifo(USBx) != HAL_OK)
for
(i = 0U; i < cfg.Host_channels; i++)
if
(USBx == USB_OTG_HS)
else
if
(cfg.dma_enable == 0U)
USB_InitFSLSPClkSel(const USB_OTG_GlobalTypeDef *, uint8_t)
if
(freq == HCFG_48_MHZ)
else if
(freq == HCFG_6_MHZ)
else
USB_ResetPort(const USB_OTG_GlobalTypeDef *)
USB_DriveVbus(const USB_OTG_GlobalTypeDef *, uint8_t)
if
(((hprt0 & USB_OTG_HPRT_PPWR) == 0U) && (state == 1U))
if
(((hprt0 & USB_OTG_HPRT_PPWR) == USB_OTG_HPRT_PPWR) && (state == 0U))
USB_GetHostSpeed(const USB_OTG_GlobalTypeDef *)
USB_GetCurrentFrame(const USB_OTG_GlobalTypeDef *)
USB_HC_Init(USB_OTG_GlobalTypeDef *, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint16_t)
switch
(ep_type)
case
EP_TYPE_CTRL:
case
EP_TYPE_BULK:
if
((epnum & 0x80U) == 0x80U)
else
if
(USBx == USB_OTG_HS)
case
EP_TYPE_INTR:
if
((epnum & 0x80U) == 0x80U)
case
EP_TYPE_ISOC:
if
((epnum & 0x80U) == 0x80U)
default
if
((epnum & 0x80U) == 0x80U)
else
if
((speed == HPRT0_PRTSPD_LOW_SPEED) && (HostCoreSpeed != HPRT0_PRTSPD_LOW_SPEED))
else
if
((ep_type == EP_TYPE_INTR) || (ep_type == EP_TYPE_ISOC))
USB_HC_StartXfer(USB_OTG_GlobalTypeDef *, USB_OTG_HCTypeDef *, uint8_t)
if
(USBx == USB_OTG_HS)
if
(dma == 1U)
if
(((hc->ep_type == EP_TYPE_CTRL) || (hc->ep_type == EP_TYPE_BULK)) && (hc->do_ssplit == 0U))
else
if
((hc->speed == USBH_HS_SPEED) && (hc->do_ping == 1U))
if
(hc->do_ssplit == 1U)
if
(hc->ep_is_in != 0U)
else
if
(hc->ep_type == EP_TYPE_ISOC)
if
(hc->xfer_len > ISO_SPLT_MPS)
if
((hc->iso_splt_xactPos == HCSPLT_BEGIN) || (hc->iso_splt_xactPos == HCSPLT_MIDDLE))
else
else
if
((hc->iso_splt_xactPos != HCSPLT_BEGIN) && (hc->iso_splt_xactPos != HCSPLT_MIDDLE))
else
else
if
((dma == 1U) && (hc->xfer_len > hc->max_packet))
else
else
if
(hc->xfer_len > 0U)
if
(num_packets > max_hc_pkt_count)
else
if
(hc->ep_is_in != 0U)
else
if
(dma != 0U)
if
(hc->do_ssplit == 1U)
if
((hc->do_csplit == 1U) && (hc->ep_is_in == 0U))
if
(((hc->ep_type == EP_TYPE_ISOC) || (hc->ep_type == EP_TYPE_INTR)) && (hc->do_csplit == 1U) && (hc->ep_is_in == 1U))
if
((hc->ep_type == EP_TYPE_ISOC) && (hc->ep_is_in == 0U))
switch
(hc->iso_splt_xactPos)
case
HCSPLT_BEGIN:
case
HCSPLT_MIDDLE:
case
HCSPLT_END:
case
HCSPLT_FULL:
default
else
if
(hc->ep_is_in != 0U)
else
if
((hc->ep_is_in == 0U) && (hc->xfer_len > 0U) && (hc->do_csplit == 0U))
switch
(hc->ep_type)
case
EP_TYPE_CTRL:
case
EP_TYPE_BULK:
if
(len_words > (USBx->HNPTXSTS & 0xFFFFU))
case
EP_TYPE_INTR:
case
EP_TYPE_ISOC:
default
USB_HC_ReadInterrupt(const USB_OTG_GlobalTypeDef *)
USB_HC_Halt(const USB_OTG_GlobalTypeDef *, uint8_t)
if
((((USBx->GAHBCFG & USB_OTG_GAHBCFG_DMAEN) == USB_OTG_GAHBCFG_DMAEN) && (SplitEna == 0U)) && ((ChannelEna == 0U) || (((HcEpType == HCCHAR_ISOC) || (HcEpType == HCCHAR_INTR)))))
if
((HcEpType == HCCHAR_CTRL) || (HcEpType == HCCHAR_BULK))
if
((USBx->GAHBCFG & USB_OTG_GAHBCFG_DMAEN) == 0U)
if
((USBx->HNPTXSTS & (0xFFU << 16)) == 0U)
if
(count > 1000U)
else
else
else
if
((USBx_HOST->HPTXSTS & (0xFFU << 16)) == 0U)
if
(count > 1000U)
else
USB_DoPing(const USB_OTG_GlobalTypeDef *, uint8_t)
USB_StopHost(USB_OTG_GlobalTypeDef *)
if
(USB_FlushRxFifo(USBx) != HAL_OK)
for
(i = 0U; i <= 15U; i++)
for
(i = 0U; i <= 15U; i++)
if
(count > 1000U)
USB_ActivateRemoteWakeup(const USB_OTG_GlobalTypeDef *)
if
((USBx_DEVICE->DSTS & USB_OTG_DSTS_SUSPSTS) == USB_OTG_DSTS_SUSPSTS)
USB_DeActivateRemoteWakeup(const USB_OTG_GlobalTypeDef *)