XilinxProcessorIPLib/drivers/aienginev2/src/io_backend/ext/xaie_baremetal.c
static XAie_MemInst* XAie_BaremetalMemAllocate(XAie_DevInst *DevInst, u64 Size,
		XAie_MemCacheProp Cache)
{
	XAie_MemInst *MemInst;

	(void)Cache;
	MemInst = (XAie_MemInst *)malloc(sizeof(*MemInst));
	if(MemInst == NULL) {
		XAIE_ERROR("memory allocation failed\n");
		return NULL;
	}

	MemInst->VAddr = (void *)malloc(Size);
	if(MemInst->VAddr == NULL) {
		XAIE_ERROR("malloc failed\n");
		free(MemInst);
		return NULL;
	}
	MemInst->DevAddr = (u64)MemInst->VAddr;
	MemInst->Size = Size;
	MemInst->DevInst = DevInst;
	/*
	 * TODO: Cache is not handled at the moment for baremetal. The allocated
	 * memory is always cached.
	 */

	return MemInst;
}
/*****************************************************************************/
/**
*
* This is the memory function to allocate a memory
*
* @param	DevInst: Device Instance
* @param	Size: Size of the memory
* @param	Cache: Value from XAie_MemCacheProp enum
*
* @return	Pointer to the allocated memory instance.
*
* @note		Internal only.
*
*******************************************************************************/
This is the memory function to allocate a memory
This is the memory function to allocate a memory
static XAie_MemInst* XAie_BaremetalMemAllocate(XAie_DevInst *DevInst, u64 Size,
		XAie_MemCacheProp Cache)
{
	XAie_MemInst *MemInst;
	(void)Cache;
	MemInst = (XAie_MemInst *)malloc(sizeof(*MemInst));
	if(MemInst == NULL) {
		XAIE_ERROR("memory allocation failed\n");
		return NULL;
	}
	MemInst->VAddr = (void *)malloc(Size);
	if(MemInst->VAddr == NULL) {
		XAIE_ERROR("malloc failed\n");
		free(MemInst);
		return NULL;
	}
	MemInst->DevAddr = (u64)MemInst->VAddr;
	MemInst->Size = Size;
	MemInst->DevInst = DevInst;
	return MemInst;
}
static XAie_MemInst * XAie_BaremetalMemAllocate ( XAie_DevInst * DevInst , u64 Size , XAie_MemCacheProp Cache ) { XAie_MemInst * MemInst ; ( void ) Cache ; MemInst = ( XAie_MemInst * ) malloc ( sizeof ( * MemInst ) ) ; if ( MemInst == NULL ) { XAIE_ERROR ( " \n " ) ; return NULL ; } MemInst -> VAddr = ( void * ) malloc ( Size ) ; if ( MemInst -> VAddr == NULL ) { XAIE_ERROR ( " \n " ) ; free ( MemInst ) ; return NULL ; } MemInst -> DevAddr = ( u64 ) MemInst -> VAddr ; MemInst -> Size = Size ; MemInst -> DevInst = DevInst ; return MemInst ; }
This is the memory function to allocate a memory
This is the memory function to allocate a memory
/*
	 * TODO: Cache is not handled at the moment for baremetal. The allocated
	 * memory is always cached.
	 */