XilinxProcessorIPLib/drivers/audio_formatter/examples/xaudioformatter_intr_example.c
u32 InitializeI2sTx(XI2s_Tx *I2sTxInstancePtr)
{
	/*
	 * Lookup and Initialize the I2S transmitter so that it's ready to use.
	 */
	u32 Status;
	XI2stx_Config *I2STxConfig;
	I2STxConfig = XI2s_Tx_LookupConfig(I2S_TX_DEVICE_ID);
	if (I2STxConfig == NULL) {
		return XST_FAILURE;
	}

	Status = XI2s_Tx_CfgInitialize(I2sTxInstancePtr, I2STxConfig,
		I2STxConfig->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XScuGic_Connect(&Intc,	I2S_TX_INTERRUPT_ID,
		(XInterruptHandler)XI2s_Tx_IntrHandler,
		(void *)I2sTxInstancePtr);
	if (Status == XST_SUCCESS) {
		XScuGic_Enable(&Intc, I2S_TX_INTERRUPT_ID);
	} else {
		xil_printf("ERR:: Unable to register i2s tx interrupt handler");
		return XST_FAILURE;
	}

	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AES_BLKCMPLT,
			&I2sTxAesBlockCmplIntrHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AES_BLKSYNCERR,
			&I2sTxAesBlockErrIntrHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AES_CHSTSUPD,
			&I2sTxAesGetChStsHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AUD_UNDRFLW,
			&I2sTxUnderflowIntrHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetSclkOutDiv(I2sTxInstancePtr, I2S_TX_MCLK, I2S_TX_FS);
	XI2s_Tx_SetChMux(I2sTxInstancePtr, 0, XI2S_TX_CHMUX_AXIS_01);
	XI2s_Tx_IntrEnable(I2sTxInstancePtr, XI2S_TX_GINTR_EN_MASK);
	XI2s_Tx_IntrEnable(I2sTxInstancePtr, XI2S_TX_INTR_AES_BLKCMPLT_MASK);
	XI2s_Tx_IntrEnable(I2sTxInstancePtr, XI2S_TX_INTR_AUDUNDRFLW_MASK);
	XI2s_Tx_Enable(I2sTxInstancePtr, 0x1);
}
/*****************************************************************************/
/**
 * This function does the lookup and intialization of the I2S transmitter.
 *
 * @param	I2sTxInstancePtr is a pointer to the I2sTx 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 transmitter.
@param       I2sTxInstancePtr is a pointer to the I2sTx 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 transmitter . @param I2sTxInstancePtr is a pointer to the I2sTx driver instance @return XST_SUCCESS if the call is successful otherwise XST_FAILURE . @note None .
u32 InitializeI2sTx(XI2s_Tx *I2sTxInstancePtr)
{
	u32 Status;
	XI2stx_Config *I2STxConfig;
	I2STxConfig = XI2s_Tx_LookupConfig(I2S_TX_DEVICE_ID);
	if (I2STxConfig == NULL) {
		return XST_FAILURE;
	}
	Status = XI2s_Tx_CfgInitialize(I2sTxInstancePtr, I2STxConfig,
		I2STxConfig->BaseAddress);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	Status = XScuGic_Connect(&Intc,	I2S_TX_INTERRUPT_ID,
		(XInterruptHandler)XI2s_Tx_IntrHandler,
		(void *)I2sTxInstancePtr);
	if (Status == XST_SUCCESS) {
		XScuGic_Enable(&Intc, I2S_TX_INTERRUPT_ID);
	} else {
		xil_printf("ERR:: Unable to register i2s tx interrupt handler");
		return XST_FAILURE;
	}
	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AES_BLKCMPLT,
			&I2sTxAesBlockCmplIntrHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AES_BLKSYNCERR,
			&I2sTxAesBlockErrIntrHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AES_CHSTSUPD,
			&I2sTxAesGetChStsHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetHandler(I2sTxInstancePtr, XI2S_TX_HANDLER_AUD_UNDRFLW,
			&I2sTxUnderflowIntrHandler,
			(void *)I2sTxInstancePtr);
	XI2s_Tx_SetSclkOutDiv(I2sTxInstancePtr, I2S_TX_MCLK, I2S_TX_FS);
	XI2s_Tx_SetChMux(I2sTxInstancePtr, 0, XI2S_TX_CHMUX_AXIS_01);
	XI2s_Tx_IntrEnable(I2sTxInstancePtr, XI2S_TX_GINTR_EN_MASK);
	XI2s_Tx_IntrEnable(I2sTxInstancePtr, XI2S_TX_INTR_AES_BLKCMPLT_MASK);
	XI2s_Tx_IntrEnable(I2sTxInstancePtr, XI2S_TX_INTR_AUDUNDRFLW_MASK);
	XI2s_Tx_Enable(I2sTxInstancePtr, 0x1);
}
u32 InitializeI2sTx ( XI2s_Tx * I2sTxInstancePtr ) { u32 Status ; XI2stx_Config * I2STxConfig ; I2STxConfig = XI2s_Tx_LookupConfig ( I2S_TX_DEVICE_ID ) ; if ( I2STxConfig == NULL ) { return XST_FAILURE ; } Status = XI2s_Tx_CfgInitialize ( I2sTxInstancePtr , I2STxConfig , I2STxConfig -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } Status = XScuGic_Connect ( & Intc , I2S_TX_INTERRUPT_ID , ( XInterruptHandler ) XI2s_Tx_IntrHandler , ( void * ) I2sTxInstancePtr ) ; if ( Status == XST_SUCCESS ) { XScuGic_Enable ( & Intc , I2S_TX_INTERRUPT_ID ) ; } else { xil_printf ( " " ) ; return XST_FAILURE ; } XI2s_Tx_SetHandler ( I2sTxInstancePtr , XI2S_TX_HANDLER_AES_BLKCMPLT , & I2sTxAesBlockCmplIntrHandler , ( void * ) I2sTxInstancePtr ) ; XI2s_Tx_SetHandler ( I2sTxInstancePtr , XI2S_TX_HANDLER_AES_BLKSYNCERR , & I2sTxAesBlockErrIntrHandler , ( void * ) I2sTxInstancePtr ) ; XI2s_Tx_SetHandler ( I2sTxInstancePtr , XI2S_TX_HANDLER_AES_CHSTSUPD , & I2sTxAesGetChStsHandler , ( void * ) I2sTxInstancePtr ) ; XI2s_Tx_SetHandler ( I2sTxInstancePtr , XI2S_TX_HANDLER_AUD_UNDRFLW , & I2sTxUnderflowIntrHandler , ( void * ) I2sTxInstancePtr ) ; XI2s_Tx_SetSclkOutDiv ( I2sTxInstancePtr , I2S_TX_MCLK , I2S_TX_FS ) ; XI2s_Tx_SetChMux ( I2sTxInstancePtr , 0 , XI2S_TX_CHMUX_AXIS_01 ) ; XI2s_Tx_IntrEnable ( I2sTxInstancePtr , XI2S_TX_GINTR_EN_MASK ) ; XI2s_Tx_IntrEnable ( I2sTxInstancePtr , XI2S_TX_INTR_AES_BLKCMPLT_MASK ) ; XI2s_Tx_IntrEnable ( I2sTxInstancePtr , XI2S_TX_INTR_AUDUNDRFLW_MASK ) ; XI2s_Tx_Enable ( I2sTxInstancePtr , 0x1 ) ; }
This function does the lookup and intialization of the I2S transmitter.
This function does the lookup and intialization of the I2S transmitter .
/*
	 * Lookup and Initialize the I2S transmitter so that it's ready to use.
	 */