XilinxProcessorIPLib/drivers/axipcie/examples/xaxipcie_ep_cdma_example.c
int DmaDataTransfer (u16 DeviceID)
{
	int Status;
	volatile int Error;
	XAxiCdma_Config *ConfigPtr;

	Error = 0;

	/*
	 * Make sure we have a valid addresses for Src and Dst.
	 */
	if (AXICDMA_SRC_ADDR == 0) {
		return XST_FAILURE;
	}

	if (AXICDMA_DEST_ADDR == 0) {
		return XST_FAILURE;
	}

	/*
	 * Initialize the AXI CDMA IP.
	 */
	ConfigPtr = XAxiCdma_LookupConfig(DeviceID);
	if (ConfigPtr == NULL) {
		return XST_FAILURE;
	}

	Status = XAxiCdma_CfgInitialize(&CdmaInstance,
				ConfigPtr, ConfigPtr->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Reset the AXI CDMA device.
	 */
	XAxiCdma_Reset(&CdmaInstance);

	/*
	 * Disable AXI CDMA Interrupts
	 */
	XAxiCdma_IntrDisable(&CdmaInstance, XAXICDMA_XR_IRQ_ALL_MASK);

	/*
	 * Start Transferring Data from source to destination in polled mode
	 */
	XAxiCdma_SimpleTransfer (&CdmaInstance, AXICDMA_SRC_ADDR,
					AXICDMA_DEST_ADDR, AXICDMA_LENGTH, 0, 0);

	/*
	 * Poll Status register waiting for either Completion or Error
	 */
	while (XAxiCdma_IsBusy(&CdmaInstance));

	Error = XAxiCdma_GetError(&CdmaInstance);

	if (Error != 0x0) {

		xil_printf("AXI CDMA Transfer Error =  %8.8x\r\n");
		return XST_FAILURE;
	}

	xil_printf("AXI CDMA Transfer is Complete\r\n");


	return XST_SUCCESS;
}
/*****************************************************************************/
/**
* 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.
*
* @param	DeviceId is device ID of the XAxiCdma Device.
*
* @return
*		- 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.
*
******************************************************************************/
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.
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 .
int DmaDataTransfer (u16 DeviceID)
{
	int Status;
	volatile int Error;
	XAxiCdma_Config *ConfigPtr;
	Error = 0;
	if (AXICDMA_SRC_ADDR == 0) {
		return XST_FAILURE;
	}
	if (AXICDMA_DEST_ADDR == 0) {
		return XST_FAILURE;
	}
	ConfigPtr = XAxiCdma_LookupConfig(DeviceID);
	if (ConfigPtr == NULL) {
		return XST_FAILURE;
	}
	Status = XAxiCdma_CfgInitialize(&CdmaInstance,
				ConfigPtr, ConfigPtr->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XAxiCdma_Reset(&CdmaInstance);
	XAxiCdma_IntrDisable(&CdmaInstance, XAXICDMA_XR_IRQ_ALL_MASK);
	XAxiCdma_SimpleTransfer (&CdmaInstance, AXICDMA_SRC_ADDR,
					AXICDMA_DEST_ADDR, AXICDMA_LENGTH, 0, 0);
	while (XAxiCdma_IsBusy(&CdmaInstance));
	Error = XAxiCdma_GetError(&CdmaInstance);
	if (Error != 0x0) {
		xil_printf("AXI CDMA Transfer Error =  %8.8x\r\n");
		return XST_FAILURE;
	}
	xil_printf("AXI CDMA Transfer is Complete\r\n");
	return XST_SUCCESS;
}
int DmaDataTransfer ( u16 DeviceID ) { int Status ; volatile int Error ; XAxiCdma_Config * ConfigPtr ; Error = 0 ; if ( AXICDMA_SRC_ADDR == 0 ) { return XST_FAILURE ; } if ( AXICDMA_DEST_ADDR == 0 ) { return XST_FAILURE ; } ConfigPtr = XAxiCdma_LookupConfig ( DeviceID ) ; if ( ConfigPtr == NULL ) { return XST_FAILURE ; } Status = XAxiCdma_CfgInitialize ( & CdmaInstance , ConfigPtr , ConfigPtr -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XAxiCdma_Reset ( & CdmaInstance ) ; XAxiCdma_IntrDisable ( & CdmaInstance , XAXICDMA_XR_IRQ_ALL_MASK ) ; XAxiCdma_SimpleTransfer ( & CdmaInstance , AXICDMA_SRC_ADDR , AXICDMA_DEST_ADDR , AXICDMA_LENGTH , 0 , 0 ) ; while ( XAxiCdma_IsBusy ( & CdmaInstance ) ) ; Error = XAxiCdma_GetError ( & CdmaInstance ) ; if ( Error != 0x0 ) { xil_printf ( " \r \n " ) ; return XST_FAILURE ; } xil_printf ( " \r \n " ) ; return XST_SUCCESS ; }
This function transfers data from Source Address to Destination Address
using the AXI CDMA.
This function transfers data from Source Address to Destination Address using the AXI CDMA .
/*
	 * Make sure we have a valid addresses for Src and Dst.
	 */ /*
	 * Initialize the AXI CDMA IP.
	 */ /*
	 * Reset the AXI CDMA device.
	 */ /*
	 * Disable AXI CDMA Interrupts
	 */ /*
	 * Start Transferring Data from source to destination in polled mode
	 */ /*
	 * Poll Status register waiting for either Completion or Error
	 */