XilinxProcessorIPLib/drivers/aiengine/src/tile/xaietile_perfcnt.c
static u8 _XAieTile_PerfCounterControl(XAieGbl_Tile *TileInstPtr, u8 ModId,
		u8 Counter, u16 StartEvent, u16 StopEvent, u16 ResetEvent)
{
	u64 RegAddr;
	u32 FldVal = 0;
	u32 FldMask = 0;
	u64 Addr = TileInstPtr->TileAddr;

	if (StartEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		FldMask |= PerfCtrl[ModId].Start[Counter].Mask;
		FldVal |= XAie_SetField(StartEvent,
				PerfCtrl[ModId].Start[Counter].Lsb,
				PerfCtrl[ModId].Start[Counter].Mask);
	}

	if (StopEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		FldMask |= PerfCtrl[ModId].Stop[Counter].Mask;
		FldVal |= XAie_SetField(StopEvent,
				PerfCtrl[ModId].Stop[Counter].Lsb,
				PerfCtrl[ModId].Stop[Counter].Mask);

	}

	if (StartEvent != XAIETILE_PERFCNT_EVENT_INVALID ||
			StopEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		RegAddr = Addr + PerfCtrl[ModId].RegOff[Counter];
		XAieGbl_MaskWrite32(RegAddr, FldMask, FldVal);
	}

	if (ResetEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		RegAddr = Addr + PerfCtrlReset[ModId].RegOff[Counter];

		FldMask = PerfCtrlReset[ModId].Reset[Counter].Mask;
		FldVal = XAie_SetField(ResetEvent,
				PerfCtrlReset[ModId].Reset[Counter].Lsb,
				PerfCtrlReset[ModId].Reset[Counter].Mask);

		XAieGbl_MaskWrite32(RegAddr, FldMask, FldVal);
	}

	return XAIE_SUCCESS;
}
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This is an internal API to set the performance counter control.
*
* @param	TileInstPtr - Pointer to the Tile instance.
* @param	ModId - Module ID. Should be one of
* XAIETILE_PERFCNT_MODULE_CORE, XAIETILE_PERFCNT_MODULE_PL, or
* XAIETILE_PERFCNT_MODULE_MEM.
* @param	Counter - Counter ID. The max value differs upon @ModID
* @param	StartEvent - Event ID to start
* @param	StopEvent - Event ID to stop
* @param	ResetEvent - Event ID to reset
*
* @return	XAIE_SUCCESS on success
*
* @note		Used only within this file.
*
*******************************************************************************/
Function Definitions
This is an internal API to set the performance counter control.
Function Definitions This is an internal API to set the performance counter control .
static u8 _XAieTile_PerfCounterControl(XAieGbl_Tile *TileInstPtr, u8 ModId,
		u8 Counter, u16 StartEvent, u16 StopEvent, u16 ResetEvent)
{
	u64 RegAddr;
	u32 FldVal = 0;
	u32 FldMask = 0;
	u64 Addr = TileInstPtr->TileAddr;
	if (StartEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		FldMask |= PerfCtrl[ModId].Start[Counter].Mask;
		FldVal |= XAie_SetField(StartEvent,
				PerfCtrl[ModId].Start[Counter].Lsb,
				PerfCtrl[ModId].Start[Counter].Mask);
	}
	if (StopEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		FldMask |= PerfCtrl[ModId].Stop[Counter].Mask;
		FldVal |= XAie_SetField(StopEvent,
				PerfCtrl[ModId].Stop[Counter].Lsb,
				PerfCtrl[ModId].Stop[Counter].Mask);
	}
	if (StartEvent != XAIETILE_PERFCNT_EVENT_INVALID ||
			StopEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		RegAddr = Addr + PerfCtrl[ModId].RegOff[Counter];
		XAieGbl_MaskWrite32(RegAddr, FldMask, FldVal);
	}
	if (ResetEvent != XAIETILE_PERFCNT_EVENT_INVALID) {
		RegAddr = Addr + PerfCtrlReset[ModId].RegOff[Counter];
		FldMask = PerfCtrlReset[ModId].Reset[Counter].Mask;
		FldVal = XAie_SetField(ResetEvent,
				PerfCtrlReset[ModId].Reset[Counter].Lsb,
				PerfCtrlReset[ModId].Reset[Counter].Mask);
		XAieGbl_MaskWrite32(RegAddr, FldMask, FldVal);
	}
	return XAIE_SUCCESS;
}
static u8 _XAieTile_PerfCounterControl ( XAieGbl_Tile * TileInstPtr , u8 ModId , u8 Counter , u16 StartEvent , u16 StopEvent , u16 ResetEvent ) { u64 RegAddr ; u32 FldVal = 0 ; u32 FldMask = 0 ; u64 Addr = TileInstPtr -> TileAddr ; if ( StartEvent != XAIETILE_PERFCNT_EVENT_INVALID ) { FldMask |= PerfCtrl [ ModId ] . Start [ Counter ] . Mask ; FldVal |= XAie_SetField ( StartEvent , PerfCtrl [ ModId ] . Start [ Counter ] . Lsb , PerfCtrl [ ModId ] . Start [ Counter ] . Mask ) ; } if ( StopEvent != XAIETILE_PERFCNT_EVENT_INVALID ) { FldMask |= PerfCtrl [ ModId ] . Stop [ Counter ] . Mask ; FldVal |= XAie_SetField ( StopEvent , PerfCtrl [ ModId ] . Stop [ Counter ] . Lsb , PerfCtrl [ ModId ] . Stop [ Counter ] . Mask ) ; } if ( StartEvent != XAIETILE_PERFCNT_EVENT_INVALID || StopEvent != XAIETILE_PERFCNT_EVENT_INVALID ) { RegAddr = Addr + PerfCtrl [ ModId ] . RegOff [ Counter ] ; XAieGbl_MaskWrite32 ( RegAddr , FldMask , FldVal ) ; } if ( ResetEvent != XAIETILE_PERFCNT_EVENT_INVALID ) { RegAddr = Addr + PerfCtrlReset [ ModId ] . RegOff [ Counter ] ; FldMask = PerfCtrlReset [ ModId ] . Reset [ Counter ] . Mask ; FldVal = XAie_SetField ( ResetEvent , PerfCtrlReset [ ModId ] . Reset [ Counter ] . Lsb , PerfCtrlReset [ ModId ] . Reset [ Counter ] . Mask ) ; XAieGbl_MaskWrite32 ( RegAddr , FldMask , FldVal ) ; } return XAIE_SUCCESS ; }
Function Definitions
This is an internal API to set the performance counter control.
Function Definitions This is an internal API to set the performance counter control .