Lines Matching refs:USBx

57 static HAL_StatusTypeDef USB_CoreReset(USB_OTG_GlobalTypeDef *USBx);
83 HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg) in USB_CoreInit() argument
88 USBx->GUSBCFG |= USB_OTG_GUSBCFG_PHYSEL; in USB_CoreInit()
91 ret = USB_CoreReset(USBx); in USB_CoreInit()
96 USBx->GCCFG |= USB_OTG_GCCFG_PWRDWN; in USB_CoreInit()
101 USBx->GCCFG &= ~(USB_OTG_GCCFG_PWRDWN); in USB_CoreInit()
114 HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, in USB_SetTurnaroundTime() argument
181 USBx->GUSBCFG &= ~USB_OTG_GUSBCFG_TRDT; in USB_SetTurnaroundTime()
182 USBx->GUSBCFG |= (uint32_t)((UsbTrd << 10) & USB_OTG_GUSBCFG_TRDT); in USB_SetTurnaroundTime()
193 HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx) in USB_EnableGlobalInt() argument
195 USBx->GAHBCFG |= USB_OTG_GAHBCFG_GINT; in USB_EnableGlobalInt()
205 HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx) in USB_DisableGlobalInt() argument
207 USBx->GAHBCFG &= ~USB_OTG_GAHBCFG_GINT; in USB_DisableGlobalInt()
220 HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_ModeTypeDef mode) in USB_SetCurrentMode() argument
224 USBx->GUSBCFG &= ~(USB_OTG_GUSBCFG_FHMOD | USB_OTG_GUSBCFG_FDMOD); in USB_SetCurrentMode()
228 USBx->GUSBCFG |= USB_OTG_GUSBCFG_FHMOD; in USB_SetCurrentMode()
234 …} while ((USB_GetMode(USBx) != (uint32_t)USB_HOST_MODE) && (ms < HAL_USB_CURRENT_MODE_MAX_DELAY_MS… in USB_SetCurrentMode()
238 USBx->GUSBCFG |= USB_OTG_GUSBCFG_FDMOD; in USB_SetCurrentMode()
244 …} while ((USB_GetMode(USBx) != (uint32_t)USB_DEVICE_MODE) && (ms < HAL_USB_CURRENT_MODE_MAX_DELAY_… in USB_SetCurrentMode()
267 HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg) in USB_DevInit() argument
270 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DevInit()
275 USBx->DIEPTXF[i] = 0U; in USB_DevInit()
284 USBx->GCCFG &= ~USB_OTG_GCCFG_VBDEN; in USB_DevInit()
287 USBx->GOTGCTL |= USB_OTG_GOTGCTL_BVALOEN; in USB_DevInit()
288 USBx->GOTGCTL |= USB_OTG_GOTGCTL_BVALOVAL; in USB_DevInit()
293 USBx->GCCFG |= USB_OTG_GCCFG_VBDEN; in USB_DevInit()
300 (void)USB_SetDevSpeed(USBx, USB_OTG_SPEED_FULL); in USB_DevInit()
303 if (USB_FlushTxFifo(USBx, 0x10U) != HAL_OK) /* all Tx FIFOs */ in USB_DevInit()
308 if (USB_FlushRxFifo(USBx) != HAL_OK) in USB_DevInit()
365 USBx->GINTMSK = 0U; in USB_DevInit()
368 USBx->GINTSTS = 0xBFFFFFFFU; in USB_DevInit()
371 USBx->GINTMSK |= USB_OTG_GINTMSK_RXFLVLM; in USB_DevInit()
374 USBx->GINTMSK |= USB_OTG_GINTMSK_USBSUSPM | USB_OTG_GINTMSK_USBRST | in USB_DevInit()
381 USBx->GINTMSK |= USB_OTG_GINTMSK_SOFM; in USB_DevInit()
386 USBx->GINTMSK |= (USB_OTG_GINTMSK_SRQIM | USB_OTG_GINTMSK_OTGINT); in USB_DevInit()
400 HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num) in USB_FlushTxFifo() argument
413 } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_AHBIDL) == 0U); in USB_FlushTxFifo()
417 USBx->GRSTCTL = (USB_OTG_GRSTCTL_TXFFLSH | (num << 6)); in USB_FlushTxFifo()
427 } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_TXFFLSH) == USB_OTG_GRSTCTL_TXFFLSH); in USB_FlushTxFifo()
437 HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx) in USB_FlushRxFifo() argument
450 } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_AHBIDL) == 0U); in USB_FlushRxFifo()
454 USBx->GRSTCTL = USB_OTG_GRSTCTL_RXFFLSH; in USB_FlushRxFifo()
464 } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_RXFFLSH) == USB_OTG_GRSTCTL_RXFFLSH); in USB_FlushRxFifo()
478 HAL_StatusTypeDef USB_SetDevSpeed(const USB_OTG_GlobalTypeDef *USBx, uint8_t speed) in USB_SetDevSpeed() argument
480 uint32_t USBx_BASE = (uint32_t)USBx; in USB_SetDevSpeed()
493 uint8_t USB_GetDevSpeed(const USB_OTG_GlobalTypeDef *USBx) in USB_GetDevSpeed() argument
495 uint32_t USBx_BASE = (uint32_t)USBx; in USB_GetDevSpeed()
518 HAL_StatusTypeDef USB_ActivateEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *… in USB_ActivateEndpoint() argument
520 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ActivateEndpoint()
556 HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EP… in USB_ActivateDedicatedEndpoint() argument
558 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ActivateDedicatedEndpoint()
595 HAL_StatusTypeDef USB_DeactivateEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef… in USB_DeactivateEndpoint() argument
597 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DeactivateEndpoint()
642 HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_… in USB_DeactivateDedicatedEndpoint() argument
644 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DeactivateDedicatedEndpoint()
680 HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep) in USB_EPStartXfer() argument
682 uint32_t USBx_BASE = (uint32_t)USBx; in USB_EPStartXfer()
751 (void)USB_WritePacket(USBx, ep->xfer_buff, ep->num, (uint16_t)ep->xfer_len); in USB_EPStartXfer()
818 HAL_StatusTypeDef USB_EPStopXfer(const USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep) in USB_EPStopXfer() argument
822 uint32_t USBx_BASE = (uint32_t)USBx; in USB_EPStopXfer()
878 HAL_StatusTypeDef USB_WritePacket(const USB_OTG_GlobalTypeDef *USBx, uint8_t *src, in USB_WritePacket() argument
881 uint32_t USBx_BASE = (uint32_t)USBx; in USB_WritePacket()
906 void *USB_ReadPacket(const USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len) in USB_ReadPacket() argument
908 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ReadPacket()
948 HAL_StatusTypeDef USB_EPSetStall(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep) in USB_EPSetStall() argument
950 uint32_t USBx_BASE = (uint32_t)USBx; in USB_EPSetStall()
979 HAL_StatusTypeDef USB_EPClearStall(const USB_OTG_GlobalTypeDef *USBx, const USB_OTG_EPTypeDef *ep) in USB_EPClearStall() argument
981 uint32_t USBx_BASE = (uint32_t)USBx; in USB_EPClearStall()
1008 HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx) in USB_StopDevice() argument
1011 uint32_t USBx_BASE = (uint32_t)USBx; in USB_StopDevice()
1027 ret = USB_FlushRxFifo(USBx); in USB_StopDevice()
1033 ret = USB_FlushTxFifo(USBx, 0x10U); in USB_StopDevice()
1049 HAL_StatusTypeDef USB_SetDevAddress(const USB_OTG_GlobalTypeDef *USBx, uint8_t address) in USB_SetDevAddress() argument
1051 uint32_t USBx_BASE = (uint32_t)USBx; in USB_SetDevAddress()
1064 HAL_StatusTypeDef USB_DevConnect(const USB_OTG_GlobalTypeDef *USBx) in USB_DevConnect() argument
1066 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DevConnect()
1081 HAL_StatusTypeDef USB_DevDisconnect(const USB_OTG_GlobalTypeDef *USBx) in USB_DevDisconnect() argument
1083 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DevDisconnect()
1098 uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef const *USBx) in USB_ReadInterrupts() argument
1102 tmpreg = USBx->GINTSTS; in USB_ReadInterrupts()
1103 tmpreg &= USBx->GINTMSK; in USB_ReadInterrupts()
1114 uint32_t USB_ReadChInterrupts(const USB_OTG_GlobalTypeDef *USBx, uint8_t chnum) in USB_ReadChInterrupts() argument
1116 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ReadChInterrupts()
1130 uint32_t USB_ReadDevAllOutEpInterrupt(const USB_OTG_GlobalTypeDef *USBx) in USB_ReadDevAllOutEpInterrupt() argument
1132 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ReadDevAllOutEpInterrupt()
1146 uint32_t USB_ReadDevAllInEpInterrupt(const USB_OTG_GlobalTypeDef *USBx) in USB_ReadDevAllInEpInterrupt() argument
1148 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ReadDevAllInEpInterrupt()
1164 uint32_t USB_ReadDevOutEPInterrupt(const USB_OTG_GlobalTypeDef *USBx, uint8_t epnum) in USB_ReadDevOutEPInterrupt() argument
1166 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ReadDevOutEPInterrupt()
1182 uint32_t USB_ReadDevInEPInterrupt(const USB_OTG_GlobalTypeDef *USBx, uint8_t epnum) in USB_ReadDevInEPInterrupt() argument
1184 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ReadDevInEPInterrupt()
1203 void USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt) in USB_ClearInterrupts() argument
1205 USBx->GINTSTS &= interrupt; in USB_ClearInterrupts()
1216 uint32_t USB_GetMode(const USB_OTG_GlobalTypeDef *USBx) in USB_GetMode() argument
1218 return ((USBx->GINTSTS) & 0x1U); in USB_GetMode()
1226 HAL_StatusTypeDef USB_ActivateSetup(const USB_OTG_GlobalTypeDef *USBx) in USB_ActivateSetup() argument
1228 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ActivateSetup()
1244 HAL_StatusTypeDef USB_EP0_OutStart(const USB_OTG_GlobalTypeDef *USBx, const uint8_t *psetup) in USB_EP0_OutStart() argument
1246 uint32_t USBx_BASE = (uint32_t)USBx; in USB_EP0_OutStart()
1247 uint32_t gSNPSiD = *(__IO const uint32_t *)(&USBx->CID + 0x1U); in USB_EP0_OutStart()
1271 static HAL_StatusTypeDef USB_CoreReset(USB_OTG_GlobalTypeDef *USBx) in USB_CoreReset() argument
1284 } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_AHBIDL) == 0U); in USB_CoreReset()
1288 USBx->GRSTCTL |= USB_OTG_GRSTCTL_CSRST; in USB_CoreReset()
1298 } while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST); in USB_CoreReset()
1311 HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg) in USB_HostInit() argument
1314 uint32_t USBx_BASE = (uint32_t)USBx; in USB_HostInit()
1321 USBx->GCCFG &= ~(USB_OTG_GCCFG_VBDEN); in USB_HostInit()
1324 USBx->GCCFG &= ~(USB_OTG_GCCFG_BCDEN); in USB_HostInit()
1330 if (USB_FlushTxFifo(USBx, 0x10U) != HAL_OK) /* all Tx FIFOs */ in USB_HostInit()
1335 if (USB_FlushRxFifo(USBx) != HAL_OK) in USB_HostInit()
1348 USBx->GINTMSK = 0U; in USB_HostInit()
1351 USBx->GINTSTS = CLEAR_INTERRUPT_MASK; in USB_HostInit()
1354 USBx->GRXFSIZ = 0x80U; in USB_HostInit()
1355 USBx->DIEPTXF0_HNPTXFSIZ = (uint32_t)(((0x60U << 16) & USB_OTG_NPTXFD) | 0x80U); in USB_HostInit()
1356 USBx->HPTXFSIZ = (uint32_t)(((0x40U << 16)& USB_OTG_HPTXFSIZ_PTXFD) | 0xE0U); in USB_HostInit()
1358 USBx->GINTMSK |= USB_OTG_GINTMSK_RXFLVLM; in USB_HostInit()
1361 USBx->GINTMSK |= (USB_OTG_GINTMSK_PRTIM | USB_OTG_GINTMSK_HCIM | \ in USB_HostInit()
1378 HAL_StatusTypeDef USB_InitFSLSPClkSel(const USB_OTG_GlobalTypeDef *USBx, uint8_t freq) in USB_InitFSLSPClkSel() argument
1380 uint32_t USBx_BASE = (uint32_t)USBx; in USB_InitFSLSPClkSel()
1408 HAL_StatusTypeDef USB_ResetPort(const USB_OTG_GlobalTypeDef *USBx) in USB_ResetPort() argument
1410 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ResetPort()
1435 HAL_StatusTypeDef USB_DriveVbus(const USB_OTG_GlobalTypeDef *USBx, uint8_t state) in USB_DriveVbus() argument
1437 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DriveVbus()
1464 uint32_t USB_GetHostSpeed(USB_OTG_GlobalTypeDef const *USBx) in USB_GetHostSpeed() argument
1466 uint32_t USBx_BASE = (uint32_t)USBx; in USB_GetHostSpeed()
1478 uint32_t USB_GetCurrentFrame(USB_OTG_GlobalTypeDef const *USBx) in USB_GetCurrentFrame() argument
1480 uint32_t USBx_BASE = (uint32_t)USBx; in USB_GetCurrentFrame()
1508 HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num, in USB_HC_Init() argument
1513 uint32_t USBx_BASE = (uint32_t)USBx; in USB_HC_Init()
1579 USBx->GINTMSK |= USB_OTG_GINTMSK_HCIM; in USB_HC_Init()
1591 HostCoreSpeed = USB_GetHostSpeed(USBx); in USB_HC_Init()
1623 HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc) in USB_HC_StartXfer() argument
1625 uint32_t USBx_BASE = (uint32_t)USBx; in USB_HC_StartXfer()
1698 if (len_words > (USBx->HNPTXSTS & 0xFFFFU)) in USB_HC_StartXfer()
1701 USBx->GINTMSK |= USB_OTG_GINTMSK_NPTXFEM; in USB_HC_StartXfer()
1713 USBx->GINTMSK |= USB_OTG_GINTMSK_PTXFEM; in USB_HC_StartXfer()
1722 (void)USB_WritePacket(USBx, hc->xfer_buff, hc->ch_num, (uint16_t)hc->xfer_len); in USB_HC_StartXfer()
1733 uint32_t USB_HC_ReadInterrupt(const USB_OTG_GlobalTypeDef *USBx) in USB_HC_ReadInterrupt() argument
1735 uint32_t USBx_BASE = (uint32_t)USBx; in USB_HC_ReadInterrupt()
1747 HAL_StatusTypeDef USB_HC_Halt(const USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num) in USB_HC_Halt() argument
1749 uint32_t USBx_BASE = (uint32_t)USBx; in USB_HC_Halt()
1760 if ((((USBx->GAHBCFG & USB_OTG_GAHBCFG_DMAEN) == USB_OTG_GAHBCFG_DMAEN) && (SplitEna == 0U)) && in USB_HC_Halt()
1771 if ((USBx->GAHBCFG & USB_OTG_GAHBCFG_DMAEN) == 0U) in USB_HC_Halt()
1773 if ((USBx->HNPTXSTS & (0xFFU << 16)) == 0U) in USB_HC_Halt()
1831 HAL_StatusTypeDef USB_DoPing(const USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num) in USB_DoPing() argument
1833 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DoPing()
1855 HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx) in USB_StopHost() argument
1858 uint32_t USBx_BASE = (uint32_t)USBx; in USB_StopHost()
1863 (void)USB_DisableGlobalInt(USBx); in USB_StopHost()
1866 if (USB_FlushTxFifo(USBx, 0x10U) != HAL_OK) /* all Tx FIFOs */ in USB_StopHost()
1871 if (USB_FlushRxFifo(USBx) != HAL_OK) in USB_StopHost()
1908 USBx->GINTSTS = CLEAR_INTERRUPT_MASK; in USB_StopHost()
1910 (void)USB_EnableGlobalInt(USBx); in USB_StopHost()
1920 HAL_StatusTypeDef USB_ActivateRemoteWakeup(const USB_OTG_GlobalTypeDef *USBx) in USB_ActivateRemoteWakeup() argument
1922 uint32_t USBx_BASE = (uint32_t)USBx; in USB_ActivateRemoteWakeup()
1938 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(const USB_OTG_GlobalTypeDef *USBx) in USB_DeActivateRemoteWakeup() argument
1940 uint32_t USBx_BASE = (uint32_t)USBx; in USB_DeActivateRemoteWakeup()
1957 HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) in USB_CoreInit() argument
1960 UNUSED(USBx); in USB_CoreInit()
1977 HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx) in USB_EnableGlobalInt() argument
1982 USBx->ISTR = 0U; in USB_EnableGlobalInt()
1991 USBx->CNTR = (uint16_t)winterruptmask; in USB_EnableGlobalInt()
2002 HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx) in USB_DisableGlobalInt() argument
2013 USBx->CNTR &= (uint16_t)(~winterruptmask); in USB_DisableGlobalInt()
2026 HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode) in USB_SetCurrentMode() argument
2029 UNUSED(USBx); in USB_SetCurrentMode()
2047 HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) in USB_DevInit() argument
2054 USBx->CNTR = (uint16_t)USB_CNTR_FRES; in USB_DevInit()
2057 USBx->CNTR = 0U; in USB_DevInit()
2060 USBx->ISTR = 0U; in USB_DevInit()
2063 USBx->BTABLE = BTABLE_ADDRESS; in USB_DevInit()
2076 HAL_StatusTypeDef USB_FlushTxFifo(USB_TypeDef const *USBx, uint32_t num) in USB_FlushTxFifo() argument
2079 UNUSED(USBx); in USB_FlushTxFifo()
2095 HAL_StatusTypeDef USB_FlushRxFifo(USB_TypeDef const *USBx) in USB_FlushRxFifo() argument
2098 UNUSED(USBx); in USB_FlushRxFifo()
2116 HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) in USB_ActivateEndpoint() argument
2121 wEpRegVal = PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_T_MASK; in USB_ActivateEndpoint()
2147 PCD_SET_ENDPOINT(USBx, ep->num, (wEpRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); in USB_ActivateEndpoint()
2149 PCD_SET_EP_ADDRESS(USBx, ep->num, ep->num); in USB_ActivateEndpoint()
2156 PCD_SET_EP_TX_ADDRESS(USBx, ep->num, ep->pmaadress); in USB_ActivateEndpoint()
2157 PCD_CLEAR_TX_DTOG(USBx, ep->num); in USB_ActivateEndpoint()
2162 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); in USB_ActivateEndpoint()
2167 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); in USB_ActivateEndpoint()
2173 PCD_SET_EP_RX_ADDRESS(USBx, ep->num, ep->pmaadress); in USB_ActivateEndpoint()
2176 PCD_SET_EP_RX_CNT(USBx, ep->num, ep->maxpacket); in USB_ActivateEndpoint()
2177 PCD_CLEAR_RX_DTOG(USBx, ep->num); in USB_ActivateEndpoint()
2182 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); in USB_ActivateEndpoint()
2187 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_NAK); in USB_ActivateEndpoint()
2198 PCD_SET_BULK_EP_DBUF(USBx, ep->num); in USB_ActivateEndpoint()
2203 PCD_CLEAR_EP_KIND(USBx, ep->num); in USB_ActivateEndpoint()
2207 PCD_SET_EP_DBUF_ADDR(USBx, ep->num, ep->pmaaddr0, ep->pmaaddr1); in USB_ActivateEndpoint()
2212 PCD_CLEAR_RX_DTOG(USBx, ep->num); in USB_ActivateEndpoint()
2213 PCD_CLEAR_TX_DTOG(USBx, ep->num); in USB_ActivateEndpoint()
2216 PCD_SET_EP_DBUF_CNT(USBx, ep->num, ep->is_in, ep->maxpacket); in USB_ActivateEndpoint()
2219 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); in USB_ActivateEndpoint()
2220 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); in USB_ActivateEndpoint()
2225 PCD_CLEAR_RX_DTOG(USBx, ep->num); in USB_ActivateEndpoint()
2226 PCD_CLEAR_TX_DTOG(USBx, ep->num); in USB_ActivateEndpoint()
2231 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); in USB_ActivateEndpoint()
2236 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); in USB_ActivateEndpoint()
2239 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); in USB_ActivateEndpoint()
2253 HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) in USB_DeactivateEndpoint() argument
2259 PCD_CLEAR_TX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2262 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); in USB_DeactivateEndpoint()
2267 PCD_CLEAR_RX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2270 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); in USB_DeactivateEndpoint()
2280 PCD_CLEAR_RX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2281 PCD_CLEAR_TX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2284 PCD_TX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2286 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); in USB_DeactivateEndpoint()
2287 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); in USB_DeactivateEndpoint()
2292 PCD_CLEAR_RX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2293 PCD_CLEAR_TX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2294 PCD_RX_DTOG(USBx, ep->num); in USB_DeactivateEndpoint()
2297 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); in USB_DeactivateEndpoint()
2298 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); in USB_DeactivateEndpoint()
2312 HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep) in USB_EPStartXfer() argument
2336 USB_WritePMA(USBx, ep->xfer_buff, ep->pmaadress, (uint16_t)len); in USB_EPStartXfer()
2337 PCD_SET_EP_TX_CNT(USBx, ep->num, len); in USB_EPStartXfer()
2348 PCD_SET_BULK_EP_DBUF(USBx, ep->num); in USB_EPStartXfer()
2354 if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) in USB_EPStartXfer()
2357 PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); in USB_EPStartXfer()
2361 USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); in USB_EPStartXfer()
2375 PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); in USB_EPStartXfer()
2379 USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); in USB_EPStartXfer()
2384 PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); in USB_EPStartXfer()
2388 USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); in USB_EPStartXfer()
2402 PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); in USB_EPStartXfer()
2406 USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); in USB_EPStartXfer()
2415 PCD_CLEAR_BULK_EP_DBUF(USBx, ep->num); in USB_EPStartXfer()
2418 PCD_SET_EP_TX_CNT(USBx, ep->num, len); in USB_EPStartXfer()
2422 USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); in USB_EPStartXfer()
2431 if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) in USB_EPStartXfer()
2434 PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); in USB_EPStartXfer()
2438 USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); in USB_EPStartXfer()
2443 PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); in USB_EPStartXfer()
2447 USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); in USB_EPStartXfer()
2453 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_VALID); in USB_EPStartXfer()
2462 PCD_SET_OUT_STATUS(USBx, ep->num); in USB_EPStartXfer()
2466 PCD_CLEAR_OUT_STATUS(USBx, ep->num); in USB_EPStartXfer()
2490 wEPVal = PCD_GET_ENDPOINT(USBx, ep->num); in USB_EPStartXfer()
2496 PCD_FREE_USER_BUFFER(USBx, ep->num, 0U); in USB_EPStartXfer()
2513 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); in USB_EPStartXfer()
2526 HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) in USB_EPSetStall() argument
2530 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_STALL); in USB_EPSetStall()
2534 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_STALL); in USB_EPSetStall()
2546 HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) in USB_EPClearStall() argument
2550 PCD_CLEAR_TX_DTOG(USBx, ep->num); in USB_EPClearStall()
2555 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); in USB_EPClearStall()
2560 PCD_CLEAR_RX_DTOG(USBx, ep->num); in USB_EPClearStall()
2563 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); in USB_EPClearStall()
2575 HAL_StatusTypeDef USB_EPStopXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep) in USB_EPStopXfer() argument
2585 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); in USB_EPStopXfer()
2590 PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); in USB_EPStopXfer()
2601 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_NAK); in USB_EPStopXfer()
2606 PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); in USB_EPStopXfer()
2620 HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx) in USB_StopDevice() argument
2623 USBx->CNTR = (uint16_t)USB_CNTR_FRES; in USB_StopDevice()
2626 USBx->ISTR = 0U; in USB_StopDevice()
2629 USBx->CNTR = (uint16_t)(USB_CNTR_FRES | USB_CNTR_PDWN); in USB_StopDevice()
2641 HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address) in USB_SetDevAddress() argument
2646 USBx->DADDR = (uint16_t)USB_DADDR_EF; in USB_SetDevAddress()
2657 HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx) in USB_DevConnect() argument
2660 USBx->BCDR |= (uint16_t)USB_BCDR_DPPU; in USB_DevConnect()
2670 HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx) in USB_DevDisconnect() argument
2673 USBx->BCDR &= (uint16_t)(~(USB_BCDR_DPPU)); in USB_DevDisconnect()
2683 uint32_t USB_ReadInterrupts(USB_TypeDef const *USBx) in USB_ReadInterrupts() argument
2687 tmpreg = USBx->ISTR; in USB_ReadInterrupts()
2696 uint32_t USB_ReadDevAllOutEpInterrupt(USB_TypeDef *USBx) in USB_ReadDevAllOutEpInterrupt() argument
2699 UNUSED(USBx); in USB_ReadDevAllOutEpInterrupt()
2712 uint32_t USB_ReadDevAllInEpInterrupt(USB_TypeDef *USBx) in USB_ReadDevAllInEpInterrupt() argument
2715 UNUSED(USBx); in USB_ReadDevAllInEpInterrupt()
2730 uint32_t USB_ReadDevOutEPInterrupt(USB_TypeDef *USBx, uint8_t epnum) in USB_ReadDevOutEPInterrupt() argument
2733 UNUSED(USBx); in USB_ReadDevOutEPInterrupt()
2749 uint32_t USB_ReadDevInEPInterrupt(USB_TypeDef *USBx, uint8_t epnum) in USB_ReadDevInEPInterrupt() argument
2752 UNUSED(USBx); in USB_ReadDevInEPInterrupt()
2767 void USB_ClearInterrupts(USB_TypeDef *USBx, uint32_t interrupt) in USB_ClearInterrupts() argument
2770 UNUSED(USBx); in USB_ClearInterrupts()
2784 HAL_StatusTypeDef USB_EP0_OutStart(USB_TypeDef *USBx, uint8_t *psetup) in USB_EP0_OutStart() argument
2787 UNUSED(USBx); in USB_EP0_OutStart()
2801 HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx) in USB_ActivateRemoteWakeup() argument
2803 USBx->CNTR |= (uint16_t)USB_CNTR_RESUME; in USB_ActivateRemoteWakeup()
2813 HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx) in USB_DeActivateRemoteWakeup() argument
2815 USBx->CNTR &= (uint16_t)(~USB_CNTR_RESUME); in USB_DeActivateRemoteWakeup()
2828 void USB_WritePMA(USB_TypeDef const *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNByte… in USB_WritePMA() argument
2831 uint32_t BaseAddr = (uint32_t)USBx; in USB_WritePMA()
2863 void USB_ReadPMA(USB_TypeDef const *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) in USB_ReadPMA() argument
2866 uint32_t BaseAddr = (uint32_t)USBx; in USB_ReadPMA()