XilinxProcessorIPLib/drivers/sysmonpsu/examples/xsysmonpsu_intr_example.c
static int SysMonPsuSetupInterruptSystem(XScuGic* XScuGicInstPtr, XSysMonPsu *SysMonPtr,
				      u16 IntrId )
{
	int Status;

#ifndef TESTAPP_GEN
	XScuGic_Config *XScuGicConfig; /* Config for interrupt controller */

	/* Initialize the interrupt controller driver */
	XScuGicConfig = XScuGic_LookupConfig(XSCUGIC_DEVICE_ID);
	if (NULL == XScuGicConfig) {
		return XST_FAILURE;
	}

	Status = XScuGic_CfgInitialize(XScuGicInstPtr, XScuGicConfig,
					XScuGicConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Connect the interrupt controller interrupt handler to the
	 * hardware interrupt handling logic in the processor.
	 */
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler) XScuGic_InterruptHandler,
				XScuGicInstPtr);
#endif

	/*
	 * Connect a device driver handler that will be called when an
	 * interrupt for the device occurs, the device driver handler
	 * performs the specific interrupt processing for the device
	 */
	Status = XScuGic_Connect(XScuGicInstPtr, IntrId,
				  (Xil_ExceptionHandler) SysMonPsuInterruptHandler,
				  (void *) SysMonPtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/* Enable the interrupt for the device */
	XScuGic_Enable(XScuGicInstPtr, IntrId);

#ifndef TESTAPP_GEN
	/* Enable interrupts */
	 Xil_ExceptionEnable();
#endif
	return XST_SUCCESS;
}
/****************************************************************************/
/**
*
* This function sets up the interrupt system so interrupts can occur for the
* System Monitor.  The function is application-specific since the actual
* system may or may not have an interrupt controller. The System Monitor
* device could be directly connected to a processor without an interrupt
* controller. The user should modify this function to fit the application.
*
* @param	XScuGicInstPtr is a pointer to the Interrupt Controller driver
*		Instance.
* @param	SysMonPtr is a pointer to the driver instance for the System
* 		Monitor device which is going to be connected to the interrupt
*		controller.
* @param	IntrId is XPAR_<SYSMON_instance>_INTR
*		value from xparameters_ps.h
*
* @return	XST_SUCCESS if successful, or XST_FAILURE.
*
* @note		None.
*
*
****************************************************************************/
This function sets up the interrupt system so interrupts can occur for the
System Monitor.  The function is application-specific since the actual
system may or may not have an interrupt controller. The System Monitor
device could be directly connected to a processor without an interrupt
controller. The user should modify this function to fit the application.
This function sets up the interrupt system so interrupts can occur for the System Monitor . The function is application - specific since the actual system may or may not have an interrupt controller . The System Monitor device could be directly connected to a processor without an interrupt controller . The user should modify this function to fit the application .
static int SysMonPsuSetupInterruptSystem(XScuGic* XScuGicInstPtr, XSysMonPsu *SysMonPtr,
				      u16 IntrId )
{
	int Status;
#ifndef TESTAPP_GEN
	XScuGic_Config *XScuGicConfig; 
	XScuGicConfig = XScuGic_LookupConfig(XSCUGIC_DEVICE_ID);
	if (NULL == XScuGicConfig) {
		return XST_FAILURE;
	}
	Status = XScuGic_CfgInitialize(XScuGicInstPtr, XScuGicConfig,
					XScuGicConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler) XScuGic_InterruptHandler,
				XScuGicInstPtr);
#endif
	Status = XScuGic_Connect(XScuGicInstPtr, IntrId,
				  (Xil_ExceptionHandler) SysMonPsuInterruptHandler,
				  (void *) SysMonPtr);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	XScuGic_Enable(XScuGicInstPtr, IntrId);
#ifndef TESTAPP_GEN
	 Xil_ExceptionEnable();
#endif
	return XST_SUCCESS;
}
static int SysMonPsuSetupInterruptSystem ( XScuGic * XScuGicInstPtr , XSysMonPsu * SysMonPtr , u16 IntrId ) { int Status ; #ifndef TESTAPP_GEN XScuGic_Config * XScuGicConfig ; XScuGicConfig = XScuGic_LookupConfig ( XSCUGIC_DEVICE_ID ) ; if ( NULL == XScuGicConfig ) { return XST_FAILURE ; } Status = XScuGic_CfgInitialize ( XScuGicInstPtr , XScuGicConfig , XScuGicConfig -> CpuBaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) XScuGic_InterruptHandler , XScuGicInstPtr ) ; #endif Status = XScuGic_Connect ( XScuGicInstPtr , IntrId , ( Xil_ExceptionHandler ) SysMonPsuInterruptHandler , ( void * ) SysMonPtr ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XScuGic_Enable ( XScuGicInstPtr , IntrId ) ; #ifndef TESTAPP_GEN Xil_ExceptionEnable ( ) ; #endif return XST_SUCCESS ; }
This function sets up the interrupt system so interrupts can occur for the
System Monitor.
This function sets up the interrupt system so interrupts can occur for the System Monitor .
/* Config for interrupt controller */ /* Initialize the interrupt controller driver */ /*
	 * Connect the interrupt controller interrupt handler to the
	 * hardware interrupt handling logic in the processor.
	 */ /*
	 * Connect a device driver handler that will be called when an
	 * interrupt for the device occurs, the device driver handler
	 * performs the specific interrupt processing for the device
	 */ /* Enable the interrupt for the device */ /* Enable interrupts */