📄 video_test.c
字号:
VPFE_SYN_MODE = 0x00030F84; //linger interlaced, with VD pority as negative
VPFE_HD_VD_WID = 0;
// VPFE_PIX_LINES = 0x02CF0271;
VPFE_PIX_LINES = 0; //linger 720x625
//VPFE_PIX_LINES=0x020d0271;
/*
* sph = 1, nph = 1440, according to page 32-33 of the CCDC spec
* for BT.656 mode, this setting captures only the 720x480 of the
* active NTSV video window
*/
// VPFE_HORZ_INFO = width << 1; // Horizontal lines
VPFE_HORZ_INFO = 0x6C0;
// VPFE_HSIZE_OFF = width << 1; // Horizontal line offset
VPFE_HSIZE_OFF = 0x6C0;
VPFE_VERT_START = 0; // Vertical start line
// VPFE_VERT_LINES = height >> 1; // Vertical lines
VPFE_VERT_LINES = 0x271>>1; // Vertical lines
VPFE_CULLING = 0xFFFF00FF; // Disable cullng
/*
* Interleave the two fields
*/
VPFE_SDOFST = 0x00000249;
// VPFE_SDOFST = 0;
VPFE_SDR_ADDR = buffer;
VPFE_CLAMP = 0;
VPFE_DCSUB = 0;
VPFE_COLPTN = 0xEE44EE44;
VPFE_BLKCMP = 0;
VPFE_FPC_ADDR = 0x86800000;
VPFE_FPC = 0;
VPFE_VDINT = 0;
VPFE_ALAW = 0;
// VPFE_REC656IF = 0x00000003;
VPFE_REC656IF = 0x00000002; //linger
/*
* Input format is Cb:Y:Cr:Y, w/ Y in odd-pixel position
*/
// VPFE_CCDCFG = 0x00000800;
VPFE_CCDCFG = 0x00000800;
// VPFE_FMTCFG = 0;
VPFE_FMTCFG = 0x00008000; //linger
VPFE_FMT_HORZ = 0x000002D0;
VPFE_FMT_VERT = 0x00000272;
VPFE_FMT_ADDR0 = 0;
VPFE_FMT_ADDR1 = 0;
VPFE_FMT_ADDR2 = 0;
VPFE_FMT_ADDR3 = 0;
VPFE_FMT_ADDR4 = 0;
VPFE_FMT_ADDR5 = 0;
VPFE_FMT_ADDR6 = 0;
VPFE_FMT_ADDR7 = 0;
VPFE_PRGEVEN_0 = 0;
VPFE_PRGEVEN_1 = 0;
VPFE_PRGODD_0 = 0;
VPFE_PRGODD_1 = 0;
VPFE_VP_OUT = 0x04e22D00;
VPFE_PCR = 0x00000001; // Enable CCDC
break;
}
default:
break;
}
}
/* ------------------------------------------------------------------------ *
* *
* vpbe_init( ) *
* *
* NTSC: *
* Width: 720 *
* Height: 480 *
* *
* *
* ------------------------------------------------------------------------ */
void vpbe_init( Uint32 buffer, Uint32 width, Uint32 height, Uint32 cb_enable,Uint8 mode )
{
/*
* Setup VPBE
*/
switch(mode)
{
case 1:
{
VPSS_CLK_CTRL = 0x00000018; // Enable DAC and VENC clock, both at 27 MHz
VPBE_PCR = 0; // No clock div, clock enable
/*
* Setup OSD
*/
OSD_MODE = 0x0000007f; // Blackground color blue using clut in ROM0
// OSD_MODE = 0x00006C00; //linger
OSD_OSDWIN0MD = 0; // Disable both osd windows and cursor window
OSD_OSDWIN1MD = 0;
OSD_RECTCUR = 0;
OSD_VIDWIN0OFST = width >> 4;
OSD_VIDWIN0ADR = buffer;
OSD_BASEPX = BASEP_X;
OSD_BASEPY = BASEP_Y;
OSD_VIDWIN0XP = 0;
OSD_VIDWIN0YP = 0;
OSD_VIDWIN0XL = width;
// OSD_VIDWIN0YL = height >> 1;
OSD_VIDWIN0YL = height; //linger:full height
OSD_MISCCTL = 0;
OSD_VIDWINMD = 0x00000007; // linger width X2
// Frame mode with no up-scaling
/*
* Setup VENC
*/
/*
* Setup VENC
*/
VENC_VMOD = 0x00000043; // Standard NTSC interlaced output
VENC_VDPRO = cb_enable << 8;
VENC_DACTST = 0;
VENC_DACSEL = 0x000213;
//// VENC_VMOD = 0x00002043; // 50HZ 854X625
// VENC_VMOD = 0x00002103; //linger 60HZ 854x525
// VENC_VIOCTL = 0x00002000;
// VENC_VDPRO = 0x00000870|(cb_enable << 8);
// VENC_DACTST = 0x00000000;
// VENC_CMPNT = 0x00008000;
// VENC_DACSEL = 0x00000435;
////linger
// VENC_SYNCCTL = 0x00000003;
///*********************************/
//// VENC_HINT = 0x;
// VENC_HSTART = 0x0;
// VENC_HVALID = 0x0;
//// VENC_VINT = 0x;
// VENC_VSTART = 0x0;
// VENC_VVALID = 0x0;
// VENC_OSDCLK0 = 0x0;
// VENC_OSDCLK1 = 0x1;
// VENC_ARGBX0 = 1024;
// VENC_ARGBX1 = 1404;
// VENC_ARGBX2 = 345;
// VENC_ARGBX3 = 715;
// VENC_ARGBX4 = 1774;
///*********************************
//// VENC_HINT = 0x;
// VENC_HSTART = 0x90;
// VENC_HVALID = 0x2D0;
//// VENC_VINT = 0x;
// VENC_VSTART = 0x31;
// VENC_VVALID = 0x240;
//*********************************/
// VENC_RGBCTL = 0x00000000;
// VENC_YCCTL =
break;
}
default:
{
VPSS_CLK_CTRL = 0x00000018; // Enable DAC and VENC clock, both at 27 MHz
VPBE_PCR = 0; // No clock div, clock enable
/*
* Setup OSD
*/
OSD_MODE = 0x0000007f; // Blackground color blue using clut in ROM0
OSD_OSDWIN0MD = 0; // Disable both osd windows and cursor window
OSD_OSDWIN1MD = 0;
OSD_RECTCUR = 0;
OSD_VIDWIN0OFST = width >> 4;
OSD_VIDWIN0ADR = 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
*/
VENC_VMOD = 0x00000043; // Standard NTSC interlaced output
VENC_VDPRO = cb_enable << 8;
VENC_DACTST = 0;
VENC_DACSEL = 0x000213;
break;
}
}
}
Int16 video_test_output()
{
Uint32 i,j;
// Uint8 tmpbyte[4];
for(;;)
{
for(i =0; i< 0xcada0; i++)
{
if(0xFF==*((Uint8*)0x81000000+i))
{
i++;
if(0x00==*((Uint8*)0x81000000+i))
{
i++;
if(0x00==*((Uint8*)0x81000000+i))
{
i++;
if((0xC7==*((Uint8*)0x81000000+i))||(0x80==*((Uint8*)0x81000000+i)))
{
i++;
for(j=0;j<586*2;j++)
{
*((Uint8*)0x82000000+j) = *((Uint8*)0x81000000+i);
i++;
}
}
}
}
}
// *((Uint8*)0x82000000+i) = *((Uint8*)0x81000000+i);
// *((Uint16*)0x82000000+i) = (*((Uint16*)0x81000000+i)>>8)&0x00ff;
// *((Uint8*)0x82000000+i) = (*((Uint16*)0x81000000+i))&0x00ff;
}
}
return 0;
}
Int16 video_test_output2()
{
Uint32 i;
for(;;)
{
for(i =0; i< 720*144; i++)
{
temp2[0] = (*((Uint32*)0x81000000+i*2)>>16)&0x0000ff00;
temp2[1] = (*((Uint32*)0x81000000+i*2)>>8)&0x000000ff;
temp2[2] = (*((Uint32*)0x81000004+i*2)<<8)&0x00ff0000;
temp2[3] = *((Uint32*)0x81000004+i*2)&0xff000000;
temp2[4] = temp2[0] | temp2[1] | temp2[2] | temp2[3];
*((Uint32*)0x82000000+i) = temp2[4];
}
//U
for(i =0; i< 720*72; i++)
{
temp2[0] = (*((Uint32*)0x8100000C+i*4)<<24)&0xff000000;
temp2[1] = (*((Uint32*)0x81000008+i*4)<<16)&0x00ff0000;
temp2[2] = (*((Uint32*)0x81000004+i*4)<<8)&0x0000ff00;
temp2[3] = (*((Uint32*)0x81000000+i*4))&0x000000ff;
temp2[4] = temp2[0] | temp2[1] | temp2[2] | temp2[3];
*((Uint32*)0x82065400+i) = temp2[4];
}
//V
for(i =0; i< 720*72; i++)
{
temp2[0] = (*((Uint32*)0x8100000C+i*4)<<8)&0xff000000;
temp2[1] = (*(Uint32*)0x81000008+i*4)&0x00ff0000;
temp2[2] = (*((Uint32*)0x81000004+i*4)>>8)&0x0000ff00;
temp2[3] = (*((Uint32*)0x81000000+i*4)>>16)&0x000000ff;
temp2[4] = temp2[0] | temp2[1] | temp2[2] | temp2[3];
*((Uint32*)0x82097e00+i) = temp2[4];
}
}
}
Int16 video_test_raw()
{
Uint32 i,j;
//channel 1;
/*
while(1)
{
for(j=0;j<288;j++)
{
for(i=0;i<360;i++)
{
*((Uint32 *)0x82000000+i+j*360)=*((Uint32 *)0x81009590+i+j*432);
}
}
}
*/
//channel 2;
/*
while(1)
{
for(j=0;j<288;j++)
{
for(i=0;i<1440;i++)
{
*((Uint8 *)0x82000000+i+j*1440)=*((Uint8 *)0x8100
}
}
}
return 0;
*/
}
/* ------------------------------------------------------------------------ *
* *
* video_loopback_test( ) *
* *
* *
* *
* ------------------------------------------------------------------------ */
Int16 video_loopback_test( )
{
Uint32 i;
tvp5150_init(1,0);
vpfe_init( 0x81000000, 720, 480, 1); // Setup Front-End
vpbe_init( 0x81000000, 720, 480, 0, 1); // Setup Back-End
// video_test_output2();
// video_test_raw();
/*
for(;;)
{
for(i =0; i< 720*144; i++)
{
temp2[0] = *((Uint32*)0x81000000+i*2)&0xff000000;
temp2[1] = (*((Uint32*)0x81000000+i*2)<<8)&0x00ff0000;
temp2[2] = (*((Uint32*)0x81000004+i*2)>>16)&0x0000ff00;
temp2[3] = (*((Uint32*)0x81000004+i*2)>>8)&0x000000ff;
temp2[4] = temp2[0] | temp2[1] | temp2[2] | temp2[3];
*((Uint32*)0x82000000+i) = temp2[4];
}
//U
for(i =0; i< 720*72; i++)
{
temp2[0] = (*((Uint32*)0x81000000+i*4)<<24)&0xff000000;
temp2[1] = (*((Uint32*)0x81000004+i*4)<<16)&0x00ff0000;
temp2[2] = (*((Uint32*)0x81000008+i*4)<<8)&0x0000ff00;
temp2[3] = (*((Uint32*)0x8100000C+i*4))&0x000000ff;
temp2[4] = temp2[0] | temp2[1] | temp2[2] | temp2[3];
*((Uint32*)0x82065400+i) = temp2[4];
}
//V
for(i =0; i< 720*72; i++)
{
temp2[0] = (*((Uint32*)0x81000000+i*4)<<8)&0xff000000;
temp2[1] = (*(Uint32*)0x81000004+i*4)&0x00ff0000;
temp2[2] = (*((Uint32*)0x81000008+i*4)>>8)&0x0000ff00;
temp2[3] = (*((Uint32*)0x8100000C+i*4)>>16)&0x000000ff;
temp2[4] = temp2[0] | temp2[1] | temp2[2] | temp2[3];
*((Uint32*)0x82097e00+i) = temp2[4];
}
}
*/
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -