lib/sw_services/xilloader/src/xloader.c
XLoader_ImageInfo* XLoader_GetImageInfoEntry(u32 ImgID)
{
	XLoader_ImageInfo *ImageEntry = NULL;
	u32 Index;
	u32 EmptyImgIndex = XLOADER_IMG_INDEX_NOT_FOUND;
	u32 TempCount = 0U;
	/* Check for a existing valid image entry matching given ImgID */
	for (Index = 0U; Index < XLOADER_IMAGE_INFO_TBL_MAX_NUM; Index++) {
		if (TempCount < ImageInfoTbl.Count) {
			TempCount++;
			if ((ImageInfoTbl.TblPtr[Index].ImgID == ImgID) &&
				(ImageInfoTbl.TblPtr[Index].ImgID !=
				XLOADER_INVALID_IMG_ID)) {
				ImageEntry = &ImageInfoTbl.TblPtr[Index];
				goto END;
			}
			else if ((ImageInfoTbl.TblPtr[Index].ImgID ==
				XLOADER_INVALID_IMG_ID) && (EmptyImgIndex ==
				XLOADER_IMG_INDEX_NOT_FOUND)) {
				EmptyImgIndex = Index;
			}
			else {
				/* For MISRA-C */
			}
		}
	}

	/* If no valid image entry is found above, return empty entry */
	if ((Index == XLOADER_IMAGE_INFO_TBL_MAX_NUM) && (ImageInfoTbl.Count <
		XLOADER_IMAGE_INFO_TBL_MAX_NUM)) {
		if (EmptyImgIndex == XLOADER_IMG_INDEX_NOT_FOUND) {
			EmptyImgIndex = ImageInfoTbl.Count;
		}
		ImageEntry = &ImageInfoTbl.TblPtr[EmptyImgIndex];
		ImageEntry->ImgID = XLOADER_INVALID_IMG_ID;
	}

END:
	return ImageEntry;
}
/*****************************************************************************/
/**
 * @brief	This function returns the ImageInfoEntry by checking if an entry
 * exists for that particular ImgId in the ImgInfoTbl
 *
 * @param	ImgID of the the entry that has to be stored
 *
 * @return	Address of ImageInfo Entry in the table
 *
 *****************************************************************************/
@brief       This function returns the ImageInfoEntry by checking if an entry
exists for that particular ImgId in the ImgInfoTbl

@param       ImgID of the the entry that has to be stored

@return      Address of ImageInfo Entry in the table
@brief This function returns the ImageInfoEntry by checking if an entry exists for that particular ImgId in the ImgInfoTbl @param ImgID of the the entry that has to be stored @return Address of ImageInfo Entry in the table
XLoader_ImageInfo* XLoader_GetImageInfoEntry(u32 ImgID)
{
	XLoader_ImageInfo *ImageEntry = NULL;
	u32 Index;
	u32 EmptyImgIndex = XLOADER_IMG_INDEX_NOT_FOUND;
	u32 TempCount = 0U;
	for (Index = 0U; Index < XLOADER_IMAGE_INFO_TBL_MAX_NUM; Index++) {
		if (TempCount < ImageInfoTbl.Count) {
			TempCount++;
			if ((ImageInfoTbl.TblPtr[Index].ImgID == ImgID) &&
				(ImageInfoTbl.TblPtr[Index].ImgID !=
				XLOADER_INVALID_IMG_ID)) {
				ImageEntry = &ImageInfoTbl.TblPtr[Index];
				goto END;
			}
			else if ((ImageInfoTbl.TblPtr[Index].ImgID ==
				XLOADER_INVALID_IMG_ID) && (EmptyImgIndex ==
				XLOADER_IMG_INDEX_NOT_FOUND)) {
				EmptyImgIndex = Index;
			}
			else {
			}
		}
	}
	if ((Index == XLOADER_IMAGE_INFO_TBL_MAX_NUM) && (ImageInfoTbl.Count <
		XLOADER_IMAGE_INFO_TBL_MAX_NUM)) {
		if (EmptyImgIndex == XLOADER_IMG_INDEX_NOT_FOUND) {
			EmptyImgIndex = ImageInfoTbl.Count;
		}
		ImageEntry = &ImageInfoTbl.TblPtr[EmptyImgIndex];
		ImageEntry->ImgID = XLOADER_INVALID_IMG_ID;
	}
END:
	return ImageEntry;
}
XLoader_ImageInfo * XLoader_GetImageInfoEntry ( u32 ImgID ) { XLoader_ImageInfo * ImageEntry = NULL ; u32 Index ; u32 EmptyImgIndex = XLOADER_IMG_INDEX_NOT_FOUND ; u32 TempCount = 0U ; for ( Index = 0U ; Index < XLOADER_IMAGE_INFO_TBL_MAX_NUM ; Index ++ ) { if ( TempCount < ImageInfoTbl . Count ) { TempCount ++ ; if ( ( ImageInfoTbl . TblPtr [ Index ] . ImgID == ImgID ) && ( ImageInfoTbl . TblPtr [ Index ] . ImgID != XLOADER_INVALID_IMG_ID ) ) { ImageEntry = & ImageInfoTbl . TblPtr [ Index ] ; goto END ; } else if ( ( ImageInfoTbl . TblPtr [ Index ] . ImgID == XLOADER_INVALID_IMG_ID ) && ( EmptyImgIndex == XLOADER_IMG_INDEX_NOT_FOUND ) ) { EmptyImgIndex = Index ; } else { } } } if ( ( Index == XLOADER_IMAGE_INFO_TBL_MAX_NUM ) && ( ImageInfoTbl . Count < XLOADER_IMAGE_INFO_TBL_MAX_NUM ) ) { if ( EmptyImgIndex == XLOADER_IMG_INDEX_NOT_FOUND ) { EmptyImgIndex = ImageInfoTbl . Count ; } ImageEntry = & ImageInfoTbl . TblPtr [ EmptyImgIndex ] ; ImageEntry -> ImgID = XLOADER_INVALID_IMG_ID ; } END : return ImageEntry ; }
@brief       This function returns the ImageInfoEntry by checking if an entry
 exists for that particular ImgId in the ImgInfoTbl
@brief This function returns the ImageInfoEntry by checking if an entry exists for that particular ImgId in the ImgInfoTbl
/* Check for a existing valid image entry matching given ImgID */ /* For MISRA-C */ /* If no valid image entry is found above, return empty entry */