XilinxProcessorIPLib/drivers/aienginev2/src/io_backend/ext/xaie_baremetal.c
static AieRC XAie_BaremetalIO_RunOp(void *IOInst, XAie_DevInst *DevInst,
		XAie_BackendOpCode Op, void *Arg)
{
	(void)DevInst;
	switch(Op) {
		case XAIE_BACKEND_OP_NPIWR32:
		{
			XAie_BackendNpiWrReq *Req = Arg;

			_XAie_BaremetalIO_NpiWrite32(IOInst, Req->NpiRegOff,
					Req->Val);
			break;
		}
		case XAIE_BACKEND_OP_NPIMASKPOLL32:
		{
			XAie_BackendNpiMaskPollReq *Req = Arg;

			return _XAie_BaremetalIO_NpiMaskPoll(IOInst,
					Req->NpiRegOff, Req->Mask, Req->Val,
					Req->TimeOutUs);
		}
		case XAIE_BACKEND_OP_CONFIG_SHIMDMABD:
		{
			XAie_ShimDmaBdArgs *BdArgs =
				(XAie_ShimDmaBdArgs *)Arg;
			for(u8 i = 0; i < BdArgs->NumBdWords; i++) {
				XAie_BaremetalIO_Write32(IOInst,
						BdArgs->Addr + i * 4,
						BdArgs->BdWords[i]);
			}
			break;
		}
		case XAIE_BACKEND_OP_REQUEST_TILES:
			return _XAie_PrivilegeRequestTiles(DevInst,
					(XAie_BackendTilesArray *)Arg);
		case XAIE_BACKEND_OP_REQUEST_RESOURCE:
			return _XAie_RequestRscCommon(DevInst, Arg);
		case XAIE_BACKEND_OP_RELEASE_RESOURCE:
			return _XAie_ReleaseRscCommon(Arg);
		case XAIE_BACKEND_OP_FREE_RESOURCE:
			return _XAie_FreeRscCommon(Arg);
		case XAIE_BACKEND_OP_REQUEST_ALLOCATED_RESOURCE:
			return _XAie_RequestAllocatedRscCommon(DevInst, Arg);
		case XAIE_BACKEND_OP_PARTITION_INITIALIZE:
			return _XAie_PrivilegeInitPart(DevInst,
					(XAie_PartInitOpts *)Arg);
		case XAIE_BACKEND_OP_PARTITION_TEARDOWN:
			return _XAie_PrivilegeTeardownPart(DevInst);
		case XAIE_BACKEND_OP_GET_RSC_STAT:
			return _XAie_GetRscStatCommon(DevInst, Arg);
		default:
			XAIE_ERROR("Linux backend does not support operation "
					"%d\n", Op);
			return XAIE_FEATURE_NOT_SUPPORTED;
	}

	return XAIE_OK;
}
/*****************************************************************************/
/**
*
* This is the function to run backend operations
*
* @param	IOInst: IO instance pointer
* @param	DevInst: AI engine partition device instance
* @param	Op: Backend operation code
* @param	Arg: Backend operation argument
*
* @return	XAIE_OK for success and error code for failure.
*
* @note		Internal only.
*
*******************************************************************************/
This is the function to run backend operations
This is the function to run backend operations
static AieRC XAie_BaremetalIO_RunOp(void *IOInst, XAie_DevInst *DevInst,
		XAie_BackendOpCode Op, void *Arg)
{
	(void)DevInst;
	switch(Op) {
		case XAIE_BACKEND_OP_NPIWR32:
		{
			XAie_BackendNpiWrReq *Req = Arg;
			_XAie_BaremetalIO_NpiWrite32(IOInst, Req->NpiRegOff,
					Req->Val);
			break;
		}
		case XAIE_BACKEND_OP_NPIMASKPOLL32:
		{
			XAie_BackendNpiMaskPollReq *Req = Arg;
			return _XAie_BaremetalIO_NpiMaskPoll(IOInst,
					Req->NpiRegOff, Req->Mask, Req->Val,
					Req->TimeOutUs);
		}
		case XAIE_BACKEND_OP_CONFIG_SHIMDMABD:
		{
			XAie_ShimDmaBdArgs *BdArgs =
				(XAie_ShimDmaBdArgs *)Arg;
			for(u8 i = 0; i < BdArgs->NumBdWords; i++) {
				XAie_BaremetalIO_Write32(IOInst,
						BdArgs->Addr + i * 4,
						BdArgs->BdWords[i]);
			}
			break;
		}
		case XAIE_BACKEND_OP_REQUEST_TILES:
			return _XAie_PrivilegeRequestTiles(DevInst,
					(XAie_BackendTilesArray *)Arg);
		case XAIE_BACKEND_OP_REQUEST_RESOURCE:
			return _XAie_RequestRscCommon(DevInst, Arg);
		case XAIE_BACKEND_OP_RELEASE_RESOURCE:
			return _XAie_ReleaseRscCommon(Arg);
		case XAIE_BACKEND_OP_FREE_RESOURCE:
			return _XAie_FreeRscCommon(Arg);
		case XAIE_BACKEND_OP_REQUEST_ALLOCATED_RESOURCE:
			return _XAie_RequestAllocatedRscCommon(DevInst, Arg);
		case XAIE_BACKEND_OP_PARTITION_INITIALIZE:
			return _XAie_PrivilegeInitPart(DevInst,
					(XAie_PartInitOpts *)Arg);
		case XAIE_BACKEND_OP_PARTITION_TEARDOWN:
			return _XAie_PrivilegeTeardownPart(DevInst);
		case XAIE_BACKEND_OP_GET_RSC_STAT:
			return _XAie_GetRscStatCommon(DevInst, Arg);
		default:
			XAIE_ERROR("Linux backend does not support operation "
					"%d\n", Op);
			return XAIE_FEATURE_NOT_SUPPORTED;
	}
	return XAIE_OK;
}
static AieRC XAie_BaremetalIO_RunOp ( void * IOInst , XAie_DevInst * DevInst , XAie_BackendOpCode Op , void * Arg ) { ( void ) DevInst ; switch ( Op ) { case XAIE_BACKEND_OP_NPIWR32 : { XAie_BackendNpiWrReq * Req = Arg ; _XAie_BaremetalIO_NpiWrite32 ( IOInst , Req -> NpiRegOff , Req -> Val ) ; break ; } case XAIE_BACKEND_OP_NPIMASKPOLL32 : { XAie_BackendNpiMaskPollReq * Req = Arg ; return _XAie_BaremetalIO_NpiMaskPoll ( IOInst , Req -> NpiRegOff , Req -> Mask , Req -> Val , Req -> TimeOutUs ) ; } case XAIE_BACKEND_OP_CONFIG_SHIMDMABD : { XAie_ShimDmaBdArgs * BdArgs = ( XAie_ShimDmaBdArgs * ) Arg ; for ( u8 i = 0 ; i < BdArgs -> NumBdWords ; i ++ ) { XAie_BaremetalIO_Write32 ( IOInst , BdArgs -> Addr + i * 4 , BdArgs -> BdWords [ i ] ) ; } break ; } case XAIE_BACKEND_OP_REQUEST_TILES : return _XAie_PrivilegeRequestTiles ( DevInst , ( XAie_BackendTilesArray * ) Arg ) ; case XAIE_BACKEND_OP_REQUEST_RESOURCE : return _XAie_RequestRscCommon ( DevInst , Arg ) ; case XAIE_BACKEND_OP_RELEASE_RESOURCE : return _XAie_ReleaseRscCommon ( Arg ) ; case XAIE_BACKEND_OP_FREE_RESOURCE : return _XAie_FreeRscCommon ( Arg ) ; case XAIE_BACKEND_OP_REQUEST_ALLOCATED_RESOURCE : return _XAie_RequestAllocatedRscCommon ( DevInst , Arg ) ; case XAIE_BACKEND_OP_PARTITION_INITIALIZE : return _XAie_PrivilegeInitPart ( DevInst , ( XAie_PartInitOpts * ) Arg ) ; case XAIE_BACKEND_OP_PARTITION_TEARDOWN : return _XAie_PrivilegeTeardownPart ( DevInst ) ; case XAIE_BACKEND_OP_GET_RSC_STAT : return _XAie_GetRscStatCommon ( DevInst , Arg ) ; default : XAIE_ERROR ( " " " \n " , Op ) ; return XAIE_FEATURE_NOT_SUPPORTED ; } return XAIE_OK ; }
This is the function to run backend operations
This is the function to run backend operations