⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video_disp.c

📁 DM642视频采集回放实验例程 包含全部代码 学习DM642的朋友必看
💻 C
字号:
/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) DDK 1.10.00.23 07-02-03 (ddk-b12)" */
#include <std.h>
#include <tsk.h>  
#include <sem.h>   
#include <gio.h>

#include <csl_dat.h>
#include <csl_cache.h>


#include <fvid.h>
#include <edc.h>
#include <vport.h>
//#include <vportcap.h>
#include <vportdis.h>
#include <saa7104.h>
//#include <tvp5150a.h>    

#include <dm642.h>

#include "colorbarRGB.h"
//#include "evmdm642_vcapparams.h"
#include "evmdm642_vdisparams.h"   

/* heap IDs defined in the BIOS configuration file */
extern Int EXTERNALHEAP;
#ifdef _LOOPBACK
static const  short coeffs[5] = {0x2543, 0x3313, -0x0C8A, -0x1A04, 0x408D};
#endif

/*
 * ======== main ========
 */
main()
{
    /******************************************************/
    /* open CSL DAT module for fast copy                  */
    /******************************************************/
    CSL_init();                                             
    CACHE_clean(CACHE_L2ALL, 0, 0);
    CACHE_setL2Mode(CACHE_256KCACHE);       
    CACHE_enableCaching(CACHE_EMIFA_CE00);
    CACHE_enableCaching(CACHE_EMIFA_CE01);
    DAT_open(DAT_CHAANY, DAT_PRI_LOW, DAT_OPEN_2D);

}

/*
 * ======== tskVideoLoopback ========
 * video loopback function.
 */
void tskVideoLoopback()
{
    Int status;
    FVID_Handle disChan; 
    Int frames = 0;
    FVID_Frame *disFrameBuf;
//   Int numLinesDis = EVMDM642_vDisParamsChan.imgVSizeFld1;
    //Int numLinesCap = EVMDM642_vCapParamsChan.fldYStop1 -
    //   EVMDM642_vCapParamsChan.fldYStrt1+1;

    
   // Int numLines = (numLinesDis > numLinesCap) ? numLinesCap : numLinesDis;
  

 
   // numLines *= 2; /* both fields */
    /******************************************************/
    /* allocate both capture and display frame buffers    */
    /* in external heap memory                            */
    /******************************************************/
        //EVMDM642_vCapParamsChan.segId = EXTERNALHEAP;
        EVMDM642_vDisParamsChan.segId = EXTERNALHEAP;
        EVMDM642_vDisParamsSAA7104.hI2C = EVMDM642_I2C_hI2C;
       // EVMDM642_vCapParamsTVP5150A.hI2C = EVMDM642_I2C_hI2C;

   
    /******************************************************/
    /* initialization of display driver                   */
    /******************************************************/
    disChan = FVID_create("/VP1DISPLAY", IOM_OUTPUT, 
        &status, (Ptr)&EVMDM642_vDisParamsChan, NULL);

    
    /******************************************************/
    /* configure video encoder & decoder                  */
    /******************************************************/
    FVID_control(disChan, VPORT_CMD_EDC_BASE + EDC_CONFIG, 
        (Ptr)&EVMDM642_vDisParamsSAA7104);

    //EVMDM642_rset(0x10, 0x20); /* unlock DLL */
    //EVMDM642_rset(0x10, 0x00); /* set FPGA in 16-bit mode */
    //while(!(EVMDM642_rget(0x13) & 0x40)); /* wait until DLL is locked */


    /******************************************************/
    /* start capture & display operation                  */    
    /******************************************************/
    FVID_control(disChan, VPORT_CMD_START, NULL);

    
    /********************************************************/
    /* request a frame buffer from display & capture driver */
    /********************************************************/
    FVID_alloc(disChan, &disFrameBuf);

    frames ++;


    while(1){/* loop forever */

        FillFrmBufRGB(&disFrameBuf->frame.rpFrm, EVMDM642_vDisParamsChan.imgHSizeFld1,
            EVMDM642_vDisParamsChan.imgVSizeFld1, frames %(EVMDM642_vDisParamsChan.imgHSizeFld1 >> 3));

        CACHE_clean(CACHE_L2ALL, 0, 0);
        FVID_exchange(disChan, &disFrameBuf); 
        
        frames ++;              
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -