![]() |
usbpsu
Vitis Drivers API Documentation
|
Data Structures | |
struct | XUsbPsu_EvtBuffer |
struct XUsbPsu_EvtBuffer - Software Event buffer representation Software Event buffer representation More... | |
struct | XUsbPsu_Trb |
struct XUsbPsu_Trb - Transfer Request Block - Hardware format More... | |
struct | XUsbPsu_EpParams |
struct XUsbPsu_EpParams - Endpoint Parameters More... | |
struct | __attribute__ |
struct SetupPacket - USB Standard Control Request More... | |
struct | XUsbPsu_Ep |
struct XUsbPsu_Ep - Endpoint representation Endpoint representation More... | |
struct | XUsbPsu_Config |
struct XUsbPsu_Config - Configuration information for the USB More... | |
struct | Usb_DevData |
struct Usb_DevData - Application device data Application Data More... | |
struct | XUsbPsu |
USB Device Controller representation USB Device Controller representation. More... | |
struct | XUsbPsu_Event_Type |
struct XUsbPsu_Event_Type - Device Endpoint Events type More... | |
struct | XUsbPsu_Event_Epevt |
struct XUsbPsu_event_depvt - Device Endpoint Events More... | |
struct | XUsbPsu_Event_Devt |
struct XUsbPsu_event_devt - Device Events More... | |
struct | XUsbPsu_Event_Gevt |
struct XUsbPsu_event_gevt - Other Core Events More... | |
union | XUsbPsu_Event |
union XUsbPsu_event - representation of Event Buffer contents More... | |
Macros | |
#define | XUSBPSU_H |
by using protection macros More... | |
#define | XUSBPSU_EP_DIR_IN 1U |
Direction IN. More... | |
#define | XUSBPSU_EP_DIR_OUT 0U |
Direction OUT. More... | |
#define | XUSBPSU_USB_DIR_OUT 0U |
Direction to device. More... | |
#define | XUSBPSU_USB_DIR_IN 0x80U |
Direction to host. More... | |
#define | XUSBPSU_ENDPOINT_XFERTYPE_MASK 0x03 |
Transfer type mask. More... | |
#define | XUSBPSU_ENDPOINT_XFER_CONTROL 0U |
Control EP. More... | |
#define | XUSBPSU_ENDPOINT_XFER_ISOC 1U |
ISO EP. More... | |
#define | XUSBPSU_ENDPOINT_XFER_BULK 2U |
Bulk EP. More... | |
#define | XUSBPSU_ENDPOINT_XFER_INT 3U |
Interrupt EP. More... | |
#define | XUSBPSU_ENDPOINT_MAX_ADJUSTABLE 0x80 |
Max EP. More... | |
#define | XUSBPSU_TEST_J 1U |
Test Mode J. More... | |
#define | XUSBPSU_TEST_K 2U |
Test Mode K. More... | |
#define | XUSBPSU_TEST_SE0_NAK 3U |
Test Mode SE0_NAK. More... | |
#define | XUSBPSU_TEST_PACKET 4U |
Test Mode TEST PACKET. More... | |
#define | XUSBPSU_TEST_FORCE_ENABLE 5U |
Test Mode FORCE ENABLE. More... | |
#define | XUSBPSU_STATE_ATTACHED 0U |
Device State Attach. More... | |
#define | XUSBPSU_STATE_POWERED 1U |
Device State Power. More... | |
#define | XUSBPSU_STATE_DEFAULT 2U |
Device State Default. More... | |
#define | XUSBPSU_STATE_ADDRESS 3U |
Device State Address. More... | |
#define | XUSBPSU_STATE_CONFIGURED 4U |
Device State Configure. More... | |
#define | XUSBPSU_STATE_SUSPENDED 5U |
Device State Suspend. More... | |
#define | XUSBPSU_SPEED_UNKNOWN 0U |
Device Speed Unknown. More... | |
#define | XUSBPSU_SPEED_LOW 1U |
Device Speed Low. More... | |
#define | XUSBPSU_SPEED_FULL 2U |
Device Speed Full. More... | |
#define | XUSBPSU_SPEED_HIGH 3U |
Device Speed High. More... | |
#define | XUSBPSU_SPEED_SUPER 4U |
Device Speed Speed. More... | |
#define | XUSBPSU_DEVTEN_VNDRDEVTSTRCVEDEN ((u32)0x00000001U << 12U) |
Vendor Device Test LMP Received Event. More... | |
#define | XUSBPSU_DEVTEN_EVNTOVERFLOWEN ((u32)0x00000001U << 11U) |
Reserved. More... | |
#define | XUSBPSU_DEVTEN_CMDCMPLTEN ((u32)0x00000001U << 10U) |
Reserved. More... | |
#define | XUSBPSU_DEVTEN_ERRTICERREN ((u32)0x00000001U << 9U) |
Erratic Error Event Enable. More... | |
#define | XUSBPSU_DEVTEN_SOFEN ((u32)0x00000001U << 7U) |
Start of (u)frame. More... | |
#define | XUSBPSU_DEVTEN_EOPFEN ((u32)0x00000001U << 6U) |
U3/L2-L1 Suspend Event Enable. More... | |
#define | XUSBPSU_DEVTEN_HIBERNATIONREQEVTEN ((u32)0x00000001U << 5U) |
Hibernation Request Event. More... | |
#define | XUSBPSU_DEVTEN_WKUPEVTEN ((u32)0x00000001U << 4U) |
Resume/Remote Wakeup Detected Event Enable. More... | |
#define | XUSBPSU_DEVTEN_ULSTCNGEN ((u32)0x00000001U << 3U) |
Link State Change Event Enable. More... | |
#define | XUSBPSU_DEVTEN_CONNECTDONEEN ((u32)0x00000001U << 2U) |
Connection Done Enable. More... | |
#define | XUSBPSU_DEVTEN_USBRSTEN ((u32)0x00000001U << 1U) |
USB Reset Enable. More... | |
#define | XUSBPSU_DEVTEN_DISCONNEVTEN ((u32)0x00000001U << 0U) |
Disconnect Detected Event Enable. More... | |
Typedefs | |
typedef XUsbPsu_Config | Usb_Config |
typedef configuration structure More... | |
Enumerations | |
enum | XusbPsuLinkState { XUSBPSU_LINK_STATE_U0 = 0x00U, XUSBPSU_LINK_STATE_U1 = 0x01U, XUSBPSU_LINK_STATE_U2 = 0x02U, XUSBPSU_LINK_STATE_U3 = 0x03U, XUSBPSU_LINK_STATE_SS_DIS = 0x04U, XUSBPSU_LINK_STATE_RX_DET = 0x05U, XUSBPSU_LINK_STATE_SS_INACT = 0x06U, XUSBPSU_LINK_STATE_POLL = 0x07U, XUSBPSU_LINK_STATE_RECOV = 0x08U, XUSBPSU_LINK_STATE_HRESET = 0x09U, XUSBPSU_LINK_STATE_CMPLY = 0x0AU, XUSBPSU_LINK_STATE_LPBK = 0x0BU, XUSBPSU_LINK_STATE_RESET = 0x0EU, XUSBPSU_LINK_STATE_RESUME = 0x0FU } |
enum | XusbPsuLinkStateChange { XUSBPSU_LINK_STATE_CHANGE_U0 = 0x00U, XUSBPSU_LINK_STATE_CHANGE_SS_DIS = 0x04U, XUSBPSU_LINK_STATE_CHANGE_RX_DET = 0x05U, XUSBPSU_LINK_STATE_CHANGE_SS_INACT = 0x06U, XUSBPSU_LINK_STATE_CHANGE_RECOV = 0x08U, XUSBPSU_LINK_STATE_CHANGE_CMPLY = 0x0AU } |
Functions | |
s32 | XUsbPsu_CfgInitialize (struct XUsbPsu *InstancePtr, XUsbPsu_Config *ConfigPtr, u32 BaseAddress) |
This function does the following: More... | |
s32 | XUsbPsu_Start (struct XUsbPsu *InstancePtr) |
Starts the controller so that host can detect this device. More... | |
s32 | XUsbPsu_Stop (struct XUsbPsu *InstancePtr) |
Stops the controller so that the device disconnects from the host. More... | |
u8 | XUsbPsu_GetLinkState (struct XUsbPsu *InstancePtr) |
Gets current state of USB link. More... | |
s32 | XUsbPsu_SetLinkState (struct XUsbPsu *InstancePtr, XusbPsuLinkStateChange State) |
Sets USB Link to a particular State. More... | |
s32 | XUsbPsu_SetU1SleepTimeout (struct XUsbPsu *InstancePtr, u8 Timeout) |
Sets U1 sleep timeout. More... | |
s32 | XUsbPsu_SetU2SleepTimeout (struct XUsbPsu *InstancePtr, u8 Timeout) |
Sets U2 sleep timeout. More... | |
s32 | XUsbPsu_AcceptU1U2Sleep (struct XUsbPsu *InstancePtr) |
Enable Accept U1 and U2 sleep enable. More... | |
s32 | XUsbPsu_U1SleepEnable (struct XUsbPsu *InstancePtr) |
Enables U1 enable sleep. More... | |
s32 | XUsbPsu_U2SleepEnable (struct XUsbPsu *InstancePtr) |
Enables U2 enable sleep. More... | |
s32 | XUsbPsu_U1SleepDisable (struct XUsbPsu *InstancePtr) |
Enables U1 disable sleep. More... | |
s32 | XUsbPsu_U2SleepDisable (struct XUsbPsu *InstancePtr) |
Enables U2 disable sleep. More... | |
s32 | XUsbPsu_IsSuperSpeed (struct XUsbPsu *InstancePtr) |
Checks if the current speed is super speed or not. More... | |
struct XUsbPsu_Trb | __attribute__ ((packed)) |
Transfer Request Block - Hardware format. More... | |
s32 | XUsbPsu_EpEnable (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir, u16 Maxsize, u8 Type, u8 Restore) |
Enables endpoint for sending/receiving data. More... | |
s32 | XUsbPsu_EpDisable (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir) |
Disables Endpoint. More... | |
void | XUsbPsu_ClearStalls (struct XUsbPsu *InstancePtr) |
Clears stall on all endpoints. More... | |
s32 | XUsbPsu_EpBufferSend (struct XUsbPsu *InstancePtr, u8 UsbEp, u8 *BufferPtr, u32 BufferLen) |
Initiates DMA to send data on endpoint to the host. More... | |
s32 | XUsbPsu_EpBufferRecv (struct XUsbPsu *InstancePtr, u8 UsbEp, u8 *BufferPtr, u32 Length) |
Initiates DMA to receive data on endpoint from host. More... | |
void | XUsbPsu_EpSetStall (struct XUsbPsu *InstancePtr, u8 Epnum, u8 Dir) |
Stalls an endpoint. More... | |
void | XUsbPsu_EpClearStall (struct XUsbPsu *InstancePtr, u8 Epnum, u8 Dir) |
Clears stall on an endpoint. More... | |
void | XUsbPsu_SetEpHandler (struct XUsbPsu *InstancePtr, u8 Epnum, u8 Dir, void(*Handler)(void *, u32, u32)) |
Sets an user handler to be called after data is sent/received by an endpoint. More... | |
s32 | XUsbPsu_IsEpStalled (struct XUsbPsu *InstancePtr, u8 Epnum, u8 Dir) |
Returns status of endpoint whether it is stalled or not. More... | |
void | XUsbPsu_StopTransfer (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir, u8 Force) |
Stops transfer on Endpoint. More... | |
void | XUsbPsu_IntrHandler (void *XUsbPsuInstancePtr) |
Main interrupt handler. More... | |
void | XUsbPsu_EnableIntr (struct XUsbPsu *InstancePtr, u32 Mask) |
Enables an interrupt in event enable RegValister. More... | |
void | XUsbPsu_DisableIntr (struct XUsbPsu *InstancePtr, u32 Mask) |
Disables an interrupt in event enable RegValister. More... | |
s32 | XUsbPsu_SetDeviceAddress (struct XUsbPsu *InstancePtr, u16 Addr) |
Sets the device address of the core. More... | |
void | XUsbPsu_Idle (struct XUsbPsu *InstancePtr) |
This function puts the controller into idle state by stopping the transfers for all endpoints, stopping the usb core, and clearing the event buffers. More... | |
void | XUsbPsu_SetSpeed (struct XUsbPsu *InstancePtr, u32 Speed) |
Sets speed of the core for connecting to host. More... | |
void | XUsbPsu_Sleep (u32 USeconds) |
API for Sleep routine. More... | |
void | XUsbPsu_Ep0StallRestart (struct XUsbPsu *InstancePtr) |
Stalls control endpoint and restarts to receive setup packet. More... | |
XUsbPsu_Config * | XUsbPsu_LookupConfig (u16 DeviceId) |
Looks up the device configuration based on the unique device ID. More... | |
struct XUsbPsu_EpParams * | XUsbPsu_GetEpParams (struct XUsbPsu *InstancePtr) |
Returns zeroed parameters to be used by Endpoint commands. More... | |
s32 | XUsbPsu_SendEpCmd (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir, u32 Cmd, struct XUsbPsu_EpParams *Params) |
Sends Endpoint command to the Endpoint. More... | |
void | XUsbPsu_Ep0DataDone (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
Checks the data phase and calls user endpoint handler. More... | |
void | XUsbPsu_Ep0StatusDone (struct XUsbPsu *InstancePtr) |
Checks the status phase and starts next control transfer. More... | |
s32 | XUsbPsu_Ep0StartStatus (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
Starts status phase of control transfer. More... | |
void | XUsbPsu_Ep0_EndControlData (struct XUsbPsu *InstancePtr, struct XUsbPsu_Ep *Ept) |
Ends data phase which is used in case of the error. More... | |
s32 | XUsbPsu_EnableControlEp (struct XUsbPsu *InstancePtr, u16 Size) |
Enables USB control endpoint that is EP0OUT and EP0IN of Core. More... | |
void | XUsbPsu_PhyReset (struct XUsbPsu *InstancePtr) |
Issues core PHY reset. More... | |
s32 | XUsbPsu_WaitClearTimeout (struct XUsbPsu *InstancePtr, u32 Offset, u32 BitMask, u32 Timeout) |
Waits until a bit in a register is cleared or timeout occurs. More... | |
s32 | XUsbPsu_WaitSetTimeout (struct XUsbPsu *InstancePtr, u32 Offset, u32 BitMask, u32 Timeout) |
Waits until a bit in a register is set or timeout occurs. More... | |
u32 | XUsbPsu_ReadHwParams (struct XUsbPsu *InstancePtr, u8 RegIndex) |
Reads data from hardware parameters registers of the core. More... | |
s32 | XUsbPsu_SetTestMode (struct XUsbPsu *InstancePtr, u32 Mode) |
Enables USB2 test modes. More... | |
s32 | XUsbPsu_CoreInit (struct XUsbPsu *InstancePtr) |
Initializes the core. More... | |
void | XUsbPsu_EventBuffersSetup (struct XUsbPsu *InstancePtr) |
Sets up the event buffers so that events are written by Core. More... | |
u32 | XUsbPsu_EpGetTransferIndex (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir) |
Returns transfer index assigned by Core for an endpoint transfer. More... | |
s32 | XUsbPsu_StartEpConfig (struct XUsbPsu *InstancePtr, u32 UsbEpNum, u8 Dir) |
Sends start new configuration command to the endpoint. More... | |
s32 | XUsbPsu_SetEpConfig (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir, u16 Size, u8 Type, u8 Restore) |
Sends set endpoint configuration command to the endpoint. More... | |
s32 | XUsbPsu_SetXferResource (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir) |
Sends set transfer resource command to the endpoint. More... | |
void | XUsbPsu_StopActiveTransfers (struct XUsbPsu *InstancePtr) |
Stops any active transfer. More... | |
void | XUsbPsu_ClearStallAllEp (struct XUsbPsu *InstancePtr) |
Clears stall on all stalled endpoints. More... | |
s32 | XUsbPsu_RecvSetup (struct XUsbPsu *InstancePtr) |
Initiates DMA on control endpoint 0 to receive setup packet. More... | |
void | XUsbPsu_Ep0XferComplete (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
Handles transfer complete event of control endpoints EP0 OUT and EP0 IN. More... | |
void | XUsbPsu_Ep0XferNotReady (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
Handles transfer not ready event of control endpoints EP0 OUT and EP0 IN. More... | |
s32 | XUsbPsu_Ep0Send (struct XUsbPsu *InstancePtr, u8 *BufferPtr, u32 BufferLen) |
Initiates DMA to send data on control endpoint EP0 IN to host. More... | |
s32 | XUsbPsu_Ep0Recv (struct XUsbPsu *InstancePtr, u8 *BufferPtr, u32 Length) |
Initiates DMA to receive data on control endpoint EP0 OUT from host. More... | |
void | XUsbPsu_EpTransferDeactive (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir) |
Resets and deactivates transfer endpoint. More... | |
void | XUsbPsu_SaveEndpointState (struct XUsbPsu *InstancePtr, struct XUsbPsu_Ep *Ept) |
Queries endpoint state and saves it in EpSavedState. More... | |
void | XUsbPsu_EpXferComplete (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
Checks the data phase and calls user endpoint handler. More... | |
void | XUsbPsu_EpXferNotReady (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
For Isochronous transfer, gets the microframe time and calls respective endpoint handler. More... | |
void | XUsbPsu_EpEvent (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
Endpoint event handler. More... | |
void | XUsbPsu_DeviceEvent (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Devt *Event) |
Device event handler for device specific events. More... | |
void | XUsbPsu_EventBufferHandler (struct XUsbPsu *InstancePtr) |
Processes events in an event buffer. More... | |
void | XUsbPsu_DisconnectIntr (struct XUsbPsu *InstancePtr) |
Disconnects interrupt handler. More... | |
void | XUsbPsu_ResetIntr (struct XUsbPsu *InstancePtr) |
Resets interrupt handler. More... | |
void | XUsbPsu_Ep0Intr (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event) |
Handle interrupts of control endpoints EP0 OUT and EP0 IN. More... | |
void | XUsbPsu_ConnDoneIntr (struct XUsbPsu *InstancePtr) |
Interrupt handler which indicates that the connection is completed. More... | |
void | XUsbPsu_LinkStsChangeIntr (struct XUsbPsu *InstancePtr, u32 EvtInfo) |
Link status change interrupt handler. More... | |
void | XUsbPsu_EventHandler (struct XUsbPsu *InstancePtr, const union XUsbPsu_Event *Event) |
Processes an event entry in the event Buffer. More... | |
Variables | |
struct XUsbPsu_EpParams | __attribute__ |
Endpoint Parameters. More... | |
XUsbPsu_Config | XUsbPsu_ConfigTable [] |
Configuration table. More... | |
#define XUSBPSU_DEVTEN_CMDCMPLTEN ((u32)0x00000001U << 10U) |
Reserved.
#define XUSBPSU_DEVTEN_CONNECTDONEEN ((u32)0x00000001U << 2U) |
Connection Done Enable.
Referenced by main().
#define XUSBPSU_DEVTEN_DISCONNEVTEN ((u32)0x00000001U << 0U) |
Disconnect Detected Event Enable.
Referenced by main().
#define XUSBPSU_DEVTEN_EOPFEN ((u32)0x00000001U << 6U) |
U3/L2-L1 Suspend Event Enable.
#define XUSBPSU_DEVTEN_ERRTICERREN ((u32)0x00000001U << 9U) |
Erratic Error Event Enable.
#define XUSBPSU_DEVTEN_EVNTOVERFLOWEN ((u32)0x00000001U << 11U) |
Reserved.
Referenced by main().
#define XUSBPSU_DEVTEN_HIBERNATIONREQEVTEN ((u32)0x00000001U << 5U) |
Hibernation Request Event.
Referenced by main().
#define XUSBPSU_DEVTEN_SOFEN ((u32)0x00000001U << 7U) |
Start of (u)frame.
#define XUSBPSU_DEVTEN_ULSTCNGEN ((u32)0x00000001U << 3U) |
Link State Change Event Enable.
Referenced by main().
#define XUSBPSU_DEVTEN_USBRSTEN ((u32)0x00000001U << 1U) |
USB Reset Enable.
Referenced by main().
#define XUSBPSU_DEVTEN_VNDRDEVTSTRCVEDEN ((u32)0x00000001U << 12U) |
Vendor Device Test LMP Received Event.
#define XUSBPSU_DEVTEN_WKUPEVTEN ((u32)0x00000001U << 4U) |
Resume/Remote Wakeup Detected Event Enable.
Referenced by main().
#define XUSBPSU_ENDPOINT_MAX_ADJUSTABLE 0x80 |
Max EP.
#define XUSBPSU_ENDPOINT_XFER_BULK 2U |
Bulk EP.
Referenced by XUsbPsu_EpBufferRecv(), and XUsbPsu_EpBufferSend().
#define XUSBPSU_ENDPOINT_XFER_CONTROL 0U |
Control EP.
Referenced by XUsbPsu_EnableControlEp().
#define XUSBPSU_ENDPOINT_XFER_INT 3U |
Interrupt EP.
Referenced by XUsbPsu_EpBufferRecv(), and XUsbPsu_EpBufferSend().
#define XUSBPSU_ENDPOINT_XFER_ISOC 1U |
ISO EP.
Referenced by XUsbPsu_EpBufferRecv(), XUsbPsu_EpBufferSend(), XUsbPsu_EpXferNotReady(), and XUsbPsu_SetEpConfig().
#define XUSBPSU_ENDPOINT_XFERTYPE_MASK 0x03 |
Transfer type mask.
#define XUSBPSU_EP_DIR_IN 1U |
Direction IN.
Referenced by XUsbPsu_EnableControlEp(), XUsbPsu_Ep0DataDone(), XUsbPsu_Ep0Send(), XUsbPsu_EpBufferSend(), XUsbPsu_EpClearStall(), XUsbPsu_EpDisable(), XUsbPsu_EpEnable(), XUsbPsu_EpGetTransferIndex(), XUsbPsu_EpSetStall(), XUsbPsu_EpTransferDeactive(), XUsbPsu_EpXferComplete(), XUsbPsu_Idle(), XUsbPsu_IsEpStalled(), XUsbPsu_SendEpCmd(), XUsbPsu_SetEpHandler(), and XUsbPsu_StopTransfer().
#define XUSBPSU_EP_DIR_OUT 0U |
Direction OUT.
Referenced by XUsbPsu_EnableControlEp(), XUsbPsu_Ep0DataDone(), XUsbPsu_Ep0Recv(), XUsbPsu_Ep0StallRestart(), XUsbPsu_Ep0XferComplete(), XUsbPsu_EpBufferRecv(), XUsbPsu_EpClearStall(), XUsbPsu_EpDisable(), XUsbPsu_EpEnable(), XUsbPsu_EpGetTransferIndex(), XUsbPsu_EpSetStall(), XUsbPsu_EpTransferDeactive(), XUsbPsu_EpXferComplete(), XUsbPsu_Idle(), XUsbPsu_IsEpStalled(), XUsbPsu_RecvSetup(), XUsbPsu_SendEpCmd(), XUsbPsu_SetEpConfig(), XUsbPsu_SetEpHandler(), XUsbPsu_StartEpConfig(), and XUsbPsu_StopTransfer().
#define XUSBPSU_H |
by using protection macros
#define XUSBPSU_SPEED_FULL 2U |
Device Speed Full.
Referenced by XUsbPsu_ConnDoneIntr().
#define XUSBPSU_SPEED_HIGH 3U |
Device Speed High.
Referenced by XUsbPsu_ConnDoneIntr().
#define XUSBPSU_SPEED_LOW 1U |
Device Speed Low.
Referenced by XUsbPsu_ConnDoneIntr().
#define XUSBPSU_SPEED_SUPER 4U |
Device Speed Speed.
Referenced by XUsbPsu_ConnDoneIntr(), XUsbPsu_IsSuperSpeed(), and XUsbPsu_SetEpConfig().
#define XUSBPSU_SPEED_UNKNOWN 0U |
Device Speed Unknown.
Referenced by XUsbPsu_DisconnectIntr().
#define XUSBPSU_STATE_ADDRESS 3U |
Device State Address.
Referenced by XUsbPsu_SetDeviceAddress().
#define XUSBPSU_STATE_ATTACHED 0U |
Device State Attach.
#define XUSBPSU_STATE_CONFIGURED 4U |
Device State Configure.
Referenced by XUsbPsu_SetDeviceAddress().
#define XUSBPSU_STATE_DEFAULT 2U |
Device State Default.
Referenced by XUsbPsu_ResetIntr(), and XUsbPsu_SetDeviceAddress().
#define XUSBPSU_STATE_POWERED 1U |
Device State Power.
#define XUSBPSU_STATE_SUSPENDED 5U |
Device State Suspend.
#define XUSBPSU_TEST_FORCE_ENABLE 5U |
Test Mode FORCE ENABLE.
Referenced by XUsbPsu_SetTestMode().
#define XUSBPSU_TEST_J 1U |
Test Mode J.
Referenced by XUsbPsu_SetTestMode().
#define XUSBPSU_TEST_K 2U |
Test Mode K.
Referenced by XUsbPsu_SetTestMode().
#define XUSBPSU_TEST_PACKET 4U |
Test Mode TEST PACKET.
Referenced by XUsbPsu_SetTestMode().
#define XUSBPSU_TEST_SE0_NAK 3U |
Test Mode SE0_NAK.
Referenced by XUsbPsu_SetTestMode().
#define XUSBPSU_USB_DIR_IN 0x80U |
Direction to host.
Referenced by XUsbPsu_Ep0XferComplete().
#define XUSBPSU_USB_DIR_OUT 0U |
Direction to device.
typedef XUsbPsu_Config Usb_Config |
typedef configuration structure
enum XusbPsuLinkState |
XusbPsuLinkState | This typedef defines link state. |
XusbPsuLinkStateChange | This typedef defines link state change. |
struct XUsbPsu_Trb __attribute__ | ( | (packed) | ) |
Transfer Request Block - Hardware format.
Core events.
Device Events.
Device Endpoint Events.
Device Endpoint Events type.
s32 XUsbPsu_AcceptU1U2Sleep | ( | struct XUsbPsu * | InstancePtr | ) |
Enable Accept U1 and U2 sleep enable.
InstancePtr | Pointer to the XUsbPsu instance. |
s32 XUsbPsu_CfgInitialize | ( | struct XUsbPsu * | InstancePtr, |
XUsbPsu_Config * | ConfigPtr, | ||
u32 | BaseAddress | ||
) |
This function does the following:
- initializes a specific XUsbPsu instance. - sets up Event Buffer for Core to write events. - Core Reset and PHY Reset. - Sets core in Device Mode. - Sets default speed as HIGH_SPEED. - Sets Device Address to 0. - Enables interrupts.
InstancePtr | Pointer to the XUsbPsu instance. |
ConfigPtr | Points to the XUsbPsu device configuration structure. |
BaseAddress | Device base address in the virtual memory address space. If the address translation is not used then the physical address is passed. Unexpected errors may occur if the address mapping is changed after this function is invoked. |
References XUsbPsu::ConfigPtr, XUsbPsu_Config::EnableSuperSpeed, XUsbPsu::NumInEps, XUsbPsu::NumOutEps, Status, XUsbPsu_CoreInit(), XUsbPsu_EventBuffersSetup(), XUsbPsu_ReadHwParams(), XUsbPsu_SetDeviceAddress(), and XUsbPsu_SetSpeed().
void XUsbPsu_ClearStallAllEp | ( | struct XUsbPsu * | InstancePtr | ) |
Clears stall on all stalled endpoints.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::UsbEpNum, and XUsbPsu_EpClearStall().
Referenced by XUsbPsu_ResetIntr().
void XUsbPsu_ClearStalls | ( | struct XUsbPsu * | InstancePtr | ) |
Clears stall on all endpoints.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::UsbEpNum, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
void XUsbPsu_ConnDoneIntr | ( | struct XUsbPsu * | InstancePtr | ) |
Interrupt handler which indicates that the connection is completed.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu::AppData, XUsbPsu::HasHibernation, Size, Usb_DevData::Speed, XUsbPsu_EnableControlEp(), XUsbPsu_RecvSetup(), XUSBPSU_SPEED_FULL, XUSBPSU_SPEED_HIGH, XUSBPSU_SPEED_LOW, and XUSBPSU_SPEED_SUPER.
Referenced by XUsbPsu_DeviceEvent().
s32 XUsbPsu_CoreInit | ( | struct XUsbPsu * | InstancePtr | ) |
Initializes the core.
InstancePtr | Pointer to the XUsbPsu instance to be worked on. |
References XUsbPsu::ConfigPtr, XUsbPsu::HasHibernation, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_PhyReset(), XUsbPsu_ReadHwParams(), and XUsbPsu_WaitClearTimeout().
Referenced by XUsbPsu_CfgInitialize().
void XUsbPsu_DeviceEvent | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Devt * | Event | ||
) |
Device event handler for device specific events.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Device Event occurred in core. |
References XUsbPsu_Event_Devt::Event_Info, XUsbPsu::HasHibernation, XUsbPsu_Event_Devt::Type, XUsbPsu_ConnDoneIntr(), XUsbPsu_DisconnectIntr(), XUsbPsu_LinkStsChangeIntr(), and XUsbPsu_ResetIntr().
Referenced by XUsbPsu_EventHandler().
void XUsbPsu_DisableIntr | ( | struct XUsbPsu * | InstancePtr, |
u32 | Mask | ||
) |
Disables an interrupt in event enable RegValister.
InstancePtr | Pointer to the XUsbPsu instance to be worked on. |
Mask | OR of Interrupt Enable Masks
|
void XUsbPsu_DisconnectIntr | ( | struct XUsbPsu * | InstancePtr | ) |
Disconnects interrupt handler.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu::AppData, XUsbPsu::DisconnectIntrHandler, XUsbPsu::HasHibernation, XUsbPsu::IsConfigDone, Usb_DevData::Speed, and XUSBPSU_SPEED_UNKNOWN.
Referenced by XUsbPsu_DeviceEvent().
s32 XUsbPsu_EnableControlEp | ( | struct XUsbPsu * | InstancePtr, |
u16 | Size | ||
) |
Enables USB control endpoint that is EP0OUT and EP0IN of Core.
InstancePtr | Pointer to the XUsbPsu instance. |
Size | Control endpoint size. |
References XUSBPSU_ENDPOINT_XFER_CONTROL, XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, and XUsbPsu_EpEnable().
Referenced by XUsbPsu_ConnDoneIntr().
void XUsbPsu_EnableIntr | ( | struct XUsbPsu * | InstancePtr, |
u32 | Mask | ||
) |
Enables an interrupt in event enable RegValister.
InstancePtr | Pointer to the XUsbPsu instance to be worked on. |
Mask | OR of any interrupt enable Masks:
|
Referenced by main(), and UsbEnableEvent().
void XUsbPsu_Ep0_EndControlData | ( | struct XUsbPsu * | InstancePtr, |
struct XUsbPsu_Ep * | Ept | ||
) |
Ends data phase which is used in case of the error.
InstancePtr | Pointer to the XUsbPsu instance. |
Ept | Pointer to the Endpoint structure. |
References XUsbPsu_Ep::Direction, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Ep::UsbEpNum, XUsbPsu_GetEpParams(), XUsbPsu_SendEpCmd(), and XUsbPsu_Sleep().
Referenced by XUsbPsu_Ep0XferNotReady().
void XUsbPsu_Ep0DataDone | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
Checks the data phase and calls user endpoint handler.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Pointer to the Endpoint event occurred in core. |
References XUsbPsu::AppData, XUsbPsu_Ep::BufferPtr, XUsbPsu_Ep::BytesTxed, XUsbPsu::ConfigPtr, XUsbPsu_Event_Epevt::Epnumber, XUsbPsu::eps, XUsbPsu_Ep::Handler, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_Ep::RequestedBytes, XUsbPsu_Trb::Size, Status, XUsbPsu_Ep::UnalignedTx, XUSBPSU_EP_DIR_IN, and XUSBPSU_EP_DIR_OUT.
Referenced by XUsbPsu_Ep0XferComplete().
void XUsbPsu_Ep0Intr | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
Handle interrupts of control endpoints EP0 OUT and EP0 IN.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Pointer to the Endpoint event occurred in core. |
References XUsbPsu_Event_Epevt::Endpoint_Event, XUsbPsu_Ep0XferComplete(), and XUsbPsu_Ep0XferNotReady().
Referenced by XUsbPsu_EpEvent().
s32 XUsbPsu_Ep0Recv | ( | struct XUsbPsu * | InstancePtr, |
u8 * | BufferPtr, | ||
u32 | Length | ||
) |
Initiates DMA to receive data on control endpoint EP0 OUT from host.
InstancePtr | Pointer to the XUsbPsu instance. |
BufferPtr | Pointer to data. |
Length | Length of data to be received. |
References XUsbPsu_Ep::BufferPtr, XUsbPsu_Trb::BufferPtrHigh, XUsbPsu_Trb::BufferPtrLow, XUsbPsu_Ep::BytesTxed, XUsbPsu::ConfigPtr, XUsbPsu_Trb::Ctrl, XUsbPsu_Ep::Direction, XUsbPsu::Ep0State, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_Ep::MaxSize, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_Ep::RequestedBytes, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Trb::Size, Size, XUsbPsu_Ep::UnalignedTx, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_OUT, XUsbPsu_EpGetTransferIndex(), XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_EpBufferRecv().
s32 XUsbPsu_Ep0Send | ( | struct XUsbPsu * | InstancePtr, |
u8 * | BufferPtr, | ||
u32 | BufferLen | ||
) |
Initiates DMA to send data on control endpoint EP0 IN to host.
InstancePtr | Pointer to the XUsbPsu instance. |
BufferPtr | Pointer to data. |
BufferLen | Length of data buffer. |
References XUsbPsu_Ep::BufferPtr, XUsbPsu_Trb::BufferPtrHigh, XUsbPsu_Trb::BufferPtrLow, XUsbPsu_Ep::BytesTxed, XUsbPsu::ConfigPtr, XUsbPsu_Trb::Ctrl, XUsbPsu_Ep::Direction, XUsbPsu::Ep0State, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_Ep::RequestedBytes, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Trb::Size, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_IN, XUsbPsu_EpGetTransferIndex(), XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_EpBufferSend().
void XUsbPsu_Ep0StallRestart | ( | struct XUsbPsu * | InstancePtr | ) |
Stalls control endpoint and restarts to receive setup packet.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu::Ep0State, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUSBPSU_EP_DIR_OUT, XUsbPsu_EpSetStall(), and XUsbPsu_RecvSetup().
Referenced by XUsbPsu_Ep0StatusDone(), and XUsbPsu_Ep0XferNotReady().
s32 XUsbPsu_Ep0StartStatus | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
Starts status phase of control transfer.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Pointer to the Endpoint event occurred in core. |
References XUsbPsu_Trb::BufferPtrHigh, XUsbPsu_Trb::BufferPtrLow, XUsbPsu::ConfigPtr, XUsbPsu::ControlDir, XUsbPsu_Trb::Ctrl, XUsbPsu_Ep::Direction, XUsbPsu::Ep0State, XUsbPsu_Event_Epevt::Epnumber, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu::IsThreeStage, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Trb::Size, Type, XUsbPsu_Ep::UsbEpNum, XUsbPsu_EpGetTransferIndex(), XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_Ep0XferNotReady().
void XUsbPsu_Ep0StatusDone | ( | struct XUsbPsu * | InstancePtr | ) |
Checks the status phase and starts next control transfer.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu::ConfigPtr, XUsbPsu_Config::IsCacheCoherent, XUsbPsu::IsInTestMode, XUsbPsu::TestMode, XUsbPsu_Ep0StallRestart(), XUsbPsu_RecvSetup(), and XUsbPsu_SetTestMode().
Referenced by XUsbPsu_Ep0XferComplete().
void XUsbPsu_Ep0XferComplete | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
Handles transfer complete event of control endpoints EP0 OUT and EP0 IN.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Pointer to the Endpoint event occurred in core. |
References XUsbPsu::AppData, XUsbPsu::Chapter9, XUsbPsu::ConfigPtr, XUsbPsu::ControlDir, Ctrl, XUsbPsu::Ep0State, XUsbPsu_Event_Epevt::Epnumber, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu::IsThreeStage, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Ep0DataDone(), XUsbPsu_Ep0StatusDone(), XUSBPSU_EP_DIR_OUT, and XUSBPSU_USB_DIR_IN.
Referenced by XUsbPsu_Ep0Intr().
void XUsbPsu_Ep0XferNotReady | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
Handles transfer not ready event of control endpoints EP0 OUT and EP0 IN.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Pointer to the Endpoint event occurred in core. |
References XUsbPsu::ControlDir, XUsbPsu_Event_Epevt::Epnumber, XUsbPsu::eps, XUsbPsu_Event_Epevt::Status, XUsbPsu_Ep0_EndControlData(), XUsbPsu_Ep0StallRestart(), and XUsbPsu_Ep0StartStatus().
Referenced by XUsbPsu_Ep0Intr().
s32 XUsbPsu_EpBufferRecv | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEp, | ||
u8 * | BufferPtr, | ||
u32 | Length | ||
) |
Initiates DMA to receive data on endpoint from host.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEp | USB endpoint number. |
BufferPtr | Pointer to data. This data buffer is cache-aligned. |
Length | Length of data to be received. |
References XUsbPsu_Ep::BufferPtr, XUsbPsu_Trb::BufferPtrHigh, XUsbPsu_Trb::BufferPtrLow, XUsbPsu_Ep::BytesTxed, XUsbPsu::ConfigPtr, XUsbPsu_Trb::Ctrl, XUsbPsu_Ep::CurUf, XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_Ep::MaxSize, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_EpParams::Param2, XUsbPsu_Ep::RequestedBytes, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Trb::Size, Size, XUsbPsu_Ep::TrbEnqueue, XUsbPsu_Ep::Type, XUsbPsu_Ep::UnalignedTx, XUsbPsu_Ep::UsbEpNum, XUSBPSU_ENDPOINT_XFER_BULK, XUSBPSU_ENDPOINT_XFER_INT, XUSBPSU_ENDPOINT_XFER_ISOC, XUsbPsu_Ep0Recv(), XUSBPSU_EP_DIR_OUT, XUsbPsu_EpGetTransferIndex(), and XUsbPsu_SendEpCmd().
s32 XUsbPsu_EpBufferSend | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEp, | ||
u8 * | BufferPtr, | ||
u32 | BufferLen | ||
) |
Initiates DMA to send data on endpoint to the host.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEp | USB endpoint number. |
BufferPtr | Pointer to data. This data buffer is cache-aligned. |
BufferLen | Length of data buffer. |
References XUsbPsu_Ep::BufferPtr, XUsbPsu_Trb::BufferPtrHigh, XUsbPsu_Trb::BufferPtrLow, XUsbPsu_Ep::BytesTxed, XUsbPsu::ConfigPtr, XUsbPsu_Trb::Ctrl, XUsbPsu_Ep::CurUf, XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_EpParams::Param2, XUsbPsu_Ep::PhyEpNum, XUsbPsu_Ep::RequestedBytes, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Trb::Size, XUsbPsu_Ep::TrbEnqueue, XUsbPsu_Ep::Type, XUsbPsu_Ep::UsbEpNum, XUSBPSU_ENDPOINT_XFER_BULK, XUSBPSU_ENDPOINT_XFER_INT, XUSBPSU_ENDPOINT_XFER_ISOC, XUsbPsu_Ep0Send(), XUSBPSU_EP_DIR_IN, XUsbPsu_EpGetTransferIndex(), and XUsbPsu_SendEpCmd().
void XUsbPsu_EpClearStall | ( | struct XUsbPsu * | InstancePtr, |
u8 | Epnum, | ||
u8 | Dir | ||
) |
Clears stall on an endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
Epnum | USB endpoint number. |
Dir | Direction. |
References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_ClearStallAllEp(), and XUsbPsu_EpDisable().
s32 XUsbPsu_EpDisable | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir | ||
) |
Disables Endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint
|
References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::MaxSize, XUsbPsu_Ep::PhyEpNum, XUsbPsu_Ep::TrbDequeue, XUsbPsu_Ep::TrbEnqueue, XUsbPsu_Ep::Type, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, and XUsbPsu_EpClearStall().
s32 XUsbPsu_EpEnable | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir, | ||
u16 | Maxsize, | ||
u8 | Type, | ||
u8 | Restore | ||
) |
Enables endpoint for sending/receiving data.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint
|
Maxsize | Size of Endpoint size. |
Type | Endpoint type Control/Bulk/Interrupt/Isoc. |
Restore | Typically False, True if saved state has to be restored. |
References XUsbPsu_Trb::BufferPtrHigh, XUsbPsu_Trb::BufferPtrLow, XUsbPsu::ConfigPtr, XUsbPsu_Trb::Ctrl, XUsbPsu_Ep::CurUf, XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu::IsHibernated, XUsbPsu_Ep::MaxSize, XUsbPsu_Ep::PhyEpNum, XUsbPsu_Ep::TrbDequeue, XUsbPsu_Ep::TrbEnqueue, XUsbPsu_Ep::Type, Type, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, XUsbPsu_SetEpConfig(), XUsbPsu_SetXferResource(), and XUsbPsu_StartEpConfig().
Referenced by XUsbPsu_EnableControlEp().
void XUsbPsu_EpEvent | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
Endpoint event handler.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Endpoint Event occurred in the core. |
References XUsbPsu_Event_Epevt::Endpoint_Event, XUsbPsu_Event_Epevt::Epnumber, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep0Intr(), XUsbPsu_EpXferComplete(), and XUsbPsu_EpXferNotReady().
Referenced by XUsbPsu_EventHandler().
u32 XUsbPsu_EpGetTransferIndex | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir | ||
) |
Returns transfer index assigned by Core for an endpoint transfer.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint
|
References XUSBPSU_EP_DIR_IN, and XUSBPSU_EP_DIR_OUT.
Referenced by XUsbPsu_Ep0Recv(), XUsbPsu_Ep0Send(), XUsbPsu_Ep0StartStatus(), XUsbPsu_EpBufferRecv(), XUsbPsu_EpBufferSend(), and XUsbPsu_RecvSetup().
void XUsbPsu_EpSetStall | ( | struct XUsbPsu * | InstancePtr, |
u8 | Epnum, | ||
u8 | Dir | ||
) |
Stalls an endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
Epnum | USB endpoint number. |
Dir | Direction |
References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_Ep0StallRestart().
void XUsbPsu_EpTransferDeactive | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir | ||
) |
Resets and deactivates transfer endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint
|
References XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::MaxSize, XUsbPsu_Ep::PhyEpNum, XUsbPsu_Ep::TrbDequeue, XUsbPsu_Ep::TrbEnqueue, XUsbPsu_Ep::Type, XUSBPSU_EP_DIR_IN, and XUSBPSU_EP_DIR_OUT.
Referenced by XUsbPsu_Idle().
void XUsbPsu_EpXferComplete | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
Checks the data phase and calls user endpoint handler.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Pointer to the endpoint event occurred in core. |
References XUsbPsu::AppData, XUsbPsu_Ep::BufferPtr, XUsbPsu_Ep::BytesTxed, XUsbPsu::ConfigPtr, XUsbPsu_Ep::Direction, XUsbPsu_Event_Epevt::Endpoint_Event, XUsbPsu_Event_Epevt::Epnumber, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::Handler, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_Ep::MaxSize, XUsbPsu_Ep::RequestedBytes, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Trb::Size, XUsbPsu_Ep::TrbDequeue, XUsbPsu_Ep::UnalignedTx, XUSBPSU_EP_DIR_IN, and XUSBPSU_EP_DIR_OUT.
Referenced by XUsbPsu_EpEvent().
void XUsbPsu_EpXferNotReady | ( | struct XUsbPsu * | InstancePtr, |
const struct XUsbPsu_Event_Epevt * | Event | ||
) |
For Isochronous transfer, gets the microframe time and calls respective endpoint handler.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Pointer to the Endpoint event occurred in core. |
References XUsbPsu::AppData, XUsbPsu_Ep::CurUf, XUsbPsu_Event_Epevt::Epnumber, XUsbPsu::eps, XUsbPsu_Ep::Handler, XUsbPsu_Ep::Interval, XUsbPsu_Event_Epevt::Parameters, XUsbPsu_Ep::Type, and XUSBPSU_ENDPOINT_XFER_ISOC.
Referenced by XUsbPsu_EpEvent().
void XUsbPsu_EventBufferHandler | ( | struct XUsbPsu * | InstancePtr | ) |
Processes events in an event buffer.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu_EvtBuffer::BuffAddr, XUsbPsu::ConfigPtr, XUsbPsu_EvtBuffer::Count, XUsbPsu::Evt, XUsbPsu_EvtBuffer::Flags, XUsbPsu_Config::IsCacheCoherent, XUsbPsu::IsHibernated, XUsbPsu_EvtBuffer::Offset, XUsbPsu_Event::Raw, and XUsbPsu_EventHandler().
Referenced by XUsbPsu_IntrHandler().
void XUsbPsu_EventBuffersSetup | ( | struct XUsbPsu * | InstancePtr | ) |
Sets up the event buffers so that events are written by Core.
InstancePtr | Pointer to the XUsbPsu instance to be worked on. |
References XUsbPsu_EvtBuffer::BuffAddr, XUsbPsu::Evt, and XUsbPsu_EvtBuffer::Offset.
Referenced by XUsbPsu_CfgInitialize().
void XUsbPsu_EventHandler | ( | struct XUsbPsu * | InstancePtr, |
const union XUsbPsu_Event * | Event | ||
) |
Processes an event entry in the event Buffer.
InstancePtr | Pointer to the XUsbPsu instance. |
Event | Event entry. |
References XUsbPsu_Event::Devt, XUsbPsu_Event::Epevt, XUsbPsu_Event_Type::Is_DevEvt, XUsbPsu_Event_Type::Type, XUsbPsu_Event::Type, XUsbPsu_DeviceEvent(), and XUsbPsu_EpEvent().
Referenced by XUsbPsu_EventBufferHandler().
struct XUsbPsu_EpParams* XUsbPsu_GetEpParams | ( | struct XUsbPsu * | InstancePtr | ) |
Returns zeroed parameters to be used by Endpoint commands.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu::EpParams, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, and XUsbPsu_EpParams::Param2.
Referenced by XUsbPsu_ClearStalls(), XUsbPsu_Ep0_EndControlData(), XUsbPsu_Ep0Recv(), XUsbPsu_Ep0Send(), XUsbPsu_Ep0StartStatus(), XUsbPsu_EpClearStall(), XUsbPsu_EpSetStall(), XUsbPsu_RecvSetup(), XUsbPsu_SaveEndpointState(), XUsbPsu_SetEpConfig(), XUsbPsu_SetXferResource(), XUsbPsu_StartEpConfig(), and XUsbPsu_StopTransfer().
u8 XUsbPsu_GetLinkState | ( | struct XUsbPsu * | InstancePtr | ) |
Gets current state of USB link.
InstancePtr | Pointer to the XUsbPsu instance. |
void XUsbPsu_Idle | ( | struct XUsbPsu * | InstancePtr | ) |
This function puts the controller into idle state by stopping the transfers for all endpoints, stopping the usb core, and clearing the event buffers.
InstancePtr | Pointer to the XUsbPsu instance to be worked on. |
References XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, XUsbPsu_EpTransferDeactive(), XUsbPsu_ReadHwParams(), XUsbPsu_Stop(), XUsbPsu_StopTransfer(), and XUsbPsu_WaitClearTimeout().
void XUsbPsu_IntrHandler | ( | void * | XUsbPsuInstancePtr | ) |
Main interrupt handler.
XUsbPsuInstancePtr | Void pointer to the XUsbPsu instance. |
References XUsbPsu_EvtBuffer::Count, XUsbPsu::Evt, XUsbPsu_EvtBuffer::Flags, and XUsbPsu_EventBufferHandler().
Referenced by main(), and UsbPollHandler().
s32 XUsbPsu_IsEpStalled | ( | struct XUsbPsu * | InstancePtr, |
u8 | Epnum, | ||
u8 | Dir | ||
) |
Returns status of endpoint whether it is stalled or not.
InstancePtr | Pointer to the XUsbPsu instance. |
Epnum | USB endpoint number. |
Dir | Direction of endpoint
|
References XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::PhyEpNum, XUSBPSU_EP_DIR_IN, and XUSBPSU_EP_DIR_OUT.
s32 XUsbPsu_IsSuperSpeed | ( | struct XUsbPsu * | InstancePtr | ) |
Checks if the current speed is super speed or not.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu::AppData, Usb_DevData::Speed, and XUSBPSU_SPEED_SUPER.
Referenced by IsSuperSpeed().
void XUsbPsu_LinkStsChangeIntr | ( | struct XUsbPsu * | InstancePtr, |
u32 | EvtInfo | ||
) |
Link status change interrupt handler.
InstancePtr | Pointer to the XUsbPsu instance. |
EvtInfo | Event information. |
References XUsbPsu::LinkState.
Referenced by XUsbPsu_DeviceEvent().
XUsbPsu_Config * XUsbPsu_LookupConfig | ( | u16 | DeviceId | ) |
Looks up the device configuration based on the unique device ID.
The table contains the configuration info for each device in the system.
DeviceId | Unique device ID of the device being looked up. |
References XUsbPsu_ConfigTable.
void XUsbPsu_PhyReset | ( | struct XUsbPsu * | InstancePtr | ) |
Issues core PHY reset.
InstancePtr | Pointer to the XUsbPsu instance to be worked on. |
References XUsbPsu_Sleep().
Referenced by XUsbPsu_CoreInit().
u32 XUsbPsu_ReadHwParams | ( | struct XUsbPsu * | InstancePtr, |
u8 | RegIndex | ||
) |
Reads data from hardware parameters registers of the core.
InstancePtr | Pointer to the XUsbPsu instance to be worked on |
RegIndex | Register number to read.
|
Referenced by XUsbPsu_CfgInitialize(), XUsbPsu_CoreInit(), and XUsbPsu_Idle().
s32 XUsbPsu_RecvSetup | ( | struct XUsbPsu * | InstancePtr | ) |
Initiates DMA on control endpoint 0 to receive setup packet.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu_Trb::BufferPtrHigh, XUsbPsu_Trb::BufferPtrLow, XUsbPsu::ConfigPtr, XUsbPsu_Trb::Ctrl, XUsbPsu_Ep::Direction, XUsbPsu::Ep0State, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Config::IsCacheCoherent, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Trb::Size, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_OUT, XUsbPsu_EpGetTransferIndex(), XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_ConnDoneIntr(), XUsbPsu_Ep0StallRestart(), and XUsbPsu_Ep0StatusDone().
void XUsbPsu_ResetIntr | ( | struct XUsbPsu * | InstancePtr | ) |
Resets interrupt handler.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu::AppData, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu::IsConfigDone, XUsbPsu::NumInEps, XUsbPsu::NumOutEps, XUsbPsu::ResetIntrHandler, Usb_DevData::State, XUsbPsu::TestMode, XUsbPsu_ClearStallAllEp(), XUSBPSU_STATE_DEFAULT, and XUsbPsu_StopActiveTransfers().
Referenced by XUsbPsu_DeviceEvent().
void XUsbPsu_SaveEndpointState | ( | struct XUsbPsu * | InstancePtr, |
struct XUsbPsu_Ep * | Ept | ||
) |
Queries endpoint state and saves it in EpSavedState.
References XUsbPsu_Ep::Direction, XUsbPsu_Ep::EpSavedState, XUsbPsu_Ep::PhyEpNum, XUsbPsu_Ep::UsbEpNum, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
s32 XUsbPsu_SendEpCmd | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir, | ||
u32 | Cmd, | ||
struct XUsbPsu_EpParams * | Params | ||
) |
Sends Endpoint command to the Endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint
|
Cmd | Endpoint command. |
Params | Endpoint command parameters. |
References XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_EpParams::Param2, XUsbPsu_Ep::PhyEpNum, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, and XUsbPsu_WaitClearTimeout().
Referenced by XUsbPsu_ClearStalls(), XUsbPsu_Ep0_EndControlData(), XUsbPsu_Ep0Recv(), XUsbPsu_Ep0Send(), XUsbPsu_Ep0StartStatus(), XUsbPsu_EpBufferRecv(), XUsbPsu_EpBufferSend(), XUsbPsu_EpClearStall(), XUsbPsu_EpSetStall(), XUsbPsu_RecvSetup(), XUsbPsu_SaveEndpointState(), XUsbPsu_SetEpConfig(), XUsbPsu_SetXferResource(), XUsbPsu_StartEpConfig(), and XUsbPsu_StopTransfer().
s32 XUsbPsu_SetDeviceAddress | ( | struct XUsbPsu * | InstancePtr, |
u16 | Addr | ||
) |
Sets the device address of the core.
InstancePtr | Pointer to the XUsbPsu instance. |
Addr | Address to set. |
References XUsbPsu::AppData, Usb_DevData::State, XUSBPSU_STATE_ADDRESS, XUSBPSU_STATE_CONFIGURED, and XUSBPSU_STATE_DEFAULT.
Referenced by XUsbPsu_CfgInitialize().
s32 XUsbPsu_SetEpConfig | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir, | ||
u16 | Size, | ||
u8 | Type, | ||
u8 | Restore | ||
) |
Sends set endpoint configuration command to the endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint -XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT. |
Size | Size of Endpoint size. |
Type | Endpoint type Control/Bulk/Interrupt/Isoc. |
Restore | Typically false, true if saved state has to be restored. |
References XUsbPsu::AppData, XUsbPsu::eps, XUsbPsu_Ep::EpSavedState, XUsbPsu_Ep::Interval, XUsbPsu_EpParams::Param0, XUsbPsu_EpParams::Param1, XUsbPsu_EpParams::Param2, Usb_DevData::Speed, XUsbPsu_Ep::Type, XUSBPSU_ENDPOINT_XFER_ISOC, XUSBPSU_EP_DIR_OUT, XUsbPsu_GetEpParams(), XUsbPsu_SendEpCmd(), and XUSBPSU_SPEED_SUPER.
Referenced by XUsbPsu_EpEnable().
void XUsbPsu_SetEpHandler | ( | struct XUsbPsu * | InstancePtr, |
u8 | Epnum, | ||
u8 | Dir, | ||
void(*)(void *, u32, u32) | Handler | ||
) |
Sets an user handler to be called after data is sent/received by an endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
Epnum | USB endpoint number. |
Dir | Direction of endpoint
|
Handler | User handler to be called. |
References XUsbPsu::eps, XUsbPsu_Ep::Handler, XUsbPsu_Ep::PhyEpNum, XUSBPSU_EP_DIR_IN, and XUSBPSU_EP_DIR_OUT.
s32 XUsbPsu_SetLinkState | ( | struct XUsbPsu * | InstancePtr, |
XusbPsuLinkStateChange | State | ||
) |
Sets USB Link to a particular State.
InstancePtr | Pointer to the XUsbPsu instance. |
State | State of Link to set. |
References XUsbPsu_WaitClearTimeout().
void XUsbPsu_SetSpeed | ( | struct XUsbPsu * | InstancePtr, |
u32 | Speed | ||
) |
Sets speed of the core for connecting to host.
InstancePtr | Pointer to the XUsbPsu instance. |
Speed | Required speed
|
Referenced by XUsbPsu_CfgInitialize().
s32 XUsbPsu_SetTestMode | ( | struct XUsbPsu * | InstancePtr, |
u32 | Mode | ||
) |
Enables USB2 test modes.
InstancePtr | Pointer to the XUsbPsu instance. |
Mode | Test mode to set. |
References Status, XUSBPSU_TEST_FORCE_ENABLE, XUSBPSU_TEST_J, XUSBPSU_TEST_K, XUSBPSU_TEST_PACKET, and XUSBPSU_TEST_SE0_NAK.
Referenced by XUsbPsu_Ep0StatusDone().
s32 XUsbPsu_SetU1SleepTimeout | ( | struct XUsbPsu * | InstancePtr, |
u8 | Timeout | ||
) |
Sets U1 sleep timeout.
InstancePtr | Pointer to the XUsbPsu instance. |
Timeout | Time in microseconds |
s32 XUsbPsu_SetU2SleepTimeout | ( | struct XUsbPsu * | InstancePtr, |
u8 | Timeout | ||
) |
Sets U2 sleep timeout.
InstancePtr | Pointer to the XUsbPsu instance. |
Timeout | Time in microseconds. |
s32 XUsbPsu_SetXferResource | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir | ||
) |
Sends set transfer resource command to the endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint - XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT |
References XUsbPsu_EpParams::Param0, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_EpEnable().
void XUsbPsu_Sleep | ( | u32 | USeconds | ) |
API for Sleep routine.
USeconds | Time in MicroSeconds. |
Referenced by XUsbPsu_Ep0_EndControlData(), XUsbPsu_PhyReset(), and XUsbPsu_StopTransfer().
s32 XUsbPsu_Start | ( | struct XUsbPsu * | InstancePtr | ) |
Starts the controller so that host can detect this device.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu_WaitClearTimeout().
s32 XUsbPsu_StartEpConfig | ( | struct XUsbPsu * | InstancePtr, |
u32 | UsbEpNum, | ||
u8 | Dir | ||
) |
Sends start new configuration command to the endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint
|
References XUsbPsu::IsConfigDone, XUSBPSU_EP_DIR_OUT, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().
Referenced by XUsbPsu_EpEnable().
s32 XUsbPsu_Stop | ( | struct XUsbPsu * | InstancePtr | ) |
Stops the controller so that the device disconnects from the host.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu_WaitSetTimeout().
Referenced by XUsbPsu_Idle().
void XUsbPsu_StopActiveTransfers | ( | struct XUsbPsu * | InstancePtr | ) |
Stops any active transfer.
InstancePtr | Pointer to the XUsbPsu instance. |
References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::UsbEpNum, and XUsbPsu_StopTransfer().
Referenced by XUsbPsu_ResetIntr().
void XUsbPsu_StopTransfer | ( | struct XUsbPsu * | InstancePtr, |
u8 | UsbEpNum, | ||
u8 | Dir, | ||
u8 | Force | ||
) |
Stops transfer on Endpoint.
InstancePtr | Pointer to the XUsbPsu instance. |
UsbEpNum | USB endpoint number. |
Dir | Direction of endpoint
|
Force | Flag to stop/pause transfer. |
References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::ResourceIndex, XUsbPsu_Ep::UsbEpNum, XUSBPSU_EP_DIR_IN, XUSBPSU_EP_DIR_OUT, XUsbPsu_GetEpParams(), XUsbPsu_SendEpCmd(), and XUsbPsu_Sleep().
Referenced by XUsbPsu_Idle(), and XUsbPsu_StopActiveTransfers().
s32 XUsbPsu_U1SleepDisable | ( | struct XUsbPsu * | InstancePtr | ) |
Enables U1 disable sleep.
InstancePtr | Pointer to the XUsbPsu instance. |
s32 XUsbPsu_U1SleepEnable | ( | struct XUsbPsu * | InstancePtr | ) |
Enables U1 enable sleep.
InstancePtr | Pointer to the XUsbPsu instance. |
s32 XUsbPsu_U2SleepDisable | ( | struct XUsbPsu * | InstancePtr | ) |
Enables U2 disable sleep.
InstancePtr | Pointer to the XUsbPsu instance. |
s32 XUsbPsu_U2SleepEnable | ( | struct XUsbPsu * | InstancePtr | ) |
Enables U2 enable sleep.
InstancePtr | Pointer to the XUsbPsu instance. |
s32 XUsbPsu_WaitClearTimeout | ( | struct XUsbPsu * | InstancePtr, |
u32 | Offset, | ||
u32 | BitMask, | ||
u32 | Timeout | ||
) |
Waits until a bit in a register is cleared or timeout occurs.
InstancePtr | Pointer to the XUsbPsu instance to be worked on. |
Offset | Register offset. |
BitMask | Bit mask of required bit to be checked. |
Timeout | Time to wait specified in micro seconds. |
References XUsbPsu_Config::BaseAddress, XUsbPsu::ConfigPtr, and Status.
Referenced by XUsbPsu_CoreInit(), XUsbPsu_Idle(), XUsbPsu_SendEpCmd(), XUsbPsu_SetLinkState(), and XUsbPsu_Start().
s32 XUsbPsu_WaitSetTimeout | ( | struct XUsbPsu * | InstancePtr, |
u32 | Offset, | ||
u32 | BitMask, | ||
u32 | Timeout | ||
) |
Waits until a bit in a register is set or timeout occurs.
InstancePtr | Pointer to the XUsbPsu instance to be worked on |
Offset | Register offset. |
BitMask | Bit mask of required bit to be checked. |
Timeout | Time to wait specified in micro seconds. |
References XUsbPsu_Config::BaseAddress, XUsbPsu::ConfigPtr, and Status.
Referenced by XUsbPsu_Stop().
USB_CONFIG __attribute__ |
Endpoint Parameters.
Core events.
Device Events.
Device Endpoint Events.
Device Endpoint Events type.
Representation of Event Buffers.
Referenced by Usb_Ch9SetupBosDescReply().
XUsbPsu_Config XUsbPsu_ConfigTable[] |
Configuration table.
Referenced by XUsbPsu_LookupConfig().