lib/sw_services/xilplmi/src/xplmi_dma.c
int XPlmi_MemSet(u64 DestAddr, u32 Val, u32 Len)
{
	int Status = XST_FAILURE;
	u32 Count;
	u32 Index;
	u64 SrcAddr = DestAddr;
	u32 ChunkSize;

	if (Val == XPLMI_DATA_INIT_PZM)	{
		Status = XPlmi_EccInit(DestAddr, Len * XPLMI_WORD_LEN);
	}
	else {
		if (Len < XPLMI_SET_CHUNK_SIZE) {
			ChunkSize = Len;
		} else {
			ChunkSize = XPLMI_SET_CHUNK_SIZE;
		}

		for (Index = 0U; Index < ChunkSize; ++Index) {
			XPlmi_Out64(DestAddr, Val);
			DestAddr += XPLMI_WORD_LEN;
		}

		Count = Len / XPLMI_SET_CHUNK_SIZE ;

		/* DMA in chunks of 512 Bytes */
		for (Index = 1U; Index < Count; ++Index) {
			Status = XPlmi_DmaXfr(SrcAddr, DestAddr,
					XPLMI_SET_CHUNK_SIZE, XPLMI_PMCDMA_0);
			if (Status != XST_SUCCESS) {
				goto END;
			}
			DestAddr += (XPLMI_SET_CHUNK_SIZE * XPLMI_WORD_LEN);
		}

		/* DMA of residual bytes */
		Status = XPlmi_DmaXfr(SrcAddr, DestAddr, (Len % ChunkSize),
			XPLMI_PMCDMA_0);
	}

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used to Set the memory with a value.
 *
 * @param	DestAddr is the address where the val need to be set
 * @param	Val is the value that has to be set
 * @param	Len is size of memory to be set in words
 *
 * @return	Status of the DMA transfer
 *
 *****************************************************************************/
@brief       This function is used to Set the memory with a value.
@param       DestAddr is the address where the val need to be set
@param       Val is the value that has to be set
@param       Len is size of memory to be set in words

@return      Status of the DMA transfer
@brief This function is used to Set the memory with a value . @param DestAddr is the address where the val need to be set @param Val is the value that has to be set @param Len is size of memory to be set in words @return Status of the DMA transfer
int XPlmi_MemSet(u64 DestAddr, u32 Val, u32 Len)
{
	int Status = XST_FAILURE;
	u32 Count;
	u32 Index;
	u64 SrcAddr = DestAddr;
	u32 ChunkSize;
	if (Val == XPLMI_DATA_INIT_PZM)	{
		Status = XPlmi_EccInit(DestAddr, Len * XPLMI_WORD_LEN);
	}
	else {
		if (Len < XPLMI_SET_CHUNK_SIZE) {
			ChunkSize = Len;
		} else {
			ChunkSize = XPLMI_SET_CHUNK_SIZE;
		}
		for (Index = 0U; Index < ChunkSize; ++Index) {
			XPlmi_Out64(DestAddr, Val);
			DestAddr += XPLMI_WORD_LEN;
		}
		Count = Len / XPLMI_SET_CHUNK_SIZE ;
		for (Index = 1U; Index < Count; ++Index) {
			Status = XPlmi_DmaXfr(SrcAddr, DestAddr,
					XPLMI_SET_CHUNK_SIZE, XPLMI_PMCDMA_0);
			if (Status != XST_SUCCESS) {
				goto END;
			}
			DestAddr += (XPLMI_SET_CHUNK_SIZE * XPLMI_WORD_LEN);
		}
		Status = XPlmi_DmaXfr(SrcAddr, DestAddr, (Len % ChunkSize),
			XPLMI_PMCDMA_0);
	}
END:
	return Status;
}
int XPlmi_MemSet ( u64 DestAddr , u32 Val , u32 Len ) { int Status = XST_FAILURE ; u32 Count ; u32 Index ; u64 SrcAddr = DestAddr ; u32 ChunkSize ; if ( Val == XPLMI_DATA_INIT_PZM ) { Status = XPlmi_EccInit ( DestAddr , Len * XPLMI_WORD_LEN ) ; } else { if ( Len < XPLMI_SET_CHUNK_SIZE ) { ChunkSize = Len ; } else { ChunkSize = XPLMI_SET_CHUNK_SIZE ; } for ( Index = 0U ; Index < ChunkSize ; ++ Index ) { XPlmi_Out64 ( DestAddr , Val ) ; DestAddr += XPLMI_WORD_LEN ; } Count = Len / XPLMI_SET_CHUNK_SIZE ; for ( Index = 1U ; Index < Count ; ++ Index ) { Status = XPlmi_DmaXfr ( SrcAddr , DestAddr , XPLMI_SET_CHUNK_SIZE , XPLMI_PMCDMA_0 ) ; if ( Status != XST_SUCCESS ) { goto END ; } DestAddr += ( XPLMI_SET_CHUNK_SIZE * XPLMI_WORD_LEN ) ; } Status = XPlmi_DmaXfr ( SrcAddr , DestAddr , ( Len % ChunkSize ) , XPLMI_PMCDMA_0 ) ; } END : return Status ; }
@brief       This function is used to Set the memory with a value.
@brief This function is used to Set the memory with a value .
/* DMA in chunks of 512 Bytes */ /* DMA of residual bytes */