axipcie: xaxipcie_ep_cdma_example.c File Reference

| axipcie Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xaxipcie_ep_cdma_example.c File Reference

## Overview

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

The example handles AXI PCIe IP when it is configured as an end point. It shows how to transfer data between system memory and end point memory. The user has to enter both addresses for source and destination. One of the addresses should be in system memory and the other one in the memory local to an end point(mapped to memory space of the system).

This example assumes that there is an AXI CDMA IP in the system. The user has to specify the Source, Destination and the Length of the DMA transfer which are valid for this system and are defined AXICDMA_SRC_ADDR, AXICDMA_DEST_ADDR and AXICDMA_LENGTH respectively in this example.

Note

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

- Initialize a PCIe bridge core built as an end point
- Retrieve root complex configuration assigned to end point
- Move data form system memory to end point memory using AXICDMA IP.

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.00a rkv  03/07/11 Initial version based on PLB PCIE example
      2.00a nm   10/19/11 Renamed function call XAxiPcie_GetRequestId to
                          XAxiPcie_GetRequesterId
      3.1   ms   01/23/17 Added xil_printf statement in main function to
                          ensure that "Successfully ran" and "Failed" strings
                          are available in all examples. This is a fix for
                          CR-965028.
            ms   04/05/17 Added tabspace for return statements in functions
                          for proper documentation while generating doxygen.
    *

## Functions
int | PCIeEndPointInitialize (XAxiPcie *XlnxEndPointPtr, u16 DeviceId)
| This initialize an IP built as an end point. More...
int | DmaDataTransfer (u16 DeviceID)
| This function transfers data from Source Address to Destination Address using the AXI CDMA. More...
int | main (void)
| This function is the entry point for AXI PCIe End Point with AXI CDMA Example. More...

## Function Documentation

int DmaDataTransfer | ( | u16 | DeviceID | ) |

This function transfers data from Source Address to Destination Address using the AXI CDMA.

User has to specify the Source Address, Destination Address and Transfer Length in AXICDMA_SRC_ADDR, AXICDMA_DEST_ADDR and AXICDMA_LENGTH defines respectively.

Parameters

  DeviceId | is device ID of the XAxiCdma Device.

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE.if unsuccessful.

Note
  If the hardware system is not built correctly, this function may never return to the caller.

User has to specify the Source Address, Destination Address and Transfer Length in AXICDMA_SRC_ADDR, AXICDMA_DEST_ADDR and AXICDMA_LENGTH defines respectively.

Parameters

  DeviceId | is device ID of the XAxiCdma Device.

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE.if unsuccessful.

Note
  If the hardware system is not built correctly this function may never return to the caller.

Referenced by main().

int main | ( | void |  | ) |

This function is the entry point for AXI PCIe End Point with AXI CDMA Example.

Parameters

  None |

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE if unsuccessful

Note
  None.

References DmaDataTransfer(), and PCIeEndPointInitialize().

int PCIeEndPointInitialize | ( | XAxiPcie * | XlnxEndPointPtr,
|  | u16 | DeviceId
| ) |  |

This initialize an IP built as an end point.

This function initializes the AXI PCIE end point IP.

Parameters

  XlnxEndPointPtr | is a pointer to an instance of XAxiPcie data structure represents an end point IP.
  DeviceId | is PCIe IP unique ID

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE if unsuccessful

Note
  None.

Parameters

  XlnxEndPointPtr | is a pointer to an instance of XAxiPcie data structure represents an end point IP.
  DeviceId | is AXI PCIe IP unique Device Id

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE if unsuccessful

Note
  None.

References XAxiPcie_Config::BaseAddress, XAxiPcie_CfgInitialize(), XAxiPcie_ClearPendingInterrupts(), XAxiPcie_DisableInterrupts(), XAxiPcie_GetEnabledInterrupts(), XAxiPcie_GetPendingInterrupts(), XAxiPcie_GetRequesterId(), XAXIPCIE_ID_CLEAR_ALL_MASK, XAXIPCIE_IM_ENABLE_ALL_MASK, XAxiPcie_IsLinkUp, XAxiPcie_LookupConfig(), and XAxiPcie_ReadLocalConfigSpace().

Referenced by main().