XilinxProcessorIPLib/drivers/aiengine/src/tile/xaietile_error.c
void XAieTile_ErrorsSetupDefaultHandler(XAieGbl *AieInst)
{
	u8 Err;

	XAie_AssertVoid(AieInst != XAIE_NULL);
	XAie_AssertVoid(AieInst->Config != XAIE_NULL);
	XAie_AssertVoid(AieInst->Tiles != XAIE_NULL);
	XAie_AssertVoid(AieInst->IsReady == XAIE_COMPONENT_IS_READY);

	memset(AieInst->CoreErrHandlers, 0, sizeof(AieInst->CoreErrHandlers));
	memset(AieInst->MemErrHandlers, 0, sizeof(AieInst->MemErrHandlers));
	memset(AieInst->ShimErrHandlers, 0, sizeof(AieInst->ShimErrHandlers));
	/* Clean up the error handlers */
#ifdef __linux__
	for (u32 i = 0; i < XAIEGBL_CORE_ERROR_NUM; i++) {
		AieInst->CoreErrHandlers[i].Pid = (int)getpid();
	}
	for (u32 i = 0; i < XAIEGBL_MEM_ERROR_NUM; i++) {
		AieInst->MemErrHandlers[i].Pid = (int)getpid();
	}
	for (u32 i = 0; i < XAIEGBL_PL_ERROR_NUM; i++) {
		AieInst->ShimErrHandlers[i].Pid = (int)getpid();
	}
#endif
	/* Check if the error needs to trap the app by default */
	AieInst->CoreErrsDefaultTrap = 0;
	for (Err = XAIETILE_EVENT_CORE_SRS_SATURATE;
	     Err <= XAIETILE_EVENT_CORE_INSTR_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultTrap(XAIEGBL_MODULE_CORE, Err) == 1) {
			AieInst->CoreErrsDefaultTrap |=
				1 << (Err - XAIETILE_EVENT_CORE_SRS_SATURATE);
		}

	}
	AieInst->MemErrsDefaultTrap = 0;
	for (Err = XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED;
	     Err <= XAIETILE_EVENT_MEM_DMA_MM2S_1_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultTrap(XAIEGBL_MODULE_MEM, Err) == 1) {
			AieInst->MemErrsDefaultTrap |=
				1 << (Err - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED);
		}
	}
	AieInst->ShimErrsDefaultTrap = 0;
	for (Err = XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR;
	     Err <= XAIETILE_EVENT_SHIM_DMA_MM2S_1_ERROR_NOC; Err++) {
		if (XAieTile_ErrorsDefaultTrap(XAIEGBL_MODULE_PL, Err) == 1) {
			AieInst->ShimErrsDefaultTrap |=
				1 << (Err - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR);
		}
	}
	/* Setup error handler for error events */
	AieInst->CoreErrsPollOnly = 0;
	for (Err = XAIETILE_EVENT_CORE_SRS_SATURATE;
	     Err <= XAIETILE_EVENT_CORE_INSTR_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultLog(XAIEGBL_MODULE_CORE, Err) == 1) {
			AieInst->CoreEvtHandlers[Err].Cb = XAieTile_ErrorHandler;
		} else {
			AieInst->CoreErrsPollOnly |=
				1 << (Err - XAIETILE_EVENT_CORE_SRS_SATURATE);
		}
	}
	AieInst->MemErrsPollOnly = 0;
	for (Err = XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED;
	     Err <= XAIETILE_EVENT_MEM_DMA_MM2S_1_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultLog(XAIEGBL_MODULE_MEM, Err) == 1) {
			AieInst->MemEvtHandlers[Err].Cb = XAieTile_ErrorHandler;
		} else {
			AieInst->MemErrsPollOnly |=
				1 << (Err - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED);
		}
	}
	AieInst->ShimErrsPollOnly = 0;
	for (Err = XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR;
	     Err <= XAIETILE_EVENT_SHIM_DMA_MM2S_1_ERROR_NOC; Err++) {
		if (XAieTile_ErrorsDefaultLog(XAIEGBL_MODULE_PL, Err) == 1) {
			AieInst->ShimEvtHandlers[Err].Cb = XAieTile_ErrorHandler;
		} else {
			AieInst->ShimErrsPollOnly |=
				1 << (Err - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR);
		}
	}
}
/*****************************************************************************/
/**
 * This API initialize error default handlers.
 * When errors happens, the AIE driver will either take default action which
 * will trap the application or call the user registered callback.
 *
 * @param	AieInst - Pointer to the AIE device instance
 *
 * @return	None.
 *
 * @note	None.
 *****************************************************************************/
This API initialize error default handlers.
When errors happens, the AIE driver will either take default action which
will trap the application or call the user registered callback.

@param       AieInst - Pointer to the AIE device instance

@return      None.

@note        None.
This API initialize error default handlers . When errors happens the AIE driver will either take default action which will trap the application or call the user registered callback . @param AieInst - Pointer to the AIE device instance @return None . @note None .
void XAieTile_ErrorsSetupDefaultHandler(XAieGbl *AieInst)
{
	u8 Err;
	XAie_AssertVoid(AieInst != XAIE_NULL);
	XAie_AssertVoid(AieInst->Config != XAIE_NULL);
	XAie_AssertVoid(AieInst->Tiles != XAIE_NULL);
	XAie_AssertVoid(AieInst->IsReady == XAIE_COMPONENT_IS_READY);
	memset(AieInst->CoreErrHandlers, 0, sizeof(AieInst->CoreErrHandlers));
	memset(AieInst->MemErrHandlers, 0, sizeof(AieInst->MemErrHandlers));
	memset(AieInst->ShimErrHandlers, 0, sizeof(AieInst->ShimErrHandlers));
#ifdef __linux__
	for (u32 i = 0; i < XAIEGBL_CORE_ERROR_NUM; i++) {
		AieInst->CoreErrHandlers[i].Pid = (int)getpid();
	}
	for (u32 i = 0; i < XAIEGBL_MEM_ERROR_NUM; i++) {
		AieInst->MemErrHandlers[i].Pid = (int)getpid();
	}
	for (u32 i = 0; i < XAIEGBL_PL_ERROR_NUM; i++) {
		AieInst->ShimErrHandlers[i].Pid = (int)getpid();
	}
#endif
	AieInst->CoreErrsDefaultTrap = 0;
	for (Err = XAIETILE_EVENT_CORE_SRS_SATURATE;
	     Err <= XAIETILE_EVENT_CORE_INSTR_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultTrap(XAIEGBL_MODULE_CORE, Err) == 1) {
			AieInst->CoreErrsDefaultTrap |=
				1 << (Err - XAIETILE_EVENT_CORE_SRS_SATURATE);
		}
	}
	AieInst->MemErrsDefaultTrap = 0;
	for (Err = XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED;
	     Err <= XAIETILE_EVENT_MEM_DMA_MM2S_1_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultTrap(XAIEGBL_MODULE_MEM, Err) == 1) {
			AieInst->MemErrsDefaultTrap |=
				1 << (Err - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED);
		}
	}
	AieInst->ShimErrsDefaultTrap = 0;
	for (Err = XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR;
	     Err <= XAIETILE_EVENT_SHIM_DMA_MM2S_1_ERROR_NOC; Err++) {
		if (XAieTile_ErrorsDefaultTrap(XAIEGBL_MODULE_PL, Err) == 1) {
			AieInst->ShimErrsDefaultTrap |=
				1 << (Err - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR);
		}
	}
	AieInst->CoreErrsPollOnly = 0;
	for (Err = XAIETILE_EVENT_CORE_SRS_SATURATE;
	     Err <= XAIETILE_EVENT_CORE_INSTR_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultLog(XAIEGBL_MODULE_CORE, Err) == 1) {
			AieInst->CoreEvtHandlers[Err].Cb = XAieTile_ErrorHandler;
		} else {
			AieInst->CoreErrsPollOnly |=
				1 << (Err - XAIETILE_EVENT_CORE_SRS_SATURATE);
		}
	}
	AieInst->MemErrsPollOnly = 0;
	for (Err = XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED;
	     Err <= XAIETILE_EVENT_MEM_DMA_MM2S_1_ERROR; Err++) {
		if (XAieTile_ErrorsDefaultLog(XAIEGBL_MODULE_MEM, Err) == 1) {
			AieInst->MemEvtHandlers[Err].Cb = XAieTile_ErrorHandler;
		} else {
			AieInst->MemErrsPollOnly |=
				1 << (Err - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED);
		}
	}
	AieInst->ShimErrsPollOnly = 0;
	for (Err = XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR;
	     Err <= XAIETILE_EVENT_SHIM_DMA_MM2S_1_ERROR_NOC; Err++) {
		if (XAieTile_ErrorsDefaultLog(XAIEGBL_MODULE_PL, Err) == 1) {
			AieInst->ShimEvtHandlers[Err].Cb = XAieTile_ErrorHandler;
		} else {
			AieInst->ShimErrsPollOnly |=
				1 << (Err - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR);
		}
	}
}
void XAieTile_ErrorsSetupDefaultHandler ( XAieGbl * AieInst ) { u8 Err ; XAie_AssertVoid ( AieInst != XAIE_NULL ) ; XAie_AssertVoid ( AieInst -> Config != XAIE_NULL ) ; XAie_AssertVoid ( AieInst -> Tiles != XAIE_NULL ) ; XAie_AssertVoid ( AieInst -> IsReady == XAIE_COMPONENT_IS_READY ) ; memset ( AieInst -> CoreErrHandlers , 0 , sizeof ( AieInst -> CoreErrHandlers ) ) ; memset ( AieInst -> MemErrHandlers , 0 , sizeof ( AieInst -> MemErrHandlers ) ) ; memset ( AieInst -> ShimErrHandlers , 0 , sizeof ( AieInst -> ShimErrHandlers ) ) ; #ifdef __linux__ for ( u32 i = 0 ; i < XAIEGBL_CORE_ERROR_NUM ; i ++ ) { AieInst -> CoreErrHandlers [ i ] . Pid = ( int ) getpid ( ) ; } for ( u32 i = 0 ; i < XAIEGBL_MEM_ERROR_NUM ; i ++ ) { AieInst -> MemErrHandlers [ i ] . Pid = ( int ) getpid ( ) ; } for ( u32 i = 0 ; i < XAIEGBL_PL_ERROR_NUM ; i ++ ) { AieInst -> ShimErrHandlers [ i ] . Pid = ( int ) getpid ( ) ; } #endif AieInst -> CoreErrsDefaultTrap = 0 ; for ( Err = XAIETILE_EVENT_CORE_SRS_SATURATE ; Err <= XAIETILE_EVENT_CORE_INSTR_ERROR ; Err ++ ) { if ( XAieTile_ErrorsDefaultTrap ( XAIEGBL_MODULE_CORE , Err ) == 1 ) { AieInst -> CoreErrsDefaultTrap |= 1 << ( Err - XAIETILE_EVENT_CORE_SRS_SATURATE ) ; } } AieInst -> MemErrsDefaultTrap = 0 ; for ( Err = XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED ; Err <= XAIETILE_EVENT_MEM_DMA_MM2S_1_ERROR ; Err ++ ) { if ( XAieTile_ErrorsDefaultTrap ( XAIEGBL_MODULE_MEM , Err ) == 1 ) { AieInst -> MemErrsDefaultTrap |= 1 << ( Err - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED ) ; } } AieInst -> ShimErrsDefaultTrap = 0 ; for ( Err = XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR ; Err <= XAIETILE_EVENT_SHIM_DMA_MM2S_1_ERROR_NOC ; Err ++ ) { if ( XAieTile_ErrorsDefaultTrap ( XAIEGBL_MODULE_PL , Err ) == 1 ) { AieInst -> ShimErrsDefaultTrap |= 1 << ( Err - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR ) ; } } AieInst -> CoreErrsPollOnly = 0 ; for ( Err = XAIETILE_EVENT_CORE_SRS_SATURATE ; Err <= XAIETILE_EVENT_CORE_INSTR_ERROR ; Err ++ ) { if ( XAieTile_ErrorsDefaultLog ( XAIEGBL_MODULE_CORE , Err ) == 1 ) { AieInst -> CoreEvtHandlers [ Err ] . Cb = XAieTile_ErrorHandler ; } else { AieInst -> CoreErrsPollOnly |= 1 << ( Err - XAIETILE_EVENT_CORE_SRS_SATURATE ) ; } } AieInst -> MemErrsPollOnly = 0 ; for ( Err = XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED ; Err <= XAIETILE_EVENT_MEM_DMA_MM2S_1_ERROR ; Err ++ ) { if ( XAieTile_ErrorsDefaultLog ( XAIEGBL_MODULE_MEM , Err ) == 1 ) { AieInst -> MemEvtHandlers [ Err ] . Cb = XAieTile_ErrorHandler ; } else { AieInst -> MemErrsPollOnly |= 1 << ( Err - XAIETILE_EVENT_MEM_DM_ECC_ERROR_SCRUB_CORRECTED ) ; } } AieInst -> ShimErrsPollOnly = 0 ; for ( Err = XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR ; Err <= XAIETILE_EVENT_SHIM_DMA_MM2S_1_ERROR_NOC ; Err ++ ) { if ( XAieTile_ErrorsDefaultLog ( XAIEGBL_MODULE_PL , Err ) == 1 ) { AieInst -> ShimEvtHandlers [ Err ] . Cb = XAieTile_ErrorHandler ; } else { AieInst -> ShimErrsPollOnly |= 1 << ( Err - XAIETILE_EVENT_SHIM_AXI_MM_SLAVE_TILE_ERROR ) ; } } }
This API initialize error default handlers.
This API initialize error default handlers .
/* Clean up the error handlers */ /* Check if the error needs to trap the app by default */ /* Setup error handler for error events */