lib/sw_services/xilplmi/src/xplmi_dma.c
static int XPlmi_StartDma(u64 SrcAddr, u64 DestAddr, u32 Len, u32 Flags,
		XPmcDma** DmaPtrAddr)
{
	int Status = XST_FAILURE;
	u8 EnLast = 0U;
	XPmcDma *DmaPtr;

	XPlmi_Printf(DEBUG_INFO, "DMA Xfer Src 0x%0x%08x, Dest 0x%0x%08x, "
		"Len 0x%0x, Flags 0x%0x: ",
		(u32)(SrcAddr >> 32U), (u32)SrcAddr, (u32)(DestAddr >> 32U),
		(u32)DestAddr, Len, Flags);

	/* Select DMA pointer */
	if ((Flags & XPLMI_PMCDMA_0) == XPLMI_PMCDMA_0) {
		XPlmi_Printf(DEBUG_INFO, "PMCDMA0\n\r");
		DmaPtr = &PmcDma0;
	} else {
		XPlmi_Printf(DEBUG_INFO, "PMCDMA1\n\r");
		DmaPtr = &PmcDma1;
	}

	XPlmi_PrintArray(DEBUG_DETAILED, SrcAddr, Len, "DMA Xfer Data");

	/* Configure the secure stream switch */
	XPlmi_SSSCfgDmaDma(Flags);

	/* Setting PMC_DMA in AXI Burst mode */
	if ((Flags & XPLMI_SRC_CH_AXI_FIXED) == XPLMI_SRC_CH_AXI_FIXED) {
		DmaCtrl.AxiBurstType = 1U;
		XPmcDma_SetConfig(DmaPtr, XPMCDMA_SRC_CHANNEL, &DmaCtrl);
	}
	/* Setting PMC_DMA in AXI Burst mode */
	if ((Flags & XPLMI_DST_CH_AXI_FIXED) == XPLMI_DST_CH_AXI_FIXED) {
		DmaCtrl.AxiBurstType = 1U;
		XPmcDma_SetConfig(DmaPtr, XPMCDMA_DST_CHANNEL, &DmaCtrl);
	}

	/* Data transfer in loop back mode */
	XPmcDma_64BitTransfer(DmaPtr, XPMCDMA_DST_CHANNEL,
		(u32)(DestAddr), (u32)(DestAddr >> 32U), Len, EnLast);
	XPmcDma_64BitTransfer(DmaPtr, XPMCDMA_SRC_CHANNEL,
		(u32)(SrcAddr), (u32)(SrcAddr >> 32U), Len, EnLast);
	*DmaPtrAddr = DmaPtr;
	Status = XST_SUCCESS;
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used initiate the DMA to DMA transfer.
 *
 * @param	SrcAddr is address for SRC channel to fetch data from
 * @param	DestAddr is address for DST channel to store the data
 * @param	Len is length of the data in bytes
 * @param	Flags to select PMC DMA and DMA Burst type
 * @param	DmaPtrAddr is to store address to PmcDmaInstance
 *
 * @return	XST_SUCCESS on success and error codes on failure
 *
 *****************************************************************************/
@brief       This function is used initiate the DMA to DMA transfer.

@return      XST_SUCCESS on success and error codes on failure
@brief This function is used initiate the DMA to DMA transfer . @return XST_SUCCESS on success and error codes on failure
static int XPlmi_StartDma(u64 SrcAddr, u64 DestAddr, u32 Len, u32 Flags,
		XPmcDma** DmaPtrAddr)
{
	int Status = XST_FAILURE;
	u8 EnLast = 0U;
	XPmcDma *DmaPtr;
	XPlmi_Printf(DEBUG_INFO, "DMA Xfer Src 0x%0x%08x, Dest 0x%0x%08x, "
		"Len 0x%0x, Flags 0x%0x: ",
		(u32)(SrcAddr >> 32U), (u32)SrcAddr, (u32)(DestAddr >> 32U),
		(u32)DestAddr, Len, Flags);
	if ((Flags & XPLMI_PMCDMA_0) == XPLMI_PMCDMA_0) {
		XPlmi_Printf(DEBUG_INFO, "PMCDMA0\n\r");
		DmaPtr = &PmcDma0;
	} else {
		XPlmi_Printf(DEBUG_INFO, "PMCDMA1\n\r");
		DmaPtr = &PmcDma1;
	}
	XPlmi_PrintArray(DEBUG_DETAILED, SrcAddr, Len, "DMA Xfer Data");
	XPlmi_SSSCfgDmaDma(Flags);
	if ((Flags & XPLMI_SRC_CH_AXI_FIXED) == XPLMI_SRC_CH_AXI_FIXED) {
		DmaCtrl.AxiBurstType = 1U;
		XPmcDma_SetConfig(DmaPtr, XPMCDMA_SRC_CHANNEL, &DmaCtrl);
	}
	if ((Flags & XPLMI_DST_CH_AXI_FIXED) == XPLMI_DST_CH_AXI_FIXED) {
		DmaCtrl.AxiBurstType = 1U;
		XPmcDma_SetConfig(DmaPtr, XPMCDMA_DST_CHANNEL, &DmaCtrl);
	}
	XPmcDma_64BitTransfer(DmaPtr, XPMCDMA_DST_CHANNEL,
		(u32)(DestAddr), (u32)(DestAddr >> 32U), Len, EnLast);
	XPmcDma_64BitTransfer(DmaPtr, XPMCDMA_SRC_CHANNEL,
		(u32)(SrcAddr), (u32)(SrcAddr >> 32U), Len, EnLast);
	*DmaPtrAddr = DmaPtr;
	Status = XST_SUCCESS;
	return Status;
}
static int XPlmi_StartDma ( u64 SrcAddr , u64 DestAddr , u32 Len , u32 Flags , XPmcDma * * DmaPtrAddr ) { int Status = XST_FAILURE ; u8 EnLast = 0U ; XPmcDma * DmaPtr ; XPlmi_Printf ( DEBUG_INFO , " " " " , ( u32 ) ( SrcAddr >> 32U ) , ( u32 ) SrcAddr , ( u32 ) ( DestAddr >> 32U ) , ( u32 ) DestAddr , Len , Flags ) ; if ( ( Flags & XPLMI_PMCDMA_0 ) == XPLMI_PMCDMA_0 ) { XPlmi_Printf ( DEBUG_INFO , " \n \r " ) ; DmaPtr = & PmcDma0 ; } else { XPlmi_Printf ( DEBUG_INFO , " \n \r " ) ; DmaPtr = & PmcDma1 ; } XPlmi_PrintArray ( DEBUG_DETAILED , SrcAddr , Len , " " ) ; XPlmi_SSSCfgDmaDma ( Flags ) ; if ( ( Flags & XPLMI_SRC_CH_AXI_FIXED ) == XPLMI_SRC_CH_AXI_FIXED ) { DmaCtrl . AxiBurstType = 1U ; XPmcDma_SetConfig ( DmaPtr , XPMCDMA_SRC_CHANNEL , & DmaCtrl ) ; } if ( ( Flags & XPLMI_DST_CH_AXI_FIXED ) == XPLMI_DST_CH_AXI_FIXED ) { DmaCtrl . AxiBurstType = 1U ; XPmcDma_SetConfig ( DmaPtr , XPMCDMA_DST_CHANNEL , & DmaCtrl ) ; } XPmcDma_64BitTransfer ( DmaPtr , XPMCDMA_DST_CHANNEL , ( u32 ) ( DestAddr ) , ( u32 ) ( DestAddr >> 32U ) , Len , EnLast ) ; XPmcDma_64BitTransfer ( DmaPtr , XPMCDMA_SRC_CHANNEL , ( u32 ) ( SrcAddr ) , ( u32 ) ( SrcAddr >> 32U ) , Len , EnLast ) ; * DmaPtrAddr = DmaPtr ; Status = XST_SUCCESS ; return Status ; }
@brief       This function is used initiate the DMA to DMA transfer.
@brief This function is used initiate the DMA to DMA transfer .
/* Select DMA pointer */ /* Configure the secure stream switch */ /* Setting PMC_DMA in AXI Burst mode */ /* Setting PMC_DMA in AXI Burst mode */ /* Data transfer in loop back mode */