XilinxProcessorIPLib/drivers/v_sdirxss/examples/xuhdsdi_example/xuhdsdi_example.c
void XSdiAud_DetAudStUpdateHanlder(void *CallBackRef)
{
	XSdiAud *InstancePtr = (XSdiAud *)CallBackRef;
	XSdiAud_ActGrpSt ActiveGroupStatus;
	XSdiAud_SRSt SampleRateStatus;
	XSdiAud_AsxSt AsxStatus;
	XSdiAud_SampRate SampleRate;
	u32 Asx;
	u32 AnyGroupPresent;
	u32 FirstGroupPresent;
	int i;

	AnyGroupPresent = 0;
	FirstGroupPresent = 0;
	if (InstancePtr->Config.IsEmbed) {
		/* Fetch Audio Sample Rate and ASX information from SDI Audio Extract */
		XSdiAud_GetActGrpStatus(&SdiExtract, &ActiveGroupStatus);
		XSdiAud_Ext_GetSRStatus(&SdiExtract, &SampleRateStatus);
		XSdiAud_Ext_GetAsxStatus(&SdiExtract, &AsxStatus);
		for (i = 0; i < MAX_AUDIO_GROUPS; i++) {
			if (ActiveGroupStatus.GrpActive[i]) {
				SampleRate = SampleRateStatus.SRChPair[2 * i];
				Asx = AsxStatus.AsxPair[2 * i];
				AnyGroupPresent = 1;
				if (ActiveGroupStatus.GrpActive[0]) {
					FirstGroupPresent = 1;
				}
				break;
			}
		}

		/* Enable SDI Audio Pass-Through or AES Audio Playback */
		if (((XSDIAudioMode == XSDI_SDI_PASS_THROUGH) && AnyGroupPresent) ||
				((XSDIAudioMode == XSDI_AES_CAPTURE_PLAYBACK) && FirstGroupPresent)) {
			/* Disable Audio Status Update Interrupt (else it occurs once for every frame) */
			XSdiAud_IntrDisable(&SdiExtract,XSDIAUD_INT_EN_AUD_STAT_UPDATE_MASK);

			/* Enable SDI Audio Pass-Through or AES Audio Playback */
			if (XSDIAudioMode == XSDI_SDI_PASS_THROUGH) {
				XSdiEnableSDIAudioPassThrough(SampleRate, Asx);
			} else if (XSDIAudioMode == XSDI_AES_CAPTURE_PLAYBACK) {
				XSdiEnableAESAudioPlayback(SampleRate);
			}

			/* Report Audio Status of the incoming SDI stream */
			XSdiAud_Report_Audio_Status();

			/* Enable Sample Rate Change Interrupt (Watch dog interrupt to
			 * re-configure the path with new sample rate) */
			XSdiAud_IntrEnable(&SdiExtract, XSDIAUD_INT_EN_SMP_RATE_CHANGE_MASK);

			/* Enable Audio Group Change Interrupt (To print the new status) */
			XSdiAud_IntrEnable(&SdiExtract, XSDIAUD_INT_EN_GRP_CHANGE_MASK);
		}
	}
}
/*****************************************************************************/
/**
* This function is the callback function for the audio status change interrupt.
*
* @param  CallBackRef is a pointer to the callback function.
*
* @return None.
*
******************************************************************************/
This function is the callback function for the audio status change interrupt.
This function is the callback function for the audio status change interrupt .
void XSdiAud_DetAudStUpdateHanlder(void *CallBackRef)
{
	XSdiAud *InstancePtr = (XSdiAud *)CallBackRef;
	XSdiAud_ActGrpSt ActiveGroupStatus;
	XSdiAud_SRSt SampleRateStatus;
	XSdiAud_AsxSt AsxStatus;
	XSdiAud_SampRate SampleRate;
	u32 Asx;
	u32 AnyGroupPresent;
	u32 FirstGroupPresent;
	int i;
	AnyGroupPresent = 0;
	FirstGroupPresent = 0;
	if (InstancePtr->Config.IsEmbed) {
		XSdiAud_GetActGrpStatus(&SdiExtract, &ActiveGroupStatus);
		XSdiAud_Ext_GetSRStatus(&SdiExtract, &SampleRateStatus);
		XSdiAud_Ext_GetAsxStatus(&SdiExtract, &AsxStatus);
		for (i = 0; i < MAX_AUDIO_GROUPS; i++) {
			if (ActiveGroupStatus.GrpActive[i]) {
				SampleRate = SampleRateStatus.SRChPair[2 * i];
				Asx = AsxStatus.AsxPair[2 * i];
				AnyGroupPresent = 1;
				if (ActiveGroupStatus.GrpActive[0]) {
					FirstGroupPresent = 1;
				}
				break;
			}
		}
		if (((XSDIAudioMode == XSDI_SDI_PASS_THROUGH) && AnyGroupPresent) ||
				((XSDIAudioMode == XSDI_AES_CAPTURE_PLAYBACK) && FirstGroupPresent)) {
			XSdiAud_IntrDisable(&SdiExtract,XSDIAUD_INT_EN_AUD_STAT_UPDATE_MASK);
			if (XSDIAudioMode == XSDI_SDI_PASS_THROUGH) {
				XSdiEnableSDIAudioPassThrough(SampleRate, Asx);
			} else if (XSDIAudioMode == XSDI_AES_CAPTURE_PLAYBACK) {
				XSdiEnableAESAudioPlayback(SampleRate);
			}
			XSdiAud_Report_Audio_Status();
			XSdiAud_IntrEnable(&SdiExtract, XSDIAUD_INT_EN_SMP_RATE_CHANGE_MASK);
			XSdiAud_IntrEnable(&SdiExtract, XSDIAUD_INT_EN_GRP_CHANGE_MASK);
		}
	}
}
void XSdiAud_DetAudStUpdateHanlder ( void * CallBackRef ) { XSdiAud * InstancePtr = ( XSdiAud * ) CallBackRef ; XSdiAud_ActGrpSt ActiveGroupStatus ; XSdiAud_SRSt SampleRateStatus ; XSdiAud_AsxSt AsxStatus ; XSdiAud_SampRate SampleRate ; u32 Asx ; u32 AnyGroupPresent ; u32 FirstGroupPresent ; int i ; AnyGroupPresent = 0 ; FirstGroupPresent = 0 ; if ( InstancePtr -> Config . IsEmbed ) { XSdiAud_GetActGrpStatus ( & SdiExtract , & ActiveGroupStatus ) ; XSdiAud_Ext_GetSRStatus ( & SdiExtract , & SampleRateStatus ) ; XSdiAud_Ext_GetAsxStatus ( & SdiExtract , & AsxStatus ) ; for ( i = 0 ; i < MAX_AUDIO_GROUPS ; i ++ ) { if ( ActiveGroupStatus . GrpActive [ i ] ) { SampleRate = SampleRateStatus . SRChPair [ 2 * i ] ; Asx = AsxStatus . AsxPair [ 2 * i ] ; AnyGroupPresent = 1 ; if ( ActiveGroupStatus . GrpActive [ 0 ] ) { FirstGroupPresent = 1 ; } break ; } } if ( ( ( XSDIAudioMode == XSDI_SDI_PASS_THROUGH ) && AnyGroupPresent ) || ( ( XSDIAudioMode == XSDI_AES_CAPTURE_PLAYBACK ) && FirstGroupPresent ) ) { XSdiAud_IntrDisable ( & SdiExtract , XSDIAUD_INT_EN_AUD_STAT_UPDATE_MASK ) ; if ( XSDIAudioMode == XSDI_SDI_PASS_THROUGH ) { XSdiEnableSDIAudioPassThrough ( SampleRate , Asx ) ; } else if ( XSDIAudioMode == XSDI_AES_CAPTURE_PLAYBACK ) { XSdiEnableAESAudioPlayback ( SampleRate ) ; } XSdiAud_Report_Audio_Status ( ) ; XSdiAud_IntrEnable ( & SdiExtract , XSDIAUD_INT_EN_SMP_RATE_CHANGE_MASK ) ; XSdiAud_IntrEnable ( & SdiExtract , XSDIAUD_INT_EN_GRP_CHANGE_MASK ) ; } } }
This function is the callback function for the audio status change interrupt.
This function is the callback function for the audio status change interrupt .
/* Fetch Audio Sample Rate and ASX information from SDI Audio Extract */ /* Enable SDI Audio Pass-Through or AES Audio Playback */ /* Disable Audio Status Update Interrupt (else it occurs once for every frame) */ /* Enable SDI Audio Pass-Through or AES Audio Playback */ /* Report Audio Status of the incoming SDI stream */ /* Enable Sample Rate Change Interrupt (Watch dog interrupt to
			 * re-configure the path with new sample rate) */ /* Enable Audio Group Change Interrupt (To print the new status) */