XilinxProcessorIPLib/drivers/i2srx/examples/xi2srx_intr_example.c
int I2sRxIntrExample(INTC *IntcInstancePtr, XI2s_Rx *I2sRxInstancePtr,
		u16 DeviceId, u16 IntrId)
{
	xil_printf("I2s Receiver\r\n");
	int Status;
	XI2srx_Config *Config;
	u32 IntrCount =0;
	/*
	 * Lookup and Initialize the I2S receiver so that it's ready to use.
	 */
	Config = XI2s_Rx_LookupConfig(DeviceId);
	if (Config == NULL)
		return XST_FAILURE;

	Status = XI2s_Rx_CfgInitialize(I2sRxInstancePtr, Config,
			Config->BaseAddress);
	if (Status != XST_SUCCESS)
		return XST_FAILURE;
	/*
	 * Connect the I2S receiver counter to the interrupt
	 * subsystem such that interrupts can occur.
	 * This function is application specific.
	 */
	Status = I2sRxSetupIntrSystem(IntcInstancePtr, I2sRxInstancePtr,
			DeviceId, IntrId);
	if (Status != XST_SUCCESS)
		return XST_FAILURE;

	/*
	 * Setup the handler for the I2S receiver that will be called from the
	 * interrupt context when the I2S receiver receives a block complete
	 * interrupt or Underflow interrupt.
	 */

	XI2s_Rx_SetHandler(I2sRxInstancePtr, XI2S_RX_HANDLER_AES_BLKCMPLT,
			&I2sRxAesBlockCmplIntrHandler,
			(void *)I2sRxInstancePtr);
	XI2s_Rx_SetHandler(I2sRxInstancePtr, XI2S_RX_HANDLER_AUD_OVRFLW,
			&I2sRxOvrflwIntrHandler, (void *)I2sRxInstancePtr);
	XI2s_Rx_SetSclkOutDiv(I2sRxInstancePtr, I2S_RX_MCLK,I2S_RX_FS);
	XI2s_Rx_SetChMux(I2sRxInstancePtr, 0x0, XI2S_RX_CHMUX_XI2S_01);
	XI2s_Rx_IntrEnable(I2sRxInstancePtr, XI2S_RX_GINTR_EN_MASK);
	XI2s_Rx_IntrEnable(I2sRxInstancePtr, XI2S_RX_INTR_AES_BLKCMPLT_MASK);
	XI2s_Rx_IntrEnable(I2sRxInstancePtr, XI2S_RX_INTR_AUDOVRFLW_MASK);
	XI2s_Rx_Enable(I2sRxInstancePtr, TRUE);
	/*
	 * Enable non-critical exceptions.
	 */
	Xil_ExceptionEnable();
	while (IntrCount < I2S_RX_TIME_OUT) {
		//	while(1) {
		/* Wait until an interrupts has been received. */
		if (IntrReceived == 1) {
			break;
		}
		IntrCount++;

		Status =  XST_SUCCESS;
	}
	return Status;
	}
/*****************************************************************************/
/**
 * This function does a minimal test on the I2S receiver device and driver
 * as a  design example.  The purpose of this function is to illustrate how
 * to use the XI2s_Rx component.  It initializes a I2S receiver and then
 * sets it up such that a periodic interrupt is generated.
 *
 * This function uses interrupt driven mode of the I2S receiver.
 *
 * @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>_INTERRUPT_INTR
 *		value from xparameters.h
 *
 * @return	XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
 *
 *****************************************************************************/
This function does a minimal test on the I2S receiver device and driver
as a  design example.  The purpose of this function is to illustrate how
to use the XI2s_Rx component.  It initializes a I2S receiver and then
sets it up such that a periodic interrupt is generated.

This function uses interrupt driven mode of the I2S receiver.

@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__DEVICE_ID value from
xparameters.h
@param       IntrId is XPAR___INTERRUPT_INTR
value from xparameters.h

@return      XST_SUCCESS if the Test is successful, otherwise XST_FAILURE
This function does a minimal test on the I2S receiver device and driver as a design example . The purpose of this function is to illustrate how to use the XI2s_Rx component . It initializes a I2S receiver and then sets it up such that a periodic interrupt is generated . This function uses interrupt driven mode of the I2S receiver . @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__DEVICE_ID value from xparameters . h @param IntrId is XPAR___INTERRUPT_INTR value from xparameters . h @return XST_SUCCESS if the Test is successful otherwise XST_FAILURE
int I2sRxIntrExample(INTC *IntcInstancePtr, XI2s_Rx *I2sRxInstancePtr,
		u16 DeviceId, u16 IntrId)
{
	xil_printf("I2s Receiver\r\n");
	int Status;
	XI2srx_Config *Config;
	u32 IntrCount =0;
	Config = XI2s_Rx_LookupConfig(DeviceId);
	if (Config == NULL)
		return XST_FAILURE;
	Status = XI2s_Rx_CfgInitialize(I2sRxInstancePtr, Config,
			Config->BaseAddress);
	if (Status != XST_SUCCESS)
		return XST_FAILURE;
	Status = I2sRxSetupIntrSystem(IntcInstancePtr, I2sRxInstancePtr,
			DeviceId, IntrId);
	if (Status != XST_SUCCESS)
		return XST_FAILURE;
	XI2s_Rx_SetHandler(I2sRxInstancePtr, XI2S_RX_HANDLER_AES_BLKCMPLT,
			&I2sRxAesBlockCmplIntrHandler,
			(void *)I2sRxInstancePtr);
	XI2s_Rx_SetHandler(I2sRxInstancePtr, XI2S_RX_HANDLER_AUD_OVRFLW,
			&I2sRxOvrflwIntrHandler, (void *)I2sRxInstancePtr);
	XI2s_Rx_SetSclkOutDiv(I2sRxInstancePtr, I2S_RX_MCLK,I2S_RX_FS);
	XI2s_Rx_SetChMux(I2sRxInstancePtr, 0x0, XI2S_RX_CHMUX_XI2S_01);
	XI2s_Rx_IntrEnable(I2sRxInstancePtr, XI2S_RX_GINTR_EN_MASK);
	XI2s_Rx_IntrEnable(I2sRxInstancePtr, XI2S_RX_INTR_AES_BLKCMPLT_MASK);
	XI2s_Rx_IntrEnable(I2sRxInstancePtr, XI2S_RX_INTR_AUDOVRFLW_MASK);
	XI2s_Rx_Enable(I2sRxInstancePtr, TRUE);
	Xil_ExceptionEnable();
	while (IntrCount < I2S_RX_TIME_OUT) {
		if (IntrReceived == 1) {
			break;
		}
		IntrCount++;
		Status =  XST_SUCCESS;
	}
	return Status;
	}
int I2sRxIntrExample ( INTC * IntcInstancePtr , XI2s_Rx * I2sRxInstancePtr , u16 DeviceId , u16 IntrId ) { xil_printf ( " \r \n " ) ; int Status ; XI2srx_Config * Config ; u32 IntrCount = 0 ; Config = XI2s_Rx_LookupConfig ( DeviceId ) ; if ( Config == NULL ) return XST_FAILURE ; Status = XI2s_Rx_CfgInitialize ( I2sRxInstancePtr , Config , Config -> BaseAddress ) ; if ( Status != XST_SUCCESS ) return XST_FAILURE ; Status = I2sRxSetupIntrSystem ( IntcInstancePtr , I2sRxInstancePtr , DeviceId , IntrId ) ; if ( Status != XST_SUCCESS ) return XST_FAILURE ; XI2s_Rx_SetHandler ( I2sRxInstancePtr , XI2S_RX_HANDLER_AES_BLKCMPLT , & I2sRxAesBlockCmplIntrHandler , ( void * ) I2sRxInstancePtr ) ; XI2s_Rx_SetHandler ( I2sRxInstancePtr , XI2S_RX_HANDLER_AUD_OVRFLW , & I2sRxOvrflwIntrHandler , ( void * ) I2sRxInstancePtr ) ; XI2s_Rx_SetSclkOutDiv ( I2sRxInstancePtr , I2S_RX_MCLK , I2S_RX_FS ) ; XI2s_Rx_SetChMux ( I2sRxInstancePtr , 0x0 , XI2S_RX_CHMUX_XI2S_01 ) ; XI2s_Rx_IntrEnable ( I2sRxInstancePtr , XI2S_RX_GINTR_EN_MASK ) ; XI2s_Rx_IntrEnable ( I2sRxInstancePtr , XI2S_RX_INTR_AES_BLKCMPLT_MASK ) ; XI2s_Rx_IntrEnable ( I2sRxInstancePtr , XI2S_RX_INTR_AUDOVRFLW_MASK ) ; XI2s_Rx_Enable ( I2sRxInstancePtr , TRUE ) ; Xil_ExceptionEnable ( ) ; while ( IntrCount < I2S_RX_TIME_OUT ) { if ( IntrReceived == 1 ) { break ; } IntrCount ++ ; Status = XST_SUCCESS ; } return Status ; }
This function does a minimal test on the I2S receiver device and driver
 as a  design example.
This function does a minimal test on the I2S receiver device and driver as a design example .
/*
	 * Lookup and Initialize the I2S receiver so that it's ready to use.
	 */ /*
	 * Connect the I2S receiver counter to the interrupt
	 * subsystem such that interrupts can occur.
	 * This function is application specific.
	 */ /*
	 * Setup the handler for the I2S receiver that will be called from the
	 * interrupt context when the I2S receiver receives a block complete
	 * interrupt or Underflow interrupt.
	 */ /*
	 * Enable non-critical exceptions.
	 */ //	while(1) { /* Wait until an interrupts has been received. */