XilinxProcessorIPLib/drivers/audio_formatter/examples/xaudioformatter_intr_example.c
u32 InitializeI2sRx(XI2s_Rx *I2sRxInstancePtr)
{
	/*
	 * Lookup and Initialize the I2S receiver so that it's ready to use.
	 */
	u32 Status;
	XI2srx_Config *I2SRxConfig;
	I2SRxConfig = XI2s_Rx_LookupConfig(I2S_RX_DEVICE_ID);
	if (I2SRxConfig == NULL)
		return XST_FAILURE;

	Status = XI2s_Rx_CfgInitialize(&I2sRxInstance, I2SRxConfig,
			I2SRxConfig->BaseAddress);
	if (Status != XST_SUCCESS)
		return XST_FAILURE;

	Status = XScuGic_Connect(&Intc,	I2S_RX_INTERRUPT_ID,
		(XInterruptHandler)XI2s_Rx_IntrHandler,
		(void *)I2sRxInstancePtr);
	if (Status == XST_SUCCESS) {
		XScuGic_Enable(&Intc, I2S_RX_INTERRUPT_ID);
	} else {
		xil_printf("ERR:: Unable to register i2s rx interrupt handler");
		return XST_FAILURE;
	}

	Xil_ExceptionEnable();
	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);
	return Status;
}
/*****************************************************************************/
/**
 * This function does the lookup and intialization of the I2S receiver.
 *
 * @param	I2sRxInstancePtr is a pointer to the I2sRx driver instance
 *
 * @return	XST_SUCCESS if the call is successful, otherwise XST_FAILURE.
 *
 * @note	None.
 *
******************************************************************************/
This function does the lookup and intialization of the I2S receiver.
@param       I2sRxInstancePtr is a pointer to the I2sRx driver instance

@return      XST_SUCCESS if the call is successful, otherwise XST_FAILURE.

@note        None.
This function does the lookup and intialization of the I2S receiver . @param I2sRxInstancePtr is a pointer to the I2sRx driver instance @return XST_SUCCESS if the call is successful otherwise XST_FAILURE . @note None .
u32 InitializeI2sRx(XI2s_Rx *I2sRxInstancePtr)
{
	u32 Status;
	XI2srx_Config *I2SRxConfig;
	I2SRxConfig = XI2s_Rx_LookupConfig(I2S_RX_DEVICE_ID);
	if (I2SRxConfig == NULL)
		return XST_FAILURE;
	Status = XI2s_Rx_CfgInitialize(&I2sRxInstance, I2SRxConfig,
			I2SRxConfig->BaseAddress);
	if (Status != XST_SUCCESS)
		return XST_FAILURE;
	Status = XScuGic_Connect(&Intc,	I2S_RX_INTERRUPT_ID,
		(XInterruptHandler)XI2s_Rx_IntrHandler,
		(void *)I2sRxInstancePtr);
	if (Status == XST_SUCCESS) {
		XScuGic_Enable(&Intc, I2S_RX_INTERRUPT_ID);
	} else {
		xil_printf("ERR:: Unable to register i2s rx interrupt handler");
		return XST_FAILURE;
	}
	Xil_ExceptionEnable();
	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);
	return Status;
}
u32 InitializeI2sRx ( XI2s_Rx * I2sRxInstancePtr ) { u32 Status ; XI2srx_Config * I2SRxConfig ; I2SRxConfig = XI2s_Rx_LookupConfig ( I2S_RX_DEVICE_ID ) ; if ( I2SRxConfig == NULL ) return XST_FAILURE ; Status = XI2s_Rx_CfgInitialize ( & I2sRxInstance , I2SRxConfig , I2SRxConfig -> BaseAddress ) ; if ( Status != XST_SUCCESS ) return XST_FAILURE ; Status = XScuGic_Connect ( & Intc , I2S_RX_INTERRUPT_ID , ( XInterruptHandler ) XI2s_Rx_IntrHandler , ( void * ) I2sRxInstancePtr ) ; if ( Status == XST_SUCCESS ) { XScuGic_Enable ( & Intc , I2S_RX_INTERRUPT_ID ) ; } else { xil_printf ( " " ) ; return XST_FAILURE ; } Xil_ExceptionEnable ( ) ; 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 ) ; return Status ; }
This function does the lookup and intialization of the I2S receiver.
This function does the lookup and intialization of the I2S receiver .
/*
	 * Lookup and Initialize the I2S receiver so that it's ready to use.
	 */