usbpsu
Vitis Drivers API Documentation
Overview

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 Device disconnects from 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)
 Set U1 sleep timeout. More...
 
s32 XUsbPsu_SetU2SleepTimeout (struct XUsbPsu *InstancePtr, u8 Timeout)
 Set U2 sleep timeout. More...
 
s32 XUsbPsu_AcceptU1U2Sleep (struct XUsbPsu *InstancePtr)
 Enable Accept U1 and U2 sleep enable. More...
 
s32 XUsbPsu_U1SleepEnable (struct XUsbPsu *InstancePtr)
 Enable U1 enable sleep. More...
 
s32 XUsbPsu_U2SleepEnable (struct XUsbPsu *InstancePtr)
 Enable U2 enable sleep. More...
 
s32 XUsbPsu_U1SleepDisable (struct XUsbPsu *InstancePtr)
 Enable U1 disable sleep. More...
 
s32 XUsbPsu_U2SleepDisable (struct XUsbPsu *InstancePtr)
 Enable 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 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 - 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 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_ConfigXUsbPsu_LookupConfig (u16 DeviceId)
 Lookup the device configuration based on the unique device ID. More...
 
struct XUsbPsu_EpParamsXUsbPsu_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 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 - used in case of error. More...
 
s32 XUsbPsu_EnableControlEp (struct XUsbPsu *InstancePtr, u16 Size)
 Enables USB Control Endpoint i.e., 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 Params Registers of Core. More...
 
s32 XUsbPsu_SetTestMode (struct XUsbPsu *InstancePtr, u32 Mode)
 Enables USB2 Test Modes. More...
 
s32 XUsbPsu_CoreInit (struct XUsbPsu *InstancePtr)
 Initializes Core. More...
 
void XUsbPsu_EventBuffersSetup (struct XUsbPsu *InstancePtr)
 Sets up 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 Endpoint. More...
 
s32 XUsbPsu_SetEpConfig (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir, u16 Size, u8 Type, u8 Restore)
 Sends Set Endpoint Configuration command to Endpoint. More...
 
s32 XUsbPsu_SetXferResource (struct XUsbPsu *InstancePtr, u8 UsbEpNum, u8 Dir)
 Sends Set Transfer Resource command to Endpoint. More...
 
void XUsbPsu_StopActiveTransfers (struct XUsbPsu *InstancePtr)
 Stops any active transfer. More...
 
void XUsbPsu_ClearStallAllEp (struct XUsbPsu *InstancePtr)
 Clears stall on all stalled Eps. 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)
 Reset and Deactivate transfer Endpoint. More...
 
void XUsbPsu_SaveEndpointState (struct XUsbPsu *InstancePtr, struct XUsbPsu_Ep *Ept)
 Query endpoint state and save 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, get 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)
 Disconnect Interrupt handler. More...
 
void XUsbPsu_ResetIntr (struct XUsbPsu *InstancePtr)
 Reset Interrupt handler. More...
 
void XUsbPsu_Ep0Intr (struct XUsbPsu *InstancePtr, const struct XUsbPsu_Event_Epevt *Event)
 Handles Interrupts of Control Endpoints EP0 OUT and EP0 IN. More...
 
void XUsbPsu_ConnDoneIntr (struct XUsbPsu *InstancePtr)
 Connection Done Interrupt handler. 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 Event Buffer. More...
 

Variables

struct XUsbPsu_EpParams __attribute__
 Endpoint Parameters. More...
 
XUsbPsu_Config XUsbPsu_ConfigTable []
 Configuration table. More...
 

Macro Definition Documentation

#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
#define XUSBPSU_ENDPOINT_XFERTYPE_MASK   0x03

Transfer type mask.

#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 Documentation

typedef configuration structure

Enumeration Type Documentation

Parameters
XusbPsuLinkStateThis typedef defines link state.
Enumerator
XUSBPSU_LINK_STATE_U0 

U0 state/ in HS - ON.

XUSBPSU_LINK_STATE_U1 

U1 state.

XUSBPSU_LINK_STATE_U2 

U2 state/ in HS - SLEEP.

XUSBPSU_LINK_STATE_U3 

U3 state/ in HS - SUSPEND.

XUSBPSU_LINK_STATE_SS_DIS 

SuperSpeed connectivity is disabled.

XUSBPSU_LINK_STATE_RX_DET 

Warm reset, Receiver detection.

XUSBPSU_LINK_STATE_SS_INACT 

Link has failed SuperSpeed operation.

XUSBPSU_LINK_STATE_POLL 

POLL.

XUSBPSU_LINK_STATE_RECOV 

Retrain SuperSpeed link, Perform Hot reset, Switch to Loop back mode.

XUSBPSU_LINK_STATE_HRESET 

Hot reset using Training sets.

XUSBPSU_LINK_STATE_CMPLY 

Test the transmitter for compliance to voltage and timing specifications.

XUSBPSU_LINK_STATE_LPBK 

For test and fault isolation.

XUSBPSU_LINK_STATE_RESET 

RESET.

XUSBPSU_LINK_STATE_RESUME 

RESUME.

Parameters
XusbPsuLinkStateChangeThis typedef defines link state change.
Enumerator
XUSBPSU_LINK_STATE_CHANGE_U0 

U0 /in HS - ON.

XUSBPSU_LINK_STATE_CHANGE_SS_DIS 

SuperSpeed connectivity is disabled.

XUSBPSU_LINK_STATE_CHANGE_RX_DET 

Warm reset, Receiver detection.

XUSBPSU_LINK_STATE_CHANGE_SS_INACT 

Link has failed SuperSpeed operation.

XUSBPSU_LINK_STATE_CHANGE_RECOV 

Retrain SuperSpeed link, Perform Hot reset, Switch to Loop back mode.

XUSBPSU_LINK_STATE_CHANGE_CMPLY 

Test the transmitter for compliance to voltage and timing specifications.

Function Documentation

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.
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.
Parameters
InstancePtris a pointer to the XUsbPsu instance.
ConfigPtrpoints to the XUsbPsu device configuration structure.
BaseAddressis the 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.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.

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 Eps.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
None.
Note
None.

References XUsbPsu_Ep::Direction, XUsbPsu::eps, XUsbPsu_Ep::EpStatus, XUsbPsu_Ep::UsbEpNum, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().

void XUsbPsu_ConnDoneIntr ( struct XUsbPsu InstancePtr)

Connection Done Interrupt handler.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
None.
Note
None.

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 Core.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on.
Returns
  • XST_SUCCESS if initialization was successful
  • XST_FAILURE if initialization was not successful

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis the Device Event occurred in core.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on.
Maskis the OR of Interrupt Enable Masks
  • XUSBPSU_DEVTEN_VNDRDEVTSTRCVEDEN
  • XUSBPSU_DEVTEN_EVNTOVERFLOWEN
  • XUSBPSU_DEVTEN_CMDCMPLTEN
  • XUSBPSU_DEVTEN_ERRTICERREN
  • XUSBPSU_DEVTEN_SOFEN
  • XUSBPSU_DEVTEN_EOPFEN
  • XUSBPSU_DEVTEN_HIBERNATIONREQEVTEN
  • XUSBPSU_DEVTEN_WKUPEVTEN
  • XUSBPSU_DEVTEN_ULSTCNGEN
  • XUSBPSU_DEVTEN_CONNECTDONEEN
  • XUSBPSU_DEVTEN_USBRSTEN
  • XUSBPSU_DEVTEN_DISCONNEVTEN
Returns
None
Note
None.
void XUsbPsu_DisconnectIntr ( struct XUsbPsu InstancePtr)

Disconnect Interrupt handler.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
None.
Note
None.

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 i.e., EP0OUT and EP0IN of Core.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Sizeis control endpoint size.
Returns
XST_SUCCESS else XST_FAILURE.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on
Maskis the OR of any Interrupt Enable Masks:
  • XUSBPSU_DEVTEN_VNDRDEVTSTRCVEDEN
  • XUSBPSU_DEVTEN_EVNTOVERFLOWEN
  • XUSBPSU_DEVTEN_CMDCMPLTEN
  • XUSBPSU_DEVTEN_ERRTICERREN
  • XUSBPSU_DEVTEN_SOFEN
  • XUSBPSU_DEVTEN_EOPFEN
  • XUSBPSU_DEVTEN_HIBERNATIONREQEVTEN
  • XUSBPSU_DEVTEN_WKUPEVTEN
  • XUSBPSU_DEVTEN_ULSTCNGEN
  • XUSBPSU_DEVTEN_CONNECTDONEEN
  • XUSBPSU_DEVTEN_USBRSTEN
  • XUSBPSU_DEVTEN_DISCONNEVTEN
Returns
None
Note
None.

Referenced by main(), and UsbEnableEvent().

void XUsbPsu_Ep0_EndControlData ( struct XUsbPsu InstancePtr,
struct XUsbPsu_Ep Ept 
)

Ends Data Phase - used in case of error.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eptis a pointer to the Endpoint structure.
Returns
None
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis a pointer to the Endpoint event occurred in core.
Returns
None.
Note
None.

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 
)

Handles Interrupts of Control Endpoints EP0 OUT and EP0 IN.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis a pointer to the Endpoint event occurred in core.
Returns
None.
Note
None.

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 
)
s32 XUsbPsu_Ep0Send ( struct XUsbPsu InstancePtr,
u8 *  BufferPtr,
u32  BufferLen 
)
void XUsbPsu_Ep0StallRestart ( struct XUsbPsu InstancePtr)

Stalls Control Endpoint and restarts to receive Setup packet.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
None
Note
None.

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 
)
void XUsbPsu_Ep0StatusDone ( struct XUsbPsu InstancePtr)

Checks the Status Phase and starts next Control transfer.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis a pointer to the Endpoint event occurred in core.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis a pointer to the Endpoint event occurred in core.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpis USB endpoint number.
BufferPtris pointer to data. This data buffer is cache-aligned.
Lengthis length of data to be received.
Returns
XST_SUCCESS else XST_FAILURE
Note
This function is expected to initiates DMA to receive data on the endpoint from the Host. This data buffer should be aligned.

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 Host.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpis USB endpoint number.
BufferPtris pointer to data. This data buffer is cache-aligned.
BufferLenis length of data buffer.
Returns
XST_SUCCESS else XST_FAILURE
Note
This function is expected to initiates DMA to send data on endpoint towards Host. This data buffer should be aligned.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Epnumis USB endpoint number.
Diris direction.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT.
Returns
XST_SUCCESS else XST_FAILURE.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT.
Maxsizeis size of Endpoint size.
Typeis Endpoint type Control/Bulk/Interrupt/Isoc.
Restoreshould be true if saved state should be restored; typically this would be false
Returns
XST_SUCCESS else XST_FAILURE.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis endpoint Event occurred in the core.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT
Returns
Transfer Resource Index.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Epnumis USB endpoint number.
Diris direction.
Returns
None.
Note
None.

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 
)

Reset and Deactivate transfer Endpoint.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT.
Returns
None.
Note
None.

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 
)
void XUsbPsu_EpXferNotReady ( struct XUsbPsu InstancePtr,
const struct XUsbPsu_Event_Epevt Event 
)

For Isochronous transfer, get the microframe time and calls respective Endpoint handler.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis a pointer to the Endpoint event occurred in core.
Returns
None.
Note
None.

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)
void XUsbPsu_EventBuffersSetup ( struct XUsbPsu InstancePtr)

Sets up Event buffers so that events are written by Core.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on.
Returns
None

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 Event Buffer.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eventis the Event entry.
Returns
None.
Note
None.

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)
u8 XUsbPsu_GetLinkState ( struct XUsbPsu InstancePtr)

Gets current State of USB Link.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
Link State
Note
None.
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.

buffers.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on
Returns
None

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.

Parameters
XUsbPsuInstancePtris a void pointer to the XUsbPsu instance.
Returns
None.
Note
None.

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 - Stalled or not.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Epnumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT.
Returns
1 - if stalled 0 - if not stalled
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
EvtInfois Event information.
Returns
None.
Note
None.

References XUsbPsu::LinkState.

Referenced by XUsbPsu_DeviceEvent().

XUsbPsu_Config * XUsbPsu_LookupConfig ( u16  DeviceId)

Lookup the device configuration based on the unique device ID.

The table contains the configuration info for each device in the system.

Parameters
DeviceIdis the unique device ID of the device being looked up.
Returns
A pointer to the configuration table entry corresponding to the given device ID, or NULL if no match is found.
Note
none

References XUsbPsu_ConfigTable.

void XUsbPsu_PhyReset ( struct XUsbPsu InstancePtr)

Issues core PHY reset.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on.
Returns
None

References XUsbPsu_Sleep().

Referenced by XUsbPsu_CoreInit().

u32 XUsbPsu_ReadHwParams ( struct XUsbPsu InstancePtr,
u8  RegIndex 
)

Reads data from Hardware Params Registers of Core.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on
RegIndexis Register number to read
  • XUSBPSU_GHWPARAMS0
  • XUSBPSU_GHWPARAMS1
  • XUSBPSU_GHWPARAMS2
  • XUSBPSU_GHWPARAMS3
  • XUSBPSU_GHWPARAMS4
  • XUSBPSU_GHWPARAMS5
  • XUSBPSU_GHWPARAMS6
  • XUSBPSU_GHWPARAMS7
Returns
One of the GHWPARAMS RegValister contents.

Referenced by XUsbPsu_CfgInitialize(), XUsbPsu_CoreInit(), and XUsbPsu_Idle().

void XUsbPsu_ResetIntr ( struct XUsbPsu InstancePtr)
void XUsbPsu_SaveEndpointState ( struct XUsbPsu InstancePtr,
struct XUsbPsu_Ep Ept 
)

Query endpoint state and save it in EpSavedState.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Eptis a pointer to the XUsbPsu pointer structure.
Returns
None.
Note
None.

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 Endpoint.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/ XUSBPSU_EP_DIR_OUT.
Cmdis Endpoint command.
Paramsis Endpoint command parameters.
Returns
XST_SUCCESS else XST_FAILURE.
Note
None.

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 Device Address of the Core.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Addris address to set.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.

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 Endpoint.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint -XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT.
Sizeis size of Endpoint size.
Typeis Endpoint type Control/Bulk/Interrupt/Isoc.
Restoreshould be true if saved state should be restored; typically this would be false
Returns
XST_SUCCESS else XST_FAILURE.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Epnumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT.
Handleris user handler to be called.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Stateis State of Link to set.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.

References XUsbPsu_WaitClearTimeout().

void XUsbPsu_SetSpeed ( struct XUsbPsu InstancePtr,
u32  Speed 
)

Sets speed of the Core for connecting to Host.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Speedis required speed
  • XUSBPSU_DCFG_HIGHSPEED
  • XUSBPSU_DCFG_FULLSPEED2
  • XUSBPSU_DCFG_LOWSPEED
  • XUSBPSU_DCFG_FULLSPEED1
Returns
None
Note
None.

Referenced by XUsbPsu_CfgInitialize().

s32 XUsbPsu_SetTestMode ( struct XUsbPsu InstancePtr,
u32  Mode 
)

Enables USB2 Test Modes.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Modeis Test mode to set.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.

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 
)

Set U1 sleep timeout.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Timeoutis time in microseconds
Returns
XST_SUCCESS else XST_FAILURE
Note
None.
s32 XUsbPsu_SetU2SleepTimeout ( struct XUsbPsu InstancePtr,
u8  Timeout 
)

Set U2 sleep timeout.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Timeoutis time in microseconds
Returns
XST_SUCCESS else XST_FAILURE
Note
None.
s32 XUsbPsu_SetXferResource ( struct XUsbPsu InstancePtr,
u8  UsbEpNum,
u8  Dir 
)

Sends Set Transfer Resource command to Endpoint.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint - XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT
Returns
XST_SUCCESS else XST_FAILURE.
Note
None.

References XUsbPsu_EpParams::Param0, XUsbPsu_GetEpParams(), and XUsbPsu_SendEpCmd().

Referenced by XUsbPsu_EpEnable().

void XUsbPsu_Sleep ( u32  USeconds)

API for Sleep routine.

Parameters
USecondsis time in MicroSeconds.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.

References XUsbPsu_WaitClearTimeout().

s32 XUsbPsu_StartEpConfig ( struct XUsbPsu InstancePtr,
u32  UsbEpNum,
u8  Dir 
)

Sends Start New Configuration command to Endpoint.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/ XUSBPSU_EP_DIR_OUT.
Returns
XST_SUCCESS else XST_FAILURE.
Note
As per data book this command should be issued by software under these conditions:
  1. After power-on-reset with XferRscIdx=0 before starting to configure Physical Endpoints 0 and 1.
  2. With XferRscIdx=2 before starting to configure Physical Endpoints > 1
  3. This command should always be issued to Endpoint 0 (DEPCMD0).

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 Device disconnects from Host.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.

References XUsbPsu_WaitSetTimeout().

Referenced by XUsbPsu_Idle().

void XUsbPsu_StopActiveTransfers ( struct XUsbPsu InstancePtr)

Stops any active transfer.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
None.
Note
None.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
UsbEpNumis USB endpoint number.
Diris direction of endpoint
  • XUSBPSU_EP_DIR_IN/XUSBPSU_EP_DIR_OUT.
Forceflag to stop/pause transfer.
Returns
None.
Note
None.

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)

Enable U1 disable sleep.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.
s32 XUsbPsu_U1SleepEnable ( struct XUsbPsu InstancePtr)

Enable U1 enable sleep.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.
s32 XUsbPsu_U2SleepDisable ( struct XUsbPsu InstancePtr)

Enable U2 disable sleep.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.
s32 XUsbPsu_U2SleepEnable ( struct XUsbPsu InstancePtr)

Enable U2 enable sleep.

Parameters
InstancePtris a pointer to the XUsbPsu instance.
Returns
XST_SUCCESS else XST_FAILURE
Note
None.
s32 XUsbPsu_WaitClearTimeout ( struct XUsbPsu InstancePtr,
u32  Offset,
u32  BitMask,
u32  Timeout 
)

Waits until a bit in a register is cleared or timeout occurs.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on
Offsetis register offset.
BitMaskis bit mask of required bit to be checked.
Timeoutis the time to wait specified in micro seconds.
Returns
  • XST_SUCCESS when bit is cleared.
  • XST_FAILURE when timed out.

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.

Parameters
InstancePtris a pointer to the XUsbPsu instance to be worked on
Offsetis register offset.
BitMaskis bit mask of required bit to be checked.
Timeoutis the time to wait specified in micro seconds.
Returns
  • XST_SUCCESS when bit is set.
  • XST_FAILURE when timed out.

References XUsbPsu_Config::BaseAddress, XUsbPsu::ConfigPtr, and Status.

Referenced by XUsbPsu_Stop().

Variable Documentation

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().