XilinxProcessorIPLib/drivers/gpiops/examples/xgpiops_intr_example.c
static int SetupInterruptSystem(XScuGic *GicInstancePtr, XGpioPs *Gpio,
				u16 GpioIntrId)
{
	int Status;

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

	Xil_ExceptionInit();

	/*
	 * 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(GicInstancePtr, IntcConfig,
					IntcConfig->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,
				GicInstancePtr);

	/*
	 * 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(GicInstancePtr, GpioIntrId,
				(Xil_ExceptionHandler)XGpioPs_IntrHandler,
				(void *)Gpio);
	if (Status != XST_SUCCESS) {
		return Status;
	}

	/* Enable falling edge interrupts for all the pins in GPIO bank. */
	XGpioPs_SetIntrType(Gpio, GPIO_BANK, 0x00, 0xFFFFFFFF, 0x00);

	/* Set the handler for gpio interrupts. */
	XGpioPs_SetCallbackHandler(Gpio, (void *)Gpio, IntrHandler);


	/* Enable the GPIO interrupts of GPIO Bank. */
	XGpioPs_IntrEnable(Gpio, GPIO_BANK, (1 << Input_Bank_Pin));


	/* Enable the interrupt for the GPIO device. */
	XScuGic_Enable(GicInstancePtr, GpioIntrId);


	/* Enable interrupts in the Processor. */
	Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets up the interrupt system for the example. It enables falling
* edge interrupts for all the pins of bank 0 in the GPIO device.
*
* @param	GicInstancePtr is a pointer to the XScuGic driver Instance.
* @param	GpioInstancePtr contains a pointer to the instance of the GPIO
*		component which is going to be connected to the interrupt
*		controller.
* @param	GpioIntrId is the interrupt Id and is typically
*		XPAR_<GICPS>_<GPIOPS_instance>_VEC_ID value from
*		xparameters.h.
*
* @return	XST_SUCCESS if successful, otherwise XST_FAILURE.
*
* @note		None.
*
****************************************************************************/
This function sets up the interrupt system for the example. It enables falling
edge interrupts for all the pins of bank 0 in the GPIO device.
This function sets up the interrupt system for the example . It enables falling edge interrupts for all the pins of bank 0 in the GPIO device .
static int SetupInterruptSystem(XScuGic *GicInstancePtr, XGpioPs *Gpio,
				u16 GpioIntrId)
{
	int Status;
	XScuGic_Config *IntcConfig; 
	Xil_ExceptionInit();
	IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
	if (NULL == IntcConfig) {
		return XST_FAILURE;
	}
	Status = XScuGic_CfgInitialize(GicInstancePtr, IntcConfig,
					IntcConfig->CpuBaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler)XScuGic_InterruptHandler,
				GicInstancePtr);
	Status = XScuGic_Connect(GicInstancePtr, GpioIntrId,
				(Xil_ExceptionHandler)XGpioPs_IntrHandler,
				(void *)Gpio);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	XGpioPs_SetIntrType(Gpio, GPIO_BANK, 0x00, 0xFFFFFFFF, 0x00);
	XGpioPs_SetCallbackHandler(Gpio, (void *)Gpio, IntrHandler);
	XGpioPs_IntrEnable(Gpio, GPIO_BANK, (1 << Input_Bank_Pin));
	XScuGic_Enable(GicInstancePtr, GpioIntrId);
	Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ);
	return XST_SUCCESS;
}
static int SetupInterruptSystem ( XScuGic * GicInstancePtr , XGpioPs * Gpio , u16 GpioIntrId ) { int Status ; XScuGic_Config * IntcConfig ; Xil_ExceptionInit ( ) ; IntcConfig = XScuGic_LookupConfig ( INTC_DEVICE_ID ) ; if ( NULL == IntcConfig ) { return XST_FAILURE ; } Status = XScuGic_CfgInitialize ( GicInstancePtr , IntcConfig , IntcConfig -> CpuBaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) XScuGic_InterruptHandler , GicInstancePtr ) ; Status = XScuGic_Connect ( GicInstancePtr , GpioIntrId , ( Xil_ExceptionHandler ) XGpioPs_IntrHandler , ( void * ) Gpio ) ; if ( Status != XST_SUCCESS ) { return Status ; } XGpioPs_SetIntrType ( Gpio , GPIO_BANK , 0x00 , 0xFFFFFFFF , 0x00 ) ; XGpioPs_SetCallbackHandler ( Gpio , ( void * ) Gpio , IntrHandler ) ; XGpioPs_IntrEnable ( Gpio , GPIO_BANK , ( 1 << Input_Bank_Pin ) ) ; XScuGic_Enable ( GicInstancePtr , GpioIntrId ) ; Xil_ExceptionEnableMask ( XIL_EXCEPTION_IRQ ) ; return XST_SUCCESS ; }
This function sets up the interrupt system for the example.
This function sets up the interrupt system for the example .
/* Instance of the interrupt controller */ /*
	 * Initialize the interrupt controller driver so that it is ready to
	 * use.
	 */ /*
	 * Connect the interrupt controller interrupt handler to the hardware
	 * interrupt handling logic in the processor.
	 */ /*
	 * 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 falling edge interrupts for all the pins in GPIO bank. */ /* Set the handler for gpio interrupts. */ /* Enable the GPIO interrupts of GPIO Bank. */ /* Enable the interrupt for the GPIO device. */ /* Enable interrupts in the Processor. */