lib/sw_services/xilplmi/src/xplmi_generic.c
static int XPlmi_DmaTransfer(u64 Dest, u64 Src, u32 Len, u32 Flags)
{
	int Status = XST_FAILURE;
	u32 UnalignedWordCount;
	u32 Offset;
	u64 DestAddr = Dest;
	u64 SrcAddr = Src;
	u32 Length = Len;

	Status = XPlmi_DmaUnalignedXfer(&SrcAddr, &DestAddr, &Length,
		XPLMI_DEST_ALIGN_REQ);
	if (Status != XST_SUCCESS) {
		Status = XPlmi_UpdateStatus(XPLMI_ERR_UNALIGNED_DMA_XFER,
			Status);
		goto END;
	}

	UnalignedWordCount = Length % XPLMI_WORD_LEN;
	Length = Length - UnalignedWordCount;

	Status = XPlmi_DmaXfr(SrcAddr, DestAddr, Length, Flags);
	if(Status != XST_SUCCESS) {
		XPlmi_Printf(DEBUG_GENERAL, "DMA WRITE Failed\n\r");
		goto END;
	}

	Offset = Length * XPLMI_WORD_LEN;
	SrcAddr += Offset;
	DestAddr += Offset;
	Status = XPlmi_DmaUnalignedXfer(&SrcAddr, &DestAddr,
		&UnalignedWordCount, XPLMI_LEN_ALIGN_REQ);
	if (Status != XST_SUCCESS) {
		Status = XPlmi_UpdateStatus(XPLMI_ERR_UNALIGNED_DMA_XFER,
			Status);
	}

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function provides functionality for DMA write.
 *
 * @param	Dest is the destination address
 *          Src is the source address
 *          Len is the number of words to be transferred
 *          Flags is the DMA transfer related flags
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function provides functionality for DMA write.
@param       Dest is the destination address
Src is the source address
Len is the number of words to be transferred
Flags is the DMA transfer related flags

@return      XST_SUCCESS on success and error code on failure
@brief This function provides functionality for DMA write . @param Dest is the destination address Src is the source address Len is the number of words to be transferred Flags is the DMA transfer related flags @return XST_SUCCESS on success and error code on failure
static int XPlmi_DmaTransfer(u64 Dest, u64 Src, u32 Len, u32 Flags)
{
	int Status = XST_FAILURE;
	u32 UnalignedWordCount;
	u32 Offset;
	u64 DestAddr = Dest;
	u64 SrcAddr = Src;
	u32 Length = Len;
	Status = XPlmi_DmaUnalignedXfer(&SrcAddr, &DestAddr, &Length,
		XPLMI_DEST_ALIGN_REQ);
	if (Status != XST_SUCCESS) {
		Status = XPlmi_UpdateStatus(XPLMI_ERR_UNALIGNED_DMA_XFER,
			Status);
		goto END;
	}
	UnalignedWordCount = Length % XPLMI_WORD_LEN;
	Length = Length - UnalignedWordCount;
	Status = XPlmi_DmaXfr(SrcAddr, DestAddr, Length, Flags);
	if(Status != XST_SUCCESS) {
		XPlmi_Printf(DEBUG_GENERAL, "DMA WRITE Failed\n\r");
		goto END;
	}
	Offset = Length * XPLMI_WORD_LEN;
	SrcAddr += Offset;
	DestAddr += Offset;
	Status = XPlmi_DmaUnalignedXfer(&SrcAddr, &DestAddr,
		&UnalignedWordCount, XPLMI_LEN_ALIGN_REQ);
	if (Status != XST_SUCCESS) {
		Status = XPlmi_UpdateStatus(XPLMI_ERR_UNALIGNED_DMA_XFER,
			Status);
	}
END:
	return Status;
}
static int XPlmi_DmaTransfer ( u64 Dest , u64 Src , u32 Len , u32 Flags ) { int Status = XST_FAILURE ; u32 UnalignedWordCount ; u32 Offset ; u64 DestAddr = Dest ; u64 SrcAddr = Src ; u32 Length = Len ; Status = XPlmi_DmaUnalignedXfer ( & SrcAddr , & DestAddr , & Length , XPLMI_DEST_ALIGN_REQ ) ; if ( Status != XST_SUCCESS ) { Status = XPlmi_UpdateStatus ( XPLMI_ERR_UNALIGNED_DMA_XFER , Status ) ; goto END ; } UnalignedWordCount = Length % XPLMI_WORD_LEN ; Length = Length - UnalignedWordCount ; Status = XPlmi_DmaXfr ( SrcAddr , DestAddr , Length , Flags ) ; if ( Status != XST_SUCCESS ) { XPlmi_Printf ( DEBUG_GENERAL , " \n \r " ) ; goto END ; } Offset = Length * XPLMI_WORD_LEN ; SrcAddr += Offset ; DestAddr += Offset ; Status = XPlmi_DmaUnalignedXfer ( & SrcAddr , & DestAddr , & UnalignedWordCount , XPLMI_LEN_ALIGN_REQ ) ; if ( Status != XST_SUCCESS ) { Status = XPlmi_UpdateStatus ( XPLMI_ERR_UNALIGNED_DMA_XFER , Status ) ; } END : return Status ; }
@brief       This function provides functionality for DMA write.
@brief This function provides functionality for DMA write .