XilinxProcessorIPLib/drivers/dp14/examples/xdp_tx_audio_example.c
static void Dptx_AudioInit(XDp *InstancePtr)
{
	u32 Fs;
	u32 MAud;
	u32 NAud;
	u32 NumChs;

	/* Disable audio in the DisplayPort TX. This will also flush the buffers
	 * in the DisplayPort TX and set MUTE bit in VB-ID. */
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_CONTROL, 0x0);

	/* Configure the audio source (the S/PDIF controller). It is up to the
	 * user to implement this function. */
	Dptx_ConfigureAudioSrc(InstancePtr);
	/*******************/

	/* Write audio info frame as per user requirements. This may be optional
	 * for some systems. 8 writes are required to register
	 * XDP_TX_AUDIO_INFO_DATA. It is up to the user to implement this
	 * function. */
	Dptx_AudioSendInfoFrame(InstancePtr);
	/*******************/

	Fs = 48; /* KHz (32 | 44.1 | 48) */
	if (InstancePtr->TxInstance.LinkConfig.LinkRate ==
						XDP_TX_LINK_BW_SET_540GBPS) {
		MAud = 512 * Fs;
	}
	else if (InstancePtr->TxInstance.LinkConfig.LinkRate ==
						XDP_TX_LINK_BW_SET_270GBPS) {
		MAud = 512 * Fs;
	}
	else if (InstancePtr->TxInstance.LinkConfig.LinkRate ==
						XDP_TX_LINK_BW_SET_162GBPS) {
		MAud = 512 * Fs;
	}

	/* Write the channel count. The value is (actual count - 1). */
	NumChs = 2;
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_CHANNELS,
								NumChs - 1);

	/* NAud = 540000 | 270000 | 162000 */
	NAud = 27 * InstancePtr->TxInstance.LinkConfig.LinkRate * 1000;

	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_MAUD, MAud);
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_NAUD, NAud);

	/* Enable audio in the DisplayPort TX. */
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_CONTROL,
									0x1);
}
/******************************************************************************/
/**
 * This function will set up audio in the DisplayPort TX. The user will need
 * to implement configuration of the audio stream and, if needed, sending of
 * the info frame.
 *
 * @param	InstancePtr is a pointer to the XDp instance.
 *
 * @return	None.
 *
 * @note	The user needs to implement the Dptx_ConfigureAudioSrc and
 *		the Dptx_AudioSendInfoFrame functions to fulfill audio
 *		initialization.
 *
*******************************************************************************/
This function will set up audio in the DisplayPort TX. The user will need
to implement configuration of the audio stream and, if needed, sending of
the info frame.

@param       InstancePtr is a pointer to the XDp instance.

@return      None.

@note        The user needs to implement the Dptx_ConfigureAudioSrc and
the Dptx_AudioSendInfoFrame functions to fulfill audio
initialization.
This function will set up audio in the DisplayPort TX . The user will need to implement configuration of the audio stream and if needed sending of the info frame . @param InstancePtr is a pointer to the XDp instance . @return None . @note The user needs to implement the Dptx_ConfigureAudioSrc and the Dptx_AudioSendInfoFrame functions to fulfill audio initialization .
static void Dptx_AudioInit(XDp *InstancePtr)
{
	u32 Fs;
	u32 MAud;
	u32 NAud;
	u32 NumChs;
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_CONTROL, 0x0);
	Dptx_ConfigureAudioSrc(InstancePtr);
	Dptx_AudioSendInfoFrame(InstancePtr);
	Fs = 48; 
	if (InstancePtr->TxInstance.LinkConfig.LinkRate ==
						XDP_TX_LINK_BW_SET_540GBPS) {
		MAud = 512 * Fs;
	}
	else if (InstancePtr->TxInstance.LinkConfig.LinkRate ==
						XDP_TX_LINK_BW_SET_270GBPS) {
		MAud = 512 * Fs;
	}
	else if (InstancePtr->TxInstance.LinkConfig.LinkRate ==
						XDP_TX_LINK_BW_SET_162GBPS) {
		MAud = 512 * Fs;
	}
	NumChs = 2;
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_CHANNELS,
								NumChs - 1);
	NAud = 27 * InstancePtr->TxInstance.LinkConfig.LinkRate * 1000;
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_MAUD, MAud);
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_NAUD, NAud);
	XDp_WriteReg(InstancePtr->Config.BaseAddr, XDP_TX_AUDIO_CONTROL,
									0x1);
}
static void Dptx_AudioInit ( XDp * InstancePtr ) { u32 Fs ; u32 MAud ; u32 NAud ; u32 NumChs ; XDp_WriteReg ( InstancePtr -> Config . BaseAddr , XDP_TX_AUDIO_CONTROL , 0x0 ) ; Dptx_ConfigureAudioSrc ( InstancePtr ) ; Dptx_AudioSendInfoFrame ( InstancePtr ) ; Fs = 48 ; if ( InstancePtr -> TxInstance . LinkConfig . LinkRate == XDP_TX_LINK_BW_SET_540GBPS ) { MAud = 512 * Fs ; } else if ( InstancePtr -> TxInstance . LinkConfig . LinkRate == XDP_TX_LINK_BW_SET_270GBPS ) { MAud = 512 * Fs ; } else if ( InstancePtr -> TxInstance . LinkConfig . LinkRate == XDP_TX_LINK_BW_SET_162GBPS ) { MAud = 512 * Fs ; } NumChs = 2 ; XDp_WriteReg ( InstancePtr -> Config . BaseAddr , XDP_TX_AUDIO_CHANNELS , NumChs - 1 ) ; NAud = 27 * InstancePtr -> TxInstance . LinkConfig . LinkRate * 1000 ; XDp_WriteReg ( InstancePtr -> Config . BaseAddr , XDP_TX_AUDIO_MAUD , MAud ) ; XDp_WriteReg ( InstancePtr -> Config . BaseAddr , XDP_TX_AUDIO_NAUD , NAud ) ; XDp_WriteReg ( InstancePtr -> Config . BaseAddr , XDP_TX_AUDIO_CONTROL , 0x1 ) ; }
This function will set up audio in the DisplayPort TX.
This function will set up audio in the DisplayPort TX .
/* Disable audio in the DisplayPort TX. This will also flush the buffers
	 * in the DisplayPort TX and set MUTE bit in VB-ID. */ /* Configure the audio source (the S/PDIF controller). It is up to the
	 * user to implement this function. */ /*******************/ /* Write audio info frame as per user requirements. This may be optional
	 * for some systems. 8 writes are required to register
	 * XDP_TX_AUDIO_INFO_DATA. It is up to the user to implement this
	 * function. */ /*******************/ /* KHz (32 | 44.1 | 48) */ /* Write the channel count. The value is (actual count - 1). */ /* NAud = 540000 | 270000 | 162000 */ /* Enable audio in the DisplayPort TX. */