382 lines
5.4 KiB
C
382 lines
5.4 KiB
C
|
|
#include "sys_config.h"
|
||
|
|
#include "typesdef.h"
|
||
|
|
#include "lib/video/dvp/cmos_sensor/csi.h"
|
||
|
|
#include "tx_platform.h"
|
||
|
|
#include "list.h"
|
||
|
|
#include "dev.h"
|
||
|
|
#include "hal/i2c.h"
|
||
|
|
|
||
|
|
|
||
|
|
#if DEV_SENSOR_GC032A
|
||
|
|
|
||
|
|
SENSOR_INIT_SECTION static const unsigned char GC032aInitTable[CMOS_INIT_LEN]={
|
||
|
|
//DOTHINKEY 2.2 sensor ini format(Start from 2014.11.06)
|
||
|
|
//GC032a_SPI_1w_sdr
|
||
|
|
//www.dothinkey.com
|
||
|
|
//Preview Type : 0:DVP Raw 10 bit; 1:Raw 8 bit; 2:YUV422; 3:RAW16
|
||
|
|
//Preview Type : 4:RGB565; 5:Pixart SPI; 6:MIPI 10bit; 7:MIPI 12bit; 8: MTK SPI
|
||
|
|
//port : 0:MIPI; 1:Parallel; 2:MTK; 3:SPI; 4:TEST; 5: HISPI; 6 : Z2P/Z4P
|
||
|
|
//I2C Mode : 0:Normal 8Addr,8Data; 1:Samsung 8 Addr,8Data; 2:Micron 8 Addr,16Data
|
||
|
|
//I2C Mode : 3:Stmicro 16Addr,8Data;4:Micron2 16 Addr,16Data
|
||
|
|
//Out Format : 0:YCbYCr/RG_GB; 1:YCrYCb/GR_BG; 2:CbYCrY/GB_RG; 3:CrYCbY/BG_GR
|
||
|
|
//MCLK Speed : in KHZ,like this:24M,value is 24000
|
||
|
|
//pin : BIT0 pwdn; BIT1:reset
|
||
|
|
//avdd : in mV, like this:2.8V, value is 2800
|
||
|
|
//dovdd : in mV, like this:2.8V, value is 2800
|
||
|
|
//dvdd : in mV, like this:2.8V, value is 2800
|
||
|
|
|
||
|
|
0xf3,0xa3,//0x83 a3
|
||
|
|
0xf5,0x0c,
|
||
|
|
0xf7,0x01,
|
||
|
|
0xf8,0x03,
|
||
|
|
0xf9,0x4e,
|
||
|
|
0xfa,0x30,
|
||
|
|
0xfc,0x02,
|
||
|
|
0xfe,0x02,
|
||
|
|
0x81,0x03,
|
||
|
|
/*Analog&Cisctl*/
|
||
|
|
0xfe,0x00,
|
||
|
|
|
||
|
|
0x03,0x00,
|
||
|
|
0x04,0x42,
|
||
|
|
|
||
|
|
0x05,0x01,
|
||
|
|
0x06,0x91,
|
||
|
|
|
||
|
|
0x07,0x00,
|
||
|
|
0x08,0x10,
|
||
|
|
|
||
|
|
0x0a,0x04,
|
||
|
|
0x0c,0x04,
|
||
|
|
0x0d,0x01,
|
||
|
|
0x0e,0xe8,
|
||
|
|
0x0f,0x02,
|
||
|
|
0x10,0x88,
|
||
|
|
0x17,0x54,
|
||
|
|
0x19,0x04,
|
||
|
|
0x1a,0x0a,
|
||
|
|
0x1f,0x40,
|
||
|
|
0x20,0x30,
|
||
|
|
0x2e,0x80,
|
||
|
|
0x2f,0x2b,
|
||
|
|
0x30,0x1a,
|
||
|
|
0xfe,0x02,
|
||
|
|
0x03,0x02,
|
||
|
|
0x05,0xd7,
|
||
|
|
0x06,0x60,
|
||
|
|
0x08,0x80,
|
||
|
|
0x12,0x89,
|
||
|
|
|
||
|
|
/*blk*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0x18,0x02,
|
||
|
|
0xfe,0x02,
|
||
|
|
0x40,0x22,
|
||
|
|
0x45,0x00,
|
||
|
|
0x46,0x00,
|
||
|
|
0x49,0x20,
|
||
|
|
0x4b,0x3c,
|
||
|
|
0x50,0x20,
|
||
|
|
0x42,0x10,
|
||
|
|
/*isp*/
|
||
|
|
0xfe,0x01,
|
||
|
|
0x0a,0xc5,
|
||
|
|
0x45,0x00,
|
||
|
|
0xfe,0x00,
|
||
|
|
0x40,0xff,
|
||
|
|
0x41,0x25,
|
||
|
|
0x42,0x83,
|
||
|
|
0x43,0x10,
|
||
|
|
0x44,0x83,
|
||
|
|
0x46,0x26,
|
||
|
|
0x49,0x03,
|
||
|
|
0x4f,0x01,
|
||
|
|
0xde,0x84,
|
||
|
|
0xfe,0x02,
|
||
|
|
0x22,0xf6,
|
||
|
|
/*Shading*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0x77,0x65,
|
||
|
|
0x78,0x40,
|
||
|
|
0x79,0x52,
|
||
|
|
0xfe,0x01,
|
||
|
|
0xc1,0x3c,
|
||
|
|
0xc2,0x50,
|
||
|
|
0xc3,0x00,
|
||
|
|
0xc4,0x32,
|
||
|
|
0xc5,0x24,
|
||
|
|
0xc6,0x16,
|
||
|
|
0xc7,0x08,
|
||
|
|
0xc8,0x08,
|
||
|
|
0xc9,0x00,
|
||
|
|
0xca,0x20,
|
||
|
|
0xdc,0x7a,
|
||
|
|
0xdd,0x7a,
|
||
|
|
0xde,0xa6,
|
||
|
|
0xdf,0x60,
|
||
|
|
/*AWB*/
|
||
|
|
0xfe,0x01,
|
||
|
|
0x7c,0x09,
|
||
|
|
0x65,0x06,
|
||
|
|
0x7c,0x08,
|
||
|
|
0x56,0xf4,
|
||
|
|
0x66,0x0f,
|
||
|
|
0x67,0x84,
|
||
|
|
0x6b,0x80,
|
||
|
|
0x6d,0x12,
|
||
|
|
0x6e,0xb0,
|
||
|
|
0x86,0x00,
|
||
|
|
0x87,0x00,
|
||
|
|
0x88,0x00,
|
||
|
|
0x89,0x00,
|
||
|
|
0x8a,0x00,
|
||
|
|
0x8b,0x00,
|
||
|
|
0x8c,0x00,
|
||
|
|
0x8d,0x00,
|
||
|
|
0x8e,0x00,
|
||
|
|
0x8f,0x00,
|
||
|
|
0x90,0xef,
|
||
|
|
0x91,0xe1,
|
||
|
|
0x92,0x0c,
|
||
|
|
0x93,0xef,
|
||
|
|
0x94,0x65,
|
||
|
|
0x95,0x1f,
|
||
|
|
0x96,0x0c,
|
||
|
|
0x97,0x2d,
|
||
|
|
0x98,0x20,
|
||
|
|
0x99,0xaa,
|
||
|
|
0x9a,0x3f,
|
||
|
|
0x9b,0x2c,
|
||
|
|
0x9c,0x5f,
|
||
|
|
0x9d,0x3e,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,
|
||
|
|
0xc5,0x85,
|
||
|
|
0xc6,0x90,
|
||
|
|
0xc7,0xa5,
|
||
|
|
0xc8,0xb5,
|
||
|
|
0xc9,0xc2,
|
||
|
|
0xca,0xcc,
|
||
|
|
0xcb,0xd5,
|
||
|
|
0xcc,0xde,
|
||
|
|
0xcd,0xea,
|
||
|
|
0xce,0xf5,
|
||
|
|
0xcf,0xff,
|
||
|
|
/*Auto Gamma*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0x5a,0x08,
|
||
|
|
0x5b,0x0f,
|
||
|
|
0x5c,0x15,
|
||
|
|
0x5d,0x1c,
|
||
|
|
0x5e,0x28,
|
||
|
|
0x5f,0x36,
|
||
|
|
0x60,0x45,
|
||
|
|
0x61,0x51,
|
||
|
|
0x62,0x6a,
|
||
|
|
0x63,0x7d,
|
||
|
|
0x64,0x8d,
|
||
|
|
0x65,0x98,
|
||
|
|
0x66,0xa2,
|
||
|
|
0x67,0xb5,
|
||
|
|
0x68,0xc3,
|
||
|
|
0x69,0xcd,
|
||
|
|
0x6a,0xd4,
|
||
|
|
0x6b,0xdc,
|
||
|
|
0x6c,0xe3,
|
||
|
|
0x6d,0xf0,
|
||
|
|
0x6e,0xf9,
|
||
|
|
0x6f,0xff,
|
||
|
|
/*Gain*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0x70,0x50,
|
||
|
|
/*AEC*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0x4f,0x01,
|
||
|
|
0xfe,0x01,
|
||
|
|
0x12,0xa0,
|
||
|
|
0x13,0x3a,
|
||
|
|
0x44,0x04,
|
||
|
|
0x1f,0x30,
|
||
|
|
0x20,0x40,
|
||
|
|
|
||
|
|
0x26,0x28,
|
||
|
|
0x27,0x02,
|
||
|
|
0x28,0x30, //14.26fps
|
||
|
|
0x29,0x02,
|
||
|
|
0x2a,0x3a,
|
||
|
|
0x2b,0x02,
|
||
|
|
0x2c,0xac,
|
||
|
|
|
||
|
|
0x3c,0x20, //[5:4] Max level setting
|
||
|
|
|
||
|
|
0x3e,0x20,
|
||
|
|
0x3f,0x2d,
|
||
|
|
0x40,0x40,
|
||
|
|
0x41,0x5b,
|
||
|
|
0x42,0x82,
|
||
|
|
0x43,0xb7,
|
||
|
|
0x04,0x0a,
|
||
|
|
0x02,0x79,
|
||
|
|
0x03,0xc0,
|
||
|
|
/*measure window*/
|
||
|
|
0xcc,0x08,
|
||
|
|
0xcd,0x08,
|
||
|
|
0xce,0xa4,
|
||
|
|
0xcf,0xec,
|
||
|
|
/*DNDD*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0x81,0xb8,//f8
|
||
|
|
0x82,0x12,
|
||
|
|
0x83,0x0a,
|
||
|
|
0x84,0x01,
|
||
|
|
0x86,0x50,
|
||
|
|
0x87,0x18,
|
||
|
|
0x88,0x10,
|
||
|
|
0x89,0x70,
|
||
|
|
0x8a,0x20,
|
||
|
|
0x8b,0x10,
|
||
|
|
0x8c,0x08,
|
||
|
|
0x8d,0x0a,
|
||
|
|
/*Intpee*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0x8f,0xaa,
|
||
|
|
0x90,0x9c,
|
||
|
|
0x91,0x52,
|
||
|
|
0x92,0x03,
|
||
|
|
0x93,0x03,
|
||
|
|
0x94,0x08,
|
||
|
|
0x95,0x44,
|
||
|
|
0x97,0x00,
|
||
|
|
0x98,0x00,
|
||
|
|
/*ASDE*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0xa1,0x30,
|
||
|
|
0xa2,0x41,
|
||
|
|
0xa4,0x30,
|
||
|
|
0xa5,0x20,
|
||
|
|
0xaa,0x30,
|
||
|
|
0xac,0x32,
|
||
|
|
/*YCP*/
|
||
|
|
0xfe,0x00,
|
||
|
|
0xd1,0x3c,
|
||
|
|
0xd2,0x3c,
|
||
|
|
0xd3,0x38,
|
||
|
|
0xd6,0xf4,
|
||
|
|
0xd7,0x1d,
|
||
|
|
0xdd,0x73,
|
||
|
|
0xde,0x84,
|
||
|
|
|
||
|
|
/*SPI*/
|
||
|
|
0xfe,0x03,
|
||
|
|
0x51,0x01,
|
||
|
|
0x52,0x8b, //da //default:0x0a //0x8a
|
||
|
|
0x53,0x60,//default:0x20 line num from 0; 0x60 line num from 1
|
||
|
|
0x54,0x20,
|
||
|
|
0x55,0x00,
|
||
|
|
0x59,0x10,
|
||
|
|
|
||
|
|
0x5a,0x00,
|
||
|
|
0x5b,0x80,
|
||
|
|
0x5c,0x02,
|
||
|
|
0x5d,0xe0,
|
||
|
|
0x5e,0x01,
|
||
|
|
|
||
|
|
/////QVGA///
|
||
|
|
0xfe,0x00,
|
||
|
|
0xf7,0x01, //spi clock=48mhz
|
||
|
|
0xf8,0x03,
|
||
|
|
0xfa,0x10,
|
||
|
|
0x43,0x50, //1/2 subsample
|
||
|
|
0x55,0x00,
|
||
|
|
0x56,0xf0,
|
||
|
|
0x57,0x01,
|
||
|
|
0x58,0x40,
|
||
|
|
0xfe,0x03,
|
||
|
|
0x5b,0x40,
|
||
|
|
0x5c,0x01,
|
||
|
|
0x5d,0xf0,
|
||
|
|
0x5e,0x00,
|
||
|
|
0xfe,0x00,
|
||
|
|
-1,-1
|
||
|
|
};
|
||
|
|
|
||
|
|
SENSOR_OP_SECTION const _Sensor_Adpt_ gc032a_cmd=
|
||
|
|
{
|
||
|
|
.typ = 1, //YUV
|
||
|
|
.pixelw = 320,
|
||
|
|
.pixelh= 240,
|
||
|
|
.hsyn = 1,
|
||
|
|
.vsyn = 1,
|
||
|
|
.rduline = 0,//
|
||
|
|
.rawwide = 1,//10bits
|
||
|
|
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
|
||
|
|
.init = (uint8 *)GC032aInitTable,
|
||
|
|
.rotate_adapt = {0},
|
||
|
|
//.hvb_adapt = {0x6a,0x12,0x6a,0x12},
|
||
|
|
. mclk = 24000000,
|
||
|
|
.p_fun_adapt = {NULL,NULL,NULL},
|
||
|
|
.p_xc7016_adapt = {NULL},
|
||
|
|
};
|
||
|
|
|
||
|
|
const _Sensor_Ident_ gc032a_init=
|
||
|
|
{
|
||
|
|
0x23,0x42,0x43,0x01,0x01,0xf0
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
#endif
|