📄 sensor.c
字号:
#include "v558api.h"
#include "v558def.h"
//version:041203
//================================================
//
// HOST CTRL information
//
//================================================
const V558_CTRL_INFO CtrlInfo =
{
"Ctrl module",
V558_BUS_TYPE,
{1, 1, 3},
{12000, 24000, 1, 1}
};
//================================================
//
// IPP information
//
//================================================
V558_FILTERPARM FilterParm[] =
{
{
32, 0, //max, min
62, 52, 32, 13
},
{
83, 33, //max, min
96, 64, 16, 0
},
{
108, 83, //max, min
128, 64, 0, 0
},
{
128, 108, //max, min
160, 48, 0, 0
}
};
const V558_IPPINFO IppInfo =
{
"IPP module",
1,
0x80, 0x80, 0x80,
0xc0, 0x40,
0x60, 0x00, 0xffff,
sizeof(FilterParm) / sizeof(V558_FILTERPARM),
FilterParm,
{0,0},
{640,480},
640,
128
};
const V558_JPEGINFO JpegInfo =
{
"Jpeg module",
0x78, //qf
0x81, //tcr
0, //tcr en
0, //res
0x1000, //twc
40 //thumbwidth
};
//================================================
//
// ISP information
//
//================================================
#if SELECT_HYNIX7131GP_BAYER
const V558_SENSORREGVALUE SifRegVal[] =
{
// {0x800, 0x24, 1},
// {0x800, 0x25, 1},
// {0x805, 0x0, 0},
// {0x806, 0x1, 0},
{0x801, 0x01, 0},
{0x803, 0x0b, 0},
{0x804, 0x05, 0},
{0x814, 0x00, 0},
{0x815, 0x4, 0},
{0x816, 0x2, 0},
{0x817, 0x7f, 0},
{0x820, 0x0, 0},
{0x821, 0x0, 0},
{0x822, 0x1, 0},
{0x823, 0xe0, 0},
{0x81c, 0x0, 0},
{0x81d, 0x1, 0},
{0x81e, 0x0, 0},
{0x81f, 0x8, 0},
{0x840, 0x1, 0},
{0x841, 0xd0, 0},
{0x842, 0x1, 0},
{0x843, 0xe0, 0}
// {0x800, 0x27, 0}
};
const V558_SENSORREGVALUE SensorRegVal[] =
{
{0x01, 0x00, 1},
{0x03, 0x02, 1},
{0x0c, 0x01, 1},
{0x0d, 0xe6, 1},
{0x0e, 0x02, 1},
{0x0f, 0x86, 1},
{0x17, 0x10, 1},
{0x21, 0x8c, 1},
{0x22, 0x8c, 1},
{0x23, 0x8c, 1},
{0x30, 0x01, 1},
{0x31, 0x40, 1},
{0x60, 0x38, 1},
{0x61, 0x00, 1},
{0x70, 0x40, 1},
{0x63, 0x09, 0},
{0x64, 0x27, 0},
{0x65, 0xc0, 0}
};
const V558_SENSORREGVALUE IspRegVal[] =
{
{0x2001, 0x7f, 0},
{0x2027, 0x20, 0},
{0x2026, 0x80, 0},
{0x2010, 0x40, 0},
{0x2011, 0x01, 0},
{0x2012, 0xf0, 0},
{0x2013, 0x00, 0},
{0x2014, 0x29, 0},
{0x200a, 0x40, 0},
{0x200b, 0x60, 0},
{0x200c, 0x05, 0},
{0x200d, 0x0f, 0},
{0x200e, 0x0f, 0},
{0x200f, 0x0f, 0},
{0x2022, 0x60, 0},
{0x2023, 0x40, 0},
{0x2024, 0x40, 0},
{0x202c, 0x4a, 0},
{0x202d, 0x0e, 0},
{0x202e, 0xe9, 0},
{0x202f, 0xed, 0},
{0x2030, 0x50, 0},
{0x2031, 0x00, 0},
{0x2032, 0xf5, 0},
{0x2033, 0xd5, 0},
{0x2034, 0x70, 0},
{0x2000, 0x21, 0},
{0x208b, 0xff, 0},
// {0x208c, 0xff, 0},
// {0x208d, 0xff, 0},
{0x2081, 0x01, 0}
};
const V558_SENSORINFO SensorInfo =
{
"Hynix7131gp bayer mode",
{640, 480},
0, //bayer mode
0x1, //pixel rate
0x0, //sensor mast clock count
12000, //sif clock
V558_SNRC_I2C,
HYNIX7131GP_BAYER,
{1,1,0,0,1},
{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
{0, 0x22, 0, sizeof(SensorRegVal) / sizeof(V558_SENSORREGVALUE), SensorRegVal},
{
0x0, sizeof(IspRegVal) / sizeof(V558_SENSORREGVALUE),
IspRegVal,
{
//tgt, yfldstp,lck,ulck,gain,gadly,gmax,gainrange[4],yfldmstp,steptime,inlck, gmin, etdem, etnum,reserved1,2,3;
{0x78, 0x40, 0x0a, 0x14, 0x60, 1, 0xe0, {0x20, 0x20, 0xb, 0x10}, 0x20, 4, 0, 0x40, 4, 3, 0, 0, 0}, //ae
//flkcnt,flklinemode,flkstep,flklst,outthd,lighttype,freqtype,timeinout,reserved1,2
{0x39 ,0x1 ,0x0 ,0xd0 ,3 ,0 ,FREQ , 98, 0, 0}, //aflk
//enae,enflk,intfrq,maxexp,defexp,minexp,exppoint,dpcthd,enlight,reserved1,2
1, AUTO_FLK, 0 ,2500 ,400 ,80 ,1000 ,1000 ,1 ,0,0
},
{
//brightness,contrast
32, 32 //brightness
},
{
0x00,0x13,0x38,0x59,0x79,0x92,0xa7,0xb9,0xc8,0xd4,0xdf,0xe7,0xee,0xf4,0xf9,0xfc,0xff //gamma table
}
}
};
/********************************************************************************
Description: Write sensor register to change exposure time
Parameter: t -- exposure time clock num
*********************************************************************************/
void V558_SifSetSnrTime(UINT8 freqtype, UINT32 t)
{
V558_I2C_BATCH AeData;
AeData.RegBytes = 3;
AeData.RegAddr = 0x63;
AeData.RegVal[0]= (UINT8)(t>>16);
AeData.RegVal[1]= (UINT8)(t>>8);
AeData.RegVal[2]= (UINT8)t;
V558_SifI2cAeBatch(1, &AeData);
}
/********************************************************************************
Description: Write sensor register when change freq
Parameter: freqflag -- freq type (0)50hz,else 60hz
*********************************************************************************/
void V558_SifSetFlkParam(UINT8 freqflag)
{
}
#endif
#if SELECT_HYNIX7131GP_YUV
const V558_SENSORREGVALUE SifRegVal[] =
{
// {0x800, 0x64, 1},
// {0x800, 0x65, 1},
// {0x805, 0x01, 0},
// {0x806, 0x01, 0},
{0x802, 0x00, 0},
{0x801, 0x01, 0},
{0x803, 0x0b, 0},
{0x804, 0x05, 0},
{0x814, 0x00, 0},
{0x815, 0x00, 0},
{0x816, 0x02, 0},
{0x817, 0x80, 0},
{0x820, 0x00, 0},
{0x821, 0x00, 0},
{0x822, 0x01, 0},
{0x823, 0xe0, 0},
{0x81c, 0x00, 0},
{0x81d, 0x01, 0},
{0x81e, 0x00, 0},
{0x81f, 0x02, 0},
// {0x800, 0x67, 0}
};
const V558_SENSORREGVALUE SensorRegVal[] =
{
{0x01, 0x03, 1},
{0x03, 0x00, 1},
//windows
{0x0b, 0x00, 1},
{0x0c, 0x01, 1},
{0x0d, 0xe0, 1},
{0x0e, 0x02, 1},
{0x0f, 0x80, 1},
{0x31, 0x29, 1},
{0x14, 0x10, 1},
{0x15, 0x10, 1},
{0x16, 0x10, 1},
{0x17, 0x1c, 1},
{0x18, 0x0a, 1},
{0x19, 0x38, 1},
{0x1a, 0x12, 1},
{0x1b, 0x37, 1},
{0x21, 0x90, 1},
{0x22, 0x90, 1},
{0x23, 0x90, 1},
{0x60, 0xb9, 1},
{0x6a, 0x00, 1},
{0x6b, 0xea, 1},
{0x6c, 0x60, 1},
{0x6d, 0x06, 1},
{0x6e, 0x1a, 1},
{0x6f, 0x80, 1},
{0x66, 0x70, 1},
{0x67, 0xf6, 1},
{0x76, 0x20, 1},
{0x77, 0x75, 1},
{0x80, 0x0a, 1},
{0x81, 0x24, 1},
{0x8a, 0xe9, 1},
{0x8b, 0x28, 1},
{0x90, 0x01, 1},
//color matrix
{0x34, 0x41, 1},
{0x35, 0xc9, 1},
{0x36, 0xf6, 1},
{0x37, 0x0c, 0},
{0x38, 0x31, 0},
{0x39, 0x04, 0},
{0x3a, 0xf9, 1},
{0x3b, 0xba, 1},
{0x3c, 0x4d, 1},
//gamma
{0x40, 0x00, 1},
{0x41, 0x04, 1},
{0x42, 0x12, 1},
{0x43, 0x21, 1},
{0x44, 0x37, 1},
{0x45, 0x55, 1},
{0x46, 0x6b, 1},
{0x47, 0x7d, 1},
{0x48, 0xb4, 1},
{0x49, 0xdd, 1},
{0x50, 0x40, 1},
{0x51, 0x4b, 1},
{0x52, 0x3c, 1},
{0x53, 0x2c, 0},
{0x54, 0x1e, 0},
{0x55, 0x16, 0},
{0x56, 0x12, 1},
{0x57, 0x0e, 1},
{0x58, 0x0a, 1},
{0x59, 0x09, 1},
};
const V558_SENSORREGVALUE IspRegVal[] =
{
{0x00, 0x00, 1},
};
const V558_SENSORINFO SensorInfo =
{
"Hynix7131gp yuv mode",
{640, 480},
1, //bayer mode
0x1, //pixel rate
0x1, //sensor mast clock count
12000, //sif clock
V558_SNRC_I2C,
HYNIX7131GP_YUV,
{1,1,0,0,1},
{sizeof(SifRegVal) / sizeof(V558_SENSORREGVALUE), SifRegVal},
{0, 0x22, 0, sizeof(SensorRegVal) / sizeof(V558_SENSORREGVALUE), SensorRegVal},
{
0x0, sizeof(IspRegVal) / sizeof(V558_SENSORREGVALUE),
IspRegVal,
{
//tgt, yfldstp,lck,ulck,gain,gadly,gmax,gainrange[4],yfldmstp,steptime,inlck, gmin, etdem, etnum,reserved1,2,3;
{0x78, 0x40, 0x0a, 0x14, 0x60, 1, 0xe0, {0x20, 0x20, 0xb, 0x10}, 0x20, 4, 0, 0x20, 4, 3, 0, 0, 0}, //ae
//flkcnt,flklinemode,flkstep,flklst,outthd,lighttype,freqtype,timeinout,reserved1,2
{0x39 ,0x1 ,0x0 ,0xd0 ,3 ,0 ,FREQ , 98, 0, 0}, //aflk
//enae,enflk,intfrq,maxexp,defexp,minexp,exppoint,dpcthd,enlight,reserved1,2
1, AUTO_FLK, 0 ,1000 ,400 ,80 ,1000 ,1000 ,1 ,0,0
},
{
32, 32 //brightness
},
{
0x00,0x13,0x38,0x59,0x79,0x92,0xa7,0xb9,0xc8,0xd4,0xdf,0xe7,0xee,0xf4,0xf9,0xfc,0xff //gamma table
}
}
};
/********************************************************************************
Description: Write sensor register to change exposure time
Parameter: t -- exposure time clock num
*********************************************************************************/
void V558_SifSetSnrTime(UINT8 freqtype, UINT32 t)
{
}
/********************************************************************************
Description: Write sensor register when change freq
Parameter: freqflag -- freq type (0)50hz,else 60hz
*********************************************************************************/
void V558_SifSetFlkParam(UINT8 freqflag)
{
}
#endif
#if SELECT_FUJITSU_MBS03
const V558_SENSORREGVALUE SifRegVal[] =
{
// {0x800, 0x64, 1},
// {0x800, 0x65, 1},
// {0x805, 0x01, 0},
// {0x806, 0x01, 0},
{0x803, 0x1b, 0},
{0x804, 0x04, 0},
{0x801, 0x05, 0},
{0x802, 0x00, 0},
{0x814, 0x00, 0},
{0x815, 0x00, 0},
{0x816, 0x02, 0},
{0x817, 0x7f, 0},
{0x820, 0x00, 0},
{0x821, 0x01, 0},
{0x822, 0x01, 0},
{0x823, 0xe1, 0},
// {0x81c, 0x00, 0},
// {0x81d, 0x01, 0},
// {0x81e, 0x00, 0},
// {0x81f, 0x08, 0},
// {0x800, 0x67, 0}
};
const V558_SENSORREGVALUE SensorRegVal[] =
{
{0x1, 0x00, 1},
{0x2, 0x00, 1},
{0x3, 0x00, 1},
{0x4, 0x83, 1},
{0x5, 0x03, 1},
{0x6, 0x00, 1},
{0x7, 0xc4, 1},
{0x8, 0x20, 1},
{0x9, 0x18, 1},
{0xa, 0x00, 1},
{0xb, 0x00, 1},
{0xc, 0x03, 1},
{0xd, 0x03, 1},
{0xe, 0xf4, 1},
{0xf, 0x59, 1},
{0x10, 0x02, 1},
{0x11, 0x0c, 1},
{0x12, 0x70, 1},
{0x13, 0x85, 1},
{0x14, 0xf4, 1},
{0x15, 0x10, 1},
{0x16, 0x04, 1},
{0x17, 0x00, 1},
{0x18, 0xff, 1},
{0x19, 0x00, 1},
{0x1a, 0xc2, 1},
{0x1b, 0x00, 1},
{0x1c, 0x00, 1},
{0x1d, 0x00, 1},
{0x1e, 0x00, 1},
{0x1f, 0x00, 1}
};
const V558_SENSORREGVALUE IspRegVal[] =
{
{0x1, 0x22, 1},
{0x2, 0xff, 1},
{0x3, 0x00, 1},
{0x4, 0x41, 1},
{0x5, 0x81, 1},
{0x6, 0x00, 1},
{0x7, 0x03, 1},
{0x8, 0xb0, 1},
{0x9, 0x90, 1},
{0xa, 0x03, 1},
{0xb, 0x40, 1},
{0xc, 0xa0, 1},
{0xd, 0x00, 1},
{0xe, 0x07, 1},
{0xf, 0x00, 1},
{0x10, 0xf0, 1},
{0x11, 0x00, 1},
{0x12, 0x00, 1},
{0x13, 0x08, 1},
{0x14, 0x00, 1},
{0x15, 0x08, 1},
{0x16, 0x00, 1},
{0x17, 0x08, 1},
{0x18, 0x00, 1},
{0x19, 0x08, 1},
{0x1a, 0x00, 1},
{0x1b, 0x08, 1},
{0x1c, 0x00, 1},
{0x1d, 0x08, 1},
{0x1e, 0x00, 1},
{0x1f, 0x08, 1},
{0x20, 0x00, 1},
{0x21, 0x08, 1},
{0x22, 0x20, 1},
{0x23, 0x00, 1},
{0x24, 0x20, 1},
{0x25, 0x00, 1},
{0x26, 0x20, 1},
{0x27, 0x00, 1},
{0x28, 0x20, 1},
{0x29, 0x00, 1},
{0x2a, 0x20, 1},
{0x2b, 0x00, 1},
{0x2c, 0x2c, 1},
{0x2d, 0xc0, 1},
{0x2e, 0x20, 1},
{0x2f, 0x00, 1},
{0x30, 0x2c, 1},
{0x31, 0xc0, 1},
{0x32, 0x80, 1},
{0x33, 0x00, 1},
{0x34, 0x80, 1},
{0x35, 0x00, 1},
{0x36, 0x80, 1},
{0x37, 0x00, 1},
{0x38, 0x80, 1},
{0x39, 0x00, 1},
{0x3a, 0x80, 1},
{0x3b, 0x00, 1},
{0x3c, 0x80, 1},
{0x3d, 0x00, 1},
{0x3e, 0x80, 1},
{0x3f, 0x00, 1},
{0x40, 0x80, 1},
{0x41, 0x00, 1},
{0x42, 0x20, 1},
{0x43, 0x00, 1},
{0x44, 0x20, 1},
{0x45, 0x00, 1},
{0x46, 0x20, 1},
{0x47, 0x00, 1},
{0x48, 0x20, 1},
{0x49, 0x00, 1},
{0x4a, 0x20, 1},
{0x4b, 0x00, 1},
{0x4c, 0x2c, 1},
{0x4d, 0xc0, 1},
{0x4e, 0x20, 1},
{0x4f, 0x00, 1},
{0x50, 0x2c, 1},
{0x51, 0xc0, 1},
{0x52, 0xdd, 1},
{0x53, 0x40, 1},
{0x54, 0x40, 1},
{0x55, 0x10, 1},
{0x56, 0x10, 1},
{0x57, 0x00, 1},
{0x58, 0x00, 1},
{0x59, 0x20, 1},
{0x5a, 0xf0, 1},
{0x5b, 0xf0, 1},
{0x5c, 0xf0, 1},
{0x5d, 0x20, 1},
{0x5e, 0xf0, 1},
{0x5f, 0xf0, 1},
{0x60, 0xf0, 1},
{0x61, 0x20, 1},
{0x62, 0x0b, 1},
{0x63, 0x40, 1},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -