这个文档介绍了在DM642EVM板上视频采集和显示微驱动的使用和设计。用EDMA进行存储器和视频端口的数据传输。为了增强代码的复用性和简化设计过程,驱动分为通用视频端口层和特定编解码芯片微驱动层两个部分。外部设备控制(EDC)接口将这两个部分以即插即用的方式联系在一起。

1 Overview


 
 
 

The DSP’sEDMA is used to transfer data between memory and the TMS320DM642Video Port.

Tomaximize code reuse and streamline the integration process, bothdrivers are designed of two distinctive parts:
the genericpart and the board specific part. The external devicecontrol interface (EDC) is defined to bind these two parts togetherin a plug-and-play manner.

The generic part of the drivers uses EDMAs totransfer data to and from the video ports.; The board-specific partmainly consists of code that in the case of the capture driver,initializes and configures the SAA7115
video decoder, and in thecase of the display driver, initializes and configures the SAA7105video encoder.These

EDC-compliant modules set up the video codecs towork together with the video ports to capture or display thedesired video data in a specific format. For example, the SAA7105can be configured
to output video data in composite NTSC format orcomponent High-Definition 1080i format or a wide range of othervideo formats, depending on application requirements. In the meantime, the associated video port must also be configuredaccordingly.

The board-specific part also requires the EVM andthe DM642 DSP to be initialized by calling the EVM642_init()function from the DM642 EVM Board Support Library (BSL),
whichcomes with the EVM. This will set up the EMIF, pin-muxconfigurations and the I2C controller. An application must link allthree libraries necessary in order to function correctly: one fromthe board-specific part, such as the SAA7115 or the SAA7105, onefrom
the generic VPORTCAP or VPORTDIS part, and one from the BSL.These three libraries are called
evm642_saa7115.l64, evm642_vportcap.l64, andevmdm642.l64, respectively for capture, and are calledevm642_saa7105.l64, evm642_vportdis.l64, and
evmdm642.l64, respectively fordisplay.

2 Usage

2.1 Configuration

To use the capture or display device driver, adevice entry must be added and configured in the DSP/BIOSconfiguration tool.

The following are the device configurationsettings required to use the
capture driver:

_
Init function:
N/A, not used by this driver

_
Function table ptr:
_VPORTCAP_Fxns

_
Function table type:
IOM_Fxns

_
Device id:
0 or 1 for DM642 EVM:, specify which video port touse

_
Device params ptr:
An optional pointer to an object of typeVPORT_PortParams as defined in the header file vport.h. Thispointer will point to a device parameter structure. Setting thispointer to NULL requires that
an additional FVID_control call madefrom the application to initialize the video port. The parameterstructure is described below. An example of this structure is the _EVM642_vCapParamsNTSCPort that is defined intheevm642_vcapParamsNTSC.c file for NTSC
format videocapture.

_
Device global data ptr:
N/A, not used by this driver

The following are the device configurationsettings required to use the
display driver:

_
Init function:
N/A, not used by this driver

_
Function table ptr:
_VPORTDIS_Fxns

_
Function table type:
IOM_Fxns

_
Device id:
2 for DM642 EVM: specify which video port is inuse

_
Device params ptr:
Same as for the capture driver

_
Device global data ptr:
N/A, not used by this

2.2 Device Parameters for Generic Part of theDriver

        通用视频端口部分的设备参数

2.2.1 Port Parameters      (vport.h

typedef struct VPORT_PortParams{

IntversionId;                  //Version
number of the driver.

BooldualChanEnab;            //Dual
channel mode enable (captureonly).

Unsvc1Polarity;      //polarity of the vctrl1 pin, either
active high oractive low

Unsvc2Polarity;     //polarity of the vctrl2 pin.

Unsvc3Polarity;       //vctrl3 pin.

EDC_Fxns*edcTbl[2];   //array of up to two pointers of EDC functiontables, one
for each channel.  EDC函数表的两个指针数组

}VPORT_PortParams;

2.2.2Capture Channel Parameters   (vportcap.h

typedefstruct {

Intcmode;   //
capture mode,

IntfldOp;   //
field and frame operation mode

Intscale;    //
horizontal
½
scaling enable

Intresmpl;   //
chroma horizontal 4:2:2 to 4:2:0 re-samplingenable

Int bpk10Bit; //10-bit packing mode,

InthCtRst;   //horizontal counter reset mode.

IntvCtRst;    //
vertical counter reset

IntfldDect;    //
field detection enable, only used in external syncmode

IntextCtl;      //
external sync mode enable.

IntfldInv;      //
field inverse enable.

Uint16 fldXStrt1; //
starting
pixelnumber of field 1 ,≥0。

Uint16 fldYStrt1; 
 //starting
line number of field 1,≥1

Uint16fldXStrt2;   //starting pixel number of field 2,≥0

Uint16fldYStrt2;   //starting line number of field 2.≥1

Uint16 fldXStop1;    //the last captured pixel of field one,≥
fldXStrt1

Uint16fldYStop1;     //the last captured line of field one,≥
fldYStrt1

Uint16 fldXStop2;

Uint16 fldYStop2;

Uint16 thrld; //specifies number of double-words required togenerate DMA events

IntnumFrmBufs;   //number of frame buffers to be allocated by driverto
store video data captured

Intalignment;    //
memory alignment requirement for framebuffers

IntmergeFlds;    //
indicate whether to merge field one and two or tokeep them separate in memory.

Int segId;  //DSP/BIOS memory segment ID, used by driver forframe buffer
allocation

IntedmaPri;      //
priority level of EDMA transfers

IntirqId;        //
EDMA interrupt
ID

}VPORTCAP_Params

The definitions of the bit-fields in the aboveparameter are mapped to the
video port capture controlregister. The unnamed fields are there to represent thereserved bits in that register.

2.2.3Display Channel Parameters  (vportdis.h

typedef struct {

Intdmode;    //display mode,

Int fldOp;

Intscale;     //horizontal 2x scaling enable

Intresmpl;

Int defValEn;  //default value output enable.

Int bpk10Bit;

Int vctl1Config; //VCTL1 pin output select.

Int vctl2Config;

Int vctl3Config;

IntextCtl;     //external control enable

Uint16 frmHSize; //horizontal size of the video frame, including
theblanking period视频帧的水平尺寸,包括消隐期

Uint16frmVSize;      //
垂直尺寸。包括消隐期

Int16 imgHOffsetFld1;//display image horizontal offset in
Field 1,relative to the end of horizontal blanking 显示图像在场1的水平偏移

Int16 imgVOffsetFld1; //在场1的垂直偏移

Uint16imgHSizeFld1;   //显示图像在场1的像素宽度

Uint16imgVSizeFld1;    //图像在场1的行高度

Int16 imgHOffsetFld2;

Int16 imgVOffsetFld2;

Uint16 imgHSizeFld2;

Uint16 imgVSizeFld2;

Uint16 hBlnkStart; //specifies the pixel number within
the line onwhich horizontal blanking starts/stop.

Uint16hBlnkStop;

Uint16 vBlnkXStartFld1;//specifies the pixel number on which
the verticalblanking starts for Field 1

Uint16 vBlnkYStartFld1;

Uint16 vBlnkXStopFld1;

Uint16 vBlnkYStopFld1;

Uint16 vBlnkXStartFld2;

Uint16 vBlnkYStartFld2;

Uint16 vBlnkXStopFld2;

Uint16 vBlnkYStopFld2;

Uint16 xStartFld1;

Uint16 yStartFld1;

Uint16 xStartFld2;

Uint16 yStartFld2;

Uint16 hSyncStart;

Uint16 hSyncStop;

Uint16 vSyncXStartFld1;

Uint16 vSyncYStartFld1;

Uint16 vSyncXStopFld1;

Uint16 vSyncYStopFld1;

Uint16 vSyncXStartFld2;

Uint16 vSyncYStartFld2;

Uint16 vSyncXStopFld2;

Uint16 vSyncYStopFld2;

Uint8 yClipLow;

Uint8 yClipHigh;

Uint8 cClipLow;

Uint8 cClipHigh;

Uint8 yDefVal;

Uint8 cbDefVal;

Uint8 crDefVal;

Int rgbX;

Int incPix;

Uint16 thrld;

Int numFrmBufs;       //number
of frame buffers to be allocated by driverto store video data captured

Int alignment;

Int mergeFlds;

Int segId;

Int edmaPri;

Int irqId;

}VPORTDIS_Params;

2.2.4
Video Port Global Interrupt Processing

typedef struct VPORT_VIntCbParams{

Int cbArg;

VPORT_IntCallBack vIntCbFxn;

Uint16 vIntMask;

Uint16 vIntLine;

Int irqId;

Uns intrMask;

} VPORT_VIntCbParams;

2.2.5Commands

The following are implemented run-time commandsdefined in vport.h:

VPORT_CMD_RESET:
resets video port

VPORT_CMD_CONFIG_PORT:
configures video port

VPORT_CMD_CONFIG_CHAN:
configures a video channel

VPORT_CMD_START:
starts capture or display operation

VPORT_CMD_STOP:
stops capture or display operation

VPORT_CMD_SET_VINTCB:
setup video port global interruptcall-back

VPORT_CMD_DUND_RECOVER:
force video port to recover from displayunder-run

VPORT_CMD_COVR_RECOVER:
force video port to recover from captureover-run

2.3 Device Parameters for Board Specific Part ofthe Drivers

特定编解码芯片驱动的设备参数

2.3.1 TheExternal Device Control (EDC) Interface

As showed in Figure 2, thecapture and display mini-drivers consist of the following twoparts:

•The generic part, which is designed to work as is withdifferent external video codecs and board layouts. All of itsdependencies lies within the DM642 device. For example, thevportdis.c file in
the display mini-driver library, can be reusedwithout any code change with different video encoders on differentcustomer boards.

•The board specific part, whichonly works with specific video encoders or decoders on a specificboard. For example, the SAA7105.c file in the display mini-driverlibrary,
only works with the Phillips SAA7105 video encoder on theDM642 EVM. Source code changes may be needed even if the sameencoder is used on a different board.        The EDC interface is defined toallow seamless integration of these
two parts in order to maximizecode reuse and minimize possible errors in the integration process.It defines a set of APIs that a board-specific part of themini-driver must implement in order to work with the genericpart.

#define EDC_CONFIG0x00000001

#define EDC_RESET0x00000002

#define EDC_START0x00000003

#define EDC_STOP0x00000004

#define EDC_GET_CONFIG0x00000005

#define EDC_GET_STATUS0x00000006

#define EDC_USER0x10000000

#define EDC_SUCCESS0

#define EDC_FAILED−1

typedef void*EDC_Handle;

typedef struct EDC_Fxns{

EDC_Handle(*open)(String name, Arg optArg);

Int (*close)(PtrdevHandle);

Int (*ctrl)(PtrdevHandle, Uns cmd, Arg arg);

} EDC_Fxns;

2.3.2 SAA7105Parameters

2.3.3 SAA7115Parameters

2.3.4 String NamingConvention in FVID_create()

3Architecture

3.1 BlockDiagram


3.2 Buffer Management

3.3 Cache Coherency

It is the application’s responsibility to ensurecache coherency, as the driver does nothing in this respect.This is because data istypically moved by EDMA between fast
on-chip SRAM and slow off-chipSD-RAM for faster CPU access. Furthermore, algorithmscan use ping-pong buffer schemes to parallel the EDMA transfer andthe CPU execution, thus hiding most or all overhead associated withthe data movement. If this
is the case, cache flush and cleanoperations can be avoided by aligning the frame buffers to cacheline boundaries.

However, if the application does access thesebuffers directly, the application must flush or clean the cache toensure cache coherency, the EDMA accesses external memory directlythrough the EMIF, while the CPU goes through the cache whenaccessing
the data.

4 Constraints

This device driver does not support the followingmodes:

• Raw data capture

• Dual-channel synchronized raw-data display

• Synchronized to another video port

• Capture of MPEG transport stream

【DM642学习笔记六】TI参考文档--DM642 Video Port Mini Driver的更多相关文章

  1. SpringBoot学习笔记:Swagger实现文档管理

    SpringBoot学习笔记:Swagger实现文档管理 Swagger Swagger是一个规范且完整的框架,用于生成.描述.调用和可视化RESTful风格的Web服务.Swagger的目标是对RE ...

  2. JavaScript学习笔记7 之DOM文档对象模型

    一.什么是DOMDocument Object Model 文档 -------对象 ----模型-------缩写DOM DOM是针对HTML和XML文档的一个API(应用程序编程接口).DOM描绘 ...

  3. AngularJS1.X学习笔记14-动画(解读文档)

    最近在看算法分析,那个大O啊,小o啊,分治法啊(目前就看到这里),真是搞死了.这回呢休息一下,学学AngularJS动画,上一篇文章根据自由男人的书简单谈到了动画的话题,发现反响很大(好吧,我说慌了, ...

  4. MongoDB学习笔记四—增删改文档下

    $slice 如果希望数组的最大长度是固定的,那么可以将 $slice 和 $push 组合在一起使用,就可以保证数组不会超出设定好的最大长度.$slice 的值必须是负整数. 假设$slice的值为 ...

  5. MongoDB学习笔记三—增删改文档上

    插入insert 单条插入 > db.foo.insert({"bar":"baz"}) WriteResult({ }) 批量插入 > db.fo ...

  6. HTML&CSS基础学习笔记1.4-定义文档类型

    Web 世界中存在许多不同的文档.只有了解文档的类型,浏览器才能正确地显示文档. HTML 也有多个不同的版本,只有完全明白页面中使用的确切 HTML 版本,浏览器才能完全正确地显示出 HTML 页面 ...

  7. 《DOM Scripting》学习笔记-——第八章 充实文档的内容

    本章内容 一.一个为文档创建“缩略词语表”的函数 二.一个为文档创建“文献来源链接”的函数 三.一个为文档创建“快速访问键清单”的函数 利用DOM动态的收集和创建一些有用的辅助信息,并把它们呈现在网页 ...

  8. MongoDB快速入门学习笔记3 MongoDB的文档插入操作

    1.文档的数据存储格式为BSON,类似于JSON.MongoDB插入数据时会检验数据中是否有“_id”,如果没有会自动生成.shell操作有insert和save两种方法.当插入一条数据有“_id”值 ...

  9. latex学习笔记----基本知识、文档排版

    1.空格和制表符等空白字符视为相同的空白距离,多个连续的空白字符等同为一个字符. 2.#  $  %  ^  _    {   }  ~ 在这些字符前面加上反斜线,就可以在文本中得到它们. 反斜线\不 ...

随机推荐

  1. IntelliJ IDEA更换主题样式分享

    原文地址:https://blog.csdn.net/liu865033503/article/details/79481785 .自定义主题样式网址:http://www.riaway.com/in ...

  2. 02.万恶之源-python 运算符和编码

    一.流程控制语句if: 第一种语法: (最基本的语法) if 条件: 代码块/结果1 结果2 # 如果条件是真(True)执行结果为1,然后结果为2,如果条件为错(False), 直接结果2. 第二种 ...

  3. ie9 jscript7 内存不足 页面无响应

    花了我差不多一天时间 我是加载一个datagrid ,多表联查,查询几遍(不一定,又是1遍就死了)后 就卡死了...后台日志都是过的.... 后来我发现数据库某个表的数据很多有一模一样的两条,把一份删 ...

  4. jquery对于ajax的封装

    第一层封装 $.ajax({ 属性名:值,属性名:值}) /* url: 请求服务器地址 data:请求参数 dataType:服务器返回数据类型 error 请求出错执行的功能 success 请求 ...

  5. 【LGP5437】【XR-2】约定

    题目 显然每一条边出现在生成树中的方案数是相等的 根据矩阵树定理,\(n\)个节点的完全图生成树个数是\(n^{n-2}\)种,完全图共有\(\frac{n(n-1)}{2}\)条边,一棵生成树共\( ...

  6. iOS逆向系列-逆向APP思路

    界面分析 通过Cycript.Reveal. 对于Reveal安装配置可参考配置iOS逆向系列-Reveal 通过Reveal找到内存中的UI对象 静态分析 开发者编写的所有代码最终编译链接到Mach ...

  7. printk函数

    一个不同是 printk 允许你根据消息的严重程度对其分类, 通过附加不同的记录级别或者 优先级在消息上. 你常常用一个宏定义来指示记录级别. 例如, KERN_INFO, 我们之前曾 在一些打印语句 ...

  8. 继承Activity和View

    1,当你自定一个继承自view的视图A之后, 如果你在一个继承自Activity的组件B中需要使用A里面的一些方法,如果在B中需要使用A中的一些方法好像不可以直接使用. 需要在B中使用setConte ...

  9. MQTT入门介绍

    一简述 MQTT(Message Queuing Telemetry Transport,消息队列遥测传输协议),是一种基于发布/订阅(publish/subscribe)模式的"轻量级&q ...

  10. php7 mysql_pconnect() 缺失 解决方法

    php7 兼容 MySQL 相关函数 PHP7 废除了 ”mysql.dll” ,推荐使用 mysqli 或者 pdo_mysql http://PHP.net/manual/zh/mysqlinfo ...