I have a hardware where DM6435 is connected to host processor through BT.656. interface. VPFE CCDC[7:0] are connected to host processor that outputs 8-bit UYVY format BT.656 video.
I am currently using video loopback application from PSP package(psp_1_10_03) located at pspdrivers_1_10_03\packages\ti\sdo\pspdrivers\system\dm6437\bios\evmDM6437\video\sample\build\loopback. I have removed configuration and usage of VPBE completely. I have also removed registeration of TVP5146 functions that are used for configuration of TVP5146 video decoder.
I have modified VPFE video driver such that it doesn't return error if external decoder configuration functions are not set.
There frame buffer that I get after FVID_exchange is having all zeros. Please suggest if any other changes are required in driver of application.
Following is the application code that configures VPFE and tries to capture video:
/*******************************************************************************
**+--------------------------------------------------------------------------+**
**| **** |**
**| **** |**
**| ******o*** |**
**| ********_///_**** |**
**| ***** /_//_/ **** |**
**| ** ** (__/ **** |**
**| ********* |**
**| **** |**
**| *** |**
**| |**
**| Copyright (c) 2006-2010 Texas Instruments Incorporated |**
**| ALL RIGHTS RESERVED |**
**| |**
**| Permission is hereby granted to licensees of Texas Instruments |**
**| Incorporated (TI) products to use this computer program for the sole |**
**| purpose off implementing a licensee product based on TI products. |**
**| No other rights to reproduce, use, or disseminate this computer |**
**| program, whether in part or in whole, are granted. |**
**| |**
**| TI makes no representation or warranties with respect to the |**
**| performance of this computer program, and specifically disclaims |**
**| any responsibility for any damages, special or consequential, |**
**| connected with the use of this program. |**
**| |**
**+--------------------------------------------------------------------------+**
*******************************************************************************/
/** \file psp_bios_vpss_loopback_sample.c
*
* \brief This file contains the test / demo code to demonstrate the
* VPSS driver implemented using the GIO Framework Architecture
*
* This file test the VPSS Front End and Back End Driver.It performs
* loopback application.It captures Image from CCDC and give the captured
* Image to the Back End.Here Front End and Back End Driver work
* simulanteously.
*
* (C) Copyright 2010, Texas Instruments, Inc
*
* \author PSP Team
*
* \version 0.1 Created
*/
/****************************************************************************
HEADER FILE INCLUSION
*****************************************************************************/
#include <std.h>
#include <gio.h>
#include <log.h>
#include <ti/sdo/pspdrivers/system/dm6437/bios/evmDM6437/video/fvid.h>
#include <ti/sdo/pspdrivers/system/dm6437/bios/evmDM6437/video/fvid_evmDM6437.h>
#include <ti/sdo/pspdrivers/drivers/vpfe/psp_vpfe.h>
#include <ti/sdo/pspdrivers/drivers/vpbe/psp_vpbe.h>
#include <ti/sdo/pspdrivers/system/dm6437/bios/evmDM6437/video/psp_tvp5146_extVidDecoder.h>
#include <ti/sdo/pspdrivers/pal_os/bios/psputils.h>
/****************************************************************************
MACROS DEFINED
*****************************************************************************/
#define VPSS_DBG PSP_DEBUG
#define NO_OF_BUFFERS (4u)
/*Global Variable Defined */
static FVID_Frame *CcdcallocFB[NO_OF_BUFFERS]={NULL};
static FVID_Frame *VidallocFB[NO_OF_BUFFERS] ={NULL};
static FVID_Handle CcdcHandle;
static FVID_Handle Vid0Handle;
static FVID_Handle VencHandle;
#define IMAGE_WIDTH (704)
#define IMAGE_HEIGHT (480)
static PSP_VPFE_TVP5146_ConfigParams tvp5146Params =
{
TRUE, /* enable656Sync */
PSP_VPFE_TVP5146_FORMAT_COMPOSITE, /* format */
PSP_VPFE_TVP5146_MODE_AUTO /* mode */
};
static PSP_VPFECcdcConfigParams ccdcParams =
{
FVID_VI_BT656_8BIT, /* dataFlow */
FVID_FRAME_MODE, /* ffMode */
IMAGE_HEIGHT, /* height */
IMAGE_WIDTH, /* width */
(IMAGE_WIDTH *2), /* pitch */
0, /* horzStartPix */
0, /* vertStartPix */
NULL, /* appCallback */
{
NULL, /* extVD Fxn */
NULL,
NULL,
},
0 /*segId */
};
static PSP_VPBEOsdConfigParams vid0Params =
{
FVID_FRAME_MODE, /* ffmode */
FVID_BPP_BITS16, /* bitsPerPixel */
FVID_YCbCr422_INTERLEAVED, /* colorFormat */
(720 * (16/8u)), /* pitch */
0, /* leftMargin */
0, /* topMargin */
720, /* width */
480, /* height */
0, /* segId */
PSP_VPBE_ZOOM_IDENTITY, /* hScaling */
PSP_VPBE_ZOOM_IDENTITY, /* vScaling */
PSP_VPBE_EXP_IDENTITY, /* hExpansion */
PSP_VPBE_EXP_IDENTITY, /* vExpansion */
NULL /* appCallback */
};
static PSP_VPBEVencConfigParams vencParams =
{
PSP_VPBE_DISPLAY_NTSC_INTERLACED_COMPOSITE /* Display Standard */
};
static void vpss_main()
{
PSP_VPBEChannelParams beinitParams;
PSP_VPFEChannelParams feinitParams;
GIO_Attrs gioAttrs = GIO_ATTRS;
FVID_Frame *FBAddr = NULL;
Uint32 i = 0;
Uint32 NumOfIterations = 1000;
VPSS_DBG("VPSS: Loopback Application Started \r\n");
/**
* Create Ccdc Channel
**/
feinitParams.id = PSP_VPFE_CCDC;
feinitParams.params = (PSP_VPFECcdcConfigParams*)&ccdcParams;
CcdcHandle = FVID_create("/VPFE0",IOM_INOUT,NULL,&feinitParams,&gioAttrs);
if(NULL == CcdcHandle)
{
VPSS_DBG("VPSS :CCDC Create.......FAILED \r\n");
VPSS_DBG("VPSS :End of VPSS Loopback Application\r\n");
return;
}
/**
* Configure the TVP5146 Video Decoder
**/
/*
if(IOM_COMPLETED != FVID_control(CcdcHandle,
VPFE_ExtVD_BASE+PSP_VPSS_EXT_VIDEO_DECODER_CONFIG,
&tvp5146Params))
*/
/*
if(IOM_COMPLETED != FVID_control(CcdcHandle,
PSP_VPFE_IOCTL_START_CCDC,
NULL))
{
VPSS_DBG("VPSS :Error in Configuring Video Decoder \r\n");
}
else
{*/
for (i=0;i<NO_OF_BUFFERS;i++)
{
if(IOM_COMPLETED == FVID_allocBuffer(CcdcHandle,&CcdcallocFB[i]))
{
if(IOM_COMPLETED != FVID_queue(CcdcHandle,CcdcallocFB[i]))
{
VPSS_DBG("VPSS :CCDC Queuing.......FAILED \r\n");
}
}
}
//}
/**
* Create Video Channel
**/
/*
beinitParams.id = PSP_VPBE_VIDEO_0;
beinitParams.params = (PSP_VPBEOsdConfigParams *)&vid0Params;
Vid0Handle = FVID_create("/VPBE0",IOM_INOUT,NULL,&beinitParams,&gioAttrs);
if(NULL == Vid0Handle)
{
VPSS_DBG("VPSS :VIDE0 -0 Create.......FAILED \r\n");
VPSS_DBG("VPSS :End of VPSS Loopback Application\r\n");
return;
}
else
{
for (i=0;i<NO_OF_BUFFERS;i++)
{
if(IOM_COMPLETED == FVID_allocBuffer(Vid0Handle,&VidallocFB[i]))
{
if(IOM_COMPLETED != FVID_queue(Vid0Handle,VidallocFB[i]))
{
VPSS_DBG("VPSS :Video 0 Queuing.......FAILED \r\n");
}
}
}
}
*/
/**
* Create Venc Channel
**/
/*
beinitParams.id = PSP_VPBE_VENC;
beinitParams.params = (PSP_VPBEVencConfigParams *)&vencParams;
VencHandle = FVID_create("/VPBE0",IOM_INOUT,NULL,&beinitParams,&gioAttrs);
if (NULL == VencHandle)
{
VPSS_DBG("VPSS :Venc Create ... FAILED!\r\n");
VPSS_DBG("VPSS :End of VPSS Loopback Application\r\n");
return;
}
*/
VPSS_DBG("VPSS :VPSS Loopback Started \r\n");
FVID_allocBuffer(CcdcHandle, &FBAddr);
if(IOM_COMPLETED != FVID_control(CcdcHandle,
PSP_VPFE_IOCTL_START_CCDC,
NULL))
{
VPSS_DBG("VPSS :Error in Configuring Video Decoder \r\n");
}
for(i = 0; i < NumOfIterations; i++)
{
CcdcallocFB[i % NO_OF_BUFFERS] = FBAddr;
if(IOM_COMPLETED != FVID_exchange(CcdcHandle,&FBAddr))
{
VPSS_DBG("VPSS :CCDC Exchange.......FAILED \r\n");
}
VidallocFB[i % NO_OF_BUFFERS] = FBAddr;
/*
if(IOM_COMPLETED != FVID_exchange(Vid0Handle,&FBAddr))
{
VPSS_DBG("VPSS :Video -0 Exchange.......FAILED \r\n");
}
*/
}
/**
* Delete Channels
**/
FVID_delete(CcdcHandle);
/*
FVID_delete(Vid0Handle);
FVID_delete(VencHandle);
*/
/**
* Free Memory
**/
MEM_free(0,FBAddr->frame.frameBufferPtr,(720*480*2));
MEM_free(0,FBAddr,sizeof(FVID_Frame));
for(i = 0; i < NO_OF_BUFFERS; i++)
{
/* Capture */
MEM_free(0,CcdcallocFB[i]->frame.frameBufferPtr,(720*480*2));
MEM_free(0,CcdcallocFB[i],sizeof(FVID_Frame));
/* Display */
MEM_free(0,VidallocFB[i]->frame.frameBufferPtr,(720*480*2));
MEM_free(0,VidallocFB[i],sizeof(FVID_Frame));
}
VPSS_DBG("VPSS: Loopback Application Ended \r\n");
}
void start_vpss_test()
{
vpss_main();
}