📄 mt9t001_init.c
字号:
/*
* Copyright 2004 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.
*
*/
#include "MT9T001_init.h"
/*
Initialize the EDC configuration structure for Capture
*/
void MT9T001_configCapParams(VPORTCAP_Params *chan, MT9T001_Params *params, Uint16 rowsize, Uint16 colsize, Uint16 horizblank, Uint16 vertblank, Uint16 shutterwidth)
{
params->rowsize = rowsize - 1;
params->colsize = colsize - 1;
params->horizblank = horizblank;
params->vertblank = vertblank;
params->shutterwidth = shutterwidth;
chan->fldXStop1 = colsize - 1;
chan->fldYStop1 = rowsize;
chan->fldXStop2 = colsize - 1;
chan->fldYStop2 = rowsize;
chan->thrld = (colsize);
}
/*
Initialize the EDC configuration structure with color gain values
*/
void MT9T001_configColorGain(MT9T001_Params *params, Uint16 redA, Uint16 redD, Uint16 greenA, Uint16 greenD, Uint16 blueA, Uint16 blueD, Uint16 globalA, Uint16 globalD, Uint16 blacklevel)
{
/****************************************
MT9T001 Register Variable Declarations
****************************************/
/*************************************************/
typedef struct GREEN1GAIN {
unsigned int analog :7;
unsigned int d7 :1;
unsigned int digital :7;
unsigned int d15 :1;
} s_Green1Gain;
typedef union {
Uint16 data;
Uint8 byte[2];
s_Green1Gain flds;
} MT9T001_Green1Gain;
/*************************************************/
typedef struct BLUEGAIN {
unsigned int analog :7;
unsigned int d7 :1;
unsigned int digital :7;
unsigned int d15 :1;
} s_BlueGain;
typedef union {
Uint16 data;
Uint8 byte[2];
s_BlueGain flds;
} MT9T001_BlueGain;
/*************************************************/
typedef struct REDGAIN {
unsigned int analog :7;
unsigned int d7 :1;
unsigned int digital :7;
unsigned int d15 :1;
} s_RedGain;
typedef union {
Uint16 data;
Uint8 byte[2];
s_RedGain flds;
} MT9T001_RedGain;
/*************************************************/
typedef struct GREEN2GAIN {
unsigned int analog :7;
unsigned int d7 :1;
unsigned int digital :7;
unsigned int d15 :1;
} s_Green2Gain;
typedef union {
Uint16 data;
Uint8 byte[2];
s_Green2Gain flds;
} MT9T001_Green2Gain;
/*************************************************/
typedef struct GLOBALGAIN {
unsigned int analog :7;
unsigned int d7 :1;
unsigned int digital :7;
unsigned int d15 :1;
} s_GlobalGain;
typedef union {
Uint16 data;
Uint8 byte[2];
s_GlobalGain flds;
} MT9T001_GlobalGain;
/*************************************************/
typedef struct BLACKLEVEL {
unsigned int d0_d1 :2;
unsigned int level :10;
unsigned int d12_d15 :4;
} s_BlackLevel;
typedef union {
Uint16 data;
Uint8 byte[2];
s_BlackLevel flds;
} MT9T001_BlackLevel;
/*************************************************/
MT9T001_Green1Gain Green1Gain_reg;
MT9T001_BlueGain BlueGain_reg;
MT9T001_RedGain RedGain_reg;
MT9T001_Green2Gain Green2Gain_reg;
MT9T001_GlobalGain GlobalGain_reg;
MT9T001_BlackLevel BlackLevel_reg;
// initialize registers
RedGain_reg.data = 0;
BlueGain_reg.data = 0;
Green1Gain_reg.data = 0;
Green2Gain_reg.data = 0;
BlackLevel_reg.data = 0;
GlobalGain_reg.data = 0;
// Set RGB Gain Values
RedGain_reg.flds.analog = redA;
RedGain_reg.flds.digital = redD;
BlueGain_reg.flds.analog = blueA;
BlueGain_reg.flds.digital = blueD;
Green1Gain_reg.flds.analog = greenA;
Green1Gain_reg.flds.digital = greenD;
Green2Gain_reg.flds.analog = greenA;
Green2Gain_reg.flds.digital = greenD;
BlackLevel_reg.flds.level = blacklevel;
// Set global gain value
GlobalGain_reg.flds.analog = globalA;
GlobalGain_reg.flds.digital = globalD;
params->redgain = RedGain_reg.data;
params->bluegain = BlueGain_reg.data;
params->green1gain = Green1Gain_reg.data;
params->green2gain = Green2Gain_reg.data;
params->globalgain = GlobalGain_reg.data;
params->blacklevel = BlackLevel_reg.data;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -