xdmapcie
Xilinx SDK Drivers API Documentation
xdmapcie_rc_enumerate_example.c File Reference

Overview

This file contains a design example for using XDMA PCIe IP and its driver.

This is an example to show the usage of driver APIs when XDMA PCIe IP is configured as a Root Port.

The example initializes the XDMA PCIe IP and shows how to enumerate the PCIe system.

Note

This example should be used only when XDMA PCIe IP is configured as root complex.

This code will illustrate how the XDmaPcie IP and its standalone driver can be used to:

  • Initialize a XDMA PCIe IP core built as a root complex
  • Enumerate PCIe end points in the system
  • Assign BARs to end points
  • find capabilities on end point

Please note that this example enumerates and initializes PCIe end points only.

We tried to use as much of the driver's API calls as possible to show the reader how each call could be used and that probably made the example not the shortest way of doing the tasks shown as they could be done.

  MODIFICATION HISTORY:
  Ver   Who  Date     Changes


1.0 tk 01/30/2019 Initial version of XDMA PCIe root complex example *

Functions

int PcieInitRootComplex (XDmaPcie *XdmaPciePtr, u16 DeviceId)
 This function initializes a XDMA PCIe IP built as a root complex. More...
 
int main (void)
 This function is the entry point for PCIe Root Complex Enumeration Example. More...
 

Function Documentation

int main ( void  )

This function is the entry point for PCIe Root Complex Enumeration Example.

Parameters
None
Returns
  • XST_SUCCESS if successful
  • XST_FAILURE if unsuccessful.
Note
None.

References PcieInitRootComplex(), and XDmaPcie_EnumerateFabric().

int PcieInitRootComplex ( XDmaPcie XdmaPciePtr,
u16  DeviceId 
)

This function initializes a XDMA PCIe IP built as a root complex.

Parameters
XdmaPciePtris a pointer to an instance of XDmaPcie data structure represents a root complex IP.
DeviceIdis XDMA PCIe IP unique ID
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if unsuccessful.
Note
None.

References XDmaPcie_Config::BaseAddress, XDmaPcie::Config, XDmaPcie_Config::IncludeRootComplex, XDmaPcie_CfgInitialize(), XDmaPcie_ClearPendingInterrupts(), XDmaPcie_DisableInterrupts(), XDmaPcie_GetEnabledInterrupts(), XDmaPcie_GetPendingInterrupts(), XDmaPcie_GetRequesterId(), XDMAPCIE_ID_CLEAR_ALL_MASK, XDMAPCIE_IM_ENABLE_ALL_MASK, XDmaPcie_IsLinkUp, XDmaPcie_LookupConfig(), XDmaPcie_ReadLocalConfigSpace(), and XDmaPcie_WriteLocalConfigSpace().

Referenced by main().