Vertical Generation Configuration Example with Active Chroma for YUV 4:2:0 Active for Odd Lines - 6.2 English

Video Timing Controller Product Guide (PG016)

Document ID
PG016
Release Date
2023-11-03
Version
6.2 English

Programming the vertical generation registers to the values shown in Table: Example Vertical Generation Register Inputs (Alternate 4:2:0 Chroma) will result in the video timing signal outputs shown in This Figure .

Notice that the Generator Encoding Register bits [3:0] are set to 0b0011, as in the previous example. Bits [9:8] of the Generator Encoding Register is set to 1 instead of 0. This configures the Active Chroma output signal for 4:2:0 mode, but with the opposite line set.

Table 3-4: Example Vertical Generation Register Inputs (Alternate 4:2:0 Chroma)

Register Address

Register Name

Value

0x0060

Generator Active Size

0x0004_0003

0x0070

Generator HSize

0x0000_0007

0x0074

Generator VSize

0x0000_0008

0x0078

Generator HSync

0x0005_0004

0x0080

Generator Frame 0 Vsync

0x0006_0005

0x0068

Generator Encoding

0x0000_0103

0x006C

Generator Polarity

0x0000_003f

0x0000

Control

0x01ff_ff07

Figure 3-6: Generated Vertical Timing (Alternate 4:2:0 Chroma)

X-Ref Target - Figure 3-6

Figure_8_Generated_Vertical_Timing_Alternate_4_2_0_Chroma.png

The following C code shows how to configure the register values in Table: Example Vertical Generation Register Inputs (Alternate 4:2:0 Chroma) using the Video Timing Controller driver.

XVtc Vtc;                      /* Device driver instance */

XVtc_Signal SignalCfg;         /* VTC Signal configuration */

XVtc_Polarity Polarity;        /* Polarity configuration */

XVtc_SourceSelect SourceSelect;/* Source Selection configuration */

XVtc_Config *VtcCfgPtr;

VtcCfgPtr = XVtc_LookupConfig(VTC_DEVICE_ID);

XVtc_CfgInitialize(&Vtc, VtcCfgPtr, VtcCfgPtr->BaseAddress);

/* Setup the VTC Source Select config structure. */

/* 1=Generator registers are source */

/* 0=Detector  registers are source */

memset((void *)&SourceSelect, 0, sizeof(SourceSelect));

SourceSelect.VBlankPolSrc      = 1;

SourceSelect.VSyncPolSrc       = 1;

SourceSelect.HBlankPolSrc      = 1;

SourceSelect.HSyncPolSrc       = 1;

SourceSelect.ActiveVideoPolSrc = 1;

SourceSelect.ActiveChromaPolSrc= 1;

SourceSelect.VChromaSrc     = 1;

SourceSelect.VActiveSrc     = 1;

SourceSelect.VBackPorchSrc  = 1;

SourceSelect.VSyncSrc       = 1;

SourceSelect.VFrontPorchSrc = 1;

SourceSelect.VTotalSrc      = 1;

SourceSelect.HActiveSrc     = 1;

SourceSelect.HBackPorchSrc  = 1;

SourceSelect.HSyncSrc       = 1;

SourceSelect.HFrontPorchSrc = 1;

SourceSelect.HTotalSrc      = 1;

/* Setup the VTC Polarity config structure. */

memset((void *)&Polarity, 0, sizeof(Polarity));

Polarity.ActiveChromaPol = 1;

Polarity.ActiveVideoPol  = 1;

Polarity.VBlankPol       = 1;

Polarity.VSyncPol        = 1;

Polarity.HBlankPol       = 1;

Polarity.HSyncPol        = 1;

/* Setup the VTC Signal config structure. */

memset((void *)&SignalCfg, 0, sizeof(XVtc_Signal));

SignalCfg.OriginMode        = 1;//Set Frame Origin to Start of Active Video

SignalCfg.HTotal            = 7;

SignalCfg.HActiveStart      = 0;

SignalCfg.HFrontPorchStart  = 3;// Active Video Width

SignalCfg.HSyncStart        = 4;// Active Video Width + FP Width

SignalCfg.HBackPorchStart   = 5;// Active Video Width + FP Width + Sync Width

SignalCfg.V0Total           = 8;

SignalCfg.V0ChromaStart     = 0;

SignalCfg.V0ActiveStart     = 1;

SignalCfg.V0FrontPorchStart = 4;// Active Video Height

SignalCfg.V0SyncStart       = 5;// Active Video Height + FP_Width

SignalCfg.V0BackPorchStart  = 6;// Active Video Height + FP Width + Sync Width

/* Write VTC config to HW */

XVtc_RegUpdate(&VTC);

XVtc_SetPolarity(&Vtc, &Polarity);

XVtc_SetGenerator(&Vtc, &SignalCfg);

XVtc_SetSource(&Vtc, &SourceSelect);

XVtc_SetSkipLine(&Vtc, 1);

/* Enable VTC Generator */

XVtc_Enable Generator(&Vtc);