lib/sw_services/xilplmi/src/xplmi_dma.c
int XPlmi_MemSetBytes(const void * DestPtr, u32 DestLen, u8 Val, u32 Len)
{
	int Status = XST_FAILURE;
	u64 DestAddr = (u64)(UINTPTR)DestPtr;
	u8 StartBytes;
	u32 WordVal = ((u32)Val) | ((u32)Val << 8U) |
			((u32)Val << 16U) | ((u32)Val << 24U);

	if (DestPtr == NULL) {
		goto END;
	}
	if (Len > DestLen) {
		goto END;
	}

	StartBytes = (XPLMI_WORD_LEN - (u8)(DestAddr & XPLMI_WORD_LEN_MASK)) &
		XPLMI_WORD_LEN_MASK;
	if (StartBytes > Len) {
			StartBytes = (u8)Len;
			goto END1;
	}
	while (StartBytes > 0U) {
		XPlmi_OutByte64(DestAddr, Val);
		DestAddr++;
		--StartBytes;
	}
	Len = Len - StartBytes;
	StartBytes = (u8)(Len & XPLMI_WORD_LEN_MASK);
	Len = Len - StartBytes;

	Status = XPlmi_MemSet(DestAddr, WordVal, (Len >> XPLMI_WORD_LEN_SHIFT));
	if (Status != XST_SUCCESS) {
		goto END;
	}

	DestAddr += Len;

END1:
	while (StartBytes > 0U) {
		XPlmi_OutByte64(DestAddr, Val);
		DestAddr++;
		--StartBytes;
	}

	Status = XST_SUCCESS;

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function is used to Set the memory with a value. If Len is
 * 			greater than DestLen, then DestPtr is filled with Val till DestLen
 * 			bytes and is considered as a failure.
 *
 * @param	DestPtr is the pointer where the val need to be set
 * @param	DestLen is the memory allotted to destination buffer in bytes
 * @param	Val is the value that has to be set
 * @param	Len is size of memory to be set in bytes
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function is used to Set the memory with a value. If Len is
greater than DestLen, then DestPtr is filled with Val till DestLen
bytes and is considered as a failure.

@param       DestPtr is the pointer where the val need to be set
@param       DestLen is the memory allotted to destination buffer in bytes
@param       Val is the value that has to be set
@param       Len is size of memory to be set in bytes

@return      XST_SUCCESS on success and error code on failure
@brief This function is used to Set the memory with a value . If Len is greater than DestLen then DestPtr is filled with Val till DestLen bytes and is considered as a failure . @param DestPtr is the pointer where the val need to be set @param DestLen is the memory allotted to destination buffer in bytes @param Val is the value that has to be set @param Len is size of memory to be set in bytes @return XST_SUCCESS on success and error code on failure
int XPlmi_MemSetBytes(const void * DestPtr, u32 DestLen, u8 Val, u32 Len)
{
	int Status = XST_FAILURE;
	u64 DestAddr = (u64)(UINTPTR)DestPtr;
	u8 StartBytes;
	u32 WordVal = ((u32)Val) | ((u32)Val << 8U) |
			((u32)Val << 16U) | ((u32)Val << 24U);
	if (DestPtr == NULL) {
		goto END;
	}
	if (Len > DestLen) {
		goto END;
	}
	StartBytes = (XPLMI_WORD_LEN - (u8)(DestAddr & XPLMI_WORD_LEN_MASK)) &
		XPLMI_WORD_LEN_MASK;
	if (StartBytes > Len) {
			StartBytes = (u8)Len;
			goto END1;
	}
	while (StartBytes > 0U) {
		XPlmi_OutByte64(DestAddr, Val);
		DestAddr++;
		--StartBytes;
	}
	Len = Len - StartBytes;
	StartBytes = (u8)(Len & XPLMI_WORD_LEN_MASK);
	Len = Len - StartBytes;
	Status = XPlmi_MemSet(DestAddr, WordVal, (Len >> XPLMI_WORD_LEN_SHIFT));
	if (Status != XST_SUCCESS) {
		goto END;
	}
	DestAddr += Len;
END1:
	while (StartBytes > 0U) {
		XPlmi_OutByte64(DestAddr, Val);
		DestAddr++;
		--StartBytes;
	}
	Status = XST_SUCCESS;
END:
	return Status;
}
int XPlmi_MemSetBytes ( const void * DestPtr , u32 DestLen , u8 Val , u32 Len ) { int Status = XST_FAILURE ; u64 DestAddr = ( u64 ) ( UINTPTR ) DestPtr ; u8 StartBytes ; u32 WordVal = ( ( u32 ) Val ) | ( ( u32 ) Val << 8U ) | ( ( u32 ) Val << 16U ) | ( ( u32 ) Val << 24U ) ; if ( DestPtr == NULL ) { goto END ; } if ( Len > DestLen ) { goto END ; } StartBytes = ( XPLMI_WORD_LEN - ( u8 ) ( DestAddr & XPLMI_WORD_LEN_MASK ) ) & XPLMI_WORD_LEN_MASK ; if ( StartBytes > Len ) { StartBytes = ( u8 ) Len ; goto END1 ; } while ( StartBytes > 0U ) { XPlmi_OutByte64 ( DestAddr , Val ) ; DestAddr ++ ; -- StartBytes ; } Len = Len - StartBytes ; StartBytes = ( u8 ) ( Len & XPLMI_WORD_LEN_MASK ) ; Len = Len - StartBytes ; Status = XPlmi_MemSet ( DestAddr , WordVal , ( Len >> XPLMI_WORD_LEN_SHIFT ) ) ; if ( Status != XST_SUCCESS ) { goto END ; } DestAddr += Len ; END1 : while ( StartBytes > 0U ) { XPlmi_OutByte64 ( DestAddr , Val ) ; DestAddr ++ ; -- StartBytes ; } Status = XST_SUCCESS ; 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 .