AM261x MCU+ SDK  26.00.00
cil.h File Reference

Introduction

This file contains the interface to the Core Interface Layer.

Go to the source code of this file.

Macros

#define DWC_ENDXFER_FORCE   1U
 
#define DWC_ENDXFER_NODELAY   2U
 
#define dwc_usb3_is_hwo(desc)   ((desc)->control & DWC_DSCCTL_HWO_BIT)
 
#define dwc_usb3_is_ioc(desc)   ((desc)->control & DWC_DSCCTL_IOC_BIT)
 
#define dwc_usb3_get_xfercnt(desc)
 
#define dwc_usb3_get_xfersts(desc)
 
#define dwc_usb3_get_xfersofn(desc)
 
#define dwc_usb3_get_eventsofn(event)
 

Functions

int dwc_usb3_pcd_check_snpsid (dwc_usb3_device_t *dev, u32 addr_ofs)
 This routine ensures the device is really a DWC_usb3 controller, by reading and verifying the SNPSID register contents. The value should be 0x5533XXXX, which corresponds to "U3", as in "USB3 version X.XXX". More...
 
int dwc_usb3_pcd_common_init (dwc_usb3_device_t *dev, volatile u8 __iomem *base, const dwc_usb3_core_params_t *core_params)
 This routine is called to initialize the DWC_usb3 CSR data structures. The register addresses in the device structures are initialized from the base address supplied by the caller. The calling routine must make the OS calls to get the base address of the DWC_usb3 controller registers. The core_params argument holds the parameters that specify how the core should be configured. More...
 
void dwc_usb3_pcd_common_remove (dwc_usb3_device_t *dev)
 
void dwc_usb3_pcd_device_init (dwc_usb3_device_t *dev, int soft_reset, int restore)
 This routine initializes the DWC_usb3 controller registers. More...
 
void dwc_usb3_pcd_device_remove (dwc_usb3_device_t *dev)
 This routine deinitializes the DWC_usb3 controller registers. More...
 
u32 dwc_usb3_pcd_get_link_state (dwc_usb3_pcd_t *pcd)
 This function retrieves the current link state. More...
 
void dwc_usb3_pcd_set_link_state (dwc_usb3_pcd_t *pcd, u32 state)
 This function sets state of USB link. More...
 
void dwc_usb3_pcd_remote_wake (dwc_usb3_pcd_t *pcd, int function)
 This function sends a Remote Wakeup to the host. More...
 
void dwc_usb3_pcd_do_test_mode (unsigned long data)
 This routine is called when the SET_FEATURE TEST_MODE Setup packet is sent from the host. The Device Control register is written with the Test Mode bits set to the specified Test Mode. This is done as a tasklet so that the "Status" phase of the control transfer completes before transmitting the TEST packets. More...
 
void dwc_usb3_fill_desc (dwc_usb3_dma_desc_t *desc, dwc_dma_t dma_addr, u32 dma_len, u32 stream, u32 type, u32 ctrlbits, int own)
 
void dwc_usb3_start_desc_chain (dwc_usb3_dma_desc_t *desc)
 
void dwc_usb3_end_desc_chain (dwc_usb3_dma_desc_t *desc)
 
void dwc_usb3_enable_desc (dwc_usb3_dma_desc_t *desc)
 
void dwc_usb3_disable_desc (dwc_usb3_dma_desc_t *desc)
 
int dwc_usb3_xmit_fn_remote_wake (dwc_usb3_pcd_t *pcd, u32 intf)
 
int dwc_usb3_xmit_ltm (dwc_usb3_pcd_t *pcd, u32 value)
 
int dwc_usb3_xmit_host_role_request (dwc_usb3_pcd_t *pcd, u32 param)
 
int dwc_usb3_set_scratchpad_buf_array (dwc_usb3_pcd_t *pcd, dwc_dma_t dma_addr)
 
int dwc_usb3_flush_fifo (dwc_usb3_pcd_t *pcd, u32 fifo_sel)
 
int dwc_usb3_dep_cfg (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 depcfg0, u32 depcfg1, u32 depcfg2)
 
int dwc_usb3_dep_xfercfg (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 depstrmcfg)
 
u32 dwc_usb3_dep_getepstate (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg)
 
int dwc_usb3_dep_sstall (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg)
 
int dwc_usb3_dep_cstall (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, int clr_pend)
 
int dwc_usb3_dep_startxfer (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, dwc_dma_t dma_addr, u32 stream_or_uf)
 
int dwc_usb3_dep_updatexfer (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 tri)
 
int dwc_usb3_dep_endxfer (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 tri, u32 flags, void *condition)
 
int dwc_usb3_dep_startnewcfg (dwc_usb3_pcd_t *pcd, dwc_usb3_dev_ep_regs_t __iomem *ep_reg, u32 rsrcidx)
 
int dwc_usb3_enable_ep (dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep)
 
int dwc_usb3_disable_ep (dwc_usb3_pcd_t *pcd, dwc_usb3_pcd_ep_t *ep)
 
int dwc_usb3_get_device_speed (dwc_usb3_pcd_t *pcd)
 
int dwc_usb3_get_frame (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_set_address (dwc_usb3_pcd_t *pcd, int addr)
 This function sets the Device Address. More...
 
void dwc_usb3_ena_usb2_phy_suspend (dwc_usb3_pcd_t *pcd)
 This function enables USB2 Phy suspend. More...
 
void dwc_usb3_dis_usb2_phy_suspend (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_ena_usb3_phy_suspend (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_dis_usb3_phy_suspend (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_accept_u1 (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_accept_u2 (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_enable_u1 (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_enable_u2 (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_disable_u1 (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_disable_u2 (dwc_usb3_pcd_t *pcd)
 
int dwc_usb3_u1_enabled (dwc_usb3_pcd_t *pcd)
 
int dwc_usb3_u2_enabled (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_clr_eps_enabled (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_dump_dev_registers (dwc_usb3_pcd_t *pcd)
 
void dwc_usb3_dump_dbgregs (dwc_usb3_device_t *dev)
 
void dwc_usb3_dump_global_registers (dwc_usb3_device_t *dev)
 
void dwc_usb3_set_tx_fifo_size (dwc_usb3_device_t *dev, int *sz)
 
void dwc_usb3_set_rx_fifo_size (dwc_usb3_device_t *dev, u32 size)
 
void dwc_usb3_init_eventbuf (dwc_usb3_device_t *dev, int bufno, u32 *addr, u32 size, dwc_dma_t dma_addr)
 
void dwc_usb3_dis_flush_eventbuf_intr (dwc_usb3_device_t *dev, int bufno)
 
void dwc_usb3_enable_common_interrupts (dwc_usb3_device_t *dev)
 
void dwc_usb3_enable_device_interrupts (dwc_usb3_device_t *dev)
 
int dwc_usb3_handle_event (dwc_usb3_device_t *dev)
 
int dwc_usb3_irq (dwc_usb3_device_t *dev, int irq)
 
int dwc_usb3_task (dwc_usb3_device_t *dev)
 
void dwc_usb3_task_init (dwc_usb3_device_t *dev)
 
static __inline u32 dwc_usb3_mode (dwc_usb3_device_t *dev)
 
static __inline int dwc_usb3_is_device_mode (dwc_usb3_device_t *dev)
 
static __inline int dwc_usb3_is_host_mode (dwc_usb3_device_t *dev)
 

Macro Definition Documentation

◆ DWC_ENDXFER_FORCE

#define DWC_ENDXFER_FORCE   1U

◆ DWC_ENDXFER_NODELAY

#define DWC_ENDXFER_NODELAY   2U

◆ dwc_usb3_is_hwo

#define dwc_usb3_is_hwo (   desc)    ((desc)->control & DWC_DSCCTL_HWO_BIT)

◆ dwc_usb3_is_ioc

#define dwc_usb3_is_ioc (   desc)    ((desc)->control & DWC_DSCCTL_IOC_BIT)

◆ dwc_usb3_get_xfercnt

#define dwc_usb3_get_xfercnt (   desc)

◆ dwc_usb3_get_xfersts

#define dwc_usb3_get_xfersts (   desc)

◆ dwc_usb3_get_xfersofn

#define dwc_usb3_get_xfersofn (   desc)

◆ dwc_usb3_get_eventsofn

#define dwc_usb3_get_eventsofn (   event)

Function Documentation

◆ dwc_usb3_fill_desc()

void dwc_usb3_fill_desc ( dwc_usb3_dma_desc_t desc,
dwc_dma_t  dma_addr,
u32  dma_len,
u32  stream,
u32  type,
u32  ctrlbits,
int  own 
)

Fill in the four dwords of a DMA descriptor (aka a TRB).

◆ dwc_usb3_start_desc_chain()

void dwc_usb3_start_desc_chain ( dwc_usb3_dma_desc_t desc)

Make a DMA descriptor the start of a chain by setting its CHN bit and clearing its IOC bit.

Parameters
descThe DMA descriptor (TRB) to operate on.

◆ dwc_usb3_end_desc_chain()

void dwc_usb3_end_desc_chain ( dwc_usb3_dma_desc_t desc)

Make a DMA descriptor the end of a chain by clearing its CHN bit and setting its IOC bit.

Parameters
descThe DMA descriptor (TRB) to operate on.

◆ dwc_usb3_enable_desc()

void dwc_usb3_enable_desc ( dwc_usb3_dma_desc_t desc)

Enable a DMA descriptor by setting its HWO bit.

Parameters
descThe DMA descriptor (TRB) to operate on.

◆ dwc_usb3_disable_desc()

void dwc_usb3_disable_desc ( dwc_usb3_dma_desc_t desc)

Disable a DMA descriptor by clearing its HWO bit.

NOTE: This must only be called if it is known that the hardware has finished with the DMA descriptor, but for some reason the hardware has not cleared the HWO bit.

Parameters
descThe DMA descriptor (TRB) to operate on.

◆ dwc_usb3_xmit_fn_remote_wake()

int dwc_usb3_xmit_fn_remote_wake ( dwc_usb3_pcd_t pcd,
u32  intf 
)

Send TRANSMIT FUNCTION WAKE DEVICE NOTIFICATION command to Device

◆ dwc_usb3_xmit_ltm()

int dwc_usb3_xmit_ltm ( dwc_usb3_pcd_t pcd,
u32  value 
)

Send LATENCY TOLERANCE MESSAGE DEVICE NOTIFICATION command to Device

◆ dwc_usb3_xmit_host_role_request()

int dwc_usb3_xmit_host_role_request ( dwc_usb3_pcd_t pcd,
u32  param 
)

◆ dwc_usb3_set_scratchpad_buf_array()

int dwc_usb3_set_scratchpad_buf_array ( dwc_usb3_pcd_t pcd,
dwc_dma_t  dma_addr 
)

Send SET SCRATCHPAD BUFFER ARRAY command to Device

◆ dwc_usb3_flush_fifo()

int dwc_usb3_flush_fifo ( dwc_usb3_pcd_t pcd,
u32  fifo_sel 
)

Send SELECTED FIFO FLUSH command to Device

◆ dwc_usb3_dep_cfg()

int dwc_usb3_dep_cfg ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg,
u32  depcfg0,
u32  depcfg1,
u32  depcfg2 
)

Send DEPCFG command to EP

◆ dwc_usb3_dep_xfercfg()

int dwc_usb3_dep_xfercfg ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg,
u32  depstrmcfg 
)

Send DEPXFERCFG command to EP

◆ dwc_usb3_dep_getepstate()

u32 dwc_usb3_dep_getepstate ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg 
)

Send DEPGETEPSTATE command to EP

◆ dwc_usb3_dep_sstall()

int dwc_usb3_dep_sstall ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg 
)

Send DEPSSTALL command to EP

◆ dwc_usb3_dep_cstall()

int dwc_usb3_dep_cstall ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg,
int  clr_pend 
)

Send DEPCSTALL command to EP

◆ dwc_usb3_dep_startxfer()

int dwc_usb3_dep_startxfer ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg,
dwc_dma_t  dma_addr,
u32  stream_or_uf 
)

Send DEPSTRTXFER command to EP

◆ dwc_usb3_dep_updatexfer()

int dwc_usb3_dep_updatexfer ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg,
u32  tri 
)

Send DEPUPDTXFER command to EP

◆ dwc_usb3_dep_endxfer()

int dwc_usb3_dep_endxfer ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg,
u32  tri,
u32  flags,
void *  condition 
)

Send DEPENDXFER command to EP

◆ dwc_usb3_dep_startnewcfg()

int dwc_usb3_dep_startnewcfg ( dwc_usb3_pcd_t pcd,
dwc_usb3_dev_ep_regs_t __iomem ep_reg,
u32  rsrcidx 
)

Send DEPSTRTNEWCFG command to EP

◆ dwc_usb3_enable_ep()

int dwc_usb3_enable_ep ( dwc_usb3_pcd_t pcd,
dwc_usb3_pcd_ep_t ep 
)

Enable an EP in the DALEPENA register.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to enable.
Returns
0 if succesful, -DWC_E_BUSY if already enabled.

◆ dwc_usb3_disable_ep()

int dwc_usb3_disable_ep ( dwc_usb3_pcd_t pcd,
dwc_usb3_pcd_ep_t ep 
)

Disable an EP in the DALEPENA register.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
epThe EP to disable.
Returns
0 if succesful, -DWC_E_INVALID if already disabled.

◆ dwc_usb3_get_device_speed()

int dwc_usb3_get_device_speed ( dwc_usb3_pcd_t pcd)

Get the device speed from the device status register and convert it to USB speed constant.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
Returns
The device speed.

◆ dwc_usb3_get_frame()

int dwc_usb3_get_frame ( dwc_usb3_pcd_t pcd)

Get the current microframe number.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
Returns
The current microframe number.

◆ dwc_usb3_set_address()

void dwc_usb3_set_address ( dwc_usb3_pcd_t pcd,
int  addr 
)

This function sets the Device Address.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
addrThe address to set.

◆ dwc_usb3_ena_usb2_phy_suspend()

void dwc_usb3_ena_usb2_phy_suspend ( dwc_usb3_pcd_t pcd)

This function enables USB2 Phy suspend.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_dis_usb2_phy_suspend()

void dwc_usb3_dis_usb2_phy_suspend ( dwc_usb3_pcd_t pcd)

Disable USB2 Phy suspend.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_ena_usb3_phy_suspend()

void dwc_usb3_ena_usb3_phy_suspend ( dwc_usb3_pcd_t pcd)

Enable USB3 Phy suspend.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_dis_usb3_phy_suspend()

void dwc_usb3_dis_usb3_phy_suspend ( dwc_usb3_pcd_t pcd)

Disable USB3 Phy suspend.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_accept_u1()

void dwc_usb3_accept_u1 ( dwc_usb3_pcd_t pcd)

Enable the Device to accept U1 control commands from the Host.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_accept_u2()

void dwc_usb3_accept_u2 ( dwc_usb3_pcd_t pcd)

Enable the Device to accept U2 control commands from the Host.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_enable_u1()

void dwc_usb3_enable_u1 ( dwc_usb3_pcd_t pcd)

Enable U1 sleep.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_enable_u2()

void dwc_usb3_enable_u2 ( dwc_usb3_pcd_t pcd)

Enable U2 sleep.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_disable_u1()

void dwc_usb3_disable_u1 ( dwc_usb3_pcd_t pcd)

Disable U1 sleep.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_disable_u2()

void dwc_usb3_disable_u2 ( dwc_usb3_pcd_t pcd)

Disable U2 sleep.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_u1_enabled()

int dwc_usb3_u1_enabled ( dwc_usb3_pcd_t pcd)

Test whether U1 sleep is enabled.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
Returns
1 if enabled, 0 if not.

◆ dwc_usb3_u2_enabled()

int dwc_usb3_u2_enabled ( dwc_usb3_pcd_t pcd)

Test whether U2 sleep is enabled.

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.
Returns
1 if enabled, 0 if not.

◆ dwc_usb3_clr_eps_enabled()

void dwc_usb3_clr_eps_enabled ( dwc_usb3_pcd_t pcd)

Clear 'eps_enabled' flag and 'ena_once' flags for all EPs, so EPs will get completely reconfigured by SetConfig and SetInterface.

◆ dwc_usb3_dump_dev_registers()

void dwc_usb3_dump_dev_registers ( dwc_usb3_pcd_t pcd)

This routine reads the device registers and prints them

Parameters
pcdProgramming view of DWC_usb3 peripheral controller.

◆ dwc_usb3_dump_dbgregs()

void dwc_usb3_dump_dbgregs ( dwc_usb3_device_t dev)

This routine dumps the core's internal debug registers

Parameters
devProgramming view of DWC_usb3 controller.

◆ dwc_usb3_dump_global_registers()

void dwc_usb3_dump_global_registers ( dwc_usb3_device_t dev)

This routine reads the core global registers and prints them

Parameters
devProgramming view of DWC_usb3 controller.

◆ dwc_usb3_set_tx_fifo_size()

void dwc_usb3_set_tx_fifo_size ( dwc_usb3_device_t dev,
int *  sz 
)

Set the size of the Tx FIFOs

NOTE: The following code for setting the FIFO sizes only works for cores configured with the 3 RAM option. Setting FIFO sizes for the 2 RAM option is not implemented.

Parameters
devProgramming view of DWC_usb3 controller.
szNew sizes for the FIFOs.

◆ dwc_usb3_set_rx_fifo_size()

void dwc_usb3_set_rx_fifo_size ( dwc_usb3_device_t dev,
u32  size 
)

Set the size of the Rx FIFO

NOTE: The following code for setting the FIFO sizes only works for cores configured with the 3 RAM option. Setting FIFO sizes for the 2 RAM option is not implemented.

Parameters
devProgramming view of DWC_usb3 controller.
sizeNew size for the FIFO.

◆ dwc_usb3_init_eventbuf()

void dwc_usb3_init_eventbuf ( dwc_usb3_device_t dev,
int  bufno,
u32 addr,
u32  size,
dwc_dma_t  dma_addr 
)

◆ dwc_usb3_dis_flush_eventbuf_intr()

void dwc_usb3_dis_flush_eventbuf_intr ( dwc_usb3_device_t dev,
int  bufno 
)

◆ dwc_usb3_enable_common_interrupts()

void dwc_usb3_enable_common_interrupts ( dwc_usb3_device_t dev)

◆ dwc_usb3_enable_device_interrupts()

void dwc_usb3_enable_device_interrupts ( dwc_usb3_device_t dev)

◆ dwc_usb3_handle_event()

int dwc_usb3_handle_event ( dwc_usb3_device_t dev)

◆ dwc_usb3_irq()

int dwc_usb3_irq ( dwc_usb3_device_t dev,
int  irq 
)

◆ dwc_usb3_task()

int dwc_usb3_task ( dwc_usb3_device_t dev)

◆ dwc_usb3_task_init()

void dwc_usb3_task_init ( dwc_usb3_device_t dev)

◆ dwc_usb3_mode()

static __inline u32 dwc_usb3_mode ( dwc_usb3_device_t dev)
static

This routine returns the current operating mode, host or device.

Returns
0 - Device Mode, 1 - Host Mode

◆ dwc_usb3_is_device_mode()

static __inline int dwc_usb3_is_device_mode ( dwc_usb3_device_t dev)
static

This routine returns true if the current operating mode is Device.

Returns
1 - Device mode, 0 - Not Device mode

◆ dwc_usb3_is_host_mode()

static __inline int dwc_usb3_is_host_mode ( dwc_usb3_device_t dev)
static

This routine returns true if the current operating mode is Host.

Returns
1 - Host mode, 0 - Not Host mode
DWC_DSCSTS_TRBRSP_SHIFT
#define DWC_DSCSTS_TRBRSP_SHIFT
Definition: hw.h:1775
DWC_DSCSTS_TRBRSP_BITS
#define DWC_DSCSTS_TRBRSP_BITS
Definition: hw.h:1774
DWC_DEPEVT_ISOC_UFRAME_NUM_SHIFT
#define DWC_DEPEVT_ISOC_UFRAME_NUM_SHIFT
Definition: hw.h:997
DWC_DSCSTS_XFRCNT_SHIFT
#define DWC_DSCSTS_XFRCNT_SHIFT
Definition: hw.h:1767
DWC_DSCCTL_STRMID_SOFN_SHIFT
#define DWC_DSCCTL_STRMID_SOFN_SHIFT
Definition: hw.h:1831
DWC_DEPEVT_ISOC_UFRAME_NUM_BITS
#define DWC_DEPEVT_ISOC_UFRAME_NUM_BITS
Definition: hw.h:996
DWC_DSCCTL_STRMID_SOFN_BITS
#define DWC_DSCCTL_STRMID_SOFN_BITS
Definition: hw.h:1830
DWC_DSCSTS_XFRCNT_BITS
#define DWC_DSCSTS_XFRCNT_BITS
Definition: hw.h:1766