46 #include "../../libchip/libchip_compiler.h" 47 #include "../../libchip/include/usbhs.h" 64 #define SHIFT_INTERUPT 12 82 #define UDPHS_ENDPOINT_DISABLED 0 84 #define UDPHS_ENDPOINT_HALTED 1 86 #define UDPHS_ENDPOINT_IDLE 2 88 #define UDPHS_ENDPOINT_SENDING 3 90 #define UDPHS_ENDPOINT_RECEIVING 4 92 #define UDPHS_ENDPOINT_SENDINGM 5 94 #define UDPHS_ENDPOINT_RECEIVINGM 6 102 #define MBL_NbBuffer(i, o, size) (((i)>(o))?((i)-(o)):((i)+(size)-(o))) 212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
214 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xEE,
215 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
216 0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD,
217 0xFC, 0x7E, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0x7E
234 static
void UDPHS_EndOfTransfer(uint8_t bEndpoint, uint8_t bStatus)
236 Endpoint *pEp = &(endpoints[bEndpoint]);
303 if (pBi->
remaining == 0 || forceEnd || size == 0) {
333 Endpoint *pEndpoint = &(endpoints[bEndpoint]);
339 volatile uint8_t *pBytes;
340 volatile uint8_t bufferEnd = 1;
343 size = pEndpoint->
size;
362 int32_t c8 = size >> 3;
363 int32_t c1 = size & 0x7;
366 *(pFifo++) = *(pBytes ++);
367 *(pFifo++) = *(pBytes ++);
368 *(pFifo++) = *(pBytes ++);
369 *(pFifo++) = *(pBytes ++);
371 *(pFifo++) = *(pBytes ++);
372 *(pFifo++) = *(pBytes ++);
373 *(pFifo++) = *(pBytes ++);
374 *(pFifo++) = *(pBytes ++);
378 *(pFifo++) = *(pBytes ++);
391 Endpoint *pEndpoint = &(endpoints[bEndpoint]);
408 for (; size; size --)
409 *(pFifo ++) = *(pTransfer->
pData ++);
422 Endpoint *pEndpoint = &(endpoints[bEndpoint]);
427 if (wPacketSize > pTransfer->
remaining) {
440 while (wPacketSize > 0) {
441 *(pTransfer->
pData++) = *(pFifo++);
453 uint32_t *pData = (uint32_t *)(
void *)pRequest;
454 volatile uint32_t *pFifo;
473 Endpoint *pEp = &(endpoints[bEndpoint]);
595 if (pXfr->
remaining == 0 || wPktSize < pEp->size) {
690 uint8_t bDmaEndpoint = bEndpoint - 1;
692 Endpoint *pEp = &(endpoints[bEndpoint]);
696 int32_t iRemain, iXfred;
718 (USBHS_DEVDMACONTROL_END_TR_EN
759 TRACE_ERROR(
"UDPHS_DmaHandler: ST 0x%X\n\r", (
unsigned int)dwDmaSr);
768 UDPHS_EndOfTransfer(bEndpoint, bRc);
795 uint8_t bDmaEndpoint = bEndpoint - 1;
797 Endpoint *pEp = &(endpoints[bEndpoint]);
809 pXfr->
pData = (
void *) pData;
875 Endpoint *pEp = &(endpoints[bEndpoint]);
880 if (dLength >= 0x10000)
896 pTx->
pBuffer = (uint8_t *)pData;
954 uint8_t bDmaEndpoint = (bEndpoint - 1);
955 Endpoint *pEp = &(endpoints[bEndpoint]);
967 pXfr->
pData = (
void *)pData;
1126 uint32_t epBit, epCfg;
1133 pEndpoint = &(endpoints[ep]);
1135 pEndpoint->
bank = 0;
1151 UDPHS_EndOfTransfer(ep, bStatus);
1195 uint8_t bEndpointDir;
1196 uint8_t bNbTrans = 1;
1197 uint8_t bSizeEpt = 0;
1202 if (pDescriptor == 0) {
1205 pEndpoint = &(endpoints[bEndpoint]);
1213 USBDeviceDescriptor *pDevDesc = (USBDeviceDescriptor *)pDescriptor;
1215 pEndpoint = &(endpoints[bEndpoint]);
1218 pEndpoint->
size = pDevDesc->bMaxPacketSize0;
1224 pEndpoint = &(endpoints[bEndpoint]);
1236 bNbTrans = ((pEndpoint->
size >> 11) & 0x3);
1247 pEndpoint->
size &= 0x7FF;
1266 if (pEndpoint->
size <= 8)
1268 else if (pEndpoint->
size <= 16)
1270 else if (pEndpoint->
size <= 32)
1272 else if (pEndpoint->
size <= 64)
1274 else if (pEndpoint->
size <= 128)
1276 else if (pEndpoint->
size <= 256)
1278 else if (pEndpoint->
size <= 512)
1280 else if (pEndpoint->
size <= 1024)
1288 ((pEndpoint->
bank) - 1));
1297 TRACE_ERROR(
"PB bEndpointDir: 0x%X\n\r", bEndpointDir);
1344 Endpoint *pEndpoint = &(endpoints[bEP]);
1353 pTransfer->
fCallback = (
void *)fCallback;
1368 uint16_t startOffset)
1370 Endpoint *pEndpoint = &(endpoints[bEndpoint]);
1383 for (i = 0; i < mblSize; i --) {
1385 pMbList[i].
size = 0;
1395 pXfr->
pMbl = pMbList;
1459 const void *pHdr, uint8_t bHdrLen,
1460 const void *pData, uint32_t dLength)
1464 Endpoint *pEp = &(endpoints[bEndpoint]);
1465 uint8_t bDmaEndpoint = (bEndpoint - 1);
1485 pXfr->
pData = (
void *) pData;
1494 if (bHdrLen + dLength > 0) {
1509 pDmaLL[0].pNxtDesc = (
void *)&pDmaLL[1];
1510 pDmaLL[0].pAddr = (
void *)pHdr;
1517 uint8_t *pU8 = (uint8_t *)pData;
1518 uint32_t maxSize = bNbTrans * pEp->
size;
1519 dLength = pXfr->
buffered - bHdrLen;
1521 if (dLength > maxSize) dLength = maxSize;
1523 uint32_t pktLen, ndxData = 0;
1525 pktLen = pEp->
size - bHdrLen;
1528 if (pktLen >= dLength) {
1529 pDmaLL[1].pNxtDesc = (
void *)
NULL;
1530 pDmaLL[1].pAddr = (
void *)pU8;
1536 pDmaLL[1].pNxtDesc = (
void *)&pDmaLL[2];
1537 pDmaLL[1].pAddr = (
void *)pU8;
1548 if (pktLen >= dLength) {
1549 pDmaLL[1].pNxtDesc = (
void *)
NULL;
1550 pDmaLL[1].pAddr = (
void *)&pU8[ndxData];
1556 pDmaLL[2].pNxtDesc = (
void *)&pDmaLL[3];
1557 pDmaLL[2].pAddr = (
void *)&pU8[ndxData];
1562 dLength -= pktLen; ndxData += pktLen;
1564 pDmaLL[3].pNxtDesc = (
void *)
NULL;
1565 pDmaLL[3].pAddr = (
void *)&pU8[ndxData];
1576 dLength = pXfr->
buffered - bHdrLen;
1577 pDmaLL[1].pNxtDesc = (
void *)
NULL;
1578 pDmaLL[1].pAddr = (
void *)pData;
1625 return UDPHS_Read(bEndpoint, pData, dLength);
1657 #ifdef USB_DEVICE_HS_SUPPORT 1740 if ((uint32_t)dmaLL & 0xFFFFFFF0)
1783 Endpoint *pEndpoint = &(endpoints[bEP]);
1813 Endpoint *pEndpoint = &(endpoints[bEndpoint]);
1814 uint8_t bDmaEndpoint = (bEndpoint - 1);
1862 }
else if (ctl == 0) {
#define USBHS_DEVISR_SOF
(USBHS_DEVISR) Start of Frame Interrupt
#define USBD_STATUS_INVALID_PARAMETER
#define CHIP_USB_NUMENDPOINTS
#define USBHS_DEVEPTCFG_NBTRANS_Msk
(USBHS_DEVEPTCFG[10]) Number of transactions per microframe for isochronous endpoint ...
Buffer struct used for multi-buffer-listed transfer.
__STATIC_INLINE void SCB_InvalidateDCache_by_Addr(uint32_t *addr, int32_t dsize)
D-Cache Invalidate by address.
__STATIC_INLINE void SCB_CleanDCache_by_Addr(uint32_t *addr, int32_t dsize)
D-Cache Clean by address.
uint8_t USBD_HAL_Read(uint8_t bEndpoint, void *pData, uint32_t dLength)
#define USBFeatureRequest_TESTSE0NAK
uint8_t USBD_HAL_Write(uint8_t bEndpoint, const void *pData, uint32_t dLength)
#define USBHS_DEVCTRL_SPDCONF_HIGH_SPEED
(USBHS_DEVCTRL) Forced high speed.
#define USBHS_DEVEPTIMR_TXINE
(USBHS_DEVEPTIMR[10]) Transmitted IN Data Interrupt
static uint8_t UDPHS_Read(uint8_t bEndpoint, void *pData, uint32_t dLength)
#define USBHS_DEVDMACONTROL_CHANN_ENB
(USBHS_DEVDMACONTROL) Channel Enable Command
#define USBD_STATUS_RESET
void USBD_HAL_Disconnect(void)
Disable Pull-up, disconnect.
__I uint32_t USBHS_DEVEPTISR[10]
(Usbhs Offset: 0x130) Device Endpoint Status Register (n = 0)
#define USBHS_DEVCTRL_TSTJ
(USBHS_DEVCTRL) Test mode J
#define USBHS_DEVEPTCFG_NBTRANS_Pos
#define UDPHS_ENDPOINT_IDLE
#define USBHS_DEVDMACONTROL_END_TR_EN
(USBHS_DEVDMACONTROL) End of Transfer Enable Control (OUT transfers only)
uint8_t USBD_HAL_IsHighSpeed(void)
#define USBHS_DEVDMACONTROL_END_B_EN
(USBHS_DEVDMACONTROL) End of Buffer Enable Control
#define USBHS_DEVEPTISR_RXSTPI
(USBHS_DEVEPTISR[10]) Received SETUP Interrupt
#define USBHS_DEVEPTIER_TXINES
(USBHS_DEVEPTIER[10]) Transmitted IN Data Interrupt Enable
#define USBHS_DEVDMASTATUS_BUFF_COUNT_Pos
__STATIC_INLINE uint32_t USBHS_ReadDmaIntStatus(Usbhs *pUsbhs, uint8_t DmaNum)
Read status for a DMA Endpoint.
__STATIC_INLINE void USBHS_EnableEPIntType(Usbhs *pUsbhs, uint8_t Ep, uint32_t EpInt)
__STATIC_INLINE uint32_t USBHS_ReadIntStatus(Usbhs *pUsbhs, uint32_t IntType)
Read status for an interrupt.
__O uint32_t USBHS_DEVIDR
(Usbhs Offset: 0x0014) Device Global Interrupt Disable Register
#define USBHS_DEVEPTIDR_STALLRQC
(USBHS_DEVEPTIDR[10]) STALL Request Clear
#define USBFeatureRequest_TESTSENDZLP
__STATIC_INLINE void USBHS_RaiseInt(Usbhs *pUsbhs, uint32_t IntType)
Raise interrupt for endpoint.
#define USBHS_DEVDMACONTROL_END_TR_IT
(USBHS_DEVDMACONTROL) End of Transfer Interrupt Enable
#define USBHS_DEVEPTIDR_FIFOCONC
(USBHS_DEVEPTIDR[10]) FIFO Control Clear
#define USBHS_DEVCTRL_OPMODE2
(USBHS_DEVCTRL) Specific Operational mode
void USBD_HAL_Test(uint8_t bIndex)
__STATIC_INLINE void USBHS_EnableAddress(Usbhs *pUsbhs, uint8_t Enable)
Enable or disable USB address.
#define USBHS_DEVCTRL_TSTK
(USBHS_DEVCTRL) Test mode K
#define USBGenericDescriptor_DEVICE
#define USBHS_DEVEPTCFG_EPBK_1_BANK
(USBHS_DEVEPTCFG[10]) Single-bank endpoint
#define USBHS_DEVICR_SOFC
(USBHS_DEVICR) Start of Frame Interrupt Clear
#define USBHS_DEVCTRL_TSTPCKT
(USBHS_DEVCTRL) Test packet mode
__STATIC_INLINE void USBHS_ConfigureEPs(Usbhs *pUsbhs, const uint8_t Ep, const uint8_t Type, const uint8_t Dir, const uint8_t Size, const uint8_t Bank)
static void UDPHS_EndpointHandler(uint8_t bEndpoint)
__STATIC_INLINE uint32_t USBHS_GetUsbSpeed(Usbhs *pUsbhs)
Enable or disable USB address.
#define USBHS_DEVICR_UPRSMC
(USBHS_DEVICR) Upstream Resume Interrupt Clear
__STATIC_INLINE void USBHS_ResetEP(Usbhs *pUsbhs, uint8_t Ep)
Rests Endpoint.
#define USBEndpointDescriptor_ISOCHRONOUS
USBDTransferBuffer * pMbl
uint8_t USBD_HAL_ConfigureEP(const USBEndpointDescriptor *pDescriptor)
void USBD_HAL_Connect(void)
Enable Pull-up, connect.
#define CHIP_USB_ENDPOINTS_DMA(ep)
#define USBHS_DEVEPTISR_RXOUTI
(USBHS_DEVEPTISR[10]) Received OUT Data Interrupt
static void UDPHS_DmaSingle(uint8_t bEndpoint, Transfer *pXfr, uint32_t dwCfg)
__STATIC_INLINE void USBHS_KillBank(Usbhs *pUsbhs, uint8_t Ep)
__STATIC_INLINE void USBHS_FreezeClock(Usbhs *pUsbhs)
Freeze or unfreeze USB clock.
#define USBHS_DEVEPTIER_RXOUTES
(USBHS_DEVEPTIER[10]) Received OUT Data Interrupt Enable
__STATIC_INLINE uint8_t USBHS_GetEpType(Usbhs *pUsbhs, uint8_t Ep)
#define USBHS_DEVEPTCFG_EPSIZE_64_BYTE
(USBHS_DEVEPTCFG[10]) 64 bytes
static void UDPHS_DmaHandler(uint8_t bEndpoint)
static Endpoint endpoints[CHIP_USB_NUMENDPOINTS]
uint8_t USBD_HAL_SetTransferCallback(uint8_t bEP, TransferCallback fCallback, void *pCbData)
#define USBEndpointDescriptor_CONTROL
void USBD_HAL_RemoteWakeUp(void)
__STATIC_INLINE void USBHS_EnableEP(Usbhs *pUsbhs, uint8_t Ep, uint8_t Enable)
Enables or disables endpoint.
#define USBHS_DEVEPTISR_TXINI
(USBHS_DEVEPTISR[10]) Transmitted IN Data Interrupt
#define USBHS_DEVDMASTATUS_END_BF_ST
(USBHS_DEVDMASTATUS) End of Channel Buffer Status
__STATIC_INLINE void USBHS_SetDmaBuffAdd(UsbhsDevdma *pUsbDma, uint32_t Addr)
Sets USBHS's DMA Buffer addresse.
#define USBHS_DEVISR_WAKEUP
(USBHS_DEVISR) Wake-Up Interrupt
#define USBD_STATUS_ABORTED
__STATIC_INLINE uint32_t USBHS_ReadEPStatus(Usbhs *pUsbhs, uint8_t Ep, uint32_t EpInt)
#define USBHS_DEVIER_EORSTES
(USBHS_DEVIER) End of Reset Interrupt Enable
__STATIC_INLINE void USBHS_EnableDMAIntEP(Usbhs *pUsbhs, uint32_t DmaEp)
Enables DMA interrupt for a given endpoint.
#define UDPHS_ENDPOINT_SENDING
#define USBHS_DEVISR_EORSM
(USBHS_DEVISR) End of Resume Interrupt
__STATIC_INLINE void USBHS_SetAddress(Usbhs *pUsbhs, uint8_t Addr)
Configure USB address and enable or disable it.
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
Disable External Interrupt.
void USBD_RequestHandler(uint8_t bEndpoint, const USBGenericRequest *pRequest)
#define USBD_STATUS_LOCKED
#define USBHS_DEVEPTIER_RXSTPES
(USBHS_DEVEPTIER[10]) Received SETUP Interrupt Enable
__STATIC_INLINE void USBHS_AutoSwitchBankEnable(Usbhs *pUsbhs, uint8_t Ep, uint8_t Enable)
#define USBHS
(USBHS ) Base Address
#define USBHS_DEVDMACONTROL_BUFF_LENGTH(value)
#define USBHS_DEVIER_SOFES
(USBHS_DEVIER) Start of Frame Interrupt Enable
__STATIC_INLINE uint32_t USBHS_IsIntEnable(Usbhs *pUsbhs, uint32_t IntType)
check for interrupt of endpoint.
uint8_t USBEndpointDescriptor_GetNumber(const USBEndpointDescriptor *endpoint)
#define USBFeatureRequest_TESTJ
uint16_t USBEndpointDescriptor_GetMaxPacketSize(const USBEndpointDescriptor *endpoint)
__STATIC_INLINE void USBHS_DisableIntEP(Usbhs *pUsbhs, uint8_t Ep)
Disables interrupt for endpoint.
#define UDPHS_ENDPOINT_RECEIVING
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable External Interrupt.
__STATIC_INLINE void USBHS_EnableHighSpeed(Usbhs *pUsbhs, uint8_t Enable)
Disable/Enables High Speed mode.
#define USBD_STATUS_CANCELED
static uint8_t UDPHS_MblUpdate(MblTransfer *pTransfer, USBDTransferBuffer *pBi, uint16_t size, uint8_t forceEnd)
void USBD_ResumeHandler(void)
uint8_t USBEndpointDescriptor_GetType(const USBEndpointDescriptor *endpoint)
#define USBHS_DEVEPTIER_RSTDTS
(USBHS_DEVEPTIER[10]) Reset Data Toggle Enable
#define USBHS_DEVISR_UPRSM
(USBHS_DEVISR) Upstream Resume Interrupt
static void UDPHS_ReadPayload(uint8_t bEndpoint, int32_t wPacketSize)
#define USBHS_DEVEPTCFG_EPTYPE_CTRL
(USBHS_DEVEPTCFG[10]) Control
#define UDPHS_ENDPOINT_SENDINGM
__STATIC_INLINE bool USBHS_IsUsbHighSpeed(Usbhs *pUsbhs)
Enable or disable USB address.
void USBD_HAL_ResetEPs(uint32_t bmEPs, uint8_t bStatus, uint8_t bKeepCfg)
Reset endpoints and disable them.Terminate transfer if there is any, with given status;Reset the endp...
#define USBD_STATUS_HW_NOT_SUPPORTED
#define USBFeatureRequest_TESTK
__STATIC_INLINE void USBHS_DisableInt(Usbhs *pUsbhs, uint32_t IntType)
Disables interrupt for endpoint.
#define USBHS_DEVISR_MSOF
(USBHS_DEVISR) Micro Start of Frame Interrupt
__STATIC_INLINE void USBHS_AckInt(Usbhs *pUsbhs, uint32_t IntType)
Acknowledge interrupt for endpoint.
#define MBL_NbBuffer(i, o, size)
#define USBHS_DEVIDR_SUSPEC
(USBHS_DEVIDR) Suspend Interrupt Disable
#define USBHS_DEVEPTCFG_EPTYPE_Pos
#define USBHS_DEVISR_SUSP
(USBHS_DEVISR) Suspend Interrupt
#define USBHS_DEVEPTIDR_RXOUTEC
(USBHS_DEVEPTIDR[10]) Received OUT Data Interrupt Clear
static const char test_packet_buffer[]
#define USBHS_DEVEPTICR_RXOUTIC
(USBHS_DEVEPTICR[10]) Received OUT Data Interrupt Clear
#define UDPHS_ENDPOINT_DISABLED
__STATIC_INLINE void USBHS_ConfigureDma(UsbhsDevdma *pUsbDma, uint32_t Cfg)
Setup the USBHS DMA.
void USBD_SuspendHandler(void)
#define USBHS_DEVEPTICR_NAKINIC
(USBHS_DEVEPTICR[10]) NAKed IN Interrupt Clear
#define USBHS_DEVDMASTATUS_END_TR_ST
(USBHS_DEVDMASTATUS) End of Channel Transfer Status
static uint8_t UDPHS_MblWriteFifo(uint8_t bEndpoint)
__STATIC_INLINE void USBHS_AllocateMemory(Usbhs *pUsbhs, uint8_t Ep)
#define CHIP_USB_ENDPOINTS_HBW(ep)
__STATIC_INLINE void USBHS_SetIsoTrans(Usbhs *pUsbhs, uint8_t Ep, uint8_t nbTrans)
#define USBHS_DEVEPTIMR_STALLRQ
(USBHS_DEVEPTIMR[10]) STALL Request
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
Clear Pending Interrupt.
#define USBHS_DEVEPTIER_NBUSYBKES
(USBHS_DEVEPTIER[10]) Number of Busy Banks Interrupt Enable
void USBD_HAL_Suspend(void)
uint8_t USBD_HAL_SetupMblTransfer(uint8_t bEndpoint, USBDTransferBuffer *pMbList, uint16_t mblSize, uint16_t startOffset)
__STATIC_INLINE void USBHS_EnableInt(Usbhs *pUsbhs, uint32_t IntType)
Enables Interrupt.
__STATIC_INLINE void USBHS_UnFreezeClock(Usbhs *pUsbhs)
Freeze or unfreeze USB clock.
void(* TransferCallback)(void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
#define USBHS_DEVIER_MSOFES
(USBHS_DEVIER) Micro Start of Frame Interrupt Enable
#define DMA_MAX_FIFO_SIZE
#define USBHS_DEVCTRL_RMWKUP
(USBHS_DEVCTRL) Remote Wake-Up
void USBD_HAL_WaitReadData(uint8_t bEndpoint)
#define USBHS_DEVIER_EORSMES
(USBHS_DEVIER) End of Resume Interrupt Enable
#define USBHS_DEVDMACONTROL_END_BUFFIT
(USBHS_DEVDMACONTROL) End of Buffer Interrupt Enable
uint8_t USBD_HAL_Halt(uint8_t bEndpoint, uint8_t ctl)
__STATIC_INLINE uint32_t USBHS_IsBankKilled(Usbhs *pUsbhs, uint8_t Ep)
#define USBHS_DEVEPTICR_TXINIC
(USBHS_DEVEPTICR[10]) Transmitted IN Data Interrupt Clear
#define USBHS_DEVICR_EORSMC
(USBHS_DEVICR) End of Resume Interrupt Clear
#define USBD_STATUS_SW_NOT_SUPPORTED
void USBD_HAL_CancelIo(uint32_t bmEPs)
void USBD_HAL_SetAddress(uint8_t address)
#define USBHS_DEVEPTISR_STALLEDI
(USBHS_DEVEPTISR[10]) STALLed Interrupt
__IO uint32_t USBHS_DEVDMANXTDSC
(UsbhsDevdma Offset: 0x0) Device DMA Channel Next Descriptor Address Register
#define TRACE_WARNING(...)
#define USBHS_DEVIER_WAKEUPES
(USBHS_DEVIER) Wake-Up Interrupt Enable
#define USBHS_DEVEPTIDR_TXINEC
(USBHS_DEVEPTIDR[10]) Transmitted IN Interrupt Clear
void USBD_HAL_Disable(void)
static void UDPHS_ReadRequest(USBGenericRequest *pRequest)
#define CHIP_USB_ENDPOINTS_MAXPACKETSIZE(ep)
#define UDPHS_ENDPOINT_RECEIVINGM
#define USBHS_SR_SPEED_HIGH_SPEED
(USBHS_SR) High-Speed mode
uint8_t USBD_HAL_Stall(uint8_t bEP)
__IO uint32_t USBHS_DEVEPTCFG[10]
(Usbhs Offset: 0x100) Device Endpoint Configuration Register (n = 0)
__STATIC_INLINE void USBHS_UsbEnable(Usbhs *pUsbhs, uint8_t Enable)
Enables or disables USB.
#define USBHS_DEVIDR_EORSMEC
(USBHS_DEVIDR) End of Resume Interrupt Disable
__STATIC_INLINE void USBHS_DetachUsb(Usbhs *pUsbhs, uint8_t Enable)
Attach or detach USB.
#define USBHS_DEVEPTISR_CFGOK
(USBHS_DEVEPTISR[10]) Configuration OK Status
#define USBHS_DEVEPTCFG_EPTYPE_ISO
(USBHS_DEVEPTCFG[10]) Isochronous
#define USBHS_DEVEPTCFG_EPTYPE_BLK
(USBHS_DEVEPTCFG[10]) Bulk
#define USBHS_DEVIER_SUSPES
(USBHS_DEVIER) Suspend Interrupt Enable
#define USBHS_DEVEPTIER_STALLRQS
(USBHS_DEVEPTIER[10]) STALL Request Enable
#define USBHS_DEVDMACONTROL_LDNXT_DSC
(USBHS_DEVDMACONTROL) Load Next Channel Transfer Descriptor Enable Command
uint8_t USBEndpointDescriptor_GetDirection(const USBEndpointDescriptor *endpoint)
__STATIC_INLINE void USBHS_UsbMode(Usbhs *pUsbhs, USB_Mode_t Mode)
Device or Host Mode.
__STATIC_INLINE uint8_t USBHS_ISUsableClock(Usbhs *pUsbhs)
Check if clock is usable or not.
#define USBHS_DEVIFR_SUSPS
(USBHS_DEVIFR) Suspend Interrupt Set
#define USBHS_DEVEPTCFG_EPDIR
(USBHS_DEVEPTCFG[10]) Endpoint Direction
#define USBFeatureRequest_TESTPACKET
__STATIC_INLINE uint16_t USBHS_ByteCount(Usbhs *pUsbhs, uint8_t Ep)
void USBD_HAL_Activate(void)
#define USBHS_DEVICR_WAKEUPC
(USBHS_DEVICR) Wake-Up Interrupt Clear
__STATIC_INLINE uint32_t USBHS_IsEpIntEnable(Usbhs *pUsbhs, uint8_t Ep, uint32_t EpIntType)
__STATIC_INLINE void USBHS_AckEpInterrupt(Usbhs *pUsbhs, uint8_t Ep, uint32_t EpInt)
void(* MblTransferCallback)(void *pArg, uint8_t status)
#define USBHS_DEVIDR_WAKEUPEC
(USBHS_DEVIDR) Wake-Up Interrupt Disable
#define USBHS_DEVICR_MSOFC
(USBHS_DEVICR) Micro Start of Frame Interrupt Clear
#define CHIP_USB_ENDPOINTS_BANKS(ep)
#define USBHS_DEVICR_EORSTC
(USBHS_DEVICR) End of Reset Interrupt Clear
static uint8_t UDPHS_Write(uint8_t bEndpoint, const void *pData, uint32_t dLength)
#define USBHS_DEVEPTICR_STALLEDIC
(USBHS_DEVEPTICR[10]) STALLed Interrupt Clear
#define USBHS_DEVDMASTATUS_BUFF_COUNT_Msk
(USBHS_DEVDMASTATUS) Buffer Byte Count
__STATIC_INLINE void USBHS_SetRemoteWakeUp(Usbhs *pUsbhs)
Set Remote WakeUp mode.
union Endpoint::@33 transfer
static void UDPHS_WritePayload(uint8_t bEndpoint, int32_t size)
__IO uint32_t USBHS_DEVCTRL
(Usbhs Offset: 0x0000) Device General Control Register
__STATIC_INLINE uint32_t USBHS_GetDmaStatus(UsbhsDevdma *pUsbDma)
Get Dma Status.
TransferCallback fCallback
#define TRACE_WARNING_WP(...)
__STATIC_INLINE uint32_t USBHS_ReadEpIntStatus(Usbhs *pUsbhs, uint8_t EpNum)
Read status for an Endpoint.
#define USBHS_DEVICR_SUSPC
(USBHS_DEVICR) Suspend Interrupt Clear
__STATIC_INLINE uint8_t USBHS_IsBankFree(Usbhs *pUsbhs, uint8_t Ep)
#define USBHS_DEVISR_EORST
(USBHS_DEVISR) End of Reset Interrupt
static uint8_t UDPHS_AddWr(uint8_t bEndpoint, const void *pData, uint32_t dLength)
UsbhsDevdma USBHS_DEVDMA[USBHSDEVDMA_NUMBER]
(Usbhs Offset: 0x310) n = 1 .. 7
#define USBD_STATUS_SUCCESS
MblTransferCallback fCallback
#define USBHS_DEVEPTIFR_TXINIS
(USBHS_DEVEPTIFR[10]) Transmitted IN Data Interrupt Set
#define UDPHS_ENDPOINT_HALTED
#define TRACE_DEBUG_WP(...)
#define TRACE_INFO_WP(...)
#define USBHS_DEVEPTISR_BYCT_Msk
(USBHS_DEVEPTISR[10]) Byte Count
__IO uint32_t USBHS_DEVDMACONTROL
(UsbhsDevdma Offset: 0x8) Device DMA Channel Control Register
__STATIC_INLINE uint32_t USBHS_GetConfigureEPs(Usbhs *pUsbhs, uint8_t Ep, uint32_t IntType)
void USBD_HAL_SetConfiguration(uint8_t cfgnum)
#define USBHS_DEVEPTICR_RXSTPIC
(USBHS_DEVEPTICR[10]) Received SETUP Interrupt Clear
#define USBHS_DEVIER_UPRSMES
(USBHS_DEVIER) Upstream Resume Interrupt Enable
__STATIC_INLINE void USBHS_EnableIntEP(Usbhs *pUsbhs, uint8_t EpNum)
Enables interrupt for a given endpoint.
__STATIC_INLINE void USBHS_DisableEPIntType(Usbhs *pUsbhs, uint8_t Ep, uint32_t EpInt)
uint8_t USBD_HAL_WrWithHdr(uint8_t bEndpoint, const void *pHdr, uint8_t bHdrLen, const void *pData, uint32_t dLength)
__STATIC_INLINE void USBHS_EnableTestMode(Usbhs *pUsbhs, uint32_t mode)
Disable/Enables Test mode.
__STATIC_INLINE void USBHS_RaiseEPInt(Usbhs *pUsbhs, uint8_t Ep, uint32_t EpInt)
UsbhsDevdma hardware registers.