lib/sw_services/xilloader/src/xloader.c
int XLoader_LoadImageInfoTbl(u64 DestAddr, u32 MaxSize, u32 *NumEntries)
{
	int Status = XST_FAILURE;
	u32 Len = ImageInfoTbl.Count;
	u32 MaxLen = MaxSize / sizeof(XLoader_ImageInfo);
	u32 Count = 0U;
	u32 Index = 0U;
	u32 SrcAddr = XPLMI_IMAGE_INFO_TBL_BUFFER_ADDR;
	const XLoader_ImageInfo *ImageInfo = (XLoader_ImageInfo *)(UINTPTR)SrcAddr;

	if (Len > MaxLen) {
		Status = (int)XLOADER_ERR_INVALID_DEST_IMGINFOTBL_SIZE;
		goto END;
	}

	while (Count < Len) {
		if (Index >= XLOADER_IMAGE_INFO_TBL_MAX_NUM) {
			break;
		}

		if (ImageInfo->ImgID != XLOADER_INVALID_IMG_ID) {
			Status = XPlmi_DmaXfr((u64)SrcAddr, DestAddr,
					sizeof(XLoader_ImageInfo) >> XPLMI_WORD_LEN_SHIFT,
					XPLMI_PMCDMA_0);
			if (Status != XST_SUCCESS) {
				goto END;
			}
			Count++;
			DestAddr += sizeof(XLoader_ImageInfo);
		}
		Index++;
		SrcAddr += sizeof(XLoader_ImageInfo);
		ImageInfo++;
	}

	if (ImageInfoTbl.IsBufferFull == (u8)TRUE) {
		Status = (int)XLOADER_ERR_IMAGE_INFO_TBL_FULL;
		XPlmi_Printf(DEBUG_INFO, "Image Info Table Overflowed\r\n");
	}
	*NumEntries = Len;

END:
	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function loads the ImageInfo table to the given memory address
 *
 * @param	DestAddr is the 64 bit Destination Address
 * @param	MaxSize is the max size of Buffer present at Destination Address
 * @param	NumEntries that are loaded from the Image Info Table
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function loads the ImageInfo table to the given memory address
@param       DestAddr is the 64 bit Destination Address
@param       MaxSize is the max size of Buffer present at Destination Address
@param       NumEntries that are loaded from the Image Info Table

@return      XST_SUCCESS on success and error code on failure
@brief This function loads the ImageInfo table to the given memory address @param DestAddr is the 64 bit Destination Address @param MaxSize is the max size of Buffer present at Destination Address @param NumEntries that are loaded from the Image Info Table @return XST_SUCCESS on success and error code on failure
int XLoader_LoadImageInfoTbl(u64 DestAddr, u32 MaxSize, u32 *NumEntries)
{
	int Status = XST_FAILURE;
	u32 Len = ImageInfoTbl.Count;
	u32 MaxLen = MaxSize / sizeof(XLoader_ImageInfo);
	u32 Count = 0U;
	u32 Index = 0U;
	u32 SrcAddr = XPLMI_IMAGE_INFO_TBL_BUFFER_ADDR;
	const XLoader_ImageInfo *ImageInfo = (XLoader_ImageInfo *)(UINTPTR)SrcAddr;
	if (Len > MaxLen) {
		Status = (int)XLOADER_ERR_INVALID_DEST_IMGINFOTBL_SIZE;
		goto END;
	}
	while (Count < Len) {
		if (Index >= XLOADER_IMAGE_INFO_TBL_MAX_NUM) {
			break;
		}
		if (ImageInfo->ImgID != XLOADER_INVALID_IMG_ID) {
			Status = XPlmi_DmaXfr((u64)SrcAddr, DestAddr,
					sizeof(XLoader_ImageInfo) >> XPLMI_WORD_LEN_SHIFT,
					XPLMI_PMCDMA_0);
			if (Status != XST_SUCCESS) {
				goto END;
			}
			Count++;
			DestAddr += sizeof(XLoader_ImageInfo);
		}
		Index++;
		SrcAddr += sizeof(XLoader_ImageInfo);
		ImageInfo++;
	}
	if (ImageInfoTbl.IsBufferFull == (u8)TRUE) {
		Status = (int)XLOADER_ERR_IMAGE_INFO_TBL_FULL;
		XPlmi_Printf(DEBUG_INFO, "Image Info Table Overflowed\r\n");
	}
	*NumEntries = Len;
END:
	return Status;
}
int XLoader_LoadImageInfoTbl ( u64 DestAddr , u32 MaxSize , u32 * NumEntries ) { int Status = XST_FAILURE ; u32 Len = ImageInfoTbl . Count ; u32 MaxLen = MaxSize / sizeof ( XLoader_ImageInfo ) ; u32 Count = 0U ; u32 Index = 0U ; u32 SrcAddr = XPLMI_IMAGE_INFO_TBL_BUFFER_ADDR ; const XLoader_ImageInfo * ImageInfo = ( XLoader_ImageInfo * ) ( UINTPTR ) SrcAddr ; if ( Len > MaxLen ) { Status = ( int ) XLOADER_ERR_INVALID_DEST_IMGINFOTBL_SIZE ; goto END ; } while ( Count < Len ) { if ( Index >= XLOADER_IMAGE_INFO_TBL_MAX_NUM ) { break ; } if ( ImageInfo -> ImgID != XLOADER_INVALID_IMG_ID ) { Status = XPlmi_DmaXfr ( ( u64 ) SrcAddr , DestAddr , sizeof ( XLoader_ImageInfo ) >> XPLMI_WORD_LEN_SHIFT , XPLMI_PMCDMA_0 ) ; if ( Status != XST_SUCCESS ) { goto END ; } Count ++ ; DestAddr += sizeof ( XLoader_ImageInfo ) ; } Index ++ ; SrcAddr += sizeof ( XLoader_ImageInfo ) ; ImageInfo ++ ; } if ( ImageInfoTbl . IsBufferFull == ( u8 ) TRUE ) { Status = ( int ) XLOADER_ERR_IMAGE_INFO_TBL_FULL ; XPlmi_Printf ( DEBUG_INFO , " \r \n " ) ; } * NumEntries = Len ; END : return Status ; }
@brief       This function loads the ImageInfo table to the given memory address
 @param       DestAddr is the 64 bit Destination Address
 @param       MaxSize is the max size of Buffer present at Destination Address
 @param       NumEntries that are loaded from the Image Info Table
@brief This function loads the ImageInfo table to the given memory address @param DestAddr is the 64 bit Destination Address @param MaxSize is the max size of Buffer present at Destination Address @param NumEntries that are loaded from the Image Info Table