XilinxProcessorIPLib/drivers/i2stx/examples/xi2stx_intr_example.c
static int I2sTxSetupIntrSystem(INTC* IntcInstancePtr,
		XI2s_Tx* I2sTxInstancePtr,
		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_Tx_IntrHandler,
			(void *)I2sTxInstancePtr);
	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 Transmitter can cause interrupts thru the interrupt
	 * controller.
	 */
	Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Enable the interrupt for the I2s Transmitter.
	 */
	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 interrupt handler that will be called when an
	 * interrupt occurs for the device.
	 */
	Status = XScuGic_Connect(IntcInstancePtr, IntrId,
			(Xil_ExceptionHandler)XI2s_Tx_IntrHandler,
			I2sTxInstancePtr);
	if (Status != XST_SUCCESS) {
		return Status;
	}
	/*
	 * Enable the interrupt for the I2s Transmitter 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 Transmitter. This function is application specific since the
 * actual system may or may not have an interrupt controller.  The I2s
 * Transmitter 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	I2sTxInstancePtr is a pointer to the XI2s_Tx driver Instance.
 * @param	DeviceId is the XPAR_<i2s_tx_instance>_DEVICE_ID value from
 *		xparameters.h.
 * @param	IntrId is XPAR_<INTC_instance>_<i2s_tx_instance>_VEC_ID
 *		value from xparameters.h.
 *
 * @return	XST_SUCCESS if the Test is successful, otherwise XST_FAILURE.
 *
 ******************************************************************************/
This function setups the interrupt system such that interrupts can occur
for the I2s Transmitter. This function is application specific since the
actual system may or may not have an interrupt controller.  The I2s
Transmitter 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       I2sTxInstancePtr is a pointer to the XI2s_Tx driver Instance.
@param       DeviceId is the XPAR__DEVICE_ID value from
xparameters.h.
@param       IntrId is XPAR___VEC_ID
value from xparameters.h.

@return      XST_SUCCESS if the Test is successful, otherwise XST_FAILURE.
This function setups the interrupt system such that interrupts can occur for the I2s Transmitter . This function is application specific since the actual system may or may not have an interrupt controller . The I2s Transmitter 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 I2sTxInstancePtr is a pointer to the XI2s_Tx driver Instance . @param DeviceId is the XPAR__DEVICE_ID value from xparameters . h . @param IntrId is XPAR___VEC_ID value from xparameters . h . @return XST_SUCCESS if the Test is successful otherwise XST_FAILURE .
static int I2sTxSetupIntrSystem(INTC* IntcInstancePtr,
		XI2s_Tx* I2sTxInstancePtr,
		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_Tx_IntrHandler,
			(void *)I2sTxInstancePtr);
	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,
			(Xil_ExceptionHandler)XI2s_Tx_IntrHandler,
			I2sTxInstancePtr);
	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 I2sTxSetupIntrSystem ( INTC * IntcInstancePtr , XI2s_Tx * I2sTxInstancePtr , 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_Tx_IntrHandler , ( void * ) I2sTxInstancePtr ) ; 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 , ( Xil_ExceptionHandler ) XI2s_Tx_IntrHandler , I2sTxInstancePtr ) ; 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 Transmitter.
This function setups the interrupt system such that interrupts can occur for the I2s Transmitter .
/*
	 * 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 Transmitter can cause interrupts thru the interrupt
	 * controller.
	 */ /*
	 * Enable the interrupt for the I2s Transmitter.
	 */ /*
	 * 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 Transmitter device.
	 */ /* XPAR_INTC_0_DEVICE_ID */ /*
	 * Initialize the exception table.
	 */ /*
	 * Register the interrupt controller handler with the exception table.
	 */