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

📄 capvp.h

📁 基于TMS320DM642实现的视频采集程序。
💻 H
字号:
/*
 * mini-driver command word.
 */
#define CAPVP_CMD_EDC_BASE  0x80000000

#define CAPVP_CMD_GET		IOM_USER + 1
#define CAPVP_CMD_PUT		IOM_USER + 2
#define CAPVP_CMD_EXCHANGE	IOM_USER + 3

#define CAPVP_CMD_STARTCAP	IOM_USER + 10
#define CAPVP_CMD_STOPCAP	IOM_USER + 11

/******************************************************************************
 * Binding of external device control function tables to the video port       *
 * is done when _mdBindDev() is called at system initialization time.         *
 * A statically defined EDC function table is passed to the _mdBindDev()      *
 * function via the "devParam" argument. This argument must point to a        *
 * type of data structure that is defined below                               *
 *****************************************************************************/
typedef enum ChanMode{
	SINGLE,
	DUAL
}ChanMode;

typedef enum CtlActivePol{
	HIGH,
	LOW
}CtlActivePol;

typedef struct CapVP_Params{
    ChanMode		chanMode;	/* vprot dual channel mode select 			 */
    CtlActivePol    vctl1Pol;   /* vport control pin 1 active polarity select*/
    CtlActivePol    vctl2Pol;   /* vport control pin 2 active polarity select*/
    CtlActivePol    vctl3Pol;   /* vport control pin 3 active polarity select*/
    EDC_Fxns*   	edcFxns[2]; /* function tables for edc modules 			 */
}CapVP_Params;

/******************************************************************************
 * Describe the action of the channel created by GIO_create().		      	  *
 * When create a channel you should pass the parameters of the channel     	  *
 * to GIO module or INV. But if the parameter is INV, you should config		  *
 * the channel befor start the channel.										  *
 *****************************************************************************/
#define VP_CAP_SINGLE		0x00000000
#define VP_CAP_CONTINUOUS	0x00000001

typedef struct CapChan_Params{
    Uns	 	capMode;    		/* capture mode settings   					 */ 
    Uns	 	conCap;				/* continuous capture enable bit			 */
    Uns  	scale;    			/* indicate whether to enable 1/2 scaling 	 */
    Uns  	resmpl;   			/* indicate whether to enable sub-sampling   */
    Uns  	bpkMode; 			/* 10-bit bit-pack mode                   	 */
    Uns  	hCtRstMode;   		/* horizontal counter reset mode             */         
    Uns  	vCtRstMode;   		/* vertical counter reset mode               */
    Uns  	fldDectMode;  		/* field detect mode						 */
    Uns  	synModeSel; 		/* enable external timing control            */
    Uns  	fldModeSel;   		/* enable inversion of the detected fid      */    

    Short 	fld1XStart;  		/* field 1 X start 							 */
    Short   fld1YStart; 		/* field 1 Y start 							 */
    Short 	fld1XStop; 			/* field 1 X stop  							 */    
    Short 	fld1YStop;  		/* field 1 Y stop  				 			 */
    Short 	fld2XStart;  		/* field 2 X start 							 */
    Short 	fld2YStart;  		/* field 2 Y start 							 */
    Short 	fld2XStop;  		/* field 2 X stop  							 */
    Short 	fld2YStop;  		/* field 2 Y stop  							 */	
    Short 	fld1Thrld;     		/* field 1 video FIFO threshold 			 */
	Short 	fld2Thrld;     		/* field 1 video FIFO threshold 			 */
	
	Uns		edmaIRQid;			/* edma interrupt request number			 */
	Int		heapSegIid;			/* heap segment id where buf manager malloced*/	
	Int		heapSegSid;			/* heap segment id where video buf malloced  */
	Int		vBufCnt;			/* video buf cout							 */
}CapChan_Params;

/******************************************************************************
 * Video data buffer manager												  *
 *****************************************************************************/
#define	VP_YCBR_CHAN_CNT	0x00000003
#define	VP_VBUF_IS_EMPTY	0x00000000
#define	VP_VBUF_IS_FULL		0x00000001

typedef struct CapChan_YCrbBufElem{
	Char	*ycbr[VP_YCBR_CHAN_CNT];				/* Y Cb Cr buffer pointer*/
}CapChan_YCrbBufElem;

typedef struct CapChan_VideoBufElem{
    QUE_Elem        		linkQue; 				/* for queuing 			 */
	Char					bufSt[VP_YCBR_CHAN_CNT];/* Y Cb Cr buffer status */
    CapChan_YCrbBufElem		ycrbBuf;    		/* yuv frame buffer      */
}CapChan_VideoBufElem;

/******************************************************************************
 * Video port channel manager												  *
 *****************************************************************************/
#define VP_EDMA_CHAN_CNT 	0x00000003
#define VP_CAPTURE_FRAME	0x00000000
#define VP_CAPTURE_FIELD1	0x00000001
#define VP_CAPTURE_FIELD2	0x00000002

typedef struct CapChan_Elem{
	Ptr						hCapVP;
	
	Uns						chanid;
	Uns						baseAddr;
	Uns						yCbrSrcAddr;
	
    Uns        				edmaChanid[VP_EDMA_CHAN_CNT];
    EDMA_Handle         	hEdma[VP_EDMA_CHAN_CNT];
	EDMA_Config				edmaCfg[VP_EDMA_CHAN_CNT];
    Int                 	edmaTcc[VP_EDMA_CHAN_CNT];
	Bool					edmaConfigFlg;

	QUE_Elem				vEmptyBufQue;
	QUE_Elem				vFillingBufQue;
	QUE_Elem				vFullBufQue;
	QUE_Elem				vEmptingBufQue;
	Uns						vCapScope;
	Uns						vConCap;	
	Bool					vSnapStarted;
	Uns						vFld1YBufSz;
	Uns						vFld2YBufSz;
	Uns						vFramYBufSz;
	Uns						vFld1Cnt[VP_YCBR_CHAN_CNT];	//Y Cb Cr
	Uns						vFld2Cnt[VP_YCBR_CHAN_CNT];	//Y Cb Cr
	Uns						vFramCnt[VP_YCBR_CHAN_CNT];	//Y Cb Cr
	
	QUE_Elem				iomPktQue;
	
	EDC_Handle				hEDC;
	EDC_Fxns				*edcFxns;
		
    IOM_TiomCallback    	cbFxn;
    Arg                 	cbArg;
    	
	Int						heapSegIid;
	Int						heapSegSid;
}CapChan_Elem, *CapChan_Handle;

/******************************************************************************
 * Video port manager													  	  *
 *****************************************************************************/
#define	VP_STATUS_UNUSED		0x00000000
#define	VP_STATUS_OPENED		0x00000001
#define	VP_STATUS_CHAOPENED		0x00000002
#define	VP_STATUS_CHBOPENED		0x00000004
#define	VP_STATUS_CHASUPPORT	0x00000008
#define	VP_STATUS_CHBSUPPORT	0x00000010

#define	VP_SUPCMODE_NONE		0x00000000
#define VP_CHAN_CNT        		0x00000002

typedef struct CapVP_Elem{
	Uns				status;
	Uns				supCMode;
	Uns				baseAddr;
	CapChan_Elem	capChan[VP_CHAN_CNT];
}CapVP_Elem, *CapVP_Handle;

/*****************************************************************************/

⌨️ 快捷键说明

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