XilinxProcessorIPLib/drivers/v_hdmitxss/examples/xhdmi_example/TxOnly/xhdmi_example.c
void XV_ConfigTpg(XV_tpg *InstancePtr)
{
	XV_tpg                *pTpg = InstancePtr;
	XVidC_VideoStream     *HdmiTxSsVidStreamPtr;

	HdmiTxSsVidStreamPtr = XV_HdmiTxSs_GetVideoStream(&HdmiTxSs);

	u32 width, height;
	XVidC_VideoMode VideoMode;
	VideoMode = HdmiTxSsVidStreamPtr->VmId;

	/* If Color bar, the 480i/576i HActive need to be divided by 2 */
	/* 1440x480i/1440x576i --> 720x480i/720x576i */
		/* NTSC/PAL Support */
		if ((VideoMode == XVIDC_VM_1440x480_60_I) ||
				(VideoMode == XVIDC_VM_1440x576_50_I) ) {

			width  = HdmiTxSsVidStreamPtr->Timing.HActive/2;
			height = HdmiTxSsVidStreamPtr->Timing.VActive;
		} else {
			/* If not NTSC/PAL, the HActive,
			 * and VActive remain as it is
			 */
			width  = HdmiTxSsVidStreamPtr->Timing.HActive;
			height = HdmiTxSsVidStreamPtr->Timing.VActive;
		}

	/* Work around:
	 * Can't set TPG to pass-through mode if the width or height = 0
	 */
	if (!((width == 0 || height == 0) && IsPassThrough)) {
		/* Stop TPG */
		XV_tpg_DisableAutoRestart(pTpg);

		XV_tpg_Set_height(pTpg, height);
		XV_tpg_Set_width(pTpg,  width);
		XV_tpg_Set_colorFormat(pTpg,
				HdmiTxSsVidStreamPtr->ColorFormatId);
		XV_tpg_Set_bckgndId(pTpg, Pattern);
		XV_tpg_Set_ovrlayId(pTpg, 0);

		XV_tpg_Set_enableInput(pTpg, IsPassThrough);

		if (IsPassThrough) {
			XV_tpg_Set_passthruStartX(pTpg,0);
			XV_tpg_Set_passthruStartY(pTpg,0);
			XV_tpg_Set_passthruEndX(pTpg,width);
			XV_tpg_Set_passthruEndY(pTpg,height);
		}

		/* Start TPG */
		XV_tpg_EnableAutoRestart(pTpg);
		XV_tpg_Start(pTpg);
	}
}
/*****************************************************************************/
/**
*
* This function generates video pattern.
*
* @param  IsPassThrough specifies either pass-through or colorbar mode.
*
* @return None.
*
* @note   None.
*
******************************************************************************/
This function generates video pattern.
This function generates video pattern .
void XV_ConfigTpg(XV_tpg *InstancePtr)
{
	XV_tpg                *pTpg = InstancePtr;
	XVidC_VideoStream     *HdmiTxSsVidStreamPtr;
	HdmiTxSsVidStreamPtr = XV_HdmiTxSs_GetVideoStream(&HdmiTxSs);
	u32 width, height;
	XVidC_VideoMode VideoMode;
	VideoMode = HdmiTxSsVidStreamPtr->VmId;
		if ((VideoMode == XVIDC_VM_1440x480_60_I) ||
				(VideoMode == XVIDC_VM_1440x576_50_I) ) {
			width  = HdmiTxSsVidStreamPtr->Timing.HActive/2;
			height = HdmiTxSsVidStreamPtr->Timing.VActive;
		} else {
			width  = HdmiTxSsVidStreamPtr->Timing.HActive;
			height = HdmiTxSsVidStreamPtr->Timing.VActive;
		}
	if (!((width == 0 || height == 0) && IsPassThrough)) {
		XV_tpg_DisableAutoRestart(pTpg);
		XV_tpg_Set_height(pTpg, height);
		XV_tpg_Set_width(pTpg,  width);
		XV_tpg_Set_colorFormat(pTpg,
				HdmiTxSsVidStreamPtr->ColorFormatId);
		XV_tpg_Set_bckgndId(pTpg, Pattern);
		XV_tpg_Set_ovrlayId(pTpg, 0);
		XV_tpg_Set_enableInput(pTpg, IsPassThrough);
		if (IsPassThrough) {
			XV_tpg_Set_passthruStartX(pTpg,0);
			XV_tpg_Set_passthruStartY(pTpg,0);
			XV_tpg_Set_passthruEndX(pTpg,width);
			XV_tpg_Set_passthruEndY(pTpg,height);
		}
		XV_tpg_EnableAutoRestart(pTpg);
		XV_tpg_Start(pTpg);
	}
}
void XV_ConfigTpg ( XV_tpg * InstancePtr ) { XV_tpg * pTpg = InstancePtr ; XVidC_VideoStream * HdmiTxSsVidStreamPtr ; HdmiTxSsVidStreamPtr = XV_HdmiTxSs_GetVideoStream ( & HdmiTxSs ) ; u32 width , height ; XVidC_VideoMode VideoMode ; VideoMode = HdmiTxSsVidStreamPtr -> VmId ; if ( ( VideoMode == XVIDC_VM_1440x480_60_I ) || ( VideoMode == XVIDC_VM_1440x576_50_I ) ) { width = HdmiTxSsVidStreamPtr -> Timing . HActive / 2 ; height = HdmiTxSsVidStreamPtr -> Timing . VActive ; } else { width = HdmiTxSsVidStreamPtr -> Timing . HActive ; height = HdmiTxSsVidStreamPtr -> Timing . VActive ; } if ( ! ( ( width == 0 || height == 0 ) && IsPassThrough ) ) { XV_tpg_DisableAutoRestart ( pTpg ) ; XV_tpg_Set_height ( pTpg , height ) ; XV_tpg_Set_width ( pTpg , width ) ; XV_tpg_Set_colorFormat ( pTpg , HdmiTxSsVidStreamPtr -> ColorFormatId ) ; XV_tpg_Set_bckgndId ( pTpg , Pattern ) ; XV_tpg_Set_ovrlayId ( pTpg , 0 ) ; XV_tpg_Set_enableInput ( pTpg , IsPassThrough ) ; if ( IsPassThrough ) { XV_tpg_Set_passthruStartX ( pTpg , 0 ) ; XV_tpg_Set_passthruStartY ( pTpg , 0 ) ; XV_tpg_Set_passthruEndX ( pTpg , width ) ; XV_tpg_Set_passthruEndY ( pTpg , height ) ; } XV_tpg_EnableAutoRestart ( pTpg ) ; XV_tpg_Start ( pTpg ) ; } }
This function generates video pattern.
This function generates video pattern .
/* If Color bar, the 480i/576i HActive need to be divided by 2 */ /* 1440x480i/1440x576i --> 720x480i/720x576i */ /* NTSC/PAL Support */ /* If not NTSC/PAL, the HActive,
			 * and VActive remain as it is
			 */ /* Work around:
	 * Can't set TPG to pass-through mode if the width or height = 0
	 */ /* Stop TPG */ /* Start TPG */