XilinxProcessorIPLib/drivers/xadcps/examples/xadcps_intr_example.c
static int XAdcSetupInterruptSystem(XScuGic *IntcInstancePtr,
				      XAdcPs *XAdcPtr,
				      u16 IntrId )
{

	int Status;
	XScuGic_Config *IntcConfig; /* Instance of the interrupt controller */


	/*
	 * 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 device driver 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,
				(Xil_InterruptHandler)XAdcInterruptHandler,
				(void *)XAdcPtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}

	/*
	 * Enable the interrupt for the XADC device.
	 */
	XScuGic_Enable(IntcInstancePtr, IntrId);

	/*
	 * Initialize the exception table.
	 */
	Xil_ExceptionInit();

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


	return XST_SUCCESS;

}
/****************************************************************************/
/**
*
* This function sets up the interrupt system so interrupts can occur for the
* XADC/ADC.  The function is application-specific since the actual
* system may or may not have an interrupt controller. The XADC/ADC
* device could be directly connected to a processor without an interrupt
* controller. The user should modify this function to fit the application.
*
* @param	IntcInstancePtr is a pointer to the Interrupt Controller
*		driver Instance.
* @param	XAdcPtr 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_<INTC_instance>_<SYSMON_ADC_instance>_VEC_ID
*		value from xparameters.h.
*
* @return	XST_SUCCESS if successful, or XST_FAILURE.
*
* @note		None.
*
*
****************************************************************************/
This function sets up the interrupt system so interrupts can occur for the
XADC/ADC.  The function is application-specific since the actual
system may or may not have an interrupt controller. The XADC/ADC
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 XADC / ADC . The function is application - specific since the actual system may or may not have an interrupt controller . The XADC / ADC device could be directly connected to a processor without an interrupt controller . The user should modify this function to fit the application .
static int XAdcSetupInterruptSystem(XScuGic *IntcInstancePtr,
				      XAdcPs *XAdcPtr,
				      u16 IntrId )
{
	int Status;
	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,
				(Xil_InterruptHandler)XAdcInterruptHandler,
				(void *)XAdcPtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	XScuGic_Enable(IntcInstancePtr, IntrId);
	Xil_ExceptionInit();
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler) XScuGic_InterruptHandler,
				IntcInstancePtr);
	Xil_ExceptionEnable();
	return XST_SUCCESS;
}
static int XAdcSetupInterruptSystem ( XScuGic * IntcInstancePtr , XAdcPs * XAdcPtr , u16 IntrId ) { int Status ; 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 , ( Xil_InterruptHandler ) XAdcInterruptHandler , ( void * ) XAdcPtr ) ; if ( Status != XST_SUCCESS ) { return Status ; } XScuGic_Enable ( IntcInstancePtr , IntrId ) ; Xil_ExceptionInit ( ) ; Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) XScuGic_InterruptHandler , IntcInstancePtr ) ; Xil_ExceptionEnable ( ) ; return XST_SUCCESS ; }
This function sets up the interrupt system so interrupts can occur for the
XADC/ADC.
This function sets up the interrupt system so interrupts can occur for the XADC / ADC .
/* Instance of the interrupt controller */ /*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */ /*
	 * Connect the device driver handler that will be called when an
	 * interrupt for the device occurs, the handler defined above performs
	 * the specific interrupt processing for the device.
	 */ /*
	 * Enable the interrupt for the XADC device.
	 */ /*
	 * Initialize the exception table.
	 */ /*
	 * Register the interrupt controller handler with the exception table.
	 */ /*
	 * Enable exceptions.
	 */