DM642,DM643视频采集基本架构--程序注释
落鹤生 发布于 2010-01-15 21:40 点击: 995次 |
来自:hi.baidu.com |
本文以实际代码的方式介绍TI德州仪器的DM642,DM643视频采集基本架构。
DM642,DM643视频采集基本架构--程序注释
-
-
-
-
-
-
- #include <std.h> //如果使用C语言,必须将此文件作为第一个头文件。
- #include <tsk.h>
- #include <sem.h>
- #include <gio.h>
- #include <csl_dat.h>
- #include <csl_cache.h> //使用CSL库,要用到的一些头文件,可参考CSL
- #include <fvid.h> //视频驱动头文件
- #include <edc.h>
- #include <vport.h>
- #include <vportcap.h>
- #include <vportdis.h>
- #include <saa7105.h>
- #include <tvp51xx.h>
- #include <dec643.h> //芯片头文件。
-
-
- #include <evmdm642_capParamsSDTVDefault.h> //捕获设备配置文件
- #include <evmdm642_disParamsVGADefault.h> //如用VGA显示,需要的显示设备配置文件
- #include "colorbar.h" //如显示彩色滚动条,需要,否则不需要。
-
- VPORT_PortParams EVMDM642_vCapParamsPort
- = EVMDM642_CAP_PARAMS_PORT_EMBEDDED_DEFAULT;
-
-
-
-
-
-
-
- static VPORTCAP_Params EVMDM642_vCapParamsChan
- = EVMDM642_CAP_PARAMS_CHAN_EMBEDDED_DEFAULT(PAL720);
-
-
- static TVP51XX_ConfParams EVMDM642_vCapParamsTVP51XX
- = EVMDM642_CAP_PARAMS_TVP51XX_EMBEDDED_DEFAULT(PAL601, COMPOSITE, 0);
-
-
- static const short coeffs[5] = {0x2543, 0x3313, -0x0C8A, -0x1A04, 0x408D};
-
-
-
- VPORT_PortParams EVMDM642_vDisParamsPort
- = EVMDM642_DIS_PARAMS_PORT_DEFAULT;
-
-
-
-
-
-
- static VPORTDIS_Params EVMDM642_vDisParamsChan
- = EVMDM642_DIS_PARAMS_CHAN_RGB565_DEFAULT(VGA);
-
-
- static SAA7105_ConfParams EVMDM642_vDisParamsSAA7105
- = EVMDM642_DIS_PARAMS_SAA7105_RGB565_DEFAULT(VGA);
-
-
- extern Int EXTERNALHEAP;
-
-
-
-
- main()
- {
-
-
-
- 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);
- }
-
-
-
-
-
-
- void tskVideoLoopback()
- {
- Int i;
- Int status;
- Int frames = 0;
- FVID_Handle disChan;
- FVID_Frame *disFrameBuf;
- FVID_Handle capChan;
- FVID_Frame *capFrameBuf;
-
-
- Int numLinesDis = EVMDM642_vDisParamsChan.imgVSizeFld1;
-
-
- Int numLinesCap = (EVMDM642_vCapParamsChan.fldYStop1 -
- EVMDM642_vCapParamsChan.fldYStrt1+1)*2;
-
-
- Int numLines = (numLinesDis > numLinesCap) ? numLinesCap : numLinesDis;
-
-
- Int numPixels = (EVMDM642_vCapParamsChan.fldXStop1 -
- EVMDM642_vCapParamsChan.fldXStrt1+1);
-
-
- Int capLinePitch = (EVMDM642_vCapParamsChan.fldXStop1 -
- EVMDM642_vCapParamsChan.fldXStrt1+1);
-
-
- Int disLinePitch = EVMDM642_vDisParamsChan.imgHSizeFld1;
-
-
-
-
-
-
- EVMDM642_vDisParamsChan.segId = EXTERNALHEAP;
- EVMDM642_vDisParamsSAA7105.hI2C = DEC643_I2C_hI2C;
- EVMDM642_vCapParamsChan.segId = EXTERNALHEAP;
- EVMDM642_vCapParamsTVP51XX.hI2C = DEC643_I2C_hI2C;
-
-
-
-
- capChan = FVID_create("/VP1CAPTURE/A/1",
- IOM_INPUT, &status, (Ptr)&EVMDM642_vCapParamsChan, NULL);
-
-
-
-
- disChan = FVID_create("/VP2DISPLAY", IOM_OUTPUT,
- &status, (Ptr)&EVMDM642_vDisParamsChan, NULL);
-
-
-
-
- FVID_control(disChan, VPORT_CMD_EDC_BASE + EDC_CONFIG,
- (Ptr)&EVMDM642_vDisParamsSAA7105);
- FVID_control(capChan, VPORT_CMD_EDC_BASE + EDC_CONFIG,
- (Ptr)&EVMDM642_vCapParamsTVP51XX);
- CACHE_clean(CACHE_L2ALL, 0, 0);
-
-
-
-
- FVID_control(disChan, VPORT_CMD_START, NULL);
- FVID_control(capChan, VPORT_CMD_START, NULL);
-
-
-
-
- FVID_alloc(disChan, &disFrameBuf);
- FVID_alloc(capChan, &capFrameBuf);
- frames ++;
- while(1)
- {
-
-
-
- for(i = 0; i < numLines; i++)
- {
- yc2rgb16(coeffs, capFrameBuf->frame.iFrm.y1 + i * (capLinePitch),
- capFrameBuf->frame.iFrm.cb1 + (capLinePitch >> 1) * i,
- capFrameBuf->frame.iFrm.cr1 + (capLinePitch >> 1) * i,
- disFrameBuf->frame.rpFrm.buf + (disLinePitch << 1) * i,
- numPixels);
- }
-
- FVID_exchange(capChan, &capFrameBuf);
-
-
-
-
-
- CACHE_clean(CACHE_L2ALL, 0, 0);
- FVID_exchange(disChan, &disFrameBuf);
-
- frames ++;
- }
- }
|
-
转载于:https://www.cnblogs.com/itxiaocaiyidie/p/3219286.html