XilinxProcessorIPLib/drivers/i2srx/examples/xi2srx_intr_example.c
static int I2sRxSetupIntrSystem(INTC *IntcInstancePtr,
			XI2s_Rx *I2sRxInstancePtr,
			u16 DeviceId, u16 IntrId)
{
		int Status;
#ifdef XPAR_INTC_0_DEVICE_ID
		/*
		 * Initialize the interrupt controller driver so that
		 * it's ready to use, specify the device ID that is generated
		 * in xparameters.h
		 */
		Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
		if (Status != XST_SUCCESS)
			return XST_FAILURE;
		/*
		 * 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 = XIntc_Connect(IntcInstancePtr, IntrId,
				(XInterruptHandler)XI2S_Rx_IntrHandler,
				(void *)I2sRxInstancePtr);
		if (Status != XST_SUCCESS)
			return XST_FAILURE;

		/*
		 * Start the interrupt controller such that interrupts are
		 * enabled for all devices that cause interrupts, specific
		 * real mode so that the I2S receiver 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 I2S receiver.
		 */
		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 (IntcConfig == NULL)
			return XST_FAILURE;
		Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
				IntcConfig->CpuBaseAddress);
		if (Status != XST_SUCCESS)
			return XST_FAILURE;
		/*
		 * Connect the interrupt handler that will be called when an
		 * interrupt occurs for the device.
		 */
		Status = XScuGic_Connect(IntcInstancePtr, IntrId,
				(Xil_ExceptionHandler)XI2s_Rx_IntrHandler,
				I2sRxInstancePtr);
		if (Status != XST_SUCCESS)
			return Status;
		/*
		 * Enable the interrupt for the I2S receiver device.
		 */
		XScuGic_Enable(IntcInstancePtr, IntrId);

#endif /* XPAR_INTC_0_DEVICE_ID */

#ifndef TESTAPP_GEN
		/*
		 * 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);
#endif
		return XST_SUCCESS;
}
/*****************************************************************************/
/**
* This function setups the interrupt system such that interrupts can occur
* for the I2S receiver. This function is application specific since the actual
* system may or may not have an interrupt controller.  The I2S receiver 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	I2sRxInstancePtr is a pointer to the XI2S_Rx driver Instance.
* @param	DeviceId is the XPAR_<i2s_rx_instance>_DEVICE_ID value from
*		xparameters.h.
* @param	IntrId is XPAR_<INTC_instance>_<i2s_rx_instance>_VEC_ID
*		value from xparameters.h.
*
* @return	XST_SUCCESS if the Test is successful, otherwise XST_FAILURE.
*
* @note	This function contains an infinite loop such that if interrupts
*		are not working it may never return.
*
******************************************************************************/
This function setups the interrupt system such that interrupts can occur
for the I2S receiver. This function is application specific since the actual
system may or may not have an interrupt controller.  The I2S receiver could
be directly connected to a processor without an interrupt controller.  The
user should modify this function to fit the application.
This function setups the interrupt system such that interrupts can occur for the I2S receiver . This function is application specific since the actual system may or may not have an interrupt controller . The I2S receiver could be directly connected to a processor without an interrupt controller . The user should modify this function to fit the application .
static int I2sRxSetupIntrSystem(INTC *IntcInstancePtr,
			XI2s_Rx *I2sRxInstancePtr,
			u16 DeviceId, 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)XI2S_Rx_IntrHandler,
				(void *)I2sRxInstancePtr);
		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 (IntcConfig == NULL)
			return XST_FAILURE;
		Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,
				IntcConfig->CpuBaseAddress);
		if (Status != XST_SUCCESS)
			return XST_FAILURE;
		Status = XScuGic_Connect(IntcInstancePtr, IntrId,
				(Xil_ExceptionHandler)XI2s_Rx_IntrHandler,
				I2sRxInstancePtr);
		if (Status != XST_SUCCESS)
			return Status;
		XScuGic_Enable(IntcInstancePtr, IntrId);
#endif 
#ifndef TESTAPP_GEN
		Xil_ExceptionInit();
		Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
				(Xil_ExceptionHandler) INTC_HANDLER,
				IntcInstancePtr);
#endif
		return XST_SUCCESS;
}
static int I2sRxSetupIntrSystem ( INTC * IntcInstancePtr , XI2s_Rx * I2sRxInstancePtr , u16 DeviceId , 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 ) XI2S_Rx_IntrHandler , ( void * ) I2sRxInstancePtr ) ; 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 ( IntcConfig == NULL ) return XST_FAILURE ; Status = XScuGic_CfgInitialize ( IntcInstancePtr , IntcConfig , IntcConfig -> CpuBaseAddress ) ; if ( Status != XST_SUCCESS ) return XST_FAILURE ; Status = XScuGic_Connect ( IntcInstancePtr , IntrId , ( Xil_ExceptionHandler ) XI2s_Rx_IntrHandler , I2sRxInstancePtr ) ; if ( Status != XST_SUCCESS ) return Status ; XScuGic_Enable ( IntcInstancePtr , IntrId ) ; #endif #ifndef TESTAPP_GEN Xil_ExceptionInit ( ) ; Xil_ExceptionRegisterHandler ( XIL_EXCEPTION_ID_INT , ( Xil_ExceptionHandler ) INTC_HANDLER , IntcInstancePtr ) ; #endif return XST_SUCCESS ; }
This function setups the interrupt system such that interrupts can occur
for the I2S receiver.
This function setups the interrupt system such that interrupts can occur for the I2S receiver .
/*
		 * Initialize the interrupt controller driver so that
		 * it's ready to use, specify the device ID that is generated
		 * in xparameters.h
		 */ /*
		 * 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
		 */ /*
		 * Start the interrupt controller such that interrupts are
		 * enabled for all devices that cause interrupts, specific
		 * real mode so that the I2S receiver can cause interrupts
		 * through the interrupt controller.
		 */ /*
		 * Enable the interrupt for the I2S receiver.
		 */ /*
		 * Initialize the interrupt controller driver so that it is
		 * ready to use.
		 */ /*
		 * Connect the interrupt handler that will be called when an
		 * interrupt occurs for the device.
		 */ /*
		 * Enable the interrupt for the I2S receiver device.
		 */ /* XPAR_INTC_0_DEVICE_ID */ /*
		 * Initialize the exception table.
		 */ /*
		 * Register the interrupt controller handler with the exception
		 * table.
		 */