XilinxProcessorIPLib/drivers/axipmon/examples/xaxipmon_intr_example.c
static int AxiPmonSetupIntrSystem(INTC* IntcInstancePtr, XAxiPmon* InstancePtr,
								u16 IntrId)
{
	int Status;
#ifdef XPAR_INTC_0_DEVICE_ID
	/*
	 * Initialize the interrupt controller driver so that it's ready to
	 * use.
	 */
	Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Connect the handler that will be called when an interrupt
	 * for the device occurs, the handler defined above performs the
	 * specific interrupt processing for the device.
	 */
	Status = XIntc_Connect(IntcInstancePtr, IntrId,
		(XInterruptHandler) AxiPmonInterruptHandler, InstancePtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Start the interrupt controller so interrupts are enabled for all
	 * devices that cause interrupts. Specify real mode so that the Axi
	 * Performance Monitor device can cause interrupts through the interrupt
	 * controller.
	 */
	Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Enable the interrupt for the AXI Performance Monitor.
	 */
	XIntc_Enable(IntcInstancePtr, IntrId);
#else
	XScuGic_Config *IntcConfig;
	/*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */
	IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
	if (NULL == IntcConfig) {
		return XST_FAILURE;
	}
	Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
					IntcConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Connect the handler that will be called when an interrupt
	 * for the device occurs, the handler defined above performs the
	 * specific interrupt processing for the device.
	 */
	Status = XScuGic_Connect(IntcInstancePtr, IntrId,
		(XInterruptHandler) AxiPmonInterruptHandler, InstancePtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuGic_Enable(IntcInstancePtr, IntrId);
#endif
	/*
	 * Initialize the exception table.
	 */
	Xil_ExceptionInit();

	/*
	 * Register the interrupt controller handler with the exception table.
	 */
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler) INTC_HANDLER,
					IntcInstancePtr);
	/*
	 * Enable exceptions.
	 */
	Xil_ExceptionEnable();

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function performs the AXI Performance Monitor set up for Interrupts
*
* @param	IntcInstancePtr is a reference to the Interrupt Controller
*			driver Instance
* @param	InstancePtr is a reference to the  XAxiPmon driver Instance
* @param	IntrId is XPAR_<INTC_instance>_<AXIPMON_instance>_INTERRUPT_INTR
*			value from xparameters.h
*
* @return
*		- XST_SUCCESS if the interrupt setup is successful.
*		- XST_FAILURE if interrupt setup is not successful.
*
* @note		None.
*
******************************************************************************/
This function performs the AXI Performance Monitor set up for Interrupts
This function performs the AXI Performance Monitor set up for Interrupts
static int AxiPmonSetupIntrSystem(INTC* IntcInstancePtr, XAxiPmon* InstancePtr,
								u16 IntrId)
{
	int Status;
#ifdef XPAR_INTC_0_DEVICE_ID
	Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XIntc_Connect(IntcInstancePtr, IntrId,
		(XInterruptHandler) AxiPmonInterruptHandler, InstancePtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XIntc_Enable(IntcInstancePtr, IntrId);
#else
	XScuGic_Config *IntcConfig;
	IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
	if (NULL == IntcConfig) {
		return XST_FAILURE;
	}
	Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
					IntcConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XScuGic_Connect(IntcInstancePtr, IntrId,
		(XInterruptHandler) AxiPmonInterruptHandler, InstancePtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuGic_Enable(IntcInstancePtr, IntrId);
#endif
	Xil_ExceptionInit();
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler) INTC_HANDLER,
					IntcInstancePtr);
	Xil_ExceptionEnable();
	return XST_SUCCESS;
}
static int AxiPmonSetupIntrSystem ( INTC * IntcInstancePtr , XAxiPmon * InstancePtr , u16 IntrId ) { int Status ; #ifdef XPAR_INTC_0_DEVICE_ID Status = XIntc_Initialize ( IntcInstancePtr , INTC_DEVICE_ID ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = XIntc_Connect ( IntcInstancePtr , IntrId , ( XInterruptHandler ) AxiPmonInterruptHandler , InstancePtr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = XIntc_Start ( IntcInstancePtr , XIN_REAL_MODE ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XIntc_Enable ( IntcInstancePtr , IntrId ) ; #else XScuGic_Config * IntcConfig ; IntcConfig = XScuGic_LookupConfig ( INTC_DEVICE_ID ) ; if ( NULL == IntcConfig ) { return XST_FAILURE ; } Status = XScuGic_CfgInitialize ( IntcInstancePtr , IntcConfig , IntcConfig -> CpuBaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = XScuGic_Connect ( IntcInstancePtr , IntrId , ( XInterruptHandler ) AxiPmonInterruptHandler , InstancePtr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XScuGic_Enable ( IntcInstancePtr , IntrId ) ; #endif Xil_ExceptionInit ( ) ; Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) INTC_HANDLER , IntcInstancePtr ) ; Xil_ExceptionEnable ( ) ; return XST_SUCCESS ; }
This function performs the AXI Performance Monitor set up for Interrupts
This function performs the AXI Performance Monitor set up for Interrupts
/*
	 * Initialize the interrupt controller driver so that it's ready to
	 * use.
	 */ /*
	 * Connect the handler that will be called when an interrupt
	 * for the device occurs, the handler defined above performs the
	 * specific interrupt processing for the device.
	 */ /*
	 * Start the interrupt controller so interrupts are enabled for all
	 * devices that cause interrupts. Specify real mode so that the Axi
	 * Performance Monitor device can cause interrupts through the interrupt
	 * controller.
	 */ /*
	 * Enable the interrupt for the AXI Performance Monitor.
	 */ /*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */ /*
	 * Connect the handler that will be called when an interrupt
	 * for the device occurs, the handler defined above performs the
	 * specific interrupt processing for the device.
	 */ /*
	 * Initialize the exception table.
	 */ /*
	 * Register the interrupt controller handler with the exception table.
	 */ /*
	 * Enable exceptions.
	 */