hi all:
I am using tvp-5150 for encoder and connect to DM365 C[0-7]. Camera is PAL.
test code is from SpectrulDigital, I have changed some appropriately. here is the code:
static void vpfe_init( Uint32 ntsc_pal_mode )
{
Uint32 width;
Uint32 height;
if ( ntsc_pal_mode == NTSC )
{
width = 720;
height = 480;
}
else
{
width = 720;
height = 576; //change to 576
}
ISIF_SYNCEN = 0x0000; // Disable VPFE during setup
ISIF_MODESET = 0x2F84; // Interlaced, VD priority as negative
ISIF_HDW = 0x0000;
ISIF_VDW = 0x0000;
ISIF_PPLN = 0x02CF; // 720
if(ntsc_pal_mode == NTSC)
ISIF_LPFR = 0x020D; // 526
else
ISIF_LPFR = 626;
/*
* sph = 1, nph = 1440, according to the CCDC spec
* for BT.656 mode, this setting captures only the 720x480 of the
* active NTSV video window
*/
ISIF_SPH = 0x0000;
ISIF_LNH = width << 1; // * Horizontal lines
ISIF_HSIZE = width >> 4; // Horizontal line offset
ISIF_SLV0 = 0x0000; // Vertical start line
ISIF_SLV1 = 0x0000;
ISIF_LNV = height >> 1; // Vertical lines
ISIF_CULH = 0xffff; // Disable culling
ISIF_CULV = 0x00ff;
/*
* Interleave the two fields
*/
ISIF_SDOFST = 0x0249; // Line offset
//dm355 is 0
ISIF_CADU = 0x0400; // Frame buffer address high,old=0x0400, why is 0x0400?
ISIF_CADL = 0x0000; // Frame buffer address low
//dm355 is 3
ISIF_REC656IF = 0x0001; // REC656 enabled,old=1
/*
* Input format is Cb:Y:Cr:Y, w/ Y in odd-pixel position
*/
//ISIF_CCDCFG = 0x0812; // CCD configuration
ISIF_CCDCFG = 0x0802; // CCD configuration,0x10 = swap C/Y
ISIF_FMTCFG = 0x0000; // Disable formatter
ISIF_FMTSPH = 0x0000;
ISIF_FMTLNH = 0x02D0;
ISIF_FMTSLV = 0x0000;
ISIF_FMTLNV = 0x0000;
ISIF_SYNCEN = 0x0003; // Enable CCDC
}
// back end **********************************************************************
static void vpbe_init( Uint32 colorbar_loopback_mode, Uint32 ntsc_pal_mode, Uint32 output_mode )
{
Uint32 video_buffer = DDR_BASE + ( DDR_SIZE / 2 );
Uint32 basep_x;
Uint32 basep_y;
Uint32 width;
Uint32 height;
if ( ntsc_pal_mode == NTSC )
{
basep_x = 0x7A; // 122
basep_y = 0x12; // 18
width = 720;
height = 480;
}
else
{
basep_x = 0x84; // 132
basep_y = 0x16; // 22
width = 720;
height = 576; //change to 576
}
/*
* Setup clocking / DACs
*/
VDAC_CONFIG = 0x081141CC; // Take DACs out of power down mode
VPSS_CLKCTL = 0x00000018; // Enable DAC and VENC clock, both at 27 MHz
VPSS_VPBE_CLK_CTRL = 0x00000011; // Select enc_clk*1, turn on VPBE clk
VENC_CLKCTL = 0x00000001; // Enable venc
/*
* Setup OSD
*/
OSD_MODE = 0x000000fc; // Blackground color blue using clut in ROM0
OSD_OSDWIN0MD = 0; // Disable both osd windows and cursor window
OSD_OSDWIN1MD = 0;
OSD_RECTCUR = 0;
if(colorbar_loopback_mode == COLORBARS)
{
OSD_VIDWIN0OFST = width >> 4;
OSD_VIDWIN0ADR = video_buffer;
}else //loopback
{
OSD_VIDWIN0OFST = 0x1000 | width >> 4; //width >> 4 donot work! why?
OSD_VIDWIN0ADR = video_buffer;
}
OSD_BASEPX = basep_x;
OSD_BASEPY = basep_y;
OSD_VIDWIN0XP = 0;
OSD_VIDWIN0YP = 0;
OSD_VIDWIN0XL = width;
OSD_VIDWIN0YL = height >> 1;
OSD_MISCCTL = 0;
OSD_VIDWINMD = 0x00000003; // Disable vwindow 1 and enable vwindow 0
// Frame mode with no up-scaling
/*
* Setup VENC
*/
if ( ntsc_pal_mode == NTSC )
VENC_VMOD = 0x00000003; // Standard NTSC interlaced output
else
VENC_VMOD = 0x00001243; // Standard PAL interlaced output,old=0x0043
VENC_VDPRO = colorbar_loopback_mode << 8;
VENC_VDPRO |= 0x200; // 100% Color bars
VENC_DACTST = 0;
/*
* Choose Output mode
*/
if ( output_mode == COMPOSITE_OUT )
VENC_DACSEL = 0x00000000;
else if ( output_mode == SVIDEO_OUT )
VENC_DACSEL = 0x00004210;
}
static Int16 video_colorbars_test(void)
{
/* Setup Back-End */
vpbe_init( COLORBARS, PAL, COMPOSITE_OUT );
return 0;
}
static Int16 video_loopback_test(void)
{
vpfe_init( PAL);
/* Setup Back-End */
vpbe_init( LOOPBACK, PAL, COMPOSITE_OUT );
return 0;
}
But I find no COLOR in some monitor (both ColorBar and Loopback), but some monitor has color.
And when testing loop-back ,I can see some blink like water wave from the video, can I program the register to solve this problem?
Thanks.