XilinxProcessorIPLib/drivers/aienginev2/src/interrupt/xaie_interrupt.c
AieRC XAie_IntrCtrlL1Event(XAie_DevInst *DevInst, XAie_LocType Loc,
		XAie_BroadcastSw Switch, u8 IrqEventId, XAie_Events Event)
{
	u64 RegAddr;
	u32 RegOffset, EventMask, FldVal;
	u8 TileType, EventLsb, MappedEvent;
	const XAie_L1IntrMod *L1IntrMod;
	const XAie_EvntMod *EvntMod;

	if((DevInst == XAIE_NULL) ||
			(DevInst->IsReady != XAIE_COMPONENT_IS_READY)) {
		XAIE_ERROR("Invalid device instance\n");
		return XAIE_INVALID_ARGS;
	}

	TileType = DevInst->DevOps->GetTTypefromLoc(DevInst, Loc);
	if(TileType == XAIEGBL_TILE_TYPE_MAX) {
		XAIE_ERROR("Invalid tile type\n");
		return XAIE_INVALID_TILE;
	}

	L1IntrMod = DevInst->DevProp.DevMod[TileType].L1IntrMod;
	EvntMod = &DevInst->DevProp.DevMod[TileType].EvntMod[0U];

	if(L1IntrMod == NULL || IrqEventId >= L1IntrMod->NumIrqEvents) {
		XAIE_ERROR("Invalid module type or IRQ event ID\n");
		return XAIE_INVALID_ARGS;
	}

	if(Event < EvntMod->EventMin || Event > EvntMod->EventMax) {
		XAIE_ERROR("Invalid event ID\n");
		return XAIE_INVALID_ARGS;
	}

	Event -= EvntMod->EventMin;
	MappedEvent = EvntMod->XAie_EventNumber[Event];
	if(MappedEvent == XAIE_EVENT_INVALID) {
		XAIE_ERROR("Invalid event ID\n");
		return XAIE_INVALID_ARGS;
	}

	RegOffset = L1IntrMod->BaseIrqEventRegOff + Switch * L1IntrMod->SwOff;
	EventLsb = IrqEventId * L1IntrMod->IrqEventOff;
	EventMask = L1IntrMod->BaseIrqEventMask << EventLsb;
	FldVal = XAie_SetField(MappedEvent, EventLsb, EventMask);
	RegAddr = _XAie_GetTileAddr(DevInst, Loc.Row, Loc.Col) + RegOffset;

	return XAie_MaskWrite32(DevInst, RegAddr, EventMask, FldVal);
}
/*****************************************************************************/
/**
*
* This API maps an event which interrupts the first level interrupt controller
* at the given IRQ event index.
*
* @param	DevInst: Device Instance
* @param	Loc: Location of AIE Tile
* @param	Switch: Switch in the given module. For shim tile value could be
*			XAIE_EVENT_SWITCH_A or XAIE_EVENT_SWITCH_B.
* @param	IrqEventId: IRQ event index. Value 0 causes IRQ16,
*			    value 1 Causes IRQ17, and so on.
* @param	Event: Event ID to interrupt first level interrupt controller.
*
* @return	XAIE_OK on success, error code on failure.
*
* @note		None.
*
******************************************************************************/
This API maps an event which interrupts the first level interrupt controller
at the given IRQ event index.
This API maps an event which interrupts the first level interrupt controller at the given IRQ event index .
AieRC XAie_IntrCtrlL1Event(XAie_DevInst *DevInst, XAie_LocType Loc,
		XAie_BroadcastSw Switch, u8 IrqEventId, XAie_Events Event)
{
	u64 RegAddr;
	u32 RegOffset, EventMask, FldVal;
	u8 TileType, EventLsb, MappedEvent;
	const XAie_L1IntrMod *L1IntrMod;
	const XAie_EvntMod *EvntMod;
	if((DevInst == XAIE_NULL) ||
			(DevInst->IsReady != XAIE_COMPONENT_IS_READY)) {
		XAIE_ERROR("Invalid device instance\n");
		return XAIE_INVALID_ARGS;
	}
	TileType = DevInst->DevOps->GetTTypefromLoc(DevInst, Loc);
	if(TileType == XAIEGBL_TILE_TYPE_MAX) {
		XAIE_ERROR("Invalid tile type\n");
		return XAIE_INVALID_TILE;
	}
	L1IntrMod = DevInst->DevProp.DevMod[TileType].L1IntrMod;
	EvntMod = &DevInst->DevProp.DevMod[TileType].EvntMod[0U];
	if(L1IntrMod == NULL || IrqEventId >= L1IntrMod->NumIrqEvents) {
		XAIE_ERROR("Invalid module type or IRQ event ID\n");
		return XAIE_INVALID_ARGS;
	}
	if(Event < EvntMod->EventMin || Event > EvntMod->EventMax) {
		XAIE_ERROR("Invalid event ID\n");
		return XAIE_INVALID_ARGS;
	}
	Event -= EvntMod->EventMin;
	MappedEvent = EvntMod->XAie_EventNumber[Event];
	if(MappedEvent == XAIE_EVENT_INVALID) {
		XAIE_ERROR("Invalid event ID\n");
		return XAIE_INVALID_ARGS;
	}
	RegOffset = L1IntrMod->BaseIrqEventRegOff + Switch * L1IntrMod->SwOff;
	EventLsb = IrqEventId * L1IntrMod->IrqEventOff;
	EventMask = L1IntrMod->BaseIrqEventMask << EventLsb;
	FldVal = XAie_SetField(MappedEvent, EventLsb, EventMask);
	RegAddr = _XAie_GetTileAddr(DevInst, Loc.Row, Loc.Col) + RegOffset;
	return XAie_MaskWrite32(DevInst, RegAddr, EventMask, FldVal);
}
AieRC XAie_IntrCtrlL1Event ( XAie_DevInst * DevInst , XAie_LocType Loc , XAie_BroadcastSw Switch , u8 IrqEventId , XAie_Events Event ) { u64 RegAddr ; u32 RegOffset , EventMask , FldVal ; u8 TileType , EventLsb , MappedEvent ; const XAie_L1IntrMod * L1IntrMod ; const XAie_EvntMod * EvntMod ; if ( ( DevInst == XAIE_NULL ) || ( DevInst -> IsReady != XAIE_COMPONENT_IS_READY ) ) { XAIE_ERROR ( " \n " ) ; return XAIE_INVALID_ARGS ; } TileType = DevInst -> DevOps -> GetTTypefromLoc ( DevInst , Loc ) ; if ( TileType == XAIEGBL_TILE_TYPE_MAX ) { XAIE_ERROR ( " \n " ) ; return XAIE_INVALID_TILE ; } L1IntrMod = DevInst -> DevProp . DevMod [ TileType ] . L1IntrMod ; EvntMod = & DevInst -> DevProp . DevMod [ TileType ] . EvntMod [ 0U ] ; if ( L1IntrMod == NULL || IrqEventId >= L1IntrMod -> NumIrqEvents ) { XAIE_ERROR ( " \n " ) ; return XAIE_INVALID_ARGS ; } if ( Event < EvntMod -> EventMin || Event > EvntMod -> EventMax ) { XAIE_ERROR ( " \n " ) ; return XAIE_INVALID_ARGS ; } Event -= EvntMod -> EventMin ; MappedEvent = EvntMod -> XAie_EventNumber [ Event ] ; if ( MappedEvent == XAIE_EVENT_INVALID ) { XAIE_ERROR ( " \n " ) ; return XAIE_INVALID_ARGS ; } RegOffset = L1IntrMod -> BaseIrqEventRegOff + Switch * L1IntrMod -> SwOff ; EventLsb = IrqEventId * L1IntrMod -> IrqEventOff ; EventMask = L1IntrMod -> BaseIrqEventMask << EventLsb ; FldVal = XAie_SetField ( MappedEvent , EventLsb , EventMask ) ; RegAddr = _XAie_GetTileAddr ( DevInst , Loc . Row , Loc . Col ) + RegOffset ; return XAie_MaskWrite32 ( DevInst , RegAddr , EventMask , FldVal ) ; }
This API maps an event which interrupts the first level interrupt controller
at the given IRQ event index.
This API maps an event which interrupts the first level interrupt controller at the given IRQ event index .