lib/sw_services/xilplmi/src/xplmi_err.c
int XPlmi_EmSetAction(u32 ErrorNodeId, u32 ErrorMasks, u8 ActionId,
		XPlmi_ErrorHandler_t ErrorHandler)
{
	int Status = XST_FAILURE;
	u32 NodeType =  XPlmi_EventNodeType(ErrorNodeId);
	u32 ErrorId = NodeType * (u32)XPLMI_MAX_ERR_BITS;
	u32 RegMask;
	u32 ErrMasks = ErrorMasks;

	for ( ; ErrMasks != 0U; ErrMasks >>= 1U) {
		if ((ErrMasks & 0x1U) == 0U) {
			goto END;
		}
		RegMask = XPlmi_ErrRegMask(ErrorId);

		/* Check for Valid Error ID */
		if ((ErrorId >= XPLMI_ERROR_SW_ERR_MAX) ||
				(ErrorTable[ErrorId].Action == XPLMI_EM_ACTION_INVALID)) {
			/* Invalid Error Id */
			Status = XPLMI_INVALID_ERROR_ID;
			XPlmi_Printf(DEBUG_GENERAL,
					"Invalid Error: 0x%0x\n\r", ErrorId);
			goto END;
		}

		if((XPLMI_EM_ACTION_CUSTOM == ActionId) && (NULL == ErrorHandler) &&
				(XPLMI_ERROR_PMC_PSM_NCR != ErrorId)) {
			/* Null handler */
			Status = XPLMI_INVALID_ERROR_HANDLER;
			XPlmi_Printf(DEBUG_GENERAL, "Invalid Error Handler \n\r");
			goto END;
		}

		if((ActionId > XPLMI_EM_ACTION_INVALID) &&
				(ActionId < XPLMI_EM_ACTION_MAX)) {
			/* Disable the error actions for Error ID for configuring
			 * the requested error action
			 */
			Status = XPlmi_EmDisable(ErrorNodeId, RegMask);
			if (XST_SUCCESS != Status) {
				/* Error action disabling failure */
				goto END;
			}
			/* Clear any previous errors */
			XPlmi_EmClearError(NodeType, ErrorId);
		}

		/* Configure the Error Action to given Error Id */
		Status = XPlmi_EmConfig(NodeType, ErrorId, ActionId, ErrorHandler);

END:
		++ErrorId;
	}

	return Status;
}
/*****************************************************************************/
/**
 * @brief	This function sets the Action specified for a given Error Masks.
 *
 * @param	ErrorNodeId is the node ID for the error event
 * @param	ErrorMasks is the error masks to which specified action to be set
 * @param	ActionId is the action that need to be set for ErrorMasks. Action
 * 		  	can be SRST/POR/ERR OUT/INT
 * @param	ErrorHandler If INT is defined as response, handler should be
 * 		  	defined.
 *
 * @return	XST_SUCCESS on success and error code on failure
 *
 *****************************************************************************/
@brief       This function sets the Action specified for a given Error Masks.
@param       ErrorNodeId is the node ID for the error event
@param       ErrorMasks is the error masks to which specified action to be set
@param       ActionId is the action that need to be set for ErrorMasks. Action
can be SRST/POR/ERR OUT/INT
@param       ErrorHandler If INT is defined as response, handler should be
defined.

@return      XST_SUCCESS on success and error code on failure
@brief This function sets the Action specified for a given Error Masks . @param ErrorNodeId is the node ID for the error event @param ErrorMasks is the error masks to which specified action to be set @param ActionId is the action that need to be set for ErrorMasks . Action can be SRST / POR / ERR OUT / INT @param ErrorHandler If INT is defined as response handler should be defined . @return XST_SUCCESS on success and error code on failure
int XPlmi_EmSetAction(u32 ErrorNodeId, u32 ErrorMasks, u8 ActionId,
		XPlmi_ErrorHandler_t ErrorHandler)
{
	int Status = XST_FAILURE;
	u32 NodeType =  XPlmi_EventNodeType(ErrorNodeId);
	u32 ErrorId = NodeType * (u32)XPLMI_MAX_ERR_BITS;
	u32 RegMask;
	u32 ErrMasks = ErrorMasks;
	for ( ; ErrMasks != 0U; ErrMasks >>= 1U) {
		if ((ErrMasks & 0x1U) == 0U) {
			goto END;
		}
		RegMask = XPlmi_ErrRegMask(ErrorId);
		if ((ErrorId >= XPLMI_ERROR_SW_ERR_MAX) ||
				(ErrorTable[ErrorId].Action == XPLMI_EM_ACTION_INVALID)) {
			Status = XPLMI_INVALID_ERROR_ID;
			XPlmi_Printf(DEBUG_GENERAL,
					"Invalid Error: 0x%0x\n\r", ErrorId);
			goto END;
		}
		if((XPLMI_EM_ACTION_CUSTOM == ActionId) && (NULL == ErrorHandler) &&
				(XPLMI_ERROR_PMC_PSM_NCR != ErrorId)) {
			Status = XPLMI_INVALID_ERROR_HANDLER;
			XPlmi_Printf(DEBUG_GENERAL, "Invalid Error Handler \n\r");
			goto END;
		}
		if((ActionId > XPLMI_EM_ACTION_INVALID) &&
				(ActionId < XPLMI_EM_ACTION_MAX)) {
			Status = XPlmi_EmDisable(ErrorNodeId, RegMask);
			if (XST_SUCCESS != Status) {
				goto END;
			}
			XPlmi_EmClearError(NodeType, ErrorId);
		}
		Status = XPlmi_EmConfig(NodeType, ErrorId, ActionId, ErrorHandler);
END:
		++ErrorId;
	}
	return Status;
}
int XPlmi_EmSetAction ( u32 ErrorNodeId , u32 ErrorMasks , u8 ActionId , XPlmi_ErrorHandler_t ErrorHandler ) { int Status = XST_FAILURE ; u32 NodeType = XPlmi_EventNodeType ( ErrorNodeId ) ; u32 ErrorId = NodeType * ( u32 ) XPLMI_MAX_ERR_BITS ; u32 RegMask ; u32 ErrMasks = ErrorMasks ; for ( ; ErrMasks != 0U ; ErrMasks >>= 1U ) { if ( ( ErrMasks & 0x1U ) == 0U ) { goto END ; } RegMask = XPlmi_ErrRegMask ( ErrorId ) ; if ( ( ErrorId >= XPLMI_ERROR_SW_ERR_MAX ) || ( ErrorTable [ ErrorId ] . Action == XPLMI_EM_ACTION_INVALID ) ) { Status = XPLMI_INVALID_ERROR_ID ; XPlmi_Printf ( DEBUG_GENERAL , " \n \r " , ErrorId ) ; goto END ; } if ( ( XPLMI_EM_ACTION_CUSTOM == ActionId ) && ( NULL == ErrorHandler ) && ( XPLMI_ERROR_PMC_PSM_NCR != ErrorId ) ) { Status = XPLMI_INVALID_ERROR_HANDLER ; XPlmi_Printf ( DEBUG_GENERAL , " \n \r " ) ; goto END ; } if ( ( ActionId > XPLMI_EM_ACTION_INVALID ) && ( ActionId < XPLMI_EM_ACTION_MAX ) ) { Status = XPlmi_EmDisable ( ErrorNodeId , RegMask ) ; if ( XST_SUCCESS != Status ) { goto END ; } XPlmi_EmClearError ( NodeType , ErrorId ) ; } Status = XPlmi_EmConfig ( NodeType , ErrorId , ActionId , ErrorHandler ) ; END : ++ ErrorId ; } return Status ; }
@brief       This function sets the Action specified for a given Error Masks.
@brief This function sets the Action specified for a given Error Masks .
/* Check for Valid Error ID */ /* Invalid Error Id */ /* Null handler */ /* Disable the error actions for Error ID for configuring
			 * the requested error action
			 */ /* Error action disabling failure */ /* Clear any previous errors */ /* Configure the Error Action to given Error Id */