This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

using dvsdk example to config 5150 based 6437

Other Parts Discussed in Thread: TVP5146, TVP5150

    Hello,I am using DM6437 development board.I use  video_preview.pjt of DVSDK . but  TI use A/D is TVP5146,and I use TVP5150,I don't know how to modify the code.please help.

   the 5150 addr = 0xB8.

I blocked the code about 5146,and config the 5150's register.but I can't get the image.

 

#define tvp5150_I2C_ADDR 0x5c

unsigned char *y,*u,*v,*temp;
static CSL_SysctlRegsOvly sysModuleRegs = (CSL_SysctlRegsOvly )CSL_SYS_0_REGS;
void tvp5150_init( );
void tvp5150_rset( Uint8 regnum, Uint8 regval );
/*
 * ======== main ========
 */
void main() {

    printf("Video Preview Application\n");
    fflush(stdout);

    /* Initialize BSL library to read jumper switches: */
    EVMDM6437_DIP_init();
    sysModuleRegs -> PINMUX0    &= (0x005482A3u);
    sysModuleRegs -> PINMUX0    |= (0x005482A3u);

    /* PCIEN    =   0: PINMUX1 - Bit 0 */
    sysModuleRegs -> PINMUX1 &= (0xFFFFFFFEu);
    sysModuleRegs -> VPSSCLKCTL = (0x18u);

    tvp5150_init( );//add he

return;
}

/*
 * ======== video_preview ========
 */
void video_preview(void) {

  FVID_Frame *frameBuffTable[FRAME_BUFF_CNT];
  FVID_Frame *frameBuffPtr;
  GIO_Handle hGioVpfeCcdc;
  GIO_Handle hGioVpbeVid0;
  GIO_Handle hGioVpbeVenc;
  int status = 0;
  int result;
  int i;
  int standard;
  int width;
  int height;

  /* Set video display/capture driver params to defaults */
 PSP_VPFE_TVP5146_ConfigParams tvp5146Params =
       VID_PARAMS_TVP5146_DEFAULT;
   
  PSP_VPFECcdcConfigParams      vpfeCcdcConfigParams =
       VID_PARAMS_CCDC_DEFAULT_D1;
  PSP_VPBEOsdConfigParams vpbeOsdConfigParams =
       VID_PARAMS_OSD_DEFAULT_D1;
  PSP_VPBEVencConfigParams vpbeVencConfigParams;

  standard = STANDARD_NTSC;//read_JP1();
 
  /* Update display/capture params based on video standard (PAL/NTSC) */
  if (standard == STANDARD_PAL)  {
       width  = 720;
       height = 576;
       vpbeVencConfigParams.displayStandard = PSP_VPBE_DISPLAY_PAL_INTERLACED_COMPOSITE;
  }
  else {
       width  = 720;
       height = 480;
       vpbeVencConfigParams.displayStandard = PSP_VPBE_DISPLAY_NTSC_INTERLACED_COMPOSITE;
  }
  vpfeCcdcConfigParams.height = vpbeOsdConfigParams.height = height;
  vpfeCcdcConfigParams.width = vpbeOsdConfigParams.width = width;
  vpfeCcdcConfigParams.pitch = vpbeOsdConfigParams.pitch = width * 2;

  /* init the frame buffer table */
  for (i=0; i<FRAME_BUFF_CNT; i++) {
    frameBuffTable[i] = NULL;
  }

  /* create video input channel */
  if (status == 0) {
    PSP_VPFEChannelParams vpfeChannelParams;
    vpfeChannelParams.id     = PSP_VPFE_CCDC;
    vpfeChannelParams.params = (PSP_VPFECcdcConfigParams*)&vpfeCcdcConfigParams;
    hGioVpfeCcdc = FVID_create("/VPFE0",IOM_INOUT,NULL,&vpfeChannelParams,NULL);
    status = (hGioVpfeCcdc == NULL ? -1 : 0);
  }

  /* create video output channel, plane 0 */
  if (status == 0) {
    PSP_VPBEChannelParams vpbeChannelParams;
    vpbeChannelParams.id     = PSP_VPBE_VIDEO_0;
    vpbeChannelParams.params = (PSP_VPBEOsdConfigParams*)&vpbeOsdConfigParams;
    hGioVpbeVid0 = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams,NULL);
    status = (hGioVpbeVid0 == NULL ? -1 : 0);
  }

  /* create video output channel, venc */
  if (status == 0) {
    PSP_VPBEChannelParams vpbeChannelParams;
    vpbeChannelParams.id     = PSP_VPBE_VENC;
    vpbeChannelParams.params = (PSP_VPBEVencConfigParams *)&vpbeVencConfigParams;
    hGioVpbeVenc = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams,NULL);
    status = (hGioVpbeVenc == NULL ? -1 : 0);
  }

  /* configure the TVP5146 video decoder */
 /* if (status == 0) {
    result = FVID_control(hGioVpfeCcdc, VPFE_ExtVD_BASE+PSP_VPSS_EXT_VIDEO_DECODER_CONFIG, &tvp5146Params);
    status = (result == IOM_COMPLETED ? 0 : -1);
  }*/
 tvp5150_init( );
  /* allocate some frame buffers */
  if (status == 0) {
    for (i=0; i<FRAME_BUFF_CNT && status == 0; i++) {
      result = FVID_allocBuffer(hGioVpfeCcdc, &frameBuffTable[i]);
      status = (result == IOM_COMPLETED && frameBuffTable[i] != NULL ? 0 : -1);
    }
  }

  /* prime up the video capture channel */
  if (status == 0) {
    FVID_queue(hGioVpfeCcdc, frameBuffTable[0]);
    FVID_queue(hGioVpfeCcdc, frameBuffTable[1]);
    FVID_queue(hGioVpfeCcdc, frameBuffTable[2]);
  }

  /* prime up the video display channel */
  if (status == 0) {
    FVID_queue(hGioVpbeVid0, frameBuffTable[3]);
    FVID_queue(hGioVpbeVid0, frameBuffTable[4]);
    FVID_queue(hGioVpbeVid0, frameBuffTable[5]);
  }

  /* grab first buffer from input queue */
  if (status == 0) {
    FVID_dequeue(hGioVpfeCcdc, &frameBuffPtr);
  }

  /* loop forever performing video capture and display */
  while ( status == 0 ) {

    /* grab a fresh video input frame */
    FVID_exchange(hGioVpfeCcdc, &frameBuffPtr);
 temp = frameBuffPtr->frame.frameBufferPtr;


 printf("test\n");
    /* display the video frame */
    FVID_exchange(hGioVpbeVid0, &frameBuffPtr);

  }

}

 tvp5150_init( )
{
   //DAVINCIEVM_waitusec( 1000 );        // wait 1 msec

    //DAVINCIEVM_waitusec( 1000 );        // wait 1 msec
// tvp5150_rset( 0x05, 0x01 );
// tvp5150_rset( 0x05, 0x00 );
 _waitusec( 1000 );
    tvp5150_rset( 0x00, 0x00 );         // Input Video: CVBS   : VI_2_B
   // tvp5150_rset( 0x01, 0x15 );
 //tvp5150_rset( 0x02, 0x00 );
    tvp5150_rset( 0x03, 0x6d);
    //tvp5150_rset( 0x03, 0x6d );         // NTSC
 //tvp5150_rset( 0x04, 0x00);
 //tvp5150_rset( 0x05, 0x00 );
 //tvp5150_rset( 0x06, 0x10 );
 //tvp5150_rset( 0x07, 0x20 );
 //tvp5150_rset( 0x08, 0x00 );
 tvp5150_rset( 0x09, 0x8B);
 tvp5150_rset( 0x0a, 0x80 );
 tvp5150_rset( 0x0b, 0x00 );
 //tvp5150_rset( 0x0c, 0x80 );
    tvp5150_rset( 0x0D, 0x07 );         // Enabling clock & Y/CB/CR input format
 //tvp5150_rset( 0x0e, 0x00 );
 tvp5150_rset( 0x0F, 0x02 );
 //tvp5150_rset( 0x11, 0x00 );
 //tvp5150_rset( 0x12, 0x00 );
 //tvp5150_rset( 0x13, 0x00 );
 //tvp5150_rset( 0x14, 0x00 );
 tvp5150_rset( 0x15, 0x05 );
 //tvp5150_rset( 0x16, 0x80 );
 //tvp5150_rset( 0x18, 0x00 );
 //tvp5150_rset( 0x19, 0x00 );
 //tvp5150_rset( 0x1a, 0x0c );
 tvp5150_rset( 0x1B, 0x14 );
 //tvp5150_rset( 0x1c, 0x00 );
 //tvp5150_rset( 0x1d, 0x00 );
// tvp5150_rset( 0x1e, 0x00 );
// tvp5150_rset( 0x28, 0x00 );


// temp = tvp5150_rget(0x01);

    _waitusec( 1000 );        // wait 1 msec
}

void tvp5150_rset( Uint8 regnum, Uint8 regval )
{
 Uint16 temp;
    Uint8 cmd[2];
    cmd[0] = regnum;    // 8-bit Register Address
    cmd[1] = regval;    // 8-bit Register Data

    temp=EVMDM6437_I2C_write( tvp5150_I2C_ADDR, cmd, 2);
}

 

 

 

  • YunFei,

    Could you please mention which BIOS PSP version is being used?

    Thanks and Regards,

    Sandeep K

  • the BIOS PSP version is psp_1_00_02_00,I don't konw how to modify the code,help me.

  • YunFei,

    Follow the steps to add the support for tvp5150: 

    1. By refering to psp_tvp5146_extVidDecoder.h [in the path : psp_1_00_02_00\pspdrivers\inc] and tvp5146_extdecoder.c [in the path : psp_1_00_02_00\pspdrivers\system\dm6437\bios\dm6437_evm\src\video\src], please generate a file psp_tvp5150_extVidDecoder.h and tvp5150_extdecoder.c. During this, according to the feature supported by the tvp5150, the structure/macros has to be defined.

    These two file contains the all the configuration related to A/D.

    2. In the sample application, the structure PSP_VPFE_TVP5150_ConfigParams (which should be defined in the generated psp_tvp5150_extVidDecoder.h file) should be populated as per the requirement.

    3. In the sample application, the structure "PSP_VPFECcdcConfigParams" has to be populated according to the functions defined in the tvp5150_extdecoder.c

    This could be like,

    static PSP_VPFECcdcConfigParams ccdcParams =
    {
        FVID_CCDC_YCBCR_8,                  /* dataFlow     */
        FVID_FRAME_MODE,                    /* ffMode       */
        480,                                /* height       */
        720,                                /* width        */
        (720 *2),                           /* pitch        */
        0,                                  /* horzStartPix */
        0,                                  /* vertStartPix */
        NULL,                               /* appCallback  */
        {
            PSP_VPFE_TVP5150_Open,         /* extVD Fxn    */
            PSP_VPFE_TVP5150_Close,
            PSP_VPFE_TVP5150_Control,
        },
        0                                   /*segId         */
    };

    These are the important steps to support whenever a new decoder is introduced. The step 1 is going to take quite amout of time, since it needs proper understanding of decoder and has to be implemeted in the source file.

    Please let me know the result.

    Thanks and Regards,

    Sandeep K

  • Hello!  

    conifg the 5150,I can capture the video,But I can't display it .

    I don't config them about VPFE,VPBE.  why?

    a part of code:

     if (status == 0) {
        PSP_VPBEChannelParams vpbeChannelParams;
        vpbeChannelParams.id     = PSP_VPBE_VIDEO_0;
        vpbeChannelParams.params = (PSP_VPBEOsdConfigParams*)&vpbeOsdConfigParams;
        hGioVpbeVid0 = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams,NULL);
        status = (hGioVpbeVid0 == NULL ? -1 : 0);
      }

      /* create video output channel, venc *///这里可能需要修改
      if (status == 0) {
        PSP_VPBEChannelParams vpbeChannelParams;
        vpbeChannelParams.id     = PSP_VPBE_VENC;
        vpbeChannelParams.params = (PSP_VPBEVencConfigParams *)&vpbeVencConfigParams;//这里配置了5146的参数
        hGioVpbeVenc = FVID_create("/VPBE0",IOM_INOUT,NULL,&vpbeChannelParams,NULL);
        status = (hGioVpbeVenc == NULL ? -1 : 0);
      }

     if (status == 0) {
        for (i=0; i<FRAME_BUFF_CNT && status == 0; i++) {
          result = FVID_allocBuffer(hGioVpfeCcdc, &frameBuffTable[i]);
          status = (result == IOM_COMPLETED && frameBuffTable[i] != NULL ? 0 : -1);
        }
      }

     

     if (status == 0) {
        FVID_queue(hGioVpfeCcdc, frameBuffTable[0]);
        FVID_queue(hGioVpfeCcdc, frameBuffTable[1]);
        FVID_queue(hGioVpfeCcdc, frameBuffTable[2]);
      }
     printf("status=%x\n",status);
      /* prime up the video display channel */
      if (status == 0) {
        FVID_queue(hGioVpbeVid0, frameBuffTable[3]);
        FVID_queue(hGioVpbeVid0, frameBuffTable[4]);
        FVID_queue(hGioVpbeVid0, frameBuffTable[5]);
      }
     printf("status=%x\n",status);
      /* grab first buffer from input queue */
      if (status == 0) {
        FVID_dequeue(hGioVpfeCcdc, &frameBuffPtr);
      } 

     

     while(1)

    {

     status = FVID_exchange(hGioVpfeCcdc, &frameBuffPtr);

    FVID_exchange(hGioVpbeVid0, &frameBuffPtr);

    }

  • could you say it clearly??and if I generate the files,something was "_PSP_VPFE_TVP5150_Open "undefined  ,so what should I do ??thanks a lot.