TI中文支持网
TI专业的中文技术问题搜集分享网站

用的TMS320DM6437,接显示器显示不完整什么情况呀,各位大大

/*
 *  Copyright 2006 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 */

/*
 *  Video Loopback Test
 *
 */

#include "stdio.h"
#include "evmdm6437_dip.h"
#include "tvp5146.h"

#define NTSC1
#define PAL0

#define COLORBARS1
#define LOOPBACK0

#define SVIDEO_OUT1
#define COMPOSITE_OUT0

/* ------------------------------------------------------------------------ *
 **
 *  vpfe_init( ntsc/pal )*
 **
 * ------------------------------------------------------------------------ */
static void vpfe_init( Uint32 ntsc_pal_mode , Uint32 video_buffer)
{
//Uint32 video_buffer = DDR_BASE + ( DDR_SIZE / 2 );Uint32 width;Uint32 height;if ( ntsc_pal_mode == NTSC ){width= 720;height  = 480;}else{width= 720;//height  = 480;height  = 576;	//zq change}VPFE_CCDC_SYN_MODE  = 0x00032F84;// interlaced, with VD pority as negativeVPFE_CCDC_HD_VD_WID = 0;VPFE_CCDC_PIX_LINES = 0x02CF020D;/**  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_CCDC_HORZ_INFO = width << 1;// Horizontal linesVPFE_CCDC_HSIZE_OFF = width << 1;// Horizontal line offsetVPFE_CCDC_VERT_START = 0;// Vertical start lineVPFE_CCDC_VERT_LINES = height >> 1; // Vertical linesVPFE_CCDC_CULLING= 0xFFFF00FF;// Disable cullng/**  Interleave the two fields*/VPFE_CCDC_SDOFST= 0x00000249;VPFE_CCDC_SDR_ADDR  = video_buffer;VPFE_CCDC_CLAMP= 0;VPFE_CCDC_DCSUB= 0;VPFE_CCDC_COLPTN= 0xEE44EE44;VPFE_CCDC_BLKCMP= 0;VPFE_CCDC_FPC_ADDR  = 0x86800000;VPFE_CCDC_FPC= 0;VPFE_CCDC_VDINT= 0;VPFE_CCDC_ALAW= 0;VPFE_CCDC_REC656IF  = 0x00000003;/**  Input format is Cb:Y:Cr:Y, w/ Y in odd-pixel position*/VPFE_CCDC_CCDCFG= 0x00000800;VPFE_CCDC_FMTCFG= 0;VPFE_CCDC_FMT_HORZ  = 0x000002D0;VPFE_CCDC_FMT_VERT  = 0x0000020E;VPFE_CCDC_FMT_ADDR0 = 0;VPFE_CCDC_FMT_ADDR1 = 0;VPFE_CCDC_FMT_ADDR2 = 0;VPFE_CCDC_FMT_ADDR3 = 0;VPFE_CCDC_FMT_ADDR4 = 0;VPFE_CCDC_FMT_ADDR5 = 0;VPFE_CCDC_FMT_ADDR6 = 0;VPFE_CCDC_FMT_ADDR7 = 0;VPFE_CCDC_PRGEVEN_0 = 0;VPFE_CCDC_PRGEVEN_1 = 0;VPFE_CCDC_PRGODD_0  = 0;VPFE_CCDC_PRGODD_1  = 0;VPFE_CCDC_VP_OUT= 0x041A2D00;VPFE_CCDC_PCR= 0x00000001;// Enable CCDC
}

/* ------------------------------------------------------------------------ *
 **
 *  vpbe_init( colorbars/loopback, ntsc/pal, svideo/composite )*
 **
 * ------------------------------------------------------------------------ */
static void vpbe_init( Uint32 colorbar_loopback_mode, Uint32 ntsc_pal_mode, Uint32 output_mode, Uint32 video_buffer )
{
//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 = 122;basep_y = 18;width= 720;height  = 480;}else{basep_x = 132;basep_y = 22;width= 720;//height  = 480;
		height  = 576;		//zq change}/** Setup VPBE*/VPSS_CLK_CTRL= 0x00000018;// Enable DAC and VENC clock, both at 27 MHzVPBE_PCR= 0;// No clock div, clock enable/** Setup OSD*/VPBE_OSD_MODE= 0x000000fc;// Blackground color blue using clut in ROM0VPBE_OSD_OSDWIN0MD  = 0;// Disable both osd windows and cursor windowVPBE_OSD_OSDWIN1MD  = 0;VPBE_OSD_RECTCUR= 0;VPBE_OSD_VIDWIN0OFST = width >> 4;VPBE_OSD_VIDWIN0ADR = video_buffer;VPBE_OSD_BASEPX= basep_x;VPBE_OSD_BASEPY= basep_y;VPBE_OSD_VIDWIN0XP  = 0;VPBE_OSD_VIDWIN0YP  = 0;VPBE_OSD_VIDWIN0XL  = width;VPBE_OSD_VIDWIN0YL  = height >> 1;VPBE_OSD_MISCCTL= 0;VPBE_OSD_VIDWINMD= 0x00000003;// Disable vwindow 1 and enable vwindow 0// Frame mode with no up-scaling/**  Setup VENC*/if ( ntsc_pal_mode == NTSC )VPBE_VENC_VMOD  = 0x00000003;// Standard NTSC interlaced outputelseVPBE_VENC_VMOD  = 0x00000043;// Standard PAL interlaced outputVPBE_VENC_VDPRO= colorbar_loopback_mode << 8;VPBE_VENC_DACTST= 0;VPBE_VENC_DACSEL= 0x00004210;/**  Choose Output mode*/if ( output_mode == COMPOSITE_OUT )VPBE_VENC_DACSEL = 0x00000000;else if ( output_mode == SVIDEO_OUT )VPBE_VENC_DACSEL = 0x00004210;
}


/* ------------------------------------------------------------------------ *
 **
 *  video_loopback_test( )*
 **
 **
 **
 * ------------------------------------------------------------------------ */
Int16 video_loopback_test( )
{Int16 ntsc_pal_mode;Int16 output_mode;Uint32 video_capture_buffer = (DDR_BASE + ( DDR_SIZE / 2 ));Uint32 video_display_buffer = (DDR_BASE + ( DDR_SIZE / 2 ) + ( DDR_SIZE / 4 ));Uint32 buffer_size;EVMDM6437_DIP_init( );do{/* Check Video Settings *///ntsc_pal_mode = EVMDM6437_DIP_get( JP1_JUMPER );// NTSC/PAL//output_mode= EVMDM6437_DIP_get( SW7_SWITCH );// SVideo/Composite
		ntsc_pal_mode = PAL;		//zq change
		output_mode= COMPOSITE_OUT;		//zq changeif ( ntsc_pal_mode == NTSC ){buffer_size = 720 * 480 * 2;if ( output_mode == COMPOSITE_OUT )printf( "Video Loopback test: [NTSC][COMPOSITE]\n" );else if ( output_mode == SVIDEO_OUT )printf( "Video Loopback test: [NTSC][S-VIDEO]\n" );elsereturn -1;}else if ( ntsc_pal_mode == PAL ){	buffer_size = 720 * 576 * 2;if ( output_mode == COMPOSITE_OUT )printf( "Video Loopback test:  [PAL][COMPOSITE]\n" );else if ( output_mode == SVIDEO_OUT )printf( "Video Loopback test:  [PAL][S-VIDEO]\n" );elsereturn -1;}elsereturn -2;/* Setup Front-End */tvp5146_init( ntsc_pal_mode, output_mode);vpfe_init( ntsc_pal_mode, video_capture_buffer );/* Setup Back-End */vpbe_init( LOOPBACK, ntsc_pal_mode, output_mode, video_capture_buffer);/* Wait for the USER to press something useful */while ( 1 ){EVMDM6437_I2C_GPIO_waitForIntr( -1 );
/*if ( EVMDM6437_DIP_get( JP1_JUMPER ) != ntsc_pal_mode )break;if ( EVMDM6437_DIP_get( SW7_SWITCH ) != output_mode )break;*/		//zq change}} while ( 1 );return 0;
}
显示器显示类似这样。。。什么情况呀,是代码哪里错了吗?

Junxian ZENG:

用的是tvp5146

/**Copyright 2006 by Spectrum Digital Incorporated.*All rights reserved. Property of Spectrum Digital Incorporated.*//**TVP5146 Video Decoder**/#include "tvp5146.h"Uint8 rom_version;
Uint8 chipid_msb;
Uint8 chipid_lsb;/* ------------------------------------------------------------------------ ****tvp5146_rset****Set codec register regnum to value regval**** ------------------------------------------------------------------------ */
void tvp5146_rset( Uint8 regnum, Uint8 regval )
{Uint8 cmd[2];cmd[0] = regnum;// 8-bit Register Addresscmd[1] = regval;// 8-bit Register DataEVMDM6437_I2C_write( TVP5146_I2C_ADDR, cmd, 2 );
}/* ------------------------------------------------------------------------ ****tvp5146_rget****Return value of codec register regnum**** ------------------------------------------------------------------------ */
Uint8 tvp5146_rget( Uint8 regnum )
{Uint8 cmd[2];cmd[0] = regnum;// 8-bit Register Addresscmd[1] = 0;// 8-bit Register DataEVMDM6437_I2C_write( TVP5146_I2C_ADDR, cmd, 1 );EVMDM6437_I2C_read ( TVP5146_I2C_ADDR, cmd, 1 );return cmd[0];
}/* ------------------------------------------------------------------------ ****tvp5146_init( )****Initialize the TVP5146**** ------------------------------------------------------------------------ */
void tvp5146_init( Uint32 ntsc_pal_mode, Uint32 input_mode )
{rom_version = tvp5146_rget( 0x70 );chipid_msb= tvp5146_rget( 0x80 );chipid_lsb= tvp5146_rget( 0x81 );_waitusec( 1000 );// wait 1 msecif ( rom_version < 8 ){tvp5146_rset( 0xE8, 0x02 );// Initalize TVP5146, must do after power ontvp5146_rset( 0xE9, 0x00 );// Skip if using TVP5146-M2tvp5146_rset( 0xEA, 0x80 );tvp5146_rset( 0xE0, 0x01 );tvp5146_rset( 0xE8, 0x60 );tvp5146_rset( 0xE9, 0x00 );tvp5146_rset( 0xEA, 0xB0 );tvp5146_rset( 0xE0, 0x01 );tvp5146_rset( 0xE0, 0x00 );_waitusec( 1000 );// wait 1 msec}switch( input_mode ){case SVIDEO_IN:tvp5146_rset( 0x00, 0x46 ); // Input Video: S-video: VI_2_C(Y) VI_1_C(C)break;case COMPONENT_IN:tvp5146_rset( 0x00, 0x05 ); // Input Video: CVBS : VI_2_Bbreak;}switch( ntsc_pal_mode ){case NTSC:tvp5146_rset( 0x02, 0x01 );break;case PAL:tvp5146_rset( 0x02, 0x02 );break;}tvp5146_rset( 0x34, 0x11 );// Enabling clock & Y/CB/CR input format_waitusec( 1000 );// wait 1 msec
}

Chris Meng:

回复 Junxian ZENG:

Zeng,

你贴的代码像是spectrum digital给EVM写的测试代码,请问你有做什么修改么?

Junxian ZENG:

回复 Chris Meng:

没修改过呀,是不是就是只能显示这么大。。。

Chris Meng:

回复 Junxian ZENG:

Zeng,

你使用的板子是spectrum digital的DM6437 EVM么?

Junxian ZENG:

回复 Chris Meng:

是的,

Chris Meng:

回复 Junxian ZENG:

Zeng,

如果是TI官方的EVM,建议不要修改代码,根据提示配置jumper,看输出是否正常。

       //ntsc_pal_mode = EVMDM6437_DIP_get( JP1_JUMPER );    // NTSC/PAL

        //output_mode   = EVMDM6437_DIP_get( SW7_SWITCH );    // SVideo/Composite
        ntsc_pal_mode = PAL;        //zq change
        output_mode   = COMPOSITE_OUT;      //zq change

Junxian ZENG:

回复 Chris Meng:

找到原因了,我用的是CCS6.0的工程却链接的是以前3.3的库,我改回新的库就可以全屏显示了,谢谢

赞(0)
未经允许不得转载:TI中文支持网 » 用的TMS320DM6437,接显示器显示不完整什么情况呀,各位大大
分享到: 更多 (0)