pure sdk for main

This commit is contained in:
divadiow
2025-08-27 09:51:58 +01:00
parent f0d033f1c9
commit 0571416e7c
3283 changed files with 1577720 additions and 1 deletions
+54
View File
@@ -0,0 +1,54 @@
#include "typesdef.h"
#include "g_sensor.h"
#include "tx_platform.h"
#include "list.h"
#include "dev.h"
#include "hal/i2c.h"
GSENSOR_INIT_SECTION const unsigned char da280InitTable[28]={
0x00,0x24,
0xFC,0X05, //delay 5ms
0x0f,0x03,
0x11,0x1e,
0x10,0x07,
0xFD,0x28, //delay 40us
0x20,0x05,
0x21,0x8f,
0x16,0x47,
0x27,0x03,
0x19,0x00,
0x21,0x87,
0x28,0x01,
-1,-1,
};
GSENSOR_INIT_SECTION const unsigned char da280prereadTable[11]={
0x01,
0xFC,0X05, //delay 5ms
0x09,
0xFC,0X05, //delay 5ms
0x19,
0xFC,0X05, //delay 5ms
-1,-1,
};
GSENSOR_OP_SECTION const _Gsensor_Adpt_ da280_cmd= {
.init = (uint8_t *)da280InitTable,
.preread = (uint8_t *)da280prereadTable,
.local_xyz = {0x02,0x03,0x04,0x05,0x06,0x07},
};
const _Gsensor_Ident_ da280_init=
{
0x13,0x4E,0x4F,0x01,0x01,0x01
};
+36
View File
@@ -0,0 +1,36 @@
#include "typesdef.h"
#include "g_sensor.h"
#include "tx_platform.h"
#include "list.h"
#include "dev.h"
#include "hal/i2c.h"
GSENSOR_INIT_SECTION const unsigned char qma7981InitTable[28]={
0x36,0xb6,
0xFC,0X05, //delay 5ms
0x36,0x00,
0xFC,0X05, //delay 5ms
0x11,0x80,
0x0F,0x02,
0x10,0xE1,
-1,-1,
};
GSENSOR_OP_SECTION const _Gsensor_Adpt_ qma7981_cmd= {
.init = (uint8_t *)qma7981InitTable,
.local_xyz = {0x01,0x02,0x03,0x04,0x05,0x06},
};
const _Gsensor_Ident_ qma7981_init=
{
0xe7,0x26,0x27,0x01,0x01,0x00
};
+35
View File
@@ -0,0 +1,35 @@
#include "typesdef.h"
#include "g_sensor.h"
#include "tx_platform.h"
#include "list.h"
#include "dev.h"
#include "hal/i2c.h"
GSENSOR_INIT_SECTION const unsigned char sc7a20InitTable[28]={
0X1F,0x00,
0x20,0x47,
0x21,0x00,
0x22,0x00,
0x23,0x88,
0xFC,0X05, //delay 5ms
-1,-1,
};
GSENSOR_OP_SECTION const _Gsensor_Adpt_ sc7a20_cmd= {
.init = (uint8_t *)sc7a20InitTable,
.local_xyz = {0x28,0x29,0x2a,0x2b,0x2c,0x2d},
};
const _Gsensor_Ident_ sc7a20_init=
{
0x11,0x32,0x33,0x01,0x01,0x0f
};
+228
View File
@@ -0,0 +1,228 @@
#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_BF2013
SENSOR_INIT_SECTION static const unsigned char bf2013InitTable[CMOS_INIT_LEN]=
{
0x12,0x00,
0x09,0x01,
0x15,0x02,
0x3A,0x00,
0x12,0x00,
0x1E,0x00,
0x13,0x00,
0x01,0x14,
0x02,0x21,
0x8C,0x01,
0x8D,0xCB,
0x87,0x20,
0x1B,0x80,
0x11,0xE0,
0x2B,0x20,
0x92,0x40,
0x06,0xE0,
0x29,0x54,
0xEB,0x30,
0xBB,0x20,
0xF5,0x21,
0xE1,0x3C,
0x16,0x01,
0xE0,0x0B,
0x2F,0xF6,
0x1F,0x20,
0x22,0x20,
0x26,0x20,
0x33,0x20,
0x34,0x08,
0x35,0x50,
0x65,0x4A,
0x66,0x48,
0x36,0x05,
0x37,0x7B,
0x38,0x46,
0x9B,0xF6,
0x9C,0x46,
0xBC,0x01,
0xBD,0xF6,
0xBE,0x46,
0x70,0x6F,
0x72,0x6B,
0x73,0x2F,
0x74,0x27,
0x77,0x90,
0x79,0x48,
0x7A,0x1E,
0x7B,0x30,
0x24,0xA3,
0x25,0xB3,
0x55,0x18,
0x80,0x7F,
0x81,0x02,
0x82,0x14,
0x83,0x23,
0x9A,0x23,
0x84,0x1A,
0x85,0x20,
0x86,0x20,
0x89,0x02,
0x8A,0x64,
0x8B,0x02,
0x8E,0x02,
0x8F,0xFD,
0x94,0x0A,
0x96,0xA6,
0x97,0x0C,
0x98,0x1A,
0x9D,0x93,
0x9E,0x7A,
0x3B,0x60,
0x3C,0x08,
0x39,0x80,
0x3F,0x7F,
0x40,0x9B,
0x41,0x88,
0x42,0x6E,
0x43,0x59,
0x44,0x4D,
0x45,0x45,
0x46,0x3E,
0x47,0x39,
0x48,0x35,
0x49,0x31,
0x4B,0x2E,
0x4C,0x2B,
0x4E,0x26,
0x4F,0x22,
0x50,0x1F,
0x51,0x0E,
0x52,0x16,
0x53,0x07,
0x54,0x1A,
0x57,0x9D,
0x58,0x82,
0x59,0x71,
0x5A,0x8D,
0x5B,0x1C,
0x5C,0x0E,
0x5D,0x95,
0x60,0x24,
0x6A,0x81,
0x23,0x77,
0xA0,0x03,
0xA1,0x31,
0xA2,0x05,
0xA3,0x10,
0xA4,0x20,
0xA5,0x2C,
0xA6,0x06,
0xA7,0x80,
0xA8,0x7E,
0xA9,0x20,
0xAA,0x20,
0xAB,0x20,
0xAC,0x3C,
0xAD,0xF0,
0xAE,0x80,
0xAF,0x00,
0xC5,0x18,
0xC6,0x00,
0xC7,0x20,
0xC8,0x18,
0xC9,0x20,
0xCA,0x17,
0xCB,0x1F,
0xCC,0x40,
0xCD,0x58,
0xEE,0x4C,
0xB0,0xE0,
0xB1,0x90,
0xB2,0x90,
0xB3,0x88,
0x56,0x64,
0x13,0x07,
-1,-1
//switch direction
//0x1e,0x30,//00:normal 10:IMAGE_V_MIRROR
};
extern struct i2c_device *iic_test;
static void bf2013_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x1e;
//buf[1] = Sensor_ReadRegister(buf,u8AddrLength,u8DataLength);
//buf[1] &=~(3<<4);
buf[1] = (r<<4)|0x00;
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
}
uint32 bf2013_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0x00UL
#define VBLANK_BASE 0x00UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x2a,(h >> 8) << 4 },
{0x2b,h & 0xff},
{0x92,v & 0xff},
{0x93,v >> 8},
{0xe3,0x00},
{0xe4,0},
};
for(i=0;i<6;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
//i2c_sensor_write(iic_test,(uint8 *)&t[i][0],1,1,0x42,0x43);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ bf2013_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)bf2013InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0xde,0x24,0xde,0x24},
. mclk = 24000000,
.p_fun_adapt = {bf2013_rotate,bf2013_hvblank,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ bf2013_init=
{
0x37,0xdc,0xdd,0x01,0x01,0xfc,//bf3
};
#endif
+197
View File
@@ -0,0 +1,197 @@
#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_BF30A2
SENSOR_INIT_SECTION static const unsigned char bf30a2InitTable[CMOS_INIT_LEN]=
{
0x12,0x00,//MTK:20 ZX:10 RDA:40
0x15,0x80,
0x6b,0x51, //71
0x04,0x00, //0x20 0x05
0x06,0x26,
0x08,0x07,
0x1c,0x12,
0x1e,0x26,
0x1f,0x01, //0x02
0x20,0x20,
0x21,0x20,
0x34,0x02,
0x35,0x02,
0x36,0x21,
0x37,0x13,
0xca,0x03,
0xcb,0x22,
0xcc,0x89,
0xcd,0x4c,
0xce,0xcb,
//0xcf,0xf0, //0x90
0xa0,0x8e,
0x01,0x1b,
0x02,0x1d,
0x13,0x08,
0x87,0x13,
0x8a,0x33,
0x8b,0x08,
0x70,0x0f,//2f 0f
0x71,0x47,//40
0x72,0x7f,//0a
0x73,0x62,
0x74,0xa2,
0x75,0xbf,
0x76,0x24,
0x77,0xff,//0xcc
0x40,0x32,
0x41,0x28,
0x42,0x26,
0x43,0x1d,
0x44,0x1a,
0x45,0x14,
0x46,0x11,
0x47,0x0f,
0x48,0x0e,
0x49,0x0d,
0x4B,0x0c,
0x4C,0x0b,
0x4E,0x0a,
0x4F,0x09,
0x50,0x09,
0x24,0x55,
0x25,0x36,
0x80,0x00,
0x81,0x20,
0x82,0x40,
0x83,0x30,
0x84,0x50,
0x85,0x30,
0x86,0xD8,
0x89,0x45,
0x8f,0x81,
0x91,0xff,
0x92,0x08,
0x94,0x82,
0x95,0xfd,
0x9a,0x20,
0x9e,0xbc,
0xf0,0x86,
0x51,0x06,
0x52,0x25,
0x53,0x2b,
0x54,0x0F,
0x57,0x2A,
0x58,0x22,
0x59,0x29,
0x23,0x33,
0xa0,0x8f,
0xa1,0x93,
0xa2,0x0f,
0xa3,0x2a,
0xa4,0x08,
0xa5,0x26,
0xa7,0x80,
0xa8,0x80,
0xa9,0x1e,
0xaa,0x19,
0xab,0x18,
0xae,0x50,
0xaf,0x04,
0xc8,0x10,
0xc9,0x15,
0xd3,0x0c,
0xd4,0x16,
0xee,0x06,
0xef,0x04,
0x55,0x33,//34
0x56,0x90,//9c
0xb1,0x58,//98 58(现用) 2c
0xb2,0x58,//98 58(现用) 2c
0xf1,0x6b,
0xb3,0xc4,
0xb4,0x0C,
0x00,0x4c,//flip[2] mirror[3] 40 4c
0x13,0x07,
0xcf,0xd0,
-1,-1
//switch direction
//0x1e,0x30,//00:normal 10:IMAGE_V_MIRROR
};
extern struct i2c_device *iic_test;
static void bf30a2_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x1e;
//buf[1] = Sensor_ReadRegister(buf,u8AddrLength,u8DataLength);
//buf[1] &=~(3<<4);
buf[1] = (r<<4)|0x00;
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
}
uint32 bf30a2_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0x00UL
#define VBLANK_BASE 0x00UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x2a,(h >> 8) << 4 },
{0x2b,h & 0xff},
{0x92,v & 0xff},
{0x93,v >> 8},
{0xe3,0x00},
{0xe4,0},
};
for(i=0;i<6;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
//i2c_sensor_write(iic_test,(uint8 *)&t[i][0],1,1,0x42,0x43);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ bf30a2_cmd=
{
.typ = 1, //YUV
.pixelw = 240,
.pixelh= 320,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)bf30a2InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0xde,0x24,0xde,0x24},
. mclk = 40000000, //40
.p_fun_adapt = {bf30a2_rotate,bf30a2_hvblank,NULL},
};
const _Sensor_Ident_ bf30a2_init=
{
0x3b,0xdc,0xdd,0x01,0x01,0xfc,//bf3
};
#endif
+231
View File
@@ -0,0 +1,231 @@
#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_BF3703
SENSOR_INIT_SECTION static const unsigned char bf3703InitTable[CMOS_INIT_LEN]=
{
/*
0x01,// [7:0]:driver type,0x01:sensor whith ISP; 0x02:ISP; 0x03:sensor whithout isp;
0x01,0x6E,0x36,0x00,// [7:0]:XCLK(BE)
0x00,0x01,0x86,0xA0,// [7:0]:BAUDRATE(BE)
0x00,// [7:0]:chip_ID_addr>>8,when AddrByteNum == 2; 0 when AddrByteNum == 1
0xfc,// [7:0]:chip_ID_addr
0x00,// [7:0]:chip_ID
0x37,//
0x00,0x00,0x00,0x00,//resverd
0x02,0x80,//image_width
0x01,0xE0,//image_height
0xdd,// [7:0]:read ID
0xdc,// [7:0]:write ID
0x01,// [7:0]:AddrByteNum ;
0x01,// [7:0]:DataByteNum
0x04,// [2:0]:ldo_config_para
0x01,// [7:0]:ID nums
*/
0x15,0x22,//02
0x09,0x01,
0x13,0x00,
0x01,0x15,
0x02,0x21,
0x8c,0x01,
0x8d,0x32,
0x87,0x18,
0x13,0x07,
0x1f,0x20,
0x22,0x1d,
0x26,0x20,
0x1e,0x30, //0x30 is 0' , 0x00 is 180'
0xbb,0x20,
0x11,0x80,
//0x2a,0x00,//HBH[11:8]
//0x2b,0xff,//ff//HBL
//0x92,0x10,//VB
//0x93,0x00,//VB
//0xe3.0x00,//VB
//0xe4.0x00,//VB
0x35,0x38,
0x65,0x30,
0x66,0x30,
0x36,0x05,
0x37,0xf6,
0x38,0x46,
0x9b,0xf6,
0x9c,0x46,
0xbc,0x01,
0xbd,0xf6,
0xbe,0x46,
0x70,0xff,//70[1] should be set to 1'b1. 70[1]=1'b1:Bad pixel enable.
0x72,0x2f,//8f
0x73,0x2f,
0x74,0x27,
0x75,0x0e,
0x77,0x90,
0x7A,0x06,
0x2f,0xf6,
0x16,0x01,
0x80,0x41,
0x9d,0x73,//99
0x9e,0x7f,
0x24,0x8c,//0x90,//0x8c,//88
0x25,0x7c,//0x80,//0x7c,//78
0x94,0x0a,
0x56,0x46, //5b
0x3f,0xb8,
0x3b,0x60,
0x3c,0x18,
0x40,0x58,
0x41,0x54,
0x42,0x4e,
0x43,0x44,
0x44,0x3e,
0x45,0x39,
0x46,0x35,
0x47,0x31,
0x48,0x2e,
0x49,0x2b,
0x4b,0x29,
0x4c,0x27,
0x4e,0x23,
0x4f,0x20,
0x50,0x1e,
0x51,0x19,//0f
0x52,0x21,//24
0x53,0x0c,//07
0x54,0x0f,//17
0x57,0x76,//73
0x58,0x85,//82
0x59,0x7b,//88
0x5a,0xa6,//a3
0x5b,0x2b,//33
0x5D,0x9d,//9d
0x5C,0x0e,//0e
0x60,0x31,//20
0xb0,0xf0,//e0
0xb1,0xc8,//c0
0xb2,0xd8,//b0
0xb3,0x9a,//8a
0x82,0x14,
0x83,0x23,
0x84,0x1a,
0x85,0x20,
0x86,0x2c,//2b
0x7b,0x2b,
0x9a,0x23,
0x98,0x18,
0x96,0xa6,
0x97,0x0c,
0x89,0x01,
0x8a,0xcb,
0x8b,0x03,
0x6a,0x81,
0x23,0x66,//66
0xa0,0x03,
0x06,0xe0,
0xa1,0X31,
0xa2,0X0e,
0xa3,0X25,
0xa4,0X0d,
0xa5,0x26,//24
0xa6,0x08,
0xa7,0x7e,
0xa8,0x80,//7b
0xa9,0x1d,
0xaa,0x20,
0xab,0x1d,
0xac,0x30,
0xad,0xf0,
0xc8,0x16,
0xc9,0x22,
0xca,0x15,
0xcb,0x21,
0xaf,0x00,//16
0xc5,0x16,//16
0xc6,0x00,
0xc7,0x22,
0xae,0x83,
0xcc,0x60,
0xcd,0x60,
0xee,0x3c,
0x8e,0x02,
0x8f,0x40,
-1,-1};
extern struct i2c_device *iic_test;
static void bf3703_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x1e;
//buf[1] = Sensor_ReadRegister(buf,u8AddrLength,u8DataLength);
//buf[1] &=~(3<<4);
buf[1] = (r<<4)|0x00;
//i2c_sensor_write(iic_test,buf,1,1,0xdc,0xdd);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
}
uint32 bf3703_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0x00UL
#define VBLANK_BASE 0x00UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x2a,(h >> 8) << 4 },
{0x2b,h & 0xff},
{0x92,v & 0xff},
{0x93,v >> 8},
{0xe3,0x00},
{0xe4,0},
};
for(i=0;i<6;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ bf3703_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)bf3703InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0xde,0x24,0xde,0x24},
. mclk = 24000000,
.p_fun_adapt = {bf3703_rotate,bf3703_hvblank,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ bf3703_init=
{
0x03,0xdc,0xdd,0x01,0x01,0xfd,//bf3703
};
#endif
+340
View File
@@ -0,0 +1,340 @@
#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_BF3720
SENSOR_INIT_SECTION static const unsigned char BF3720InitTable[CMOS_INIT_LEN]=
{
// FAE provided config
0x12, 0x80,//84
//0x12 , 0x03,//00
0x15, 0x03, // vsync high, hsync high
0x3a, 0x00, // UYVY
//0x09 , 0x10,//01??11
0x1b, 0x6e, //2F PLL
0x13, 0x80,//70 COM8[1]??0x13??=1??b0о?????????????????
//????????????????????0x01??blue gain????
//0x02??red gain???????????????
0x8c, 0x00, //
0x8d, 0x04,
0x87, 0x2a, //FF gloabl gain
0x13, 0x87,//07 COM8[1]??0x13??=1??b0о?????????????????
//????????????????????0x01??blue gain????
//0x02??red gain???????????????
0xbb, 0x20, // reserved
0x2f, 0x10, //
0x27, 0xc1, // reserved
0x16, 0x80, // reserved
0xe1, 0x98, // reserved
0xe4, 0x0f, // reserved
0xe3, 0x04, // reserved
0xec, 0xa8, // reserved
0x20, 0x40, // reserved
0xeb, 0xd5, // reserved
0xd2, 0x19, // gain diff ?
0x33, 0x80, // lens shading
0x34, 0x28, // lens shading
0x35, 0x34, // lens shading
0x65, 0x32, // lens shading
0x66, 0x30, // lens shading
0xf1, 0x00, // module by pass
0x24, 0x69,//82 AE_TAR1 ??A??????????
0x97, 0x69,//78 AE_TAR2 A????????????
//0x55??BRIGHT bit[7]?????λ????bit[7]?0????????????
//??bit[7]?1????????????
0x25, 0x88, // ae loc ?
// 0x81, 0xff, //
// 0x94, 0x82, //22 glb??
0x82, 0x2a, //22 glb??
0x83, 0x3a, //49 glb??
0x84, 0x38, //32 glb??
0x85, 0x41, //5E glb??
0x86, 0x90, //A0 glb??
0x8a, 0x9c, //C3 A6 50 hz banding filter
// 0x8b, 0x9c, //BB 60 hz banding filter
0x39, 0x0f, //CF ee
0x98, 0x12, //02 windows select, weight select
0x3f, 0x48,//90??28??????1????7????0????ü?????????1[6:0]????????
//1:???????????????
0x90, 0x30,//30 20 INT_TIM_TH ???е???????????????
0x91, 0x20,//20 1c OFFSET_TH1 ??????int-tim<int-tim-th??
//?????1+?????th1*x/4?????????????????
0x2d, 0x40,//40 60 Y_AVER_TH Y_Aver??????????????е????????????
0x2e, 0x38,//38 24 OFFSET_TH2 ??????Y_AVER<Y_AVER_TH,
//?????1-?????th2*x/4????????????????????
//gamma ????????
0x40, 0x58, // gamma
0x41, 0x54, // gamma
0x42, 0x4e, // gamma
0x43, 0x44, // gamma
0x44, 0x3e, // gamma
0x45, 0x39, // gamma
0x46, 0x35, // gamma
0x47, 0x31, // gamma
0x48, 0x2e, // gamma
0x49, 0x2b, // gamma
0x4b, 0x29, // gamma
0x4c, 0x27, // gamma
0x4e, 0x23, // gamma
0x4f, 0x20, // gamma
0x50, 0x1f, // gamma
// 0x3f, 0x80,//??? [7:6]??11?????g????gamma??
#if 0
//gamma default
0x40, 0x88,
0x41, 0x70,
0x42, 0x5f,
0x43, 0x50,
0x44, 0x46,
0x45, 0x40,
0x46, 0x3a,
0x47, 0x36,
0x48, 0x32,
0x49, 0x2f,
0x4b, 0x2c,
0x4c, 0x29,
0x4e, 0x25,
0x4f, 0x22,
0x50, 0x1f,
//gamma ?????????????
0x40, 0x98,
0x41, 0x88,
0x42, 0x6e,
0x43, 0x59,
0x44, 0x4d,
0x45, 0x45,
0x46, 0x3e,
0x47, 0x39,
0x48, 0x35,
0x49, 0x31,
0x4b, 0x2e,
0x4c, 0x2b,
0x4e, 0x26,
0x4f, 0x23,
0x50, 0x20,
//gamma low noise
0x40, 0x68,
0x41, 0x60,
0x42, 0x54,
0x43, 0x46,
0x44, 0x3e,
0x45, 0x39,
0x46, 0x35,
0x47, 0x31,
0x48, 0x2e,
0x49, 0x2b,
0x4b, 0x29,
0x4c, 0x27,
0x4e, 0x24,
0x4f, 0x22,
0x50, 0x20,
0x3f, 0x28,//??? [7:6]??11?????g????gamma??
//10???????????g????gamma???????????????
#endif
0xd4, 0x0a,
0x51, 0x0a,
0x52, 0x18,
0x53, 0x0e,
0x54, 0x17,
0x57, 0x95,
0x58, 0x7d,
0x59, 0x62,
0x5a, 0x83,
0x5b, 0x21,
0x5d, 0x95,
0xd3, 0x00,
#if 0
//CC??A?? CCM ????
0xd4, 0x0a,
0x51, 0x0a,
0x52, 0x18,
0x53, 0x0e,
0x54, 0x17,
0x57, 0x95,
0x58, 0x7d,
0x59, 0x62,
0x5a, 0x83,
0x5b, 0x21,
0x5d, 0x95,
0xd3, 0x00,
//CC??A?? CCM ????
0xd4, 0x0a,
0x51, 0x19,
0x52, 0x24,
0x53, 0x0b,
0x54, 0x12,
0x57, 0x77,
0x58, 0x65,
0x59, 0x45,
0x5a, 0x5e,
0x5b, 0x19,
0x5d, 0x95,
0xd3, 0x00,
//CC??A?? CCM ??????
0xd4, 0x0a,
0x51, 0x05,
0x52, 0x16,
0x53, 0x11,
0x54, 0x15,
0x57, 0x8f,
0x58, 0x7a,
0x59, 0x48,
0x5a, 0x88,
0x5b, 0x3f,
0x5d, 0x95,
0xd3, 0x00,
//0x55, 0x50, // cc Brightness control:
0x56, 0x38, // cc Y Coefficient for Contrast
#endif
//a??CCM
0xd4, 0x4a, // FRAM_NUM_THD ?
0x51, 0x0f, // cc
0x52, 0x35, // cc
0x53, 0x26, // cc
0x54, 0x17, // cc
// 0x55, 0x19, // cc Brightness control:
// 0x56, 0x3c, // cc Y Coefficient for Contrast
0x57, 0x86, // cc
0x58, 0x9d, // cc
0x59, 0x5b, // cc
0x5a, 0x8d, // cc
0x5b, 0x32, // cc
0x5d, 0x9d, // cc
0xd3, 0x00, // reserved
//??A?????
0x3b, 0x00, // COEF_SELSAT_COEF_SEL
0xb1, 0xd0, // Saturation
0xb2, 0xb8, // Saturation
0x3b, 0x01, // COEF_SELSAT_COEF_SEL
0xb1, 0xd0, //c0 0xb1??????????????????????0x80????????????
//?????????0x80?????????????????????????
//?????0xff???????С??0x80?????С????????????
0xb2, 0xb8, //a0?????????????????????0x80????????????
//?????????0x80????????????????
//?????0xff???????С??0x80?????С????????????
0xb0, 0xd4, //d4 Saturation ??????????6:0 ?????????? df??ff
0xb3, 0x86, //86 Saturation ??????????84,8f??ff??f6??f4
0x70, 0x87, //81 ????λ????????????????????1????????????
//??????0?????????????
0x72, 0xa2, //72 62
//[7:6]???????????????????????????????????????????????
//[5:4]?????????????????????????????????????????????
0x7a, 0x41,//33 45 ???????
//[7:4]??????????????????????С??????????????
//?С?????????????????????
//[3:0]???????????????С???????С??????????????
//??????????????????????
0x78, 0x33, //33 0x78[0]????????????λ????????1?????????????????????0??????????????
0x5c, 0x00, // Saturation
0xa2, 0x0c, // B Gain λ[5:0]?????????????
0xa3, 0x27, // B Gain λ[5:0]?????????????
0xa4, 0x09, // R Gain λ[5:0]??????????????
0xa5, 0x30, // R Gain λ[5:0]??????????????
0xa7, 0x97, // Base B Gain [7]?????????? λ[4:0]??????B????
0xa8, 0x19, //15 Base R Gain [7]??????????? λ[4:0]??????R????
0xa9, 0x52, // 57 5a AWB?????CB
0xaa, 0x52, // 54 AWB?????CR
0xab, 0x18, // 12 AWB?????CBCR
0xac, 0x30, // 3c AWB?????Y_??
0xad, 0xf0, // AWB?????Y_??
0xae, 0x33, //57 λ[7:4]??????f?????????? λ[3:0]??????f?????????
0xd0, 0x00, // Reserved
0xd1, 0x91, // 00??93
// 0x6a, 0x02,
0x23, 0x36, //33 ???????[2:0]?? [2:0]???????????У???????gain[2:0]??
//[6:4]??????????У???????gain[2:0]??
0xee, 0x30, // 4c??88
0x91, 0x9c, // be used for auto offset adjust.
0x78, 0x73, // IntCtr?
0x7c, 0x48, // Reserved
0xd9, 0xb6, // Gain
0x89, 0x2d, // 720p fps //min 15fps
0x8a, 0x9c, // 720p fps
0x8b, 0x3e, // 720p fps
0x4a, 0x70,//40
#if 1 //1280X720
0x17, 0x00, //14 16 22 HSTART high 8bit
0x18, 0x64, //8C B6 182 HSTOP high 8bit
0x19, 0x00, //0B 1E 30 VSTART high 8bit
0x1a, 0x4C, //4E 78 26VSTOP high 8bit
#else//960X536
0x17, 0x14,
0x18, 0x8C,
0x03, 0x22,
0x19, 0x0B,
0x1a, 0x4e,
#endif
// 0x03, 0x00, // Bit[6:4]: VREF end low 3 bits Bit[2:0]: VREF start low 3 bits
// 0x32, 0x00, // Bit[6:4]: HREF end low 3 bits Bit[2:0]: HREF start low 3 bits
// 0x12, 0x00,
// 0x4a, 0x30,
// 0x11, 0x01,
0x1f, 0x10,
0x22, 0x10,
0x26, 0x10,
0x56, 0x38,
0x09, 0x10, //10// output drive capability
0x1e, 0x30, // Mirror/Vflip Enable
-1,-1};
SENSOR_OP_SECTION const _Sensor_Adpt_ bf3720_cmd =
{
.typ = 1, //YUV
.pixelw = 800,
.pixelh= 608,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)BF3720InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0x80,0x0a,0x80,0x0a},
. mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ bf3720_init=
{
0x20,0xDC,0xDD,0x01,0x01,0xFD
};
#endif
+232
View File
@@ -0,0 +1,232 @@
#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_BF3A03
SENSOR_INIT_SECTION static const unsigned char bf3a03InitTable[CMOS_INIT_LEN]=
{
0x12,0x80,
0x09,0x78,//0x7d,//55
0x15,0x32,
0x1e,0x40, // 0x40 is 0' , 0x70 is 180'
0x06,0x78,
0x21,0x00,//0x00
0x3e,0x37,
0x29,0x2b,
0x27,0x98,
0x16,0x2f,//0x25
0x20,0x64,//0x00
0xd2,0x18,
0x11,0x1c,//0x10
0x2f,0x4e,//0x4e
0x1b,0x09,
0x3a,0x00,
0x4a,0x98,//0x98 //VB相关
0x12,0x00,
0x13,0x08,
0x01,0x14,
0x02,0x20,
0x8c,0x02,
0x8d,0x4c,
0x87,0x16,
0x13,0x07,
0x35,0x46,
0x65,0x38,
0x66,0x42,
0x70,0x0f,
0x3b,0x00,
0x71,0x0c,
0x73,0x29,
0x75,0x88,
0x76,0xd8,
0x77,0x0a,
0x78,0xff,
0x79,0x14,
0x7a,0x24,
0x9e,0x04,
0x7d,0x2a,
0x39,0xa0,
0x3f,0xa0,
0x90,0x20,
0x5f,0x04,//0x00
0x40,0x22,
0x41,0x23,
0x42,0x28,
0x43,0x25,
0x44,0x1d,
0x45,0x17,
0x46,0x13,
0x47,0x12,
0x48,0x10,
0x49,0x0d,
0x4b,0x0b,
0x4c,0x0b,
0x4e,0x09,
0x4f,0x07,
0x50,0x06,
0x13,0x07,
0x24,0x60, //50xz
0x97,0x40,
0x25,0x88,
0x81,0xff, //00
0x82,0x18,
0x83,0x30,
0x84,0x20,
0x85,0x38,
0x86,0x90, //88 xz
0x94,0x62, //42 xz //82
0x80,0x92,
0x98,0x8a,
0x89,0x35,
0x8a,0x4c,//0x75,//93
0x8b,0x40,//0x62,//7a
0x8e,0x2c,
0x8f,0x82,
//0x2a,0x00, //HBH
//0x2b,0x00,//0x20//HBL hb = 0x100
//0x92,0x09,//DM_LNL
//0x93,0x00,//DM_LNH
//0xe3,0x09,
//0xe4,0x00,
0x5a,0xec,
0x51,0x90,
0x52,0x10,
0x53,0x8d,
0x54,0x88,
0x57,0x82,
0x58,0x8d,
0x5a,0x7c,
0x51,0x80,
0x52,0x04,
0x53,0x8d,
0x54,0x88,
0x57,0x82,
0x58,0x8d,
0x5a,0x6c,
0x51,0x90,
0x52,0x0a,
0x53,0x84,
0x54,0x05,
0x57,0x05,
0x58,0x87,
0xb0,0xa0,
0xb1,0x26,
0xb2,0x1c,
0xb4,0xfd,
0xb0,0x30,
0xb1,0xb8,
0xb2,0xa0,
0xb4,0xf1,
0x3c,0x40,
0x56,0x48,
0x4d,0x40,
0x59,0x40,
0xb4,0xf1,//e1
0x56,0x40,
0x6a,0x81,//81
0x23,0x33,//33
0xa2,0x04,
0xa3,0x20,
0xa4,0x08,
0xa5,0x26,
0xa7,0x18,
0xa8,0x17,
0xa9,0x14,
0xaa,0x14,
0xab,0x16,
0xac,0x44,
0xad,0xf0,
0xae,0x57,
0xc5,0x66,
0xc7,0x38,
0xc8,0x08,
0xc9,0x16,
0xd3,0x09,
0xd4,0x15,
0xd0,0x00,
0x35,0x38,
0x65,0x38,
0x66,0x38,
0x96,0xf5,
0x9f,0xf4,
0xd1,0x00,
0xcc,0x77,
0xcd,0x7b,
0xce,0x82,
0xcf,0x98,
0xc3,0xa0,
-1,-1};
extern struct i2c_device *iic_test;
static void bf3a03_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x1e;
buf[1] = 0x40|(r<<4);
//Sensor_WriteRegister(SENSOR_IIC,buf,1,1);
//i2c_sensor_write(iic_test,buf,1,1,0xdc,0xdd);
//i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
}
uint32 bf3a03_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0x100UL
#define VBLANK_BASE 0x09UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x2a,(h >> 8) << 4 },
{0x2b,h & 0xff},
{0x92,v & 0xff},
{0x93,v >> 8},
{0xe3,0x09},
{0xe4,0},
};
for(i=0;i<6;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ bf3a03_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)bf3a03InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0xde,0x24,0xde,0x24},
. mclk = 24000000,
.p_fun_adapt = {bf3a03_rotate,bf3a03_hvblank,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ bf3a03_init=
{
0x3a,0xdc,0xdd,0x01,0x01,0xfc,//bf3
};
#endif
+669
View File
@@ -0,0 +1,669 @@
#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_GC0308
SENSOR_INIT_SECTION static const unsigned char GC0308InitTable[CMOS_INIT_LEN]=
{
// 0xFE,0x80,
// 0xFE,0x00, //page 0
// 0xD2,0x10, //dis AEC
// 0x22,0x55, //dis AWB
// 0x5A,0x56,
// 0x5B,0x40,
// 0x5C,0x4A,
// // 0x22,0x57, //en AWB
// 0x01,0xCE,
// 0x02,0x70,
// 0x0F,0x00,
// 0xE2,0x00,
// 0xE3,0x96,
// 0xE4,0x02,
// 0xE5,0x58,
// 0xE6,0x02,
// 0xE7,0x58,
// 0xE8,0x02,
// 0xE9,0x58,
// 0xEA,0x0C,
// 0xEB,0xBE,
// 0xEC,0x20,
// 0x05,0x00,
// 0x06,0x00,
// 0x07,0x00,
// 0x08,0x00,
// 0x09,0x01,
// 0x0A,0xE8,
// 0x0B,0x02,
// 0x0C,0x88,
// 0x0D,0x02,
// 0x0E,0x02,
// 0x10,0x22,
// 0x11,0xFD,
// 0x12,0x2A,
// 0x13,0x00,
// 0x14,0x10,
// 0x15,0x0A,
// 0x16,0x05,
// 0x17,0x01,
// 0x18,0x44,
// 0x19,0x44,
// 0x1A,0x1E,
// 0x1B,0x00,
// 0x1C,0xC1,
// 0x1D,0x08,
// 0x1E,0x60,
// 0x1F,0x16,
// 0x20,0xFF, //en rgb_gamma¡¢CC
// // 0x20,0x9f, //dis rgb_gamma¡¢CC
// 0x21,0xF8, //dis y_gamma
// // 0x21,0xFA, //en y_gamma
// 0x22,0x57, //en AWB
// 0x24,0xA2,
// 0x25,0x0F,
// 0x26,0x03,
// 0x2F,0x01,
// 0x30,0xf7,
// 0x31,0x50,
// 0x32,0x00,
// 0x39,0x04,
// 0x3A,0x18,
// 0x3B,0x20,
// 0x3C,0x00,
// 0x3D,0x00,
// 0x3E,0x00,
// 0x3F,0x00,
// 0x50,0x10,
// 0x53,0x82,
// 0x54,0x80,
// 0x55,0x80,
// 0x56,0x82,
// 0x57,0x80,
// 0x58,0x80,
// 0x59,0x80,
// 0x8B,0x40,
// 0x8C,0x40,
// 0x8D,0x40,
// 0x8E,0x2E,
// 0x8F,0x2E,
// 0x90,0x2E,
// 0x91,0x3C,
// 0x92,0x50,
// 0x5D,0x12,
// 0x5E,0x1A,
// 0x5F,0x24,
// 0x60,0x07,
// 0x61,0x15,
// 0x62,0x08,
// 0x64,0x03,
// 0x66,0xE8,
// 0x67,0x86,
// 0x68,0xA2,
// 0x69,0x18,
// 0x6A,0x0F,
// 0x6B,0x00,
// 0x6C,0x5F,
// 0x6D,0x8F,
// 0x6E,0x55,
// 0x6F,0x38,
// 0x70,0x15,
// 0x71,0x33,
// 0x72,0xDC,
// 0x73,0x80,
// 0x74,0x02,
// 0x75,0x3F,
// 0x76,0x02,
// 0x77,0x36,
// 0x78,0x88,
// 0x79,0x81,
// 0x7A,0x81,
// 0x7B,0x22,
// 0x7C,0xFF,
// /****CCM****/
// 0x93,0x48,
// 0x94,0x00,
// 0x95,0x05,
// 0x96,0xE8,
// 0x97,0x40,
// 0x98,0xF0,
// /****CCM****/
// 0xB1,0x30, //Cb?saturation
// 0xB2,0x30, //Cr?saturation
// 0xBD,0x38,
// 0xBE,0x36,
// 0xD0,0xC9,
// 0xD1,0x10,
// 0xD3,0x40, //Target Y
// 0xD5,0xF2,
// 0xD6,0x16,
// 0xDB,0x92,
// 0xDC,0xA5,
// 0xDF,0x23,
// 0xD9,0x00,
// 0xDA,0x00,
// 0xE0,0x09,
// 0xEC,0x20,
// 0xED,0x04,
// 0xEE,0xA0,
// 0xEF,0x40,
// 0x80,0x03,
// 0x80,0x03,
// /**rgb gamma table**/
// 0x9F,0x0B,
// 0xA0,0x16,
// 0xA1,0x29,
// 0xA2,0x3C,
// 0xA3,0x4F,
// 0xA4,0x5F,
// 0xA5,0x6F,
// 0xA6,0x8A,
// 0xA7,0x9F,
// 0xA8,0xB4,
// 0xA9,0xC6,
// 0xAA,0xD3,
// 0xAB,0xDD,
// 0xAC,0xE5,
// 0xAD,0xF1,
// 0xAE,0xFA,
// 0xAF,0xFF,
// /**rgb gamma table**/
// /***y gamma table***/
// 0xC0,0x00,
// 0xC1,0x35,
// 0xC2,0x49,
// 0xC3,0x64,
// 0xC4,0x78,
// 0xC5,0x88,
// 0xC6,0x97,
// 0xC7,0xa4,
// 0xC8,0xbb,
// 0xC9,0xce,
// 0xCA,0xe0,
// 0xCB,0xf0,
// 0xCC,0xFF,
// /***y gamma table***/
// 0xF0,0x02,
// 0xF1,0x01,
// 0xF2,0x01,
// 0xF3,0x30,
// 0xF9,0x9F,
// 0xFA,0x78,
// 0xFE,0x01, //page 1
// 0x00,0xF5,
// 0x02,0x1A,
// 0x0A,0xA0,
// 0x0B,0x60,
// 0x0C,0x08,
// 0x0E,0x4C,
// 0x0F,0x39,
// 0x11,0x3F,
// 0x12,0x72,
// 0x13,0x13,
// 0x14,0x42,
// 0x15,0x43,
// 0x16,0xC2,
// 0x17,0xA8,
// 0x18,0x18,
// 0x19,0x40,
// 0x1A,0xD0,
// 0x1B,0xF5,
// 0x70,0x40,
// 0x71,0x58,
// 0x72,0x30,
// 0x73,0x48,
// 0x74,0x20,
// 0x75,0x60,
// 0x77,0x20,
// 0x78,0x32,
// 0x30,0x03,
// 0x31,0x40,
// 0x32,0xE0,
// 0x33,0xE0,
// 0x34,0xE0,
// 0x35,0xB0,
// 0x36,0xC0,
// 0x37,0xC0,
// 0x38,0x04,
// 0x39,0x09,
// 0x3A,0x12,
// 0x3B,0x1C,
// 0x3C,0x28,
// 0x3D,0x31,
// 0x3E,0x44,
// 0x3F,0x57,
// 0x40,0x6C,
// 0x41,0x81,
// 0x42,0x94,
// 0x43,0xA7,
// 0x44,0xB8,
// 0x45,0xD6,
// 0x46,0xEE,
// 0x47,0x0D,
// 0xFE,0x00, //page 0
// 0xD2,0x90, //en AEC
// 0xFE,0x00, //page 0
// 0x10,0x26,
// 0x11,0x0D,
// 0x1A,0x2A,
// 0x1C,0x49,
// 0x1D,0x9A,
// 0x1E,0x61,
// 0x3A,0x20,
// 0x50,0x14,
// 0x53,0x80,
// 0x56,0x80,
// 0x8B,0x20,
// 0x8C,0x20,
// 0x8D,0x20,
// 0x8E,0x14,
// 0x8F,0x10,
// 0x90,0x14,
// 0x94,0x02,
// 0x95,0x07,
// 0x96,0xE0,
// 0xB1,0x38, //Cb?saturation
// 0xB2,0x38, //Cr?saturation
// 0xB3,0x40, //Luma_contrast
// 0xB6,0xE0,
// 0xD0,0xCB,
// 0xD3,0x45, //Target Y
// 0xF2,0x02,
// 0xF7,0x12,
// 0xF8,0x0A,
// 0xFE,0x01, //page 1
// 0x02,0x20,
// 0x04,0x10,
// 0x05,0x08,
// 0x06,0x20,
// 0x08,0x0A,
// 0x0E,0x44,
// 0x0F,0x32,
// 0x10,0x41,
// 0x11,0x37,
// 0x12,0x22,
// 0x13,0x19,
// 0x14,0x44,
// 0x15,0x44,
// 0x19,0x50,
// 0x1A,0xD8,
// 0x32,0x10,
// 0x35,0x00,
// 0x36,0x80,
// 0x37,0x00,
// 0xFE,0x00, //page 0
// 0x14,0x10,
0xFE,0x80,
0xFE,0x00, //page 0
0xD2,0x10, //dis AEC
0x22,0x35, //dis AWB
0x5A,0x50,
0x5B,0x40,
0x5C,0x4A,
// 0x22,0x37, //en AWB
0x01,0xDD,
0x02,0x18,
0x0F,0x00,
0x03,0x01,
0x04,0x2C,
0xE3,0x61,
0xE4,0x01,
0xE5,0xE5,
0xE6,0x01,
0xE7,0xE5,
0xE8,0x01,
0xE9,0xE5,
0xEA,0x01,
0xEB,0xE5,
0x05,0x00,
0x06,0x00,
0x07,0x00,
0x08,0x00,
0x09,0x01,
0x0A,0xE8,
0x0B,0x02,
0x0C,0x88,
0x0D,0x02,
0x0E,0x02,
0x10,0x22,
0x11,0xFD,
0x12,0x2A,
0x13,0x00,
0x14,0x10,
0x15,0x0A,
0x16,0x05,
0x17,0x01,
0x18,0x44,
0x19,0x44,
0x1A,0x1E,
0x1B,0x00,
0x1C,0xC1,
0x1D,0x08,
0x1E,0x60,
0x1F,0x16,
0x20,0xFF, //en rgb_gamma¡¢CC
0x21,0xF8, //dis y_gamma
0x22,0x57, //en AWB
// 0x22,0x55, //dis AWB
0x23,0x00,
0x24,0xA2,
0x25,0x0F,
0x26,0x03,
0x2F,0x01,
0x30,0xF7,
0x31,0x50,
0x32,0x00,
0x39,0x04,
0x3A,0x18,
0x3B,0x20,
0x3C,0x00,
0x3D,0x00,
0x3E,0x00,
0x3F,0x00,
0x50,0x10,
0x53,0x82,
0x54,0x80,
0x55,0x80,
0x56,0x82,
0x8B,0x40,
0x8C,0x40,
0x8D,0x40,
0x8E,0x2E,
0x8F,0x2E,
0x90,0x2E,
0x91,0x3C,
0x92,0x50,
0x5D,0x12,
0x5E,0x1A,
0x5F,0x24,
0x60,0x07,
0x61,0x15,
0x62,0x08,
0x64,0x03,
0x66,0xE8,
0x67,0x86,
0x68,0xA2,
0x69,0x18,
0x6A,0x0F,
0x6B,0x00,
0x6C,0x5F,
0x6D,0x8F,
0x6E,0x65,
0x6F,0x48,
0x70,0x15,
0x71,0x33,
0x72,0xDC,
0x73,0x80,
0x74,0x02,
0x75,0x3F,
0x76,0x02,
0x77,0x36,
0x78,0x88,
0x79,0x81,
0x7A,0x81,
0x7B,0x22,
0x7C,0xFF,
/****CCM****/
0x93,0x48,
0x94,0x00,
0x95,0x05,
0x96,0xE8,
0x97,0x40,
0x98,0xF0,
/****CCM****/
0xBD,0x38,
0xBE,0x36,
0xD0,0xC9,
0xD1,0x10,
0xD3,0x50, //Target Y
0xD5,0xF2,
0xD6,0x16,
0xDB,0x92,
0xDC,0xA5,
0xDF,0x23,
0xD9,0x00,
0xDA,0x00,
0xE0,0x09,
0xED,0x04,
0xEE,0xA0,
0xEF,0x40,
0x80,0x03,
0x80,0x03,
/**rgb gamma table**/
0x9F,0x15,
0xA0,0x2A,
0xA1,0x4A,
0xA2,0x67,
0xA3,0x79,
0xA4,0x8C,
0xA5,0x9A,
0xA6,0xB3,
0xA7,0xC5,
0xA8,0xD5,
0xA9,0xDF,
0xAA,0xE8,
0xAB,0xEE,
0xAC,0xF3,
0xAD,0xFA,
0xAE,0xFD,
0xAF,0xFF,
/**rgb gamma table**/
/***y gamma table***/
0xC0,0x00,
0xC1,0x10,
0xC2,0x1C,
0xC3,0x30,
0xC4,0x43,
0xC5,0x54,
0xC6,0x65,
0xC7,0x75,
0xC8,0x93,
0xC9,0xB0,
0xCA,0xCB,
0xCB,0xE6,
0xCC,0xFF,
/***y gamma table***/
0xF0,0x02,
0xF1,0x01,
0xF2,0x01,
0xF3,0x30,
0xF9,0x9F,
0xFA,0x78,
0xFE,0x01, //page 1
0x00,0xF5,
0x0A,0xA0,
0x0B,0x60,
0x0C,0x08,
0x0E,0x4C,
0x0F,0x39,
0x11,0x3F,
0x12,0x72,
0x13,0x13,
0x14,0x42,
0x15,0x43,
0x16,0xC2,
0x17,0xA8,
0x18,0x18,
0x19,0x40,
0x1A,0xD0,
0x1B,0xF5,
0x70,0x40,
0x71,0x58,
0x72,0x30,
0x73,0x48,
0x74,0x20,
0x75,0x60,
0x77,0x20,
0x78,0x32,
0x30,0x03,
0x31,0x40,
0x32,0xE0,
0x33,0xE0,
0x34,0xE0,
0x35,0xB0,
0x36,0xC0,
0x37,0xC0,
0x38,0x04,
0x39,0x09,
0x3A,0x12,
0x3B,0x1C,
0x3C,0x28,
0x3D,0x31,
0x3E,0x44,
0x3F,0x57,
0x40,0x6C,
0x41,0x81,
0x42,0x94,
0x43,0xA7,
0x44,0xB8,
0x45,0xD6,
0x46,0xEE,
0x47,0x0D,
0xFE,0x00, //page 0
0xD2,0x90, //en AEC
0xFE,0x00, //page 0
0x10,0x26,
0x11,0x0D,
0x1A,0x2A,
0x1C,0x49,
0x1D,0x9A,
0x1E,0x61,
0x3A,0x20,
0x50,0x14,
0x53,0x80,
0x56,0x80,
0x94,0x02,
0x95,0x07,
0x96,0xE0,
0xB0,0x40,
0xB1,0x58,
0xB2,0x58,
0xB3,0x40,
0xB5,0x00,
0xB6,0xE0,
0xD0,0xCB,
0xD3,0x50,
0xF2,0x02,
0xF7,0x12,
0xF8,0x0A,
0x9C,0x00,
0x9D,0x00,
0x9E,0x03,
0x59,0x84,
0x57,0x80,
0x58,0x7B,
0x59,0x78,
0xFE,0x01, //page 1
0x02,0x20,
0x04,0x10,
0x05,0x08,
0x06,0x20,
0x08,0x0A,
0x0E,0x44,
0x0F,0x32,
0x10,0x41,
0x11,0x37,
0x12,0x22,
0x13,0x39,
0x14,0x44,
0x15,0x44,
0x19,0x50,
0x1A,0xD8,
0x1C,0x80, //AWB r_gain_limit
0x1D,0x80, //AWB g_gain_limit
0x1E,0x80, //AWB b_gain_limit
0x32,0x10,
0x35,0x00,
0x36,0x80,
0x37,0x00,
0xFE,0x00, //page 0
0x01,0xDD,
0x02,0x18,
0x0F,0x00,
0x03,0x01,
0x04,0x2C,
0xE2,0x00,
0xE3,0x61,
0xE4,0x01,
0xE5,0xE5,
0xE6,0x01,
0xE7,0xE5,
0xE8,0x01,
0xE9,0xE5,
0xEA,0x01,
0xEB,0xE5,
0x14,0x10,
-1,-1,
};
extern struct i2c_device *iic_test;
static void GC0308_rotate(uint32 r)
{
int8 buf[2];
buf[0] = 0x14; //0',180'
buf[1] = 0x10|(r<<0);
//Sensor_WriteRegister(SENSOR_IIC,buf,1,1);
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
i2c_write(iic_test,buf,1,&buf[1],1);
}
uint32 GC0308_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0x6aUL
#define VBLANK_BASE 0x12UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x01,h & 0xff},//0x6a//0xde //HB[7:0]
{0x02,v & 0xff}, //0x0c //VB[7:0]
{0x0f,((v >> 8)<<4)|(h >> 8)} //{0x0f,0x00}, //VB/HB [11:8]
};
//for(i=0;i<3;i++)
//Sensor_WriteRegister(SENSOR_IIC,(uint8 *)&t[i][0],1,1);
for(i=0;i<3;i++)
//i2c_sensor_write(iic_test,(uint8 *)&t[i][0],1,1,0x42,0x43);
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ gc0308_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)GC0308InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0x6a,0x12,0x6a,0x12},
. mclk = 24000000,
.p_fun_adapt = {GC0308_rotate,GC0308_hvblank,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ gc0308_init=
{
0x9b,0x42,0x43,0x01,0x01,0x00
};
#endif
+293
View File
@@ -0,0 +1,293 @@
#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_GC0309
SENSOR_INIT_SECTION static const unsigned char GC0309InitTable[CMOS_INIT_LEN]=
{
0xFE,0x80,
0xFE,0x00,
0x1A,0x26,
0xD2,0x10,
0x22,0x55,
0x5A,0x56,
0x5B,0x40,
0x5C,0x4A,
0x22,0x57,
0xE2,0x00,
0xE3,0x64,
0x03,0x01,
0x04,0x2C,
0xE4,0x02,
0xE5,0x8F,
0xE6,0x02,
0xE7,0x8F,
0xE8,0x02,
0xE9,0x8F,
0xEA,0x05,
0xEB,0xDC,
0x05,0x00,
0x06,0x00,
0x07,0x00,
0x08,0x00,
0x09,0x01,
0x0A,0xE8,
0x0B,0x02,
0x0C,0x88,
0x0D,0x02,
0x0E,0x02,
0x10,0x26,
0x11,0x0D,
0x12,0x2A,
0x13,0x00,
0x14,0x10,
0x15,0x0A,
0x16,0x05,
0x17,0x01,
0x1B,0x03,
0x1C,0x49,
0x1D,0x98,
0x1E,0x20,
0x1F,0x3F,
0x20,0xFF,
0x21,0xF8,
0x24,0xA2,
0x25,0x0F,
0x26,0x03,
0x2F,0x01,
0x30,0xF7,
0x31,0x60,
0x32,0x00,
0x39,0x04,
0x3A,0x20,
0x3B,0x20,
0x3C,0x02,
0x3D,0x02,
0x3E,0x02,
0x3F,0x02,
0x50,0x24,
0x53,0x82,
0x54,0x80,
0x55,0x80,
0x56,0x82,
0x8B,0x22,
0x8C,0x20,
0x8D,0x20,
0x8E,0x10,
0x8F,0x10,
0x90,0x10,
0x91,0x3C,
0x92,0x50,
0x5D,0x12,
0x5E,0x1A,
0x5F,0x24,
0x60,0x07,
0x61,0x0E,
0x62,0x0C,
0x64,0x03,
0x66,0xE8,
0x67,0x86,
0x68,0xA2,
0x69,0x20,
0x6A,0x0F,
0x6B,0x00,
0x6C,0x53,
0x6D,0x83,
0x6E,0xAC,
0x6F,0xAC,
0x70,0x15,
0x71,0x43,
0x72,0xDC,
0x73,0x80,
0x74,0x02,
0x75,0x3F,
0x76,0x02,
0x77,0x54,
0x78,0x88,
0x79,0x81,
0x7A,0x81,
0x7B,0x22,
0x7C,0xFF,
0x93,0x48,
0x94,0x00,
0x95,0x05,
0x96,0xE8,
0x97,0x40,
0x98,0xF8,
0x9C,0x00,
0x9D,0x00,
0x9E,0x00,
0xB0,0x40,
0xB1,0x40,
0xB2,0x30,
0xB3,0x40,
0xB4,0x80,
0xB8,0x20,
0xBE,0x36,
0xBF,0x00,
0xD0,0xCB,
0xD1,0x10,
0xD3,0x5A,
0xD5,0xF2,
0xD6,0x16,
0xDB,0x92,
0xDC,0xA5,
0xDF,0x23,
0xD9,0x00,
0xDA,0x00,
0xE0,0x09,
0xEC,0x20,
0xED,0x04,
0xEE,0xA0,
0xEF,0x40,
0x9F,0x0E,
0xA0,0x1C,
0xA1,0x34,
0xA2,0x48,
0xA3,0x5A,
0xA4,0x6B,
0xA5,0x7B,
0xA6,0x95,
0xA7,0xAB,
0xA8,0xBF,
0xA9,0xCE,
0xAA,0xD9,
0xAB,0xE4,
0xAC,0xEC,
0xAD,0xF7,
0xAE,0xFD,
0xAF,0xFF,
0xC0,0x00,
0xC1,0x0B,
0xC2,0x15,
0xC3,0x27,
0xC4,0x39,
0xC5,0x49,
0xC6,0x5A,
0xC7,0x6A,
0xC8,0x89,
0xC9,0xA8,
0xCA,0xC6,
0xCB,0xE3,
0xCC,0xFF,
0xF0,0x02,
0xF1,0x01,
0xF2,0x00,
0xF3,0x30,
0xF7,0x04,
0xF8,0x02,
0xF9,0x9F,
0xFA,0x78,
0xFE,0x01,
0x00,0xF5,
0x02,0x1A,
0x0A,0xA0,
0x0B,0x60,
0x0C,0x08,
0x0E,0x4C,
0x0F,0x39,
0x11,0x3F,
0x12,0x72,
0x13,0x13,
0x14,0x42,
0x15,0x43,
0x16,0xC2,
0x17,0xA8,
0x18,0x18,
0x19,0x40,
0x1A,0xD0,
0x1B,0xF5,
0x70,0x40,
0x71,0x58,
0x72,0x30,
0x73,0x48,
0x74,0x20,
0x75,0x60,
0xFE,0x00,
0xD2,0x90,
0xFE,0x00,
0x22,0x55,
0x57,0x80,
0x58,0x78,
0x59,0x78,
0x5A,0x55,
0x5B,0x45,
0x5C,0x3A,
0xB0,0x50,
0xB1,0x40,
0xB2,0x46,
0xD3,0x6A,
-1,-1};
extern struct i2c_device *iic_test;
static void GC0309_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x14; //0',180'
buf[1] = 0x10|(r<<0);
//Sensor_WriteRegister(SENSOR_IIC,buf,1,1);
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
}
uint32 GC0309_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0xdeUL
#define VBLANK_BASE 0x24UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x01,h & 0xff},//0x6a//0xde //HB[7:0]
{0x02,v & 0xff}, //0x0c //VB[7:0]
{0x0f,((v >> 8)<<4)|(h >> 8)} //{0x0f,0x00}, //VB/HB [11:8]
};
//for(i=0;i<3;i++)
//Sensor_WriteRegister(SENSOR_IIC,(u8 *)&t[i][0],1,1);
for(i=0;i<3;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ gc0309_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)GC0309InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0xde,0x24,0xde,0x24},
. mclk = 24000000,
.p_fun_adapt = {GC0309_rotate,GC0309_hvblank,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ gc0309_init=
{
0xa0,0x42,0x43,0x01,0x01,0x00
};
#endif
+438
View File
@@ -0,0 +1,438 @@
#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_GC0311
SENSOR_INIT_SECTION static const unsigned char GC0311InitTable[CMOS_INIT_LEN]=
{
0xfe,0xf0,
0xfe,0xf0,
0xfe,0xf0,
0xfc,0x16,//clockenable
0xfc,0x16,//clockenable
0x42,0x00,
0x4f,0x01,
0x03,0x02,
0x04,0x88,
0x26,0x00,
0x29,0x40,//[7]black_compress_en,[6:0]global_offset
0x2a,0x30,
0x2b,0x30,
0x2c,0x30,
0x2d,0x30,
0x77,0x54,//AWB_R_gain
0x78,0x40,//AWB_G_gain
0x79,0x4a,//AWB_B_gain
0x73,0x80,
0x74,0x82,
0x75,0x82,
0x76,0x82,
////////////BLK/////////////////////
////////////////////////////////////////////////
0x26,0xf7,//[
0x28,0x7f,//BLKvaluelimit
0x32,0x00,
0x33,0x20,//offset_ratio_G1
0x34,0x20,//offset_ratio_G2
0x35,0x20,//offsetratio_R
0x36,0x20,//offsetratio_B
0x3b,0x08,
0x3c,0x08,
0x3d,0x08,
0x3e,0x08,
/////////////CISCTL/////////////////////////////
0xfe,0x00,//Pageselect
//////windowsetting/////
0x0d,0x01,//8cis_win_height
0x0e,0xe8,//7:0cis_win_height
0x0f,0x02,//9:8cis_win_width
0x10,0x88,//7:0cis_win_width
0x09,0x00,//row_start
0x0a,0x00,
0x0b,0x00,//col_start
0x0c,0x04,
//crop
0x50,0x01,
#if 1
///cropwindow
0x51,0x00,
0x52,0x00,///y
0x53,0x00,
0x54,0x00,///x
0x55,0x01,
0x56,0xe0,///360
0x57,0x02,
0x58,0x80,//640
#endif
/////////////////banding////////////////
0x05,0x01,
0x06,0x32,//Hb
0x07,0x00,
0x08,0x0c,//VB
0xfe,0x01,//VB
0x29,0x00,
0x2a,0x78,//step
0x2b,0x01,
0x2c,0x68,//25fps
0x2d,0x01,
0x2e,0x68,//25fps
0x2f,0x01,
0x30,0x68,//25fps
0x31,0x01,
0x32,0x68,//25fps
0x33,0x20,
0xfe,0x00,
0x17,0x14,//[1]updown,[0]mirror1417
0x19,0x04,
0x1f,0x08,
0x20,0x01,
0x21,0x48,
0x1b,0x48,//fordecreaseFPN
0x22,0xba,
0x23,0x06,//0720140113lanking
0x24,0x16,//PADdriver
//globalgainforrange
0x70,0x50,//58
////////////////////////////////////////////////
////////////blockenable/////////////
////////////////////////////////////////////////
0x40,0xff,
0x41,0x2e,
0x42,0xf9,
0x44,0xa2,//yuv
0x46,0x03,//sync_mode
0x4d,0x01,
0x4f,0x01,
//DN&EEINTP
#if 1
0x7e,0x08,
0x7f,0xc3,
0x80,0x01,//f7
0x81,0x30,//fe
0x82,0xf0,//f0
0x83,0x01,//02
0x84,0x02,
0x89,0x22,
0x90,0x2c,
0x92,0x02,
0x94,0x02,
0x95,0x48,//边缘
#else
0x7e,0x0a,
0x7f,0x03,
0x80,0x27,//20140915
0x81,0x15,
0x82,0x90,
0x83,0x02,
0x84,0x23,//0xe5
0x90,0x2c,
0x92,0x02,
0x94,0x02,
0x95,0x35,
#endif
/////////////////////ASDE////////////////
0x9a,0x20,//YoffsetLimit
0x9c,0x86,
0xa4,0x50,
0xa7,0xf0,//40travis20160127
0xaa,0x60,
0xa2,0x45,
////////////////Ygamma////////////////
//////////////////////////////////////////
#if 0
0xfe,0x00,
0x63,0x00,
0x64,0x04,
0x65,0x09,
0x66,0x17,
0x67,0x2b,
0x68,0x3d,
0x69,0x4f,
0x6a,0x5f,
0x6b,0x82,
0x6c,0xa2,
0x6d,0xc5,
0x6e,0xe5,
0x6f,0xff,
#else
0xfe,0x00,
0x63,0x00,
0x64,0x05,
0x65,0x0b,
0x66,0x19,
0x67,0x2e,
0x68,0x40,
0x69,0x54,
0x6a,0x66,
0x6b,0x86,
0x6c,0xa7,
0x6d,0xc6,
0x6e,0xe4,
0x6f,0xff,
#endif
0xfe,0x00,
////////////////RGBgamma//////////////
///////////////////////////////////////
/*
0xfe,0x00,
0xbf,0x0b,
0xc0,0x17,
0xc1,0x2a,
0xc2,0x41,
0xc3,0x54,
0xc4,0x66,
0xc5,0x74,
0xc6,0x8c,
0xc7,0xa3,
0xc8,0xb5,
0xc9,0xc4,
0xca,0xd0,
0xcb,0xdb,
0xcc,0xe5,
0xcd,0xf0,
0xce,0xf7,
0xcf,0xff,*/
0xfe,0x00,
0xbf,0x0b,
0xc0,0x16,
0xc1,0x29,
0xc2,0x3c,
0xc3,0x4f,
0xc4,0x5f,
0xc5,0x6f,
0xc6,0x8a,
0xc7,0x9f,
0xc8,0xb4,
0xc9,0xc6,
0xca,0xd3,
0xcb,0xdd,
0xcc,0xe5,
0xcd,0xf1,
0xce,0xfa,
0xcf,0xff,
///YUVmaxtrix////
0xb0,0x13,
0xb1,0x1f,//1f
0xb2,0x0e,
0xb3,0xf5,
0xb4,0xe5,
0xb5,0x26,
0xb6,0x20,
0xb7,0xde,
0xb8,0x02,
/////////////YCP//////////////
////////////////////////////
0xd1,0x2c,
0xd2,0x2c,
0xd3,0x3c,//对比度
0xdd,0x38,
0xed,0x00,
0xde,0x34,//autogray_mode
0xe4,0x00,
0xe5,0x40,
//luma_div
0xfe,0x01,
0x18,0x21,
///////////MEANSUREWINDOW////////
0x08,0xa4,
0x09,0xf0,
//////////////////AEC///////////////////////
0xfe,0x01,
0x10,0x08,//08//18//[7]low_light_mode,[6]measure_point
0x11,0x11,//[6:4]veryN
0x12,0x00,//90beforeGamma,shouldsetbit[7]as0
0x13,0x41,//Ytarget
0x15,0xfe,//fc//highrange
0x16,0xd8,//AECignore
0x17,0x98,//AECignoreen
0x1a,0x61,//SLOWmargin
0x18,0x21,//LUMA
0x21,0xc0,//auto_post_gain
0x22,0x60,//autopregain
//////////////////AWB////////////////////
0x06,0x10,
0x08,0xa0,
0x50,0xfe,
0x51,0x05,
0x52,0x28,
0x53,0x05,
0x54,0x10,
0x55,0x20,
0x56,0x16,//AWBCmax
0x57,0x10,
0x58,0xf2,
0x59,0x10,
0x5a,0x10,
0x5b,0xf0,
0x5e,0xe8,
0x5f,0x20,
0x60,0x20,
0x61,0xe0,
0x62,0x03,
0x63,0x30,
0x64,0xc0,
0x65,0xd0,
0x66,0x20,
0x67,0x00,//80//AWB_outdoor_mode
0x6d,0x90,
0x6e,0x40,
0x6f,0x08,
0x70,0x10,
0x71,0x62,
0x72,0x24,
0x73,0x71,
0x74,0x10,
0x75,0x40,
0x76,0x40,
0x77,0xc9,
0x78,0x9c,
0x79,0x18,
0x7a,0x40,
0x7b,0xb0,
0x7c,0xf5,
0x81,0x70,
0x82,0x58,
0x83,0x78,
0x8a,0xf8,
0x8b,0xf4,
0x8c,0x0a,
0x8d,0x00,
0x8e,0x00,
0x8f,0x00,
0x90,0x12,
0xfe,0x00,
////////////////SPIreciver////////////////
0xad,0x00,
//////////////////LSC///////////////////////
0xfe,0x01,
0xc0,0x1e,
0xc1,0x18,
0xc2,0x17,
0xc6,0x1e,
0xc7,0x18,
0xc8,0x17,
0xba,0x30,
0xbb,0x25,
0xbc,0x20,
0xb4,0x30,
0xb5,0x25,
0xb6,0x20,
0xc3,0x00,
0xc4,0x00,
0xc5,0x00,
0xc9,0x00,
0xca,0x00,
0xcb,0x00,
0xbd,0x00,
0xbe,0x00,
0xbf,0x00,
0xb7,0x00,
0xb8,0x00,
0xb9,0x00,
0xa8,0x0f,
0xa9,0x05,
0xaa,0x00,
0xab,0x0f,
0xac,0x05,
0xad,0x00,
0xae,0x0f,
0xaf,0x05,
0xb0,0x00,
0xb1,0x0f,
0xb2,0x05,
0xb3,0x00,
0xa4,0x00,
0xa5,0x00,
0xa6,0x00,
0xa7,0x00,
0xa1,0x3c,
0xa2,0x50,
0xfe,0x00,
0x50,0x01,//crop
0xfe,0x01,
0x9c,0x00,
0x9e,0xc0,
0x9f,0x40,
0xfe,0x00,
0x42,0xfb,
0xf1,0x07,//outputenable
0xf2,0x01,//outputenableDVPorSPI
-1,-1};
SENSOR_OP_SECTION const _Sensor_Adpt_ gc0311_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bits
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)GC0311InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0x6a,0x12,0x6a,0x12},
. mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ gc0311_init=
{
0xBB,0x66,0x67,0x01,0x01,0xf0
};
#endif
+527
View File
@@ -0,0 +1,527 @@
#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_GC0312
SENSOR_INIT_SECTION static const unsigned char GC0312InitTable[CMOS_INIT_LEN]=
{
0xfe,0xf0,
0xfe,0xf0,
0xfe,0x00,
0xfc,0x0e ,
0xfc,0x0e ,
0xf2,0x08 ,
0xf3,0x00,// output_disable
0xf7,0x1b ,
0xf8,0x03 ,
0xf9,0x0e ,
0xfa,0x11,
#if 1
/////////////////////////////////////////////////
///////////////// CISCTL reg /////////////////
/////////////////////////////////////////////////
0x00,0x2f,
0x01,0x0f,
0x02,0x04,
0x03,0x03,
0x04,0x50,
0x09,0x00,
0x0a,0x00,
0x0b,0x00,
0x0c,0x04,
0x0d,0x01,
0x0e,0xe8,
0x0f,0x02,
0x10,0x88,
0x16,0x00,
0x17,0x14,
0x18,0x1a,
0x19,0x14,
0x1b,0x48,
0x1c,0x1c,
0x1e,0x6b,
0x1f,0x28,
0x20,0x8b,//89 travis 20140801
0x21,0x49,
0x22,0xb0,
0x23,0x04,
0x24,0x16,
0x34,0x20,
/////////////////////////////////////////////////
//////////////////// BLK ////////////////////
/////////////////////////////////////////////////
0x26,0x23,
0x28,0xff,
0x29,0x00,
0x32,0x00,
0x33,0x10 ,
0x37,0x20,
0x38,0x10,
0x47,0x80,
0x4e,0x66,
0xa8,0x02,
0xa9,0x80,
/////////////////////////////////////////////////
////////////////// ISP reg ///////////////////
/////////////////////////////////////////////////
0x40,0xff,
0x41,0x21,
0x42,0xcf,
0x44,0x02,
0x45,0xa8 ,
0x46,0x02 ,
0x4a,0x11,
0x4b,0x01,
0x4c,0x20,
0x4d,0x05,
0x4f,0x01,
0x50,0x01,
0x55,0x01,
0x56,0xe0,
0x57,0x02,
0x58,0x80,
/////////////////////////////////////////////////
/////////////////// GAIN ////////////////////
/////////////////////////////////////////////////
0x70,0x70,
0x5a,0x84,
0x5b,0xc9,
0x5c,0xed,
0x77,0x74,
0x78,0x70, //0x40,
0x79,0x5f,
/////////////////////////////////////////////////
/////////////////// DNDD /////////////////////
/////////////////////////////////////////////////
0x82,0x14 ,
0x83,0x0b,
0x89,0xf0,
/////////////////////////////////////////////////
////////////////// EEINTP ////////////////////
/////////////////////////////////////////////////
0x8f,0xaa ,
0x90,0x8c ,
0x91,0x90,
0x92,0x03 ,
0x93,0x03 ,
0x94,0x05 ,
0x95,0x65 ,
0x96,0xf0 ,
/////////////////////////////////////////////////
///////////////////// ASDE ////////////////////
/////////////////////////////////////////////////
0xfe,0x00,
0x9a,0x20,
0x9b,0x80,
0x9c,0x40,
0x9d,0x80,
0xa1,0x30,
0xa2,0x32,
0xa4,0x80,//30 travis 20140929
0xa5,0x28,//30 travis 20140929
0xaa,0x30,//10 travis 20140929
0xac,0x22,
/////////////////////////////////////////////////
/////////////////// GAMMA ///////////////////
/////////////////////////////////////////////////
/*0xfe,0x00,//default
0xbf,0x08,
0xc0,0x16,
0xc1,0x28,
0xc2,0x41,
0xc3,0x5a,
0xc4,0x6c,
0xc5,0x7a,
0xc6,0x96,
0xc7,0xac,
0xc8,0xbc,
0xc9,0xc9,
0xca,0xd3,
0xcb,0xdd,
0xcc,0xe5,
0xcd,0xf1,
0xce,0xfa,
0xcf,0xff,*/
////big gammmar///////////////////////////////
0xfe,0x00,//big gamma
0xbf,0x08,
0xc0,0x1d,
0xc1,0x34,
0xc2,0x4b,
0xc3,0x60,
0xc4,0x73,
0xc5,0x85,
0xc6,0x9f,
0xc7,0xb5,
0xc8,0xc7,
0xc9,0xd5,
0xca,0xe0,
0xcb,0xe7,
0xcc,0xec,
0xcd,0xf4,
0xce,0xfa,
0xcf,0xff,
/////////////////////////////////////////////////
/////////////////// YCP //////////////////////
/////////////////////////////////////////////////
0xd0,0x40,
0xd1,0x34,
0xd2,0x34,
0xd3,0x40,
0xd6,0xf2,
0xd7,0x1b,
0xd8,0x18,
0xdd,0x03,
/////////////////////////////////////////////////
//////////////////// AEC ////////////////////
/////////////////////////////////////////////////
0xfe,0x01,
0x05,0x30,
0x06,0x75,
0x07,0x40,
0x08,0xb0,
0x0a,0x85, //0xc5,
0x0b,0x11,
0x0c,0x00,
0x12,0x52,
0x13,0x78, //0x75,
0x18,0x67,//0X95
0x19,0x67,//0X96
0x1f,0x20,
0x20,0xc0,
0x3e,0x40,
0x3f,0x57,
0x40,0x7d,
0x03,0x60,
0x44,0x02,
/////////////////////////////////////////////////
//////////////////// AWB ////////////////////
/////////////////////////////////////////////////
0xfe,0x01,
0x1c,0x91,
0x21,0x15,
0x50,0x80,
0x56,0x04,
0x59,0x08,
0x5b,0x02,
0x61,0x8d,
0x62,0xa7,
0x63,0xd0,
0x65,0x06,
0x66,0x06,
0x67,0x84,
0x69,0x08,
0x6a,0x25,
0x6b,0x01,
0x6c,0x00,//00
0x6d,0x02,
0x6e,0xf0,
0x6f,0x80,//80
0x76,0x80,
0x78,0xaf,
0x79,0x75,
0x7a,0x40,
0x7b,0x50,
0x7c,0x0c,
0x90,0xc9,//stable AWB
0x91,0xbe,
0x92,0xe2,
0x93,0xc9,
0x95,0x1b,
0x96,0xe2,
0x97,0x49,
0x98,0x1b,
0x9a,0x49,
0x9b,0x1b,
0x9c,0xc3,
0x9d,0x49,
0x9f,0xc7,
0xa0,0xc8,
0xa1,0x00,
0xa2,0x00,
0x86,0x00,
0x87,0x00,
0x88,0x00,
0x89,0x00,
0xa4,0xb9,
0xa5,0xa0,
0xa6,0xba,
0xa7,0x92,
0xa9,0xba,
0xaa,0x80,
0xab,0x9d,
0xac,0x7f,
0xae,0xbb,
0xaf,0x9d,
0xb0,0xc8,
0xb1,0x97,
0xb3,0xb7,
0xb4,0x7f,
0xb5,0x00,
0xb6,0x00,
0x8b,0x00,
0x8c,0x00,
0x8d,0x00,
0x8e,0x00,
0x94,0x55,
0x99,0xa6,
0x9e,0xaa,
0xa3,0x0a,
0x8a,0x00,
0xa8,0x55,
0xad,0x55,
0xb2,0x55,
0xb7,0x05,
0x8f,0x00,
0xb8,0xcb,
0xb9,0x9b,
//default awb/////////////////////
/*
0xa4,0xb9, //default AWB
0xa5,0xa0,
0x90,0xc9,
0x91,0xbe,
0xa6,0xb8,
0xa7,0x95,
0x92,0xe6,
0x93,0xca,
0xa9,0xbc,
0xaa,0x95,
0x95,0x23,
0x96,0xe7,
0xab,0x9d,
0xac,0x80,
0x97,0x43,
0x98,0x24,
0xae,0xb7,
0xaf,0x9e,
0x9a,0x43,
0x9b,0x24,
0xb0,0xc8,
0xb1,0x97,
0x9c,0xc4,
0x9d,0x44,
0xb3,0xb7,
0xb4,0x7f,
0x9f,0xc7,
0xa0,0xc8,
0xb5,0x00,
0xb6,0x00,
0xa1,0x00,
0xa2,0x00,
0x86,0x60,
0x87,0x08,
0x88,0x00,
0x89,0x00,
0x8b,0xde,
0x8c,0x80,
0x8d,0x00,
0x8e,0x00,
0x94,0x55,
0x99,0xa6,
0x9e,0xaa,
0xa3,0x0a,
0x8a,0x0a,
0xa8,0x55,
0xad,0x55,
0xb2,0x55,
0xb7,0x05,
0x8f,0x05,
0xb8,0xcc,
0xb9,0x9a,
*/
/////////////////////////////////////////////////
//////////////////// CC ////////////////////
/////////////////////////////////////////////////
0xfe,0x01,
0xd0,0x38,//skin red
0xd1,0x00,
0xd2,0x02,
0xd3,0x04,
0xd4,0x38,
0xd5,0x12,
0xd6,0x30,
0xd7,0x00,
0xd8,0x0a,
0xd9,0x16,
0xda,0x39,
0xdb,0xf8,
/////////////////////////////////////////////////
//////////////////// LSC ////////////////////
/////////////////////////////////////////////////
0xfe,0x01,
0xc1,0x3c,
0xc2,0x50,
0xc3,0x00,
0xc4,0x40,
0xc5,0x30,
0xc6,0x30,
0xc7,0x10,
0xc8,0x00,
0xc9,0x00,
0xdc,0x20,
0xdd,0x10,
0xdf,0x00,
0xde,0x00,
/////////////////////////////////////////////////
/////////////////// Histogram /////////////////
/////////////////////////////////////////////////
0x01,0x10,
0x0b,0x31,
0x0e,0x50,
0x0f,0x0f,
0x10,0x6e,
0x12,0xa0,
0x15,0x60,
0x16,0x60,
0x17,0xe0,
/////////////////////////////////////////////////
////////////// Measure Window ///////////////
/////////////////////////////////////////////////
0xcc,0x0c ,
0xcd,0x10,
0xce,0xa0,
0xcf,0xe6,
/////////////////////////////////////////////////
///////////////// dark sun //////////////////
/////////////////////////////////////////////////
0x45,0xf7,
0x46,0xff,
0x47,0x15,
0x48,0x03 ,
0x4f,0x60,
//////////////////banding//////////////////////
0xfe,0x00 ,
0x05,0x02,
0x06,0x2c,//HB
0x07,0x00,
0x08,0x40,//VB
0xfe,0x01,
0x25,0x00 , //anti-flicker step [11:8]
0x26,0x6a, //anti-flicker step [7:0]
0x27,0x01, //
0x28,0xe0,
0x29,0x02,//
0x2a,0xa0,
0x2b,0x03,//
0x2c,0xc0,
0x2d,0x04,//
0x2e,0x80,
0x3c,0x00,
0x3D,0x20, //
0xfe,0x00,
#else //for test
0x03,0x03,
0x04,0xff,
#endif
/////////////////////////////////////////////////
///////////////////// DVP ////////////////////
/////////////////////////////////////////////////
0xfe,0x03,
0x01,0x00,
0x02,0x00,
0x10,0x00,
0x15,0x00,
0xfe,0x00,
///////////////////OUTPUT//////////////////////
0xf3,0xff, // output_enable
-1,-1
};
extern struct i2c_device *iic_test;
static void GC0312_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x14; //0',180'
buf[1] = 0x10|(r<<0);
//Sensor_WriteRegister(SENSOR_IIC,buf,1,1);
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
}
uint32 GC0312_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0xdeUL
#define VBLANK_BASE 0x24UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x01,h & 0xff},//0x6a//0xde //HB[7:0]
{0x02,v & 0xff}, //0x0c //VB[7:0]
{0x0f,((v >> 8)<<4)|(h >> 8)} //{0x0f,0x00}, //VB/HB [11:8]
};
//for(i=0;i<3;i++)
//Sensor_WriteRegister(SENSOR_IIC,(u8 *)&t[i][0],1,1);
for(i=0;i<3;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ gc0312_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 0,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)GC0312InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0xde,0x24,0xde,0x24},
. mclk = 24000000,
.p_fun_adapt = {GC0312_rotate,GC0312_hvblank,NULL},
};
const _Sensor_Ident_ gc0312_init=
{
0x10,0x42,0x43,0x01,0x01,0xf1
};
#endif
+483
View File
@@ -0,0 +1,483 @@
#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_GC0328
SENSOR_INIT_SECTION static const unsigned char GC0328InitTable[CMOS_INIT_LEN]={
/*
0x01,// [7:0]:driver type,0x01:sensor whith ISP; 0x02:ISP; 0x03:sensor whithout isp;
0x01,0x6E,0x36,0x00,// [7:0]:XCLK(BE)
0x00,0x01,0x86,0xA0,// [7:0]:BAUDRATE(BE)
0x00,// [7:0]:chip_ID_addr>>8,when AddrByteNum == 2; 0 when AddrByteNum == 1
0xf0,// [7:0]:chip_ID_addr
0x00,// [7:0]:chip_ID
0x9d,//
0x00,0x00,0x00,0x00,//resverd
0x02,0x80,//image_width
0x01,0xE0,//image_height
0x43,// [7:0]:read ID
0x42,// [7:0]:write ID
0x01,// [7:0]:AddrByteNum ;
0x01,// [7:0]:DataByteNum
0x04,// [2:0]:ldo_config_para
0x01,// [7:0]:ID nums
*/
//0x05 , 0x00, //hb [11:8]
//0x06 , 0xde,//0xde,//hb [7:0]
//0x07 , 0x00,//vb [11:8]
0xFE,0x80,
0xFE,0x80,
0xFC,0x16,
0xFC,0x16,
0xFC,0x16,
0xFC,0x16,
0xF1,0x00,
0xF2,0x00,
0xFE,0x00,
0x4F,0x00,
0x03,0x00,
0x04,0xC0,
0x42,0x00,
0x77,0x5A,
0x78,0x40,
0x79,0x56,
0xFE,0x00,
0x0D,0x01,
0x0E,0xE8,
0x0F,0x02,
0x10,0x88,
0x09,0x00,
0x0A,0x00,
0x0B,0x00,
0x0C,0x00,
0x16,0x00,
0x17,0x14,
0x18,0x0E,
0x19,0x06,
0x1B,0x48,
0x1F,0xC8,
0x20,0x01,
0x21,0x78,
0x22,0xB0,
0x23,0x04, //GC0328C=0x04 GC0328=0x06
0x24,0x16,
0x26,0x00,
0x50,0x01,
0x70,0x45,
0x05,0x00,
0x06,0xDE,
0x07,0x00, //CHEN 0X00
0x08,0xA7, //CHEN 0XA7 0x00A7=20fps; 0x0186=15fps
0xFE,0x01,
0x29,0x00,
0x2A,0x83,
0x2B,0x02,
0x2C,0x8F,
0x2D,0x02,
0x2E,0x8F,
0x2F,0x02,
0x30,0x8F,
0x31,0x02,
0x32,0x8F,
0xFE,0x00,
0xFE,0x01,
0x50,0x00,
0x4F,0x00,
0x4C,0x01,
0x4F,0x00,
0x4F,0x00,
0x4F,0x00,
0x4F,0x00,
0x4F,0x00,
0x4D,0x30,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4D,0x40,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4D,0x50,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4D,0x60,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4D,0x70,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4F,0x01,
0x50,0x88,
0xFE,0x00,
0xFE,0x00,
0x27,0xB7,
0x28,0x7F,
0x29,0x20,
0x33,0x20,
0x34,0x20,
0x35,0x20,
0x36,0x20,
0x32,0x08,
0x3B,0x00,
0x3C,0x00,
0x3D,0x00,
0x3E,0x00,
0x47,0x00,
0x48,0x00,
0x40,0x7F,
0x41,0x26,
0x42,0xFB,
0x44,0x02,
0x45,0x00,
0x46,0x03,
0x4F,0x01,
0x4B,0x01,
0x50,0x01,
0x7E,0x0A,
0x7F,0x03,
0x81,0x15,
0x82,0x90,
0x83,0x02,
0x84,0xE5,
0x90,0x2C,
0x92,0x02,
0x94,0x02,
0x95,0x35,
0xD1,0x24,
0xD2,0x24,
0xD3,0x40,
0xDD,0xD3,
0xDE,0x38,
0xE4,0x88,
0xE5,0x40,
0xD7,0x0E,
0xFE,0x00,
0xBF,0x0E,
0xC0,0x1C,
0xC1,0x34,
0xC2,0x48,
0xC3,0x5A,
0xC4,0x6E,
0xC5,0x80,
0xC6,0x9C,
0xC7,0xB4,
0xC8,0xC7,
0xC9,0xD7,
0xCA,0xE3,
0xCB,0xED,
0xCC,0xF2,
0xCD,0xF8,
0xCE,0xFD,
0xCF,0xFF,
0xFE,0x00,
0x63,0x00,
0x64,0x05,
0x65,0x0B,
0x66,0x19,
0x67,0x2E,
0x68,0x40,
0x69,0x54,
0x6A,0x66,
0x6B,0x86,
0x6C,0xA7,
0x6D,0xC6,
0x6E,0xE4,
0x6F,0xFF,
0xFE,0x01,
0x18,0x02,
0xFE,0x00,
0x97,0x30,
0x98,0x00,
0x9B,0x60,
0x9C,0x60,
0xA4,0x50,
0xA8,0x80,
0xAA,0x40,
0xA2,0x23,
0xAD,0x28,
0xFE,0x01,
0x9C,0x00,
0x9E,0xC0,
0x9F,0x40,
0xFE,0x01,
0x08,0xA0,
0x09,0xE8,
0x10,0x08,
0x11,0x21,
0x12,0x11,
0x13,0x45,
0x15,0xFC,
0x18,0x02,
0x21,0xF0,
0x22,0x60,
0x23,0x30,
0x25,0x00,
0x24,0x14,
0x3D,0x80,
0x3E,0x40,
0xFE,0x01,
0x51,0x88,
0x52,0x12,
0x53,0x80,
0x54,0x60,
0x55,0x01,
0x56,0x02,
0x58,0x00,
0x5B,0x02,
0x5E,0xA4,
0x5F,0x8A,
0x61,0xDC,
0x62,0xDC,
0x70,0xFC,
0x71,0x10,
0x72,0x10,
0x73,0x20,
0x74,0x20,
0x75,0x01,
0x76,0x00,
0x77,0x40,
0x78,0x70,
0x79,0x00,
0x7B,0x00,
0x7C,0x71,
0x7D,0x00,
0x80,0x70,
0x81,0x58,
0x82,0x98,
0x83,0x60,
0x84,0x58,
0x85,0x50,
0xFE,0x00,
0xFE,0x01,
0xC0,0x10,
0xC1,0x0C,
0xC2,0x0A,
0xC6,0x0E,
0xC7,0x0B,
0xC8,0x0A,
0xBA,0x26,
0xBB,0x1C,
0xBC,0x1D,
0xB4,0x23,
0xB5,0x1C,
0xB6,0x1A,
0xC3,0x00,
0xC4,0x00,
0xC5,0x00,
0xC9,0x00,
0xCA,0x00,
0xCB,0x00,
0xBD,0x00,
0xBE,0x00,
0xBF,0x00,
0xB7,0x07,
0xB8,0x05,
0xB9,0x05,
0xA8,0x07,
0xA9,0x06,
0xAA,0x00,
0xAB,0x04,
0xAC,0x00,
0xAD,0x02,
0xAE,0x0D,
0xAF,0x05,
0xB0,0x00,
0xB1,0x07,
0xB2,0x03,
0xB3,0x00,
0xA4,0x00,
0xA5,0x00,
0xA6,0x00,
0xA7,0x00,
0xA1,0x3C,
0xA2,0x50,
0xFE,0x00,
0xB1,0x12,
0xB2,0xF5,
0xB3,0xFE,
0xB4,0xE0,
0xB5,0x15,
0xB6,0xC8,
0xFE,0x01,
0x50,0x00,
0xFE,0x01,
0x4F,0x00,
0x4C,0x01,
0x4F,0x00,
0x4F,0x00,
0x4F,0x00,
0x4D,0x34,
0x4E,0x04,
0x4E,0x04,
0x4E,0x02,
0x4E,0x02,
0x4D,0x44,
0x4E,0x04,
0x4E,0x04,
0x4E,0x04,
0x4D,0x53,
0x4E,0x08,
0x4E,0x08,
0x4E,0x04,
0x4E,0x04,
0x4D,0x65,
0x4E,0x04,
0x4D,0x73,
0x4E,0x20,
0x4D,0x83,
0x4E,0x20,
0x4F,0x01,
0x50,0x88,
0xFE,0x00,
0xF1,0x07,
0xF2,0x01,
-1,-1,};
extern struct i2c_device *iic_test;
static void GC0328_rotate(uint32 r)
{
int8 buf[2];
buf[0] = 0x17; //0',180'
buf[1] = 0x14|(r<<0);
//Sensor_WriteRegister(SENSOR_IIC,buf,1,1);
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
//i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
i2c_write(iic_test,buf,1,&buf[1],1);
}
uint32 GC0328_hvblank(int8 dh,int8 dv)
{
#define HBLANK_BASE 0xdeUL
#define VBLANK_BASE 0x24UL
uint32 i;
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x05,h >> 8},//HB[11:8]
{0x06,h & 0xff},//HB[7:0]
{0x07,v >> 8},//VB[11:8]
{0x08,v & 0xff},//VB[7:0]
};
for(i=0;i<4;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ gc0328_cmd =
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)GC0328InitTable,
.rotate_adapt = {0},
//.hvb_adapt = 0x6a,0x12,0x6a,0x12,
. mclk = 24000000,
.p_fun_adapt = {GC0328_rotate,GC0328_hvblank,NULL},
//.p_xc7016_adapt = NULL,
};
const _Sensor_Ident_ gc0328_init={
0x9d,0x42,0x43,0x01,0x01,0xf0
};
#endif
+491
View File
@@ -0,0 +1,491 @@
#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_GC0329
SENSOR_INIT_SECTION static const unsigned char GC0329InitTable[CMOS_INIT_LEN]=
{
0xfe,0x80,
0xfc,0x12,
0xfc,0x12,
0xfe,0x00,
0xf0,0x07,
0xf1,0x01,
0x73,0x90,
0x74,0x80,
0x75,0x80,
0x76,0x94,
//0x42,0x00,
//0x77,0x57,//AWB_R_gain
//0x78,0x4d,//AWB_G_gain
//0x79,0x45,//AWB_B_gain
//0x42,0xfc,
////////////////////analog////////////////////
0xfc,0x16,
0x0a,0x00,
0x0c,0x00,
0x17,0x14,//0x17
0x19,0x05,
0x1b,0x24,
0x1c,0x04,
0x1e,0x00,
0x1f,0xc0,
0x20,0x00,
0x21,0x48,
0x23,0x22,
0x24,0x16,
////////////////////blk////////////////////
0x26,0xf7,
0x32,0x04,
0x33,0x20,
0x34,0x20,
0x35,0x20,
0x36,0x20,
////////////////////ISPBLOCKENABLE////////////////////
0x40,0xff,
0x41,0x00,
0x42,0xfe,//0xfe
0x46,0x03,
0x4b,0xcb,
0x4d,0x01,
0x4f,0x01,
0x70,0x60,//48
//0xb0,0x00,
//0xbc,0x00,
//0xbd,0x00,
//0xbe,0x00,
////////////////////DNDD////////////////////
0x80,0xe7,
0x82,0x1f,
0x83,0x03,
0x87,0x4a,
////////////////////ASDE////////////////////
0xfe,0x01,
0x18,0x22,
0xfe,0x00,
0x9c,0x0a,
0xa4,0x50,
0xa5,0x21,
0xa7,0x35,
0xdd,0x54,
0x95,0x65,
////////////////////RGBgamma////////////////////
0xfe,0x00,
0xbf,0x06,
0xc0,0x14,
0xc1,0x27,
0xc2,0x3b,
0xc3,0x4f,
0xc4,0x62,
0xc5,0x72,
0xc6,0x8d,
0xc7,0xa4,
0xc8,0xb8,
0xc9,0xc9,
0xca,0xd6,
0xcb,0xe0,
0xcc,0xe8,
0xcd,0xf4,
0xce,0xfc,
0xcf,0xff,
//////////////////CC///////////////////
0xfe,0x00,
0xb3,0x44,
0xb4,0xfd,
0xb5,0x02,
0xb6,0xfa,
0xb7,0x48,
0xb8,0xf0,
//skin
//0xb3,0x3c,
//0xb4,0xFF,
//0xb5,0x03,
//0xb6,0x01,
//0xb7,0x3f,
//0xb8,0xF3,
0x19,0x05,
0x20,0x01,
0x22,0xba,
0x21,0x48,
////////////////////YCP////////////////////
0xfe,0x00,
0xd1,0x2d,
0xd2,0x2e,
////////////////////AEC////////////////////
0xfe,0x01,
0x10,0x40,
0x11,0xa1,
0x12,0x07,
0x13,0x40,
0x17,0x88,
0x21,0xb0,
0x22,0x48,
0x3c,0x95,
0x3d,0x50,
0x3e,0x48,
////////////////////AWB////////////////////
#if 0//main
0xfe,0x01,
0x06,0x12,
0x07,0x06,
0x08,0x9c,
0x09,0xee,
0x50,0xfc,
0x51,0x28,
0x52,0x10,
0x53,0x20,
0x54,0x12,
0x55,0x16,
0x56,0x30,
0x58,0x60,
0x59,0x08,
0x5a,0x02,
0x5b,0x63,
0x5c,0x35,
0x5d,0x72,
0x5e,0x11,
0x5f,0x40,
0x60,0x40,
0x61,0xc8,
0x62,0xa0,
0x63,0x40,
0x64,0x50,
0x65,0x98,
0x66,0xfa,
0x67,0x80,
0x68,0x70,
0x69,0x80,
0x6a,0x40,
0x6b,0x39,
0x6c,0x30,
0x6d,0x60,
0x6e,0x41,
0x70,0x50,//AWB_C_number_limit
0x71,0x00,//AWB_C_weight_mode
0x72,0x10,
0x73,0x00,////AWB_uplow_luma_value
0x74,0x40,
0x75,0x58,
0x76,0x24,
0x77,0x40,
0x78,0x20,
0x79,0x60,
0x7a,0x58,
0x7b,0x20,
0x7c,0x30,
0x7d,0x35,
0x7e,0x10,
0x7f,0x08,
0x80,0x60,
0x81,0x50,
0x82,0x42,
0x83,0x40,
0x84,0x40,
0x85,0x40,
#elif0//sub
0xfe,0x01,
0x06,0x16,
0x07,0x06,
0x08,0x98,
0x09,0xee,
0x50,0xfc,
0x51,0x20,
0x52,0x1b,//0b
0x53,0x10,//20
0x54,0x10,//40
0x55,0x10,
0x56,0x20,
0x57,0xa0,
0x58,0xa0,
0x59,0x28,
0x5a,0x02,
0x5b,0x63,
0x5c,0x04,//34
0x5d,0x73,
0x5e,0x11,
0x5f,0x40,
0x60,0x40,
0x61,0xc8,//d8//c8
0x62,0xa0,///88//A0
0x63,0x40,
0x64,0x40,//37
0x65,0xd0,
0x66,0xfa,
0x67,0x70,
0x68,0x58,
0x69,0xa5,//85jaambo
0x6a,0x40,
0x6b,0x39,
0x6c,0x18,
0x6d,0x28,
0x6e,0x41,
0x70,0x40,
0x71,0x00,
0x72,0x10,
0x73,0x30,//awboutdoor-th
0x80,0x60,
0x81,0x50,
0x82,0x42,
0x83,0x40,
0x84,0x40,
0x85,0x40,
0x86,0x40,
0x87,0x40,
0x88,0xfe,
0x89,0xa0,
0x74,0x40,
0x75,0x58,
0x76,0x24,
0x77,0x40,
0x78,0x20,
0x79,0x60,
0x7a,0x58,
0x7b,0x20,
0x7c,0x30,
0x7d,0x35,
0x7e,0x10,
0x7f,0x08,
#else
0xfe,0x01,
0x06,0x06,
0x07,0x06,
0x08,0xa6,
0x09,0xee,
0x50,0x00,
0x51,0x28,
0x52,0x28,
0x53,0x1d,
0x54,0x1d,
0x55,0x20,
0x56,0x20,
//0x57,0x00,
0x58,0x60,
0x59,0x28,
0x5a,0x30,
0x5b,0x63,
0x5c,0x34,
0x5d,0x73,//0x73
0x5e,0x11,
0x5f,0x40,
0x60,0x40,
0x61,0xc8,
0x62,0xa0,
0x63,0x40,
0x64,0x50,
0x65,0x98,
0x66,0xfa,
0x67,0x70,
0x68,0x58,
0x69,0x78,
0x6a,0x40,
0x6b,0x39,
0x6c,0x40,
0x6d,0x80,
0x6e,0x41,
0x70,0x50,//AWB_C_number_limit
0x71,0x00,//AWB_C_weight_mode
0x72,0x10,
0x73,0x00,
0x74,0x32,
0x75,0x40,
0x76,0x30,
0x77,0x48,
0x7a,0x50,
0x7b,0x20,
0x80,0x4a,
0x81,0x43,
0x82,0x43,
0x83,0x40,
0x84,0x40,
0x85,0x40,
#endif
////////////////////CC-AWB////////////////////
0xd0,0x00,
0xd2,0x2c,
0xd3,0x80,
///////////////////ABS///////////////////////
0x9c,0x02,
0x9d,0x10,
///////////////////LSC//////////////////////
////forxuye062dlenssetting
0xfe,0x01,
0xa0,0x00,
0xa1,0x3c,
0xa2,0x50,
0xa3,0x00,
0xa8,0x0f,
0xa9,0x08,
0xaa,0x00,
0xab,0x04,
0xac,0x00,
0xad,0x07,
0xae,0x0e,
0xaf,0x00,
0xb0,0x00,
0xb1,0x09,
0xb2,0x00,
0xb3,0x00,
0xb4,0x31,
0xb5,0x19,
0xb6,0x24,
0xba,0x3a,
0xbb,0x24,
0xbc,0x2a,
0xc0,0x17,
0xc1,0x13,
0xc2,0x17,
0xc6,0x21,
0xc7,0x1c,
0xc8,0x1c,
0xb7,0x00,
0xb8,0x00,
0xb9,0x00,
0xbd,0x00,
0xbe,0x00,
0xbf,0x00,
0xc3,0x00,
0xc4,0x00,
0xc5,0x00,
0xc9,0x00,
0xca,0x00,
0xcb,0x00,
0xa4,0x00,
0xa5,0x00,
0xa6,0x00,
0xa7,0x00,
0xfe,0x00,
0x05,0x00,
0x06,0x6a,
0x07,0x00,
0x08,0x0c,
0xfe,0x01,
0x29,0x00,//anti-flickerstep[11:8]
0x2a,0x96,//anti-flickerstep[7:0]//78
0x2b,0x01,//explevel025fps//01
0x2c,0x68,//78
0x2d,0x01,//explevel120fps
0x2e,0x68,
0x2f,0x01,//explevel216.7fps
0x30,0x68,
0x31,0x01,//explevel3
0x32,0x68,
0x33,0x10,
//0xfe,0x00,
0xfe,0x00,
0x0d,0x01,
0x0e,0xe8,
//0x0e,0x6C,/*changewin_heightfrom488to364*/
0x0f,0x02,
0x10,0x88,/*win_width644*/
0x09,0x00,
0x0a,0x00,
0x0b,0x00,
0x0c,0x04,/*colstart4*/
0x16,0x00,
//crop
0x50,0x01,
#if 1
///cropwindow
0x51,0x00,
0x52,0x04, ///y
0x53,0x00,
0x54,0x04, ///x
0x55,0x01,
0x56,0xe0, ///360
0x57,0x02,
0x58,0x80, //640
#endif
0xfe,0x00,
////////////////////asde///////////////////
0xa0,0xaf,
0xa2,0xff,
0x44,0xa2,
-1,-1};
SENSOR_INIT_SECTION static const unsigned char GC0329prewriteInitTable[CMOS_INIT_LEN]={
0xfc,0x16,
-1,-1
};
SENSOR_OP_SECTION const _Sensor_Adpt_ gc0329_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bits
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)GC0329InitTable,
.preset =(uint8 *)GC0329prewriteInitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0x6a,0x12,0x6a,0x12},
. mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ gc0329_init=
{
0xC0,0x62,0x63,0x01,0x01,0x00
};
#endif
+779
View File
@@ -0,0 +1,779 @@
#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_OV2640
#define OV2640_JPG 1
/* Initialization sequence for VGA resolution (640x480)*/
SENSOR_INIT_SECTION static const unsigned char OV2640InitTable[]= {
#if OV2640_JPG
0xff, 0x00, /* Device control register list Table 12 */
0x2c, 0xff, /* Reserved */
0x2e, 0xdf, /* Reserved */
0xff, 0x01, /* Device control register list Table 13 */
0x3c, 0x32, /* Reserved */
0x11, 0x00, /* Clock Rate Control */
0x09, 0x02, /* Common control 2 */
0x04, 0xA8, /* Mirror */
0x13, 0xe5, /* Common control 8 */
0x14, 0x48, /* Common control 9 */
0x2c, 0x0c, /* Reserved */
0x33, 0x78, /* Reserved */
0x3a, 0x33, /* Reserved */
0x3b, 0xfB, /* Reserved */
0x3e, 0x00, /* Reserved */
0x43, 0x11, /* Reserved */
0x16, 0x10, /* Reserved */
0x4a, 0x81, /* Reserved */
0x21, 0x99, /* Reserved */
0x24, 0x40, /* Luminance signal High range */
0x25, 0x38, /* Luminance signal low range */
0x26, 0x82, /* */
0x5c, 0x00, /* Reserved */
0x63, 0x00, /* Reserved */
0x46, 0x3f, /* Frame length adjustment */
0x0c, 0x3c, /* Common control 3 */
0x61, 0x70, /* Histogram algo low level */
0x62, 0x80, /* Histogram algo high level */
0x7c, 0x05, /* Reserved */
0x20, 0x80, /* Reserved */
0x28, 0x30, /* Reserved */
0x6c, 0x00, /* Reserved */
0x6d, 0x80, /* Reserved */
0x6e, 0x00, /* Reserved */
0x70, 0x02, /* Reserved */
0x71, 0x94, /* Reserved */
0x73, 0xc1, /* Reserved */
0x3d, 0x34, /* Reserved */
0x5a, 0x57, /* Reserved */
0x12, 0x00, /* Common control 7 */
0x11, 0x00, /* Clock Rate Control 2*/
0x17, 0x11, /* Horiz window start MSB 8bits */
0x18, 0x75, /* Horiz window end MSB 8bits */
0x19, 0x01, /* Vert window line start MSB 8bits */
0x1a, 0x97, /* Vert window line end MSB 8bits */
0x32, 0x36,
0x03, 0x0f,
0x37, 0x40,
0x4f, 0xbb,
0x50, 0x9c,
0x5a, 0x57,
0x6d, 0x80,
0x6d, 0x38,
0x39, 0x02,
0x35, 0x88,
0x22, 0x0a,
0x37, 0x40,
0x23, 0x00,
0x34, 0xa0,
0x36, 0x1a,
0x06, 0x02,
0x07, 0xc0,
0x0d, 0xb7,
0x0e, 0x01,
0x4c, 0x00,
//0x2e,0x01,
0xff, 0x00,
0xe5, 0x7f,
0xf9, 0xc0,
0x41, 0x24,
0xe0, 0x14,
0x76, 0xff,
0x33, 0xa0,
0x42, 0x20,
0x43, 0x18,
0x4c, 0x00,
0x87, 0xd0,
0x88, 0x3f,
0xd7, 0x03,
0xd9, 0x10,
0xd3, 0x82,
0xc8, 0x08,
0xc9, 0x80,
0x7d, 0x00,
0x7c, 0x03,
0x7d, 0x48,
0x7c, 0x08,
0x7d, 0x20,
0x7d, 0x10,
0x7d, 0x0e,
0x90, 0x00,
0x91, 0x0e,
0x91, 0x1a,
0x91, 0x31,
0x91, 0x5a,
0x91, 0x69,
0x91, 0x75,
0x91, 0x7e,
0x91, 0x88,
0x91, 0x8f,
0x91, 0x96,
0x91, 0xa3,
0x91, 0xaf,
0x91, 0xc4,
0x91, 0xd7,
0x91, 0xe8,
0x91, 0x20,
0x92, 0x00,
0x93, 0x06,
0x93, 0xe3,
0x93, 0x02,
0x93, 0x02,
0x93, 0x00,
0x93, 0x04,
0x93, 0x00,
0x93, 0x03,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x96, 0x00,
0x97, 0x08,
0x97, 0x19,
0x97, 0x02,
0x97, 0x0c,
0x97, 0x24,
0x97, 0x30,
0x97, 0x28,
0x97, 0x26,
0x97, 0x02,
0x97, 0x98,
0x97, 0x80,
0x97, 0x00,
0x97, 0x00,
0xc3, 0xef,
0xff, 0x00,
0xba, 0xdc,
0xbb, 0x08,
0xb6, 0x24,
0xb8, 0x33,
0xb7, 0x20,
0xb9, 0x30,
0xb3, 0xb4,
0xb4, 0xca,
0xb5, 0x43,
0xb0, 0x5c,
0xb1, 0x4f,
0xb2, 0x06,
0xc7, 0x00,
0xc6, 0x51,
0xc5, 0x11,
0xc4, 0x9c,
0xbf, 0x00,
0xbc, 0x64,
0xa6, 0x00,
0xa7, 0x1e,
0xa7, 0x6b,
0xa7, 0x47,
0xa7, 0x33,
0xa7, 0x00,
0xa7, 0x23,
0xa7, 0x2e,
0xa7, 0x85,
0xa7, 0x42,
0xa7, 0x33,
0xa7, 0x00,
0xa7, 0x23,
0xa7, 0x1b,
0xa7, 0x74,
0xa7, 0x42,
0xa7, 0x33,
0xa7, 0x00,
0xa7, 0x23,
0xc0, 0xc8,
0xc1, 0x96,
0x8c, 0x00,
0x86, 0x3d,
0x50, 0x92,
0x51, 0x90,
0x52, 0x2c,
0x53, 0x00,
0x54, 0x00,
0x55, 0x88,
0x5a, 0x50,
0x5b, 0x3c,
0x5c, 0x00,
0xd3, 0x04,
0x7f, 0x00,
0xda, 0x00,
0xe5, 0x1f,
0xe1, 0x67,
0xe0, 0x00,
0xdd, 0x7f,
0x05, 0x00,
0xff, 0x00,
0xe0, 0x04,
0xc0, 0xc8,
0xc1, 0x96,
0x86, 0x3d,
0x50, 0x92,
0x51, 0x90,
0x52, 0x2c,
0x53, 0x00,
0x54, 0x00,
0x55, 0x88,
0x57, 0x00,
0x5a, 0x50,
0x5b, 0x3c,
0x5c, 0x00,
0xd3, 0x04,
0xe0, 0x00,
0xFF, 0x00,
0x05, 0x00,
0xDA, 0x08,
0xda, 0x09,
0x98, 0x00,
0x99, 0x00,
0x00, 0x00,
0xff, 0x00,
0xe0, 0x04,
0xc0, 0xc8,
0xc1, 0x96,
0x86, 0x3d,
0x50, 0x89,
0x51, 0x90,
0x52, 0x2c,
0x53, 0x00,
0x54, 0x00,
0x55, 0x88,
0x57, 0x00,
0x5a, 0xA0,
0x5b, 0x78,
0x5c, 0x00,
0xd3, 0x02,
0xe0, 0x00,
#if 1
///////////////////720////////////////////
#if (IMAGE_W == 1280)
// 0x5a,0x40,//0x5a, 0xA0, //0x5a,0x40
// 0x5b,0xb4,//0x5b, 0x78, //0x5b,0xb4
// 0x5c,0x01,//0x5c, 0x00, //0x5c,0x01
#else
// 0x5a, 0xa0,//0xa0
// 0x5b, 0x78,//0x78,
// 0x5c, 0x00,
#endif
#else
0xc0, 0xa0,//0xc8,
0xc1, 0x5a,//0x96,
0x51, 0x40,//0x90,
0x52, 0xb4,//0x2c,
0x55, 0x08,
0x5a, 0x40,//0x90,
0x5b, 0xb4,//0x2c,
0x5c, 0x01,//0x05,
#endif
//////////////////////////////////////////
// 0xd3, 0x02,
// 0xe0, 0x00,
#else
0xff, 0x01,
0x12, 0x80,
0xff, 0x00,
0x2c, 0xff,
0x2e, 0xdf,
0xff, 0x01,
0x3c, 0x32,
//
0x11, 0x01,
0x09, 0x02,
0x04, 0x28,
0x10, 0xff,
0x45, 0x20,
0x13, 0xe4,
0x14, 0x48,
0x2c, 0x0c,
0x33, 0x78,
0x3a, 0x33,
0x3b, 0xfB,
0x3e, 0x00,
0x43, 0x11,
0x16, 0x10,
//
0x39, 0x82,
//
0x35, 0x88,
0x22, 0x0a,
0x37, 0x40,
0x23, 0x00,
0x34, 0xa0,
0x36, 0x1a,
0x06, 0x02,
0x07, 0xc0,
0x0d, 0xb7,
0x0e, 0x01,
0x4c, 0x00,
0x48, 0x00,
0x5B, 0x00,
0x42, 0x83,
//
0x4a, 0x81,
0x21, 0x99,
//
0x24, 0x40,
0x25, 0x38,
0x26, 0x82,
0x5c, 0x00,
0x63, 0x00,
0x46, 0x00,
0x0c, 0x38,
//
0x61, 0x70,
0x62, 0x80,
0x7c, 0x05,
//
0x20, 0x80,
0x28, 0x30,
0x6c, 0x00,
0x6d, 0x80,
0x6e, 0x00,
0x70, 0x02,
0x71, 0x94,
0x73, 0xc1,
//
0x3d, 0x34,
0x5a, 0x57,
0x4f, 0xbb,
0x50, 0x9c,
//
//
0xff, 0x00,
0xe5, 0x7f,
0xf9, 0xc0,
0x41, 0x24,
0xe0, 0x14,
0x76, 0xff,
0x33, 0xa0,
0x42, 0x20,
0x43, 0x18,
0x4c, 0x00,
0x87, 0xd0,
0x88, 0x3f,
0xd7, 0x03,
0xd9, 0x10,
0xd3, 0x82,
//
0xc8, 0x08,
0xc9, 0x80,
#if 1
//
0x7c, 0x00,
0x7d, 0x00,
0x7c, 0x03,
0x7d, 0x48,
0x7d, 0x48,
0x7c, 0x08,
0x7d, 0x20,
0x7d, 0x10,
0x7d, 0x0e,
//
0x90, 0x00,
0x91, 0x0e,
0x91, 0x1a,
0x91, 0x31,
0x91, 0x5a,
0x91, 0x69,
0x91, 0x75,
0x91, 0x7e,
0x91, 0x88,
0x91, 0x8f,
0x91, 0x96,
0x91, 0xa3,
0x91, 0xaf,
0x91, 0xc4,
0x91, 0xd7,
0x91, 0xe8,
0x91, 0x20,
//
0x92, 0x00,
0x93, 0x06,
0x93, 0xe3,
0x93, 0x05,
0x93, 0x05,
0x93, 0x00,
0x93, 0x04,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
0x93, 0x00,
//
0x96, 0x00,
0x97, 0x08,
0x97, 0x19,
0x97, 0x02,
0x97, 0x0c,
0x97, 0x24,
0x97, 0x30,
0x97, 0x28,
0x97, 0x26,
0x97, 0x02,
0x97, 0x98,
0x97, 0x80,
0x97, 0x00,
0x97, 0x00,
#endif
//
0xc3, 0xed,
0xc4, 0x9a,
0xa4, 0x00,
0xa8, 0x00,
0xc5, 0x11,
0xc6, 0x51,
0xbf, 0x80,
0xc7, 0x00,//0x10,
//0xcc,0x5e,
//0xcd,0x41,
//0xcc,0x5e,
//0xce,0x54,
0xb6, 0x66,
0xb8, 0xA5,
0xb7, 0x64,
0xb9, 0x7C,
0xb3, 0xaf,
0xb4, 0x97,
0xb5, 0xFF,
0xb0, 0xC5,
0xb1, 0x94,
0xb2, 0x0f,
0xc4, 0x5c,
//
0xc0, 0xa0,//0xc8,
0xc1, 0x5a,//0x96,
0x86, 0x1d,
0x50, 0x00,
0x51, 0x40,//0x90,
0x52, 0xb4,//0x2c,
0x53, 0x00,
0x54, 0x00,
0x55, 0x08,
0x57, 0x00,
0x5a, 0x40,//0x90,
0x5b, 0xb4,//0x2c,
0x5c, 0x01,//0x05,
//
0xc3, 0xed,
0x7f, 0x00,
//
0xda, 0x00,
//
0xe5, 0x1f,
0xe1, 0x67,
0xe0, 0x00,
0xdd, 0x7f,
0x05, 0x00,
#endif
#if (IMAGE_FORMAT == 0)
0xFF, 0x00,
0xe0, 0x04,
0xDA, 0x00,
0xD7, 0x01,
0xe1, 0x67,
0xe0, 0x00,
#elif (IMAGE_FORMAT == 1)
0xFF, 0x00 ,
0xe0, 0x04 ,
0xDA, 0x08 ,
0xD7, 0x03 ,
0xE1, 0x77 ,
0xE0, 0x00 ,
0, 0,
#else
0xFF, 0x00,
0xe0, 0x04,
0xDA, 0x10,
0xD7, 0x03,
0xe1, 0x77,
0x44, 0x0c,
0xe0, 0x00,
0x00, 0x00,
#endif
-1,-1,
};
SENSOR_OP_SECTION const _Sensor_Adpt_ ov2640_cmd =
{
.typ = 1, //YUV
.pixelw = IMAGE_W,
.pixelh= IMAGE_H,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)OV2640InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0,0,0,0},
. mclk = 6000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ ov2640_init=
{
0x26,0x60,0x61,0x01,0x01,0x0a
};
#endif
+297
View File
@@ -0,0 +1,297 @@
#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_OV7660
SENSOR_INIT_SECTION static const unsigned char OV7660InitTable[CMOS_INIT_LEN]= //OV7670InitTable[][2]
{
#if 1
0x12, 0x80,
0x11, 0x81,
0x92, 0xA0,
0x93, 0x00,
0x9d, 0x4c,
0x9e, 0x3f,
0x3b, 0x02,//0a
0x13, 0xf0,
0x10, 0x00,
0x00, 0x00,
0x01, 0x80,
0x02, 0x80,
0x13, 0xf5,
0x12, 0x00,
0x04, 0x00,
0x18, 0x01,
0x17, 0x13,
0x32, 0x92,
0x19, 0x02,
0x1a, 0x7a,
0x03, 0x00,
0x0e, 0x84,
0x0f, 0x62,
//0x15, 0x02,
0x16, 0x02,
0x1b, 0x01,
#if 1
0x1e, 0x31,//0x01//0x31
#else
0x1e, 0x01,//0x01//0x31
#endif
0x29, 0x3c,
0x33, 0x00,
0x34, 0x07,
0x35, 0x84,
0x36, 0x00,
0x38, 0x13,
0x39, 0x43,
0x3a, 0x00,
0x3c, 0x6c,
0x3d, 0x90,
0x3f, 0x29,
0x40, 0xc1,
0x41, 0x20,
0x6B, 0x0a,
0xa1, 0xc8,
0x69, 0x80,
0x43, 0xf0,
0x44, 0x10,
0x45, 0x78,
0x46, 0xa8,
0x47, 0x60,
0x48, 0x80,
0x59, 0xba,
0x5a, 0x9a,
0x5b, 0x22,
0x5c, 0xb9,
0x5d, 0x9b,
0x5e, 0x10, // Flip (bit4) & Mirror (bit5)
0x5f, 0xe0,
0x60, 0x85,
0x61, 0x60,
0x62, 0x00,
0x63, 0x00,
0x64, 0x10,
0x65, 0x10,
0x66, 0x05,
0x94, 0x10,
0x95, 0x0E,
0x9f, 0x9d,
0xa0, 0xa0,
0x4f, 0x66,
0x50, 0x6b,
0x51, 0x05,
0x52, 0x1a,
0x53, 0x40,
0x54, 0x5a,
0x55, 0x40,
0x56, 0x40,
0x57, 0x40,
0x58, 0x0d,
0x8b, 0xcc,
0x8c, 0xcc,
0x8d, 0xcf,
0x6c, 0x40,
0x6d, 0x30,
0x6e, 0x4b,
0x6f, 0x60,
0x70, 0x70,
0x71, 0x70,
0x72, 0x70,
0x73, 0x70,
0x74, 0x60,
0x75, 0x60,
0x76, 0x50,
0x77, 0x48,
0x78, 0x3a,
0x79, 0x2e,
0x7a, 0x28,
0x7b, 0x22,
0x7c, 0x04,
0x7d, 0x07,
0x7e, 0x10,
0x7f, 0x28,
0x80, 0x36,
0x81, 0x44,
0x82, 0x52,
0x83, 0x60,
0x84, 0x6c,
0x85, 0x78,
0x86, 0x8c,
0x87, 0x9e,
0x88, 0xbb,
0x89, 0xd2,
0x8a, 0xe6,
0x14, 0x2a,//8X gain
0x24, 0xa0,
0x25, 0x90,
0x27, 0x40,
0x28, 0x40,
0x2c, 0x40,
0x13, 0xf7,
0x3b, 0x00,//night mode enable 1/4 fps
#endif
#if 0
0x12,0x80,
0x11,0x80,
0x92,0x66,
0x93,0x00,
0x9D,0x4C,
0x9E,0x3F,
0x3B,0x0A,
0x13,0xF0,
0x10,0x00,
0x00,0x00,
0x01,0x80,
0x02,0x80,
0x13,0xF5,
0x12,0x00,
0x04,0x00,
0x18,0x01,
0x17,0x13,
0x32,0x92,
0x19,0x02,
0x1A,0x7A,
0x03,0x00,
0x0E,0x84,
0x0F,0x62,
0x15,0x02,
0x16,0x02,
0x1B,0x01,
0x1E,0x31, ///0x01
0x29,0x3C,
0x33,0x00,
0x34,0x07,
0x35,0x84,
0x36,0x00,
0x38,0x13,
0x39,0x43,
0x3A,0x00,
0x3C,0x6C,
0x3D,0x90,
0x3F,0x29,
0x40,0xC1,
0x41,0x20,
0x6B,0x0A,
0xA1,0xC8,
0x69,0x80,
0x43,0xF0,
0x44,0x10,
0x45,0x78,
0x46,0xA8,
0x47,0x60,
0x48,0x80,
0x59,0xBA,
0x5A,0x9A,
0x5B,0x22,
0x5C,0xB9,
0x5D,0x9B,
0x5E,0x10,
0x5F,0xE0,
0x60,0x85,
0x61,0x60,
0x9F,0x9D,
0xA0,0xA0,
0x4F,0x66,
0x50,0x6B,
0x51,0x05,
0x52,0x19,
0x53,0x40,
0x54,0x59,
0x55,0x40,
0x56,0x40,
0x57,0x40,
0x58,0x0D,
0x8B,0xCC,
0x8C,0xCC,
0x8D,0xCF,
0x6C,0x40,
0x6D,0x30,
0x6E,0x4B,
0x6F,0x60,
0x70,0x70,
0x71,0x70,
0x72,0x70,
0x73,0x70,
0x74,0x60,
0x75,0x60,
0x76,0x50,
0x77,0x48,
0x78,0x3A,
0x79,0x2E,
0x7A,0x28,
0x7B,0x22,
0x7C,0x04,
0x7D,0x07,
0x7E,0x10,
0x7F,0x28,
0x80,0x36,
0x81,0x44,
0x82,0x52,
0x83,0x60,
0x84,0x6C,
0x85,0x78,
0x86,0x8C,
0x87,0x9E,
0x88,0xBB,
0x89,0xD2,
0x8A,0xE6,
0x14,0x1A,
0x24,0x78,
0x25,0x6C,
0x13,0xF7,
0x3B,0xC0,
#endif
-1,-1
};
SENSOR_OP_SECTION const _Sensor_Adpt_ ov7660_cmd =
{
.typ = 1,//YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
#if 0//OVSENSOR_CHOICE ==OV7670_YXK ||OVSENSOR_CHOICE == OV7670_HTX
.vsyn =1,// 1,
#else
.vsyn =0,// 1,
#endif
.rduline = 0,//
.rawwide = 1,//10bit
// .AVDD = SYS_VOL_V2_8,
// .DVDD = SYS_VOL_V1_8,
// .VDDIO = SYS_VOL_V2_8,
.colrarray =2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)OV7660InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {42000000,1120,0,0,0xff,25,0},
.hvb_adapt = {0,0,0,0},
.mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ ov7660_init=
{
0x76,0x42,0x43,0x01,0x01,0x0a
};
#endif
+432
View File
@@ -0,0 +1,432 @@
#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_OV7670
SENSOR_INIT_SECTION static const unsigned char OV7670InitTable[CMOS_INIT_LEN]=
{
#if 1
0x12,0x80,
0x09,0x10,
0xc1,0x7f,
0x11,0x80,
0x3a,0x0c,
0x3d,0xc0,
0x12,0x02,
0x15,0x40,
0x17,0x13,
0x18,0x01,
0x32,0xbf,
0x19,0x02,
0x1a,0x7a,
0x03,0x0a,
0x0c,0x00,
0x3e,0x00,
0x70,0x3a,
0x71,0x35,
0x72,0x11,
0x73,0xf0,
0xa2,0x02,
0x7a,0x20,
0x7b,0x03,
0x7c,0x0a,
0x7d,0x1a,
0x7e,0x3f,
0x7f,0x4e,
0x80,0x5b,
0x81,0x68,
0x82,0x75,
0x83,0x7f,
0x84,0x89,
0x85,0x9a,
0x86,0xa6,
0x87,0xbd,
0x88,0xd3,
0x89,0xe8,
0x13,0xe0,
0x00,0x00,
0x10,0x00,
0x0d,0x40,
0x14,0x28,
0xa5,0x02,
0xab,0x02,
0x24,0x68,
0x25,0x58,
0x26,0xc2,
0x9f,0x78,
0xa0,0x68,
0xa1,0x03,
0xa6,0xd8,
0xa7,0xd8,
0xa8,0xf0,
0xa9,0x90,
0xaa,0x14,
0x13,0xe5,
0x0e,0x61,
0x0f,0x4b,
0x16,0x02,
0x1e,0x07,
0x21,0x02,
0x22,0x91,
0x29,0x07,
0x33,0x0b,
0x35,0x0b,
0x37,0x1d,
0x38,0x71,
0x39,0x2a,
0x3c,0x78,
0x4d,0x40,
0x4e,0x20,
0x69,0x00,
0x6b,0x0a,
0x74,0x10,
0x8d,0x4f,
0x8e,0x00,
0x8f,0x00,
0x90,0x00,
0x91,0x00,
0x96,0x00,
0x9a,0x80,
0xb0,0x84,
0xb1,0x0c,
0xb2,0x0e,
0xb3,0x82,
0xb8,0x0a,
0x43,0x0a,
0x44,0xf2,
0x45,0x39,
0x46,0x62,
0x47,0x3d,
0x48,0x55,
0x59,0x83,
0x5a,0x0d,
0x5b,0xcd,
0x5c,0x8c,
0x5d,0x77,
0x5e,0x16,
0x6c,0x0a,
0x6d,0x65,
0x6e,0x11,
0x6f,0x9e,
0x6a,0x40,
0x01,0x56,
0x02,0x44,
0x13,0xe7,
0x4f,0x88,
0x50,0x8b,
0x51,0x04,
0x52,0x11,
0x53,0x8c,
0x54,0x9d,
0x55,0x00,
0x56,0x40,
0x57,0x80,
0x58,0x9a,
0x41,0x08,
0x3f,0x00,
0x75,0x04,
0x76,0x60,
0x4c,0x00,
0x77,0x01,
0x3d,0xc2,
0x4b,0x09,
0xc9,0x30,
0x41,0x38,
0x56,0x40,
0x34,0x11,
0x3b,0x12,
0xa4,0x88,
0x96,0x00,
0x97,0x30,
0x98,0x20,
0x99,0x30,
0x9a,0x84,
0x9b,0x29,
0x9c,0x03,
0x9d,0x99,
0x9e,0x7f,
0x78,0x04,
0x79,0x01,
0xc8,0xf0,
0x79,0x0f,
0xc8,0x00,
0x79,0x10,
0xc8,0x7e,
0x79,0x0a,
0xc8,0x80,
0x79,0x0b,
0xc8,0x01,
0x79,0x0c,
0xc8,0x0f,
0x79,0x0d,
0xc8,0x20,
0x79,0x09,
0xc8,0x80,
0x79,0x02,
0xc8,0xc0,
0x79,0x03,
0xc8,0x40,
0x79,0x05,
0xc8,0x30,
0x79,0x26,
0x62,0x00,
0x63,0x00,
0x64,0x06,
0x65,0x00,
0x66,0x05,
0x94,0x05,
0x95,0x09,
0x2a,0x10,
0x2b,0xc2,
0x15,0x02,
0x3a,0x04,
0x3d,0xc3,
0x19,0x03,
0x1a,0x7b,
0x2a,0x00,
0x2b,0x00,
0x18,0x01,
0x66,0x05,
0x62,0x10,
0x63,0x0b,
0x65,0x07,
0x64,0x0f,
0x94,0x0e,
0x95,0x10,
0x4f,0x87,
0x50,0x68,
0x51,0x1e,
0x52,0x15,
0x53,0x7c,
0x54,0x91,
0x58,0x1e,
0x41,0x38,
0x76,0xe0,
0x24,0x40,
0x25,0x38,
0x26,0x91,
0x7a,0x09,
0x7b,0x0c,
0x7c,0x16,
0x7d,0x28,
0x7e,0x48,
0x7f,0x57,
0x80,0x64,
0x81,0x71,
0x82,0x7e,
0x83,0x89,
0x84,0x94,
0x85,0xa8,
0x86,0xba,
0x87,0xd7,
0x88,0xec,
0x89,0xf9,
0x09,0x00,
-1,-1
#else
0x12, 0x80,
//udelay(20000,
0x11, 0x00,
0x92, 0x66,
0x93, 0x00,
0x9d, 0x4c,
0x9e, 0x3f,
0x3b, 0x0a,
0x13, 0xf0,
0x10, 0x00,
0x00, 0x00,
// 0x00, 0xff, // modified by me
// 0x07, 0x3f, // added by me
0x01, 0x80,
0x02, 0x80,
0x13, 0xf5,
//
0x12, 0x00,
0x04, 0x00,
0x18, 0x01,
0x17, 0x13,
0x32, 0x92,
0x19, 0x02,
0x1a, 0x7a,
0x03, 0x00,
//
0x0e, 0x84,
0x0f, 0x62,
0x15, 0x02,
0x16, 0x02,
0x1b, 0x01,
0x1e, 0x01,
0x29, 0x3c,
0x33, 0x00,
0x34, 0x07,
0x35, 0x84,
0x36, 0x00,
0x38, 0x13,
0x39, 0x43,
0x3a, 0x00,
0x3c, 0x6c,
0x3d, 0x90,
0x3f, 0x29,
0x40, 0xc1,
0x41, 0x20,
0x6b, 0x0a,
0xa1, 0xc8,
//
0x69, 0x80,
0x43, 0xf0,
0x44, 0x10,
0x45, 0x78,
0x46, 0xa8,
0x47, 0x60,
0x48, 0x80,
0x59, 0xba,
0x5a, 0x9a,
0x5b, 0x22,
0x5c, 0xb9,
0x5d, 0x9b,
0x5e, 0x10,
0x5f, 0xe0,
0x60, 0x85,
0x61, 0x60,
0x9f, 0x9d,
0xa0, 0xa0,
//
0x4f, 0x66,
0x50, 0x6b,
0x51, 0x05,
0x52, 0x19,
0x53, 0x40,
0x54, 0x59,
0x55, 0x40,
0x56, 0x40,
0x57, 0x40,
0x58, 0x0d,
//
0x8b, 0xcc,
0x8c, 0xcc,
0x8d, 0xcf,
//
0x6c, 0x40,
0x6d, 0x30,
0x6e, 0x4b,
0x6f, 0x60,
0x70, 0x70,
0x71, 0x70,
0x72, 0x70,
0x73, 0x70,
0x74, 0x60,
0x75, 0x60,
0x76, 0x50,
0x77, 0x48,
0x78, 0x3a,
0x79, 0x2e,
0x7a, 0x28,
0x7b, 0x22,
0x7c, 0x04,
0x7d, 0x07,
0x7e, 0x10,
0x7f, 0x28,
0x80, 0x36,
0x81, 0x44,
0x82, 0x52,
0x83, 0x60,
0x84, 0x6c,
0x85, 0x78,
0x86, 0x8c,
0x87, 0x9e,
0x88, 0xbb,
0x89, 0xd2,
0x8a, 0xe6,
//
0x14, 0x1a,
0x24, 0x78,
0x25, 0x6c,
0x62, 0x00,
0x63, 0x00,
0x64, 0x18,
0x65, 0x30,
0x66, 0x05,
0x94, 0x18,
0x95, 0x1c,
//udelay(8000,
0x13, 0xf7,
-1,-1,
#endif
};
extern struct i2c_device *iic_test;
static void OV7670_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x1e;
buf[1] = (r<<4)|0x07;
// sensor_iic_enable();
// sensor_iic_info();
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
//i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
// sensor_iic_diable();
}
uint32 OV7670_hvblank(int8 dh,int8 dv)
{
uint32 i;
#define HBLANK_BASE 0//0xb0UL//0x80UL//0xb0UL
#define VBLANK_BASE 0//0x20UL//0x0AUL//0x20UL
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x2A,(h >> 8)<<4},//HB[11:8]
{0x2B,h & 0xff},//HB[7:0]
{0x2D,v & 0xff},//VB[11:8]
{0x2E,v >> 8},//VB[7:0]
};
for(i=0;i<4;i++)
//i2c_sensor_write(iic_test,(u8 *)&t[i][0],1,1,0x42,0x43);
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ ov7670_cmd =
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)OV7670InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0,0,0,0},
. mclk = 4000000,
.p_fun_adapt = {OV7670_rotate,OV7670_hvblank,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ ov7670_init=
{
0x76,0x42,0x43,0x01,0x01,0x0a
};
#endif
+155
View File
@@ -0,0 +1,155 @@
#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_OV7725
SENSOR_INIT_SECTION static const unsigned char OV7725InitTable[CMOS_INIT_LEN]=
{
0x12,0x80,
0x3d,0x03,
0x15,0x02,
0x17,0x22,//{0x17, 0x26}, hstart
0x18,0xa0,//{0x18, 0xa0}, hsize
0x19,0x07,//{0x19, 0x05}, vstart
0x1a,0xf0,//{0x1a, 0xf2}, vsize
0x32,0x00,
0x29,0xa0,
// 0x2a,0x00,//0x10
// 0x2b,0x80,//hb 80
0x2c,0xf0,
// 0x2d,0x0a,//vb 0a
0x65,0x20,
0x0c,0x10,
0x11,0x01,
0x42,0x7f,
0x22,0x7f,
0x23,0x03,
0x63,0xe0,
0x64,0xff,
0x66,0x00,
0x13,0xff,
0x0d,0x41,
0x0e,0x65,//0xd5
0x0f,0xa5,
0x14,0x10,//0x20
0x22,0x84,//0x67
0x23,0x03,
0x24,0x70,//0x60
0x25,0x30,//0x40
0x26,0xa1,
0x6b,0xaa,
0x90,0x05,
0x91,0x01,
0x92,0x03,
0x93,0x00,
0x9c,0x20,
0x9e,0x81,
0x7e,0x0c,
0x7f,0x16,
0x80,0x2a,
0x81,0x4e,
0x82,0x61,
0x83,0x6f,
0x84,0x7b,
0x85,0x86,
0x86,0x8e,
0x87,0x97,
0x88,0xa4,
0x89,0xaf,
0x8a,0xc5,
0x8b,0xd7,
0x8c,0xe8,
0x8d,0x20,
0x94,0x6a,
0x95,0x60,
0x96,0x0e,
0x97,0x0e,
0x98,0x71,
0x99,0x83,
0x9a,0x1e,
0x9b,0x02,
0x9c,0x1d,
0xa6,0x04,
0x46,0x05,
0x47,0x21,
0x48,0x10,
0x49,0x0d,
0x4a,0x00,
0x4b,0x0a,
0x4c,0x11,
0x10,0x7f,
0xac,0xdf,
0x8f,0x05,
0x09,0x03,
0x33,0x00,
0x34,0x00,
-1,-1};
extern struct i2c_device *iic_test;
static void OV7725_rotate(uint32 r)
{
unsigned char buf[2];
buf[0] = 0x0c;
buf[1] = (r<<6)|0x10;
//i2c_sensor_write(iic_test,buf,1,1,0x42,0x43);
i2c_write(iic_test,(int8 *)buf,1,(int8 *)&buf[1],1);
}
uint32 OV7725_hvblank(int8 dh,int8 dv)
{
uint32 i;
#define HBLANK_BASE 0x80UL//0xb0UL
#define VBLANK_BASE 0x0AUL//0x20UL
int32 h = (int32)HBLANK_BASE + dh; if(h < 0) h = 0;
int32 v = (int32)VBLANK_BASE + dv; if(v < 0) v = 0;
const uint8 t[][2] = {
{0x2A,(h >> 8)<<4},//HB[11:8]
{0x2B,h & 0xff},//HB[7:0]
{0x2D,v & 0xff},//VB[11:8]
{0x2E,v >> 8},//VB[7:0]
};
for(i=0;i<4;i++)
i2c_write(iic_test,(int8 *)&t[i][0],1,(int8 *)&t[i][1],1);
return (h<<16)|v;
}
SENSOR_OP_SECTION const _Sensor_Adpt_ ov7725_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)OV7725InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0x80,0x0a,0x80,0x0a},
. mclk = 4000000,
.p_fun_adapt = {OV7725_rotate,OV7725_hvblank,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ ov7725_init=
{
0x77,0x42,0x43,0x01,0x01,0x0a
};
#endif
+479
View File
@@ -0,0 +1,479 @@
#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_SP0718
//AE target
#define SP0718_P1_0xeb 0x7c//室外亮度
#define SP0718_P1_0xec 0x75//室内亮度
//HEQ
#define SP0718_P1_0x10 0x00//outdoor
#define SP0718_P1_0x14 0x18
#define SP0718_P1_0x11 0x00//nr
#define SP0718_P1_0x15 0x18
#define SP0718_P1_0x12 0x00//dummy
#define SP0718_P1_0x16 0x10
#define SP0718_P1_0x13 0x00//low
#define SP0718_P1_0x17 0x00
SENSOR_INIT_SECTION static const unsigned char SP0718InitTable[CMOS_INIT_LEN]=
{
0xfd,0x00,
0x1C,0x00,
0x31,0x10,
0x27,0xb3,//0xb3 //2x gain
0x1b,0x17,
0x26,0xaa,
0x37,0x02,
0x28,0x8f,
0x1a,0x73,
0x1e,0x1b,
0x21,0x06, //blackout voltage
0x22,0x2a, //colbias
0x0f,0x3f,
0x10,0x3e,
0x11,0x00,
0x12,0x01,
0x13,0x3f,
0x14,0x04,
0x15,0x30,
0x16,0x31,
0x17,0x01,
0x69,0x31,
0x6a,0x2a,
0x6b,0x33,
0x6c,0x1a,
0x6d,0x32,
0x6e,0x28,
0x6f,0x29,
0x70,0x34,
0x71,0x18,
0x36,0x00,//02 delete badframe
0xfd,0x01,
0x5d,0x51,//position
0xf2,0x19,
//Blacklevel
0x1f,0x10,
0x20,0x1f,
//pregain
0xfd,0x02,
0x00,0x88,
0x01,0x88,
//SI15_SP0718 24M 50Hz 15-8fps
#if 0
//ae setting
0xfd,0x00,
0x03,0x01,
0x04,0xce,
0x06,0x00,
0x09,0x02,
0x0a,0xc4,
0xfd,0x01,
0xef,0x4d,
0xf0,0x00,
0x02,0x0c,
0x03,0x01,
0x06,0x47,
0x07,0x00,
0x08,0x01,
0x09,0x00,
//Status
0xfd,0x02,
0xbe,0x9c,
0xbf,0x03,
0xd0,0x9c,
0xd1,0x03,
0xfd,0x01,
0x5b,0x03,
0x5c,0x9c,
#else //22fps
//ae setting
0xfd,0x00,
0x03,0x02,
0x04,0xa6,
0x06,0x00,
0x09,0x00,
0x0a,0xd4,
0xfd,0x01,
0xef,0x71,
0xf0,0x00,
0x02,0x04,
0x03,0x01,
0x06,0x6b,
0x07,0x00,
0x08,0x01,
0x09,0x00,
//Status
0xfd,0x02,
0xbe,0xc4,
0xbf,0x01,
0xd0,0xc4,
0xd1,0x01,
0xfd,0x01,
0x5b,0x01,
0x5c,0xc4,
#endif
//rpc
0xfd,0x01,
0xe0,0x40,////24//4c//48//4c//44//4c//3e//3c//3a//38//rpc_1base_max
0xe1,0x30,////24//3c//38//3c//36//3c//30//2e//2c//2a//rpc_2base_max
0xe2,0x2e,////24//34//30//34//2e//34//2a//28//26//26//rpc_3base_max
0xe3,0x2a,////24//2a//2e//2c//2e//2a//2e//26//24//22//rpc_4base_max
0xe4,0x2a,////24//2a//2e//2c//2e//2a//2e//26//24//22//rpc_5base_max
0xe5,0x28,////24//2c//2a//2c//28//2c//24//22//20//rpc_6base_max
0xe6,0x28,////24//2c//2a//2c//28//2c//24//22//20//rpc_7base_max
0xe7,0x26,////24//2a//28//2a//26//2a//22//20//20//1e//rpc_8base_max
0xe8,0x26,////24//2a//28//2a//26//2a//22//20//20//1e//rpc_9base_max
0xe9,0x26,////24//2a//28//2a//26//2a//22//20//20//1e//rpc_10base_max
0xea,0x26,////24//28//26//28//24//28//20//1f//1e//1d//rpc_11base_max
0xf3,0x26,////24//28//26//28//24//28//20//1f//1e//1d//rpc_12base_max
0xf4,0x26,////24//28//26//28//24//28//20//1f//1e//1d//rpc_13base_max
//ae gain &status
0xfd,0x01,
0x04,0xe0,//rpc_max_indr
0x05,0x26,//1e//rpc_min_indr
0x0a,0xa0,//rpc_max_outdr
0x0b,0x26,//rpc_min_outdr
0x5a,0x40,//dp rpc
0xfd,0x02,
0xbc,0xa0,//rpc_heq_low
0xbd,0x80,//rpc_heq_dummy
0xb8,0x80,//mean_normal_dummy
0xb9,0x90,//mean_dummy_normal
//ae target
0xfd,0x01,
0xeb,SP0718_P1_0xeb,//78
0xec,SP0718_P1_0xec,//78
0xed,0x0a,
0xee,0x10,
//lsc
0xfd,0x01,
0x26,0x30,
0x27,0x2c,
0x28,0x07,
0x29,0x08,
0x2a,0x40,
0x2b,0x03,
0x2c,0x00,
0x2d,0x00,
0xa1,0x24,
0xa2,0x27,
0xa3,0x27,
0xa4,0x2b,
0xa5,0x1c,
0xa6,0x1a,
0xa7,0x1a,
0xa8,0x1a,
0xa9,0x18,
0xaa,0x1c,
0xab,0x17,
0xac,0x17,
0xad,0x08,
0xae,0x08,
0xaf,0x08,
0xb0,0x00,
0xb1,0x00,
0xb2,0x00,
0xb3,0x00,
0xb4,0x00,
0xb5,0x02,
0xb6,0x06,
0xb7,0x00,
0xb8,0x00,
//DP
0xfd,0x01,
0x48,0x09,
0x49,0x99,
//awb
0xfd,0x01,
0x32,0x05,
0xfd,0x00,
0xe7,0x03,
0xfd,0x02,
0x26,0xc8,
0x27,0xc6,
0xfd,0x00,
0xe7,0x00,
0xfd,0x02,
0x1b,0x80,
0x1a,0x80,
0x18,0x26,
0x19,0x28,
0xfd,0x02,
0x2a,0x00,
0x2b,0x08,
0x28,0xef,//0xa0//f8
0x29,0x20,
//d65 90 e2 93
0x66,0x42,//0x59//0x60////0x58//4e//0x48
0x67,0x62,//0x74//0x70//0x78//6b//0x69
0x68,0xee,//0xd6//0xe3//0xd5//cb//0xaa
0x69,0x18,//0xf4//0xf3//0xf8//ed
0x6a,0xa6,//0xa5
//indoor 91
0x7c,0x3b,//0x45//30//41//0x2f//0x44
0x7d,0x5b,//0x70//60//55//0x4b//0x6f
0x7e,0x15,//0a//0xed
0x7f,0x39,//23//0x28
0x80,0xaa,//0xa6
//cwf 92
0x70,0x3e,//0x38//41//0x3b
0x71,0x59,//0x5b//5f//0x55
0x72,0x31,//0x30//22//0x28
0x73,0x4f,//0x54//44//0x45
0x74,0xaa,
//tl84 93
0x6b,0x1b,//0x18//11
0x6c,0x3a,//0x3c//25//0x2f
0x6d,0x3e,//0x3a//35
0x6e,0x59,//0x5c//46//0x52
0x6f,0xaa,
//f 94
0x61,0xea,//0x03//0x00//f4//0xed
0x62,0x03,//0x1a//0x25//0f//0f
0x63,0x6a,//0x62//0x60//52//0x5d
0x64,0x8a,//0x7d//0x85//70//0x75//0x8f
0x65,0x6a,//0xaa//6a
0x75,0x80,
0x76,0x20,
0x77,0x00,
0x24,0x25,
//针对室内调偏不过灯箱测试使用//针对人脸调偏
0x20,0xd8,
0x21,0xa3,//82//a8偏暗照度还有调偏
0x22,0xd0,//e3//bc
0x23,0x86,
//outdoor r\b range
0x78,0xc3,//d8
0x79,0xba,//82
0x7a,0xa6,//e3
0x7b,0x99,//86
//skin
0x08,0x15,//
0x09,0x04,//
0x0a,0x20,//
0x0b,0x12,//
0x0c,0x27,//
0x0d,0x06,//
0x0e,0x63,//
//wt th
0x3b,0x10,
//gw
0x31,0x60,
0x32,0x60,
0x33,0xc0,
0x35,0x6f,
// sharp
0xfd,0x02,
0xde,0x0f,
0xd2,0x02,//6//控制黑白边;0-边粗,f-变细
0xd3,0x06,
0xd4,0x06,
0xd5,0x06,
0xd7,0x20,//10//2x根据增益判断轮廓阈值
0xd8,0x30,//24//1A//4x
0xd9,0x38,//28//8x
0xda,0x38,//16x
0xdb,0x08,//
0xe8,0x20,//48//轮廓强度
0xe9,0x20,
0xea,0x20,
0xeb,0x10,
0xec,0x20,//60//80
0xed,0x20,//50//60
0xee,0x20,
0xef,0x10,
//平坦区域锐化力度
0xf3,0x50,
0xf4,0x10,
0xf5,0x10,
0xf6,0x10,
//dns
0xfd,0x01,
0x64,0x44,//沿方向边缘平滑力度 //0-最强,8-最弱
0x65,0x22,
0x6d,0x08,//8//强平滑(平坦)区域平滑阈值
0x6e,0x10,//8
0x6f,0x20,
0x70,0x30,
0x71,0x08,//0d//弱平滑(非平坦)区域平滑阈值
0x72,0x12,//1b
0x73,0x1c,//20
0x74,0x24,
0x75,0x23,//[7:4]平坦区域强度,[3:0]非平坦区域强度;0-最强,8-最弱;
0x76,0x02,//46
0x77,0x02,//33
0x78,0x02,
0x81,0x10,//18//2x//根据增益判定区域阈值,低于这个做强平滑、大于这个做弱平滑;
0x82,0x20,//30//4x
0x83,0x30,//40//8x
0x84,0x48,//50//16x
0x85,0x0c,//12/8+reg0x81 第二阈值,在平坦和非平坦区域做连接
0xfd,0x02,
0xdc,0x0f,
//gamma
0xfd,0x01,
0x8b,0x00,//00//00
0x8c,0x0a,//0c//09
0x8d,0x16,//19//17
0x8e,0x1f,//25//24
0x8f,0x2a,//30//33
0x90,0x3c,//44//47
0x91,0x4e,//54//58
0x92,0x5f,//61//64
0x93,0x6c,//6d//70
0x94,0x82,//80//81
0x95,0x94,//92//8f
0x96,0xa6,//a1//9b
0x97,0xb2,//ad//a5
0x98,0xbf,//ba//b0
0x99,0xc9,//c4//ba
0x9a,0xd1,//cf//c4
0x9b,0xd8,//d7//ce
0x9c,0xe0,//e0//d7
0x9d,0xe8,//e8//e1
0x9e,0xef,//ef//ea
0x9f,0xf8,//f7//f5
0xa0,0xff,//ff//ff
//CCM
0xfd,0x02,
0x15,0xd0,//b>th
0x16,0x95,//r<th
//gc镜头照人脸偏黄
//!F
0xa0,0x80,//80
0xa1,0x00,//00
0xa2,0x00,//00
0xa3,0x00,//06
0xa4,0x8c,//8c
0xa5,0xf4,//ed
0xa6,0x0c,//0c
0xa7,0xf4,//f4
0xa8,0x80,//80
0xa9,0x00,//00
0xaa,0x30,//30
0xab,0x0c,//0c
//F
0xac,0x8c,
0xad,0xf4,
0xae,0x00,
0xaf,0xed,
0xb0,0x8c,
0xb1,0x06,
0xb2,0xf4,
0xb3,0xf4,
0xb4,0x99,
0xb5,0x0c,
0xb6,0x03,
0xb7,0x0f,
//sat u
0xfd,0x01,
0xd3,0x7a,//0x88//50
0xd4,0x7a,//0x88//50
0xd5,0x7a,//50
0xd6,0x70,//50
//sat v
0xd7,0x70,//0x88//50
0xd8,0x70,//0x88//50
0xd9,0x70,//50
0xda,0x70,//50
//auto_sat
0xdd,0x30,
0xde,0x10,
0xd2,0x01,//autosa_en
0xdf,0xff,//a0//y_mean_th
//uv_th
0xfd,0x01,
0xc2,0xaa,
0xc3,0xaa,
0xc4,0x66,
0xc5,0x66,
//heq
0xfd,0x01,
0x0f,0xff,
0x10,SP0718_P1_0x10, //out
0x14,SP0718_P1_0x14,
0x11,SP0718_P1_0x11, //nr
0x15,SP0718_P1_0x15,
0x12,SP0718_P1_0x12, //dummy
0x16,SP0718_P1_0x16,
0x13,SP0718_P1_0x13, //low
0x17,SP0718_P1_0x17,
0xfd,0x01,
0xcd,0x20,
0xce,0x1f,
0xcf,0x20,
0xd0,0x55,
//auto
0xfd,0x01,
0xfb,0x33,
//0x32,0x15,
0x33,0xff,
0x34,0xe7,
0xc6,0xa0,
0xc7,0xa0,
0xc8,0xa0,
0xc9,0xa0,
0x35,0x40,
0xff,0xff,
-1,-1};
SENSOR_OP_SECTION const _Sensor_Adpt_ sp0718_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)SP0718InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0x80,0x0a,0x80,0x0a},
. mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ sp0718_init=
{
0x71,0x42,0x43,0x01,0x01,0x02
};
#endif
+388
View File
@@ -0,0 +1,388 @@
#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_SP0A19
SENSOR_INIT_SECTION static const unsigned char SP0A19InitTable[CMOS_INIT_LEN]=
{
//SP0A19 ini
0xfd,0x00,
0x32,0x00,
0x0f,0x2f,
0x10,0x2e,
0x11,0x00,
0x12,0x18,
0x13,0x2f,
0x14,0x00,
0x15,0x3f,
0x16,0x00,
0x17,0x18,
0x25,0x40,
0x1a,0x0b,
0x1e,0xb ,
0x20,0x3f, // add
0x21,0x13, // 0x0c 24
0x22,0x19,
0x26,0x1a,
0x27,0xab,
0x28,0xfd,
0x30,0x00,
0x31,0x00,//0x10
0xfb,0x33, // 0x33
0x1f,0x08,
//Blacklevel
0xfd,0x00,
0x65,0x00,//blue_suboffset
0x66,0x00,//red_suboffset
0x67,0x00,//gr_suboffset
0x68,0x00,//gb_suboffset
0x45,0x00,
0x46,0x0f,
//ae setting 24M 22+50
0xfd , 0x00,
0x03 , 0x01,
0x04 , 0x74,
0x06 , 0x32,
0x09 , 0x00,
0x0a , 0x76,
0xf0 , 0x7c,
0xf1 , 0x00,
0xfd , 0x01,
0x90 , 0x04,
0x92 , 0x01,
0x98 , 0x7c,
0x99 , 0x00,
0x9a , 0x01,
0x9b , 0x00,
//Status
0xfd,0x01,
0xce,0xc8,
0xcf,0x04,
0xd0,0xc8,
0xd1,0x04,
0xfd,0x01,
0xc4,0x56,//70
0xc5,0x8f,//74
0xca,0x30,
0xcb,0x45,
0xcc,0x70,//rpc_heq_low
0xcd,0x48,//rpc_heq_dummy
0xfd,0x00,
//lsc for st
0xfd,0x01,
0x35,0x15,
0x36,0x15, //20
0x37,0x15,
0x38,0x15,
0x39,0x15,
0x3a,0x15, //15
0x3b,0x13,
0x3c,0x15,
0x3d,0x15,
0x3e,0x15, //12
0x3f,0x15,
0x40,0x18,
0x41,0x00,
0x42,0x04,
0x43,0x04,
0x44,0x00,
0x45,0x00,
0x46,0x00,
0x47,0x00,
0x48,0x00,
0x49,0xfd,
0x4a,0x00,
0x4b,0x00,
0x4c,0xfd,
0xfd,0x00,
//awb 1
0xfd,0x01,
0x28,0xc5,
0x29,0x9b,
//0x10,0x08,
//0x11,0x14,
//0x12,0x14,
0x2e,0x02,
0x2f,0x16,
0x17,0x17,
0x18,0x19, //0x29 0813
0x19,0x45,
//0x1a,0x9e,//a1,a5
//0x1b,0xae,//b0,9a
//0x33,0xef,
0x2a,0xef,
0x2b,0x15,
//awb2
0xfd,0x01,
0x73,0x80,
0x1a,0x80,
0x1b,0x80,
//d65
0x65,0xd5, //d6
0x66,0xfa, //f0
0x67,0x72, //7a
0x68,0x8a, //9a
//indoor
0x69,0xc6, //ab
0x6a,0xee, //ca
0x6b,0x94, //a3
0x6c,0xab, //c1
//f
0x61,0x7a, //82
0x62,0x98, //a5
0x63,0xc5, //d6
0x64,0xe6, //ec
//cwf
0x6d,0xb9, //a5
0x6e,0xde, //c2
0x6f,0xb2, //a7
0x70,0xd5, //c5
//skin detect
0xfd,0x01,
0x08,0x15,
0x09,0x04,
0x0a,0x20,
0x0b,0x12,
0x0c,0x27,
0x0d,0x06,
0x0f,0x63,//0x5f 0813
//BPC_grad
0xfd,0x00,
0x79,0xf0,
0x7a,0x80, //f0
0x7b,0x80, //f0
0x7c,0x20,//f0
//smooth
0xfd,0x00,
//
0x57,0x08, //raw_dif_thr_outdoor
0x58,0x0c, //raw_dif_thr_normal
0x56,0x0e, //raw_dif_thr_dummy
0x59,0x12, //raw_dif_thr_lowlight
//GrGb
0x89,0x08, //raw_grgb_thr_outdoor
0x8a,0x0c, //raw_grgb_thr_normal
0x9c,0x0e, //raw_grgb_thr_dummy
0x9d,0x12, //raw_grgb_thr_lowlight
//Gr\Gb
0x81,0xe0, //raw_gflt_fac_outdoor
0x82,0x80, //raw_gflt_fac_normal
0x83,0x40, //raw_gflt_fac_dummy
0x84,0x20, //raw_gflt_fac_lowlight
//GrGb
0x85,0xe0, //raw_gf_fac_outdoor
0x86,0x80, //raw_gf_fac_normal
0x87,0x40, //raw_gf_fac_dummy
0x88,0x20, //raw_gf_fac_lowlight
//
0x5a,0xff, //raw_rb_fac_outdoor
0x5b,0xe0, //raw_rb_fac_normal
0x5c,0x80, //raw_rb_fac_dummy
0x5d,0x20, //raw_rb_fac_lowlight
//sharpen
0xfd,0x01,
0xe2,0x50, //sharpen_y_base
0xe4,0xa0, //sharpen_y_max
0xe5,0x08, //rangek_neg_outdoor //0x08
0xd3,0x08, //rangek_pos_outdoor //0x08
0xd7,0x08, //range_base_outdoor //0x08
0xe6,0x0a, //rangek_neg_normal // 0x08
0xd4,0x0a, //rangek_pos_normal // 0x08
0xd8,0x0a, //range_base_normal // 0x08
0xe7,0x12, //rangek_neg_dummy // 0x10
0xd5,0x12, //rangek_pos_dummy // 0x10
0xd9,0x12, //range_base_dummy // 0x10
0xd2,0x15, //rangek_neg_lowlight
0xd6,0x15, //rangek_pos_lowlight
0xda,0x15, //range_base_lowlight
0xe8,0x20, //sharp_fac_pos_outdoor // 0x35
0xec,0x2c, //sharp_fac_neg_outdoor
0xe9,0x20, //sharp_fac_pos_nr // 0x35
0xed,0x2c, //sharp_fac_neg_nr
0xea,0x18, //sharp_fac_pos_dummy // 0x30
0xef,0x1c, //sharp_fac_neg_dummy // 0x20
0xeb,0x15, //sharp_fac_pos_low
0xf0,0x18, //sharp_fac_neg_low
//CCM
0xfd,0x01,
0xa0,0x66,
0xa1,0x00,
0xa2,0x19,
0xa3,0xf3, // 0xf6
0xa4,0x8e, // 0x99
0xa5,0x00, // 0xf2
0xa6,0x00, // 0x0d
0xa7,0xe6, // 0xda
0xa8,0x9a,//0xa0 0813 // 0x98
0xa9,0x00,
0xaa,0x03, // 0x33
0xab,0x0c,
0xfd,0x00,
//gamma
0xfd,0x00,
0x8b,0x0 , // 00,0 ,0
0x8c,0xC , // 0f,C ,11
0x8d,0x19, // 1e,19,19
0x8e,0x2C, // 3d,2C,28
0x8f,0x49, // 6c,49,46
0x90,0x61, // 92,61,61
0x91,0x77, // aa,77,78
0x92,0x8A, // b9,8A,8A
0x93,0x9B, // c4,9B,9B
0x94,0xA9, // cf,A9,A9
0x95,0xB5, // d4,B5,B5
0x96,0xC0, // da,C0,C0
0x97,0xCA, // e0,CA,CA
0x98,0xD4, // e4,D4,D4
0x99,0xDD, // e8,DD,DD
0x9a,0xE6, // ec,E6,E6
0x9b,0xEF, // f1,EF,EF
0xfd,0x01, // 01,01,01
0x8d,0xF7, // f7,F7,F7
0x8e,0xFF, // ff,FF,FF
0xfd,0x00, //
//rpc
0xfd,0x00,
0xe0,0x4c, // 4c,44,4c,3e,3c,3a,38,rpc_1base_max
0xe1,0x3c, // 3c,36,3c,30,2e,2c,2a,rpc_2base_max
0xe2,0x34, // 34,2e,34,2a,28,26,26,rpc_3base_max
0xe3,0x2e, // 2e,2a,2e,26,24,22,rpc_4base_max
0xe4,0x2e, // 2e,2a,2e,26,24,22,rpc_5base_max
0xe5,0x2c, // 2c,28,2c,24,22,20,rpc_6base_max
0xe6,0x2c, // 2c,28,2c,24,22,20,rpc_7base_max
0xe8,0x2a, // 2a,26,2a,22,20,20,1e,rpc_8base_max
0xe9,0x2a, // 2a,26,2a,22,20,20,1e,rpc_9base_max
0xea,0x2a, // 2a,26,2a,22,20,20,1e,rpc_10base_max
0xeb,0x28, // 28,24,28,20,1f,1e,1d,rpc_11base_max
0xf5,0x28, // 28,24,28,20,1f,1e,1d,rpc_12base_max
0xf6,0x28, // 28,24,28,20,1f,1e,1d,rpc_13base_max
//ae min gain
0xfd,0x01,
0x94,0xa0, //rpc_max_indr
0x95,0x28, // 1e rpc_min_indr
0x9c,0xa0, //rpc_max_outdr
0x9d,0x28, //rpc_min_outdr
//ae target
0xfd,0x00,
0xed,0x84, //80
0xf7,0x80, //7c
0xf8,0x78, //70
0xec,0x74, //6c
0xef,0x7c, //99
0xf9,0x78, //90
0xfa,0x70, //80
0xee,0x6c, //78
//gray detect
0xfd,0x01,
0x30,0x40,
//add 0813
0x31,0x70,
0x32,0x40,
0x33,0xef,
0x34,0x05,
0x4d,0x2f,
0x4e,0x20,
0x4f,0x16,
//lowlight lum
0xfd,0x00, //
0xb2,0x10, //lum_limit // 0x10
0xb3,0x1f, //lum_set
0xb4,0x30, //black_vt // 0x20
0xb5,0x45, //white_vt
//saturation
0xfd,0x00,
0xbe,0xff,
0xbf,0x01,
0xc0,0xff,
0xc1,0xd8,
0xd3,0x80, //0x78
0xd4,0x80, //0x78
0xd6,0x70, //0x78 0xd7,0x60, //0x78
0xd7,0x60,
//HEQ
0xfd,0x00,
0xdc,0x00,
0xdd,0x80, //0x80 0813 // 0x78
0xde,0xb8, //80 0x88 0813
0xdf,0x80,
//func enable
0xfd,0x00,
0x32,0x15, //0x0d
0x34,0x76, //16
0x35,0x40, //yuv 00
0x33,0xef,
0x5f,0x51,
0x1b,0xc ,
0x1C,0x28,
-1,-1};
SENSOR_OP_SECTION const _Sensor_Adpt_ sp0a19_cmd=
{
.typ = 1, //YUV
.pixelw = 640,
.pixelh= 480,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)SP0A19InitTable,
.rotate_adapt = {0},
.hvb_adapt = {0x80,0x0a,0x80,0x0a},
. mclk = 24000000,
.p_fun_adapt = {NULL,NULL,NULL},
.p_xc7016_adapt = {NULL},
};
const _Sensor_Ident_ sp0a19_init=
{
0xA6,0x42,0x43,0x01,0x01,0x02
};
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+707
View File
@@ -0,0 +1,707 @@
#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_XCG532
SENSOR_INIT_SECTION static const unsigned char XCG532InitTable[CMOS_INIT_LEN]=
{
0x03,0x00,
0x35,0xF0,
0x57,0x63,
0x58,0x04,
0x59,0xB8,
0x65,0x01,
0x60,0x00,
0x61,0x00,
0x62,0x00,
0x06,0x07,
0x07,0xBB,
0x14,0x00,
0x15,0x0F,
0x16,0x02,
0x17,0xDF,
0x1D,0x0A,
0x35,0x50,
0x55,0x52,
0x03,0x00,
0x05,0x03,
0x3D,0xB8,
0x3E,0x08,
0x3F,0x04,
0x40,0x46,
0x41,0x54,
0x42,0xA0,
0x45,0x13,
0x5C,0x00,
0x96,0xA4,
0xBC,0x00,
0x03,0x01,
0x05,0xCF,
0x06,0xB0,
0x0A,0xA4,
0x2D,0x03,
0x2E,0x20,
0x2F,0x05,
0x30,0xA2,
0x35,0x03,
0x36,0x20,
0x37,0x05,
0x38,0xA2,
0x39,0x07,
0x3A,0xA2,
0x63,0x5F,
0xA3,0x00,
0xA4,0x02,
0xA5,0x03,
0xA6,0x04,
0xA7,0x05,
0xA8,0x08,
0xA9,0x2A,
0xAA,0x10,
0xCF,0x00,
0xD0,0x00,
0xD1,0xD0,
0xD2,0x00,
0xD3,0x70,
0xD5,0x00,
0xD6,0x20,
0xD7,0x40,
0xD8,0x80,
0xD9,0xF0,
0xDA,0x00,
0xDB,0x20,
0xDC,0x46,
0xDD,0x86,
0xDE,0xFF,
0x03,0x02,
0x04,0x00,
0x05,0x0B,
0x06,0x07,
0x07,0xBC,
0x08,0x00,
0x09,0x0F,
0x0A,0x07,
0x0B,0xB2,
0x0C,0x00,
0x0D,0xE6,
0x0E,0x01,
0x0F,0x13,
0x10,0x07,
0x11,0xB4,
0x12,0x07,
0x13,0xB6,
0x14,0x07,
0x15,0xB8,
0x16,0x07,
0x17,0xBA,
0x1F,0x00,
0x20,0x79,
0x21,0x00,
0x22,0xC9,
0x23,0x01,
0x24,0x78,
0x25,0x03,
0x26,0x1B,
0x27,0x00,
0x28,0x7A,
0x29,0x00,
0x2A,0xC8,
0x2B,0x01,
0x2C,0x79,
0x2D,0x03,
0x2E,0x1A,
0x2F,0x00,
0x30,0x1E,
0x31,0x00,
0x32,0x5F,
0x33,0x00,
0x34,0x64,
0x35,0x02,
0x36,0xFE,
0x37,0x03,
0x38,0x17,
0x39,0x00,
0x3A,0xE5,
0x3B,0x00,
0x3C,0x00,
0x3D,0x00,
0x3E,0x28,
0x4F,0x07,
0x50,0x26,
0x51,0x07,
0x52,0xBC,
0x54,0x00,
0x55,0x69,
0x56,0x00,
0x57,0x7E,
0x58,0x00,
0x59,0xE1,
0x5C,0x01,
0x5D,0x7D,
0x5E,0x03,
0x5F,0x1B,
0x67,0x02,
0x68,0xFE,
0x69,0x03,
0x6A,0x17,
0xA8,0x00,
0xA9,0x09,
0xAA,0x0D,
0xBC,0x00,
0xBD,0x7E,
0xBE,0x00,
0xBF,0xC6,
0xC0,0x01,
0xC1,0x7D,
0xC2,0x02,
0xC3,0xFD,
0xC4,0x07,
0xC5,0xB8,
0xC6,0x07,
0xC7,0xBA,
0xC8,0x03,
0xC9,0x11,
0xCA,0x03,
0xCB,0x15,
0x03,0x03,
0x2B,0x07,
0x2C,0x10,
0x2D,0xF0,
0x2E,0x02,
0x2F,0x02,
0x30,0x40,
0x31,0x01,
0x32,0xF4,
0x33,0x02,
0x34,0x6E,
0x35,0x27,
0x36,0x2D,
0x37,0x47,
0x38,0x8D,
0x39,0x01,
0x3A,0x00,
0x3B,0x41,
0x3C,0x34,
0x3D,0x54,
0x3E,0x80,
0x3F,0x48,
0x40,0xA7,
0x41,0x36,
0x42,0x34,
0x55,0x04,
0x5A,0x00,
0x5B,0xE1,
0x5C,0x00,
0x67,0xC8,
0x68,0x21,
0x6B,0x40,
0x6D,0x8A,
0x83,0x0C,
0x86,0x20,
0x87,0x20,
0x88,0x20,
0x89,0x20,
0x8B,0x14,
0xB1,0x40,
0xB2,0xC0,
0xD0,0x5E,
0xD1,0x55,
0xD2,0x4B,
0xD3,0x45,
0xD4,0x49,
0xD5,0x51,
0xD6,0x56,
0x03,0x04,
0x04,0x00,
0x05,0x00,
0x06,0x00,
0x07,0x01,
0x08,0x02,
0x09,0x04,
0x0A,0x06,
0x0B,0x08,
0x0C,0x0B,
0x0D,0x11,
0x0E,0x18,
0x0F,0x1F,
0x10,0x27,
0x11,0x36,
0x12,0x44,
0x13,0x50,
0x14,0x5C,
0x15,0x83,
0x16,0xA2,
0x17,0xBD,
0x18,0xD5,
0x19,0xEB,
0x1A,0xFF,
0x7A,0x28,
0x03,0x07,
0x51,0x0F,
0x52,0x19,
0x53,0x26,
0x54,0x3A,
0x55,0x4C,
0x56,0x56,
0x57,0x60,
0x58,0x6A,
0x59,0x74,
0x5A,0x7E,
0x5B,0x88,
0x5C,0x92,
0x5D,0x9C,
0x5E,0xA6,
0x5F,0xB0,
0x60,0xBA,
0x61,0xC4,
0x62,0xCE,
0x63,0xD8,
0x64,0xDE,
0x65,0xE0,
0x66,0xE2,
0x67,0xE4,
0x68,0xE6,
0x69,0xE8,
0x6A,0xEB,
0x6B,0xED,
0x6C,0xEE,
0x6D,0xF0,
0x6E,0xF2,
0x6F,0xF5,
0x70,0xFA,
0x71,0xFF,
0x03,0x08,
0x79,0x90,
0x03,0x09,
0x1C,0x20,
0x1D,0x20,
0x1E,0x20,
0x1F,0x5A,
0x20,0x5A,
0x21,0x5A,
0x22,0x20,
0x23,0x20,
0x24,0x20,
0x25,0x5A,
0x26,0x5A,
0x27,0x5A,
0x28,0x5D,
0x29,0xFF,
0x2A,0xFF,
0x2B,0x5F,
0x2C,0x5F,
0x2D,0x00,
0x2E,0x00,
0x2F,0x00,
0x30,0x26,
0x31,0x26,
0x32,0x40,
0x33,0x40,
0x34,0x40,
0x35,0x40,
0x36,0x40,
0x37,0x06,
0x38,0x06,
0x39,0x06,
0x3A,0x08,
0x3B,0x0B,
0x3C,0x1F,
0x3D,0x1F,
0x3E,0x1F,
0x3F,0x1F,
0x40,0x1F,
0x41,0x00,
0x42,0x10,
0x43,0x30,
0x44,0x40,
0x45,0x5F,
0x46,0x3F,
0x47,0x34,
0x48,0x33,
0x49,0x3B,
0x4A,0x2A,
0x4B,0x2A,
0x4C,0x04,
0x4D,0x04,
0x4E,0x04,
0x4F,0x04,
0x50,0x04,
0x51,0x00,
0x52,0x00,
0x53,0x00,
0x54,0x00,
0x55,0x00,
0x56,0x00,
0x57,0x00,
0x58,0x00,
0x59,0x00,
0x5A,0x00,
0x5B,0x00,
0x5C,0x00,
0x5D,0x00,
0x5E,0x00,
0x5F,0x00,
0x60,0x00,
0x61,0x00,
0x62,0x00,
0x63,0x00,
0x64,0x00,
0x65,0x14,
0x66,0x17,
0x67,0x18,
0x68,0x1D,
0x69,0x00,
0x6A,0x08,
0x6B,0x08,
0x6C,0x06,
0x6D,0x06,
0x6E,0x00,
0x75,0x0A,
0x76,0x0A,
0x77,0x00,
0x78,0x00,
0x79,0x00,
0x7A,0x00,
0x7B,0x2B,
0x7C,0x19,
0x7D,0x19,
0x7E,0x19,
0x7F,0x03,
0x80,0x03,
0x81,0x50,
0x82,0x38,
0x83,0x38,
0x84,0x28,
0x85,0x04,
0x86,0x00,
0x8C,0x80,
0x8D,0x80,
0x8E,0x80,
0x8F,0x80,
0x90,0x80,
0x91,0x80,
0x92,0x04,
0x93,0x04,
0x94,0x04,
0x95,0x04,
0x96,0x04,
0x97,0x04,
0x98,0x04,
0x99,0x04,
0x9A,0x04,
0x9B,0x04,
0xA1,0x01,
0xA2,0x03,
0xA3,0x05,
0xA4,0x06,
0xA5,0x20,
0xA6,0x20,
0xA7,0x00,
0xA8,0x00,
0xA9,0x00,
0xAA,0x00,
0xAB,0x08,
0xAC,0x08,
0xAD,0x30,
0xAE,0x40,
0xAF,0x40,
0xB0,0x30,
0xB1,0x40,
0xB3,0xE0,
0xB4,0xD0,
0xB5,0xD0,
0xB6,0xD0,
0xB7,0xD0,
0xB9,0x00,
0xBA,0x00,
0xBB,0x00,
0xBC,0x00,
0xBD,0x00,
0xBE,0x00,
0xBF,0x3C,
0xC0,0x3C,
0xC1,0x3C,
0xC2,0x9B,
0xC3,0x9B,
0xC4,0x9B,
0xC5,0x80,
0xC6,0x80,
0xC7,0x80,
0xC8,0x8C,
0xC9,0x8C,
0xCA,0x8C,
0xCB,0x3A,
0xCC,0x3A,
0xCD,0x3A,
0xCE,0x8E,
0xCF,0x8E,
0xD0,0x8E,
0xD1,0x82,
0xD2,0x82,
0xD3,0x82,
0xD4,0x96,
0xD5,0x96,
0xD6,0x96,
0xD7,0x38,
0xD8,0x38,
0xD9,0x38,
0xDA,0x02,
0xDB,0x02,
0xDC,0x02,
0xDD,0x02,
0xDE,0x0B,
0xDF,0x16,
0xE0,0x02,
0xE1,0x05,
0xE2,0x08,
0xE3,0x16,
0xE4,0x20,
0xE5,0x20,
0xE6,0x10,
0xE7,0x20,
0xE8,0x40,
0xE9,0x60,
0xEA,0x60,
0xEB,0x80,
0xEC,0x04,
0xED,0x04,
0xEE,0x04,
0xEF,0x04,
0xF0,0x06,
0xF1,0x08,
0xF2,0x00,
0xF3,0x00,
0xF4,0x02,
0xF5,0x7E,
0xF6,0x17,
0xF7,0x1C,
0xF8,0xFF,
0xF9,0xFF,
0xFA,0xFF,
0xFB,0xFF,
0xFC,0xFF,
0xFD,0xFF,
0x03,0x0D,
0x04,0x34,
0x05,0x5A,
0x06,0x60,
0x07,0x22,
0x08,0x25,
0x09,0x1F,
0x0A,0x84,
0x0B,0x00,
0x0C,0x82,
0x0D,0x03,
0x0E,0x00,
0x0F,0x01,
0x10,0x1F,
0x11,0x25,
0x12,0x1A,
0x37,0x18,
0x38,0x18,
0x39,0x18,
0x3A,0x0B,
0x3B,0x00,
0x3C,0x00,
0x3D,0x1C,
0x3E,0x1C,
0x3F,0x1C,
0x40,0x05,
0x41,0x00,
0x42,0x00,
0x44,0x00,
0x45,0x00,
0x46,0x00,
0x47,0x00,
0x48,0x00,
0x49,0x20,
0x4A,0x10,
0x03,0x0E,
0x07,0x20,
0x09,0x00,
0x0A,0x02,
0x0B,0xE7,
0x0C,0x02,
0x0D,0xE7,
0x0E,0x02,
0x0F,0xEA,
0x10,0x00,
0x11,0x00,
0x12,0x0C,
0x13,0x00,
0x14,0x2E,
0x15,0xA0,
0x16,0x00,
0x17,0x2E,
0x18,0xA0,
0x38,0x70,
0x39,0x68,
0x3A,0x68,
0x3B,0x70,
0x3C,0x68,
0x3D,0x68,
0x3E,0x00,
0x3F,0x01,
0x40,0x72,
0x41,0x00,
0x42,0x02,
0x43,0xE7,
0x44,0x00,
0x45,0x0B,
0x46,0x9C,
0x47,0x00,
0x48,0x17,
0x49,0x38,
0x50,0x80,
0x51,0x08,
0x52,0x08,
0x53,0x10,
0x57,0x82,
0x58,0x7C,
0x59,0x7E,
0x5A,0x84,
0x5B,0x81,
0x5C,0x84,
0x5D,0x4A,
0x5E,0x78,
0x5F,0x87,
0x60,0x80,
0x61,0x80,
0x62,0x08,
0x63,0x08,
0x6A,0x01,
0x6B,0x73,
0x6C,0x05,
0x6D,0xCE,
0x6E,0x17,
0x6F,0x38,
0x70,0x00,
0x71,0x2E,
0x72,0x70,
0x73,0x00,
0x74,0xA7,
0x75,0x6F,
0x81,0x90,
0x82,0x80,
0x03,0x09,
0xDA,0x08,
0xDB,0x08,
0xDC,0x08,
0xDD,0x08,
0xDE,0x0B,
0xDF,0x16,
0x03,0x0E,
0x57,0x80,
0x58,0x80,
0x59,0x80,
0x5A,0x80,
0x5B,0x80,
0x5C,0x80,
0x03,0x03,
0x2C,0x10,
0x2D,0xF0,
0x2E,0x02,
0x2F,0x02,
0x30,0x40,
0x31,0x01,
0x32,0xF4,
0x33,0x02,
0x34,0x6E,
0x35,0x27,
0x03,0x03,
0x36,0x2D,
0x37,0x4C,
0x38,0x6F,
0x39,0x01,
0x3A,0x00,
0x3B,0x41,
0x3C,0x34,
0x3D,0x54,
0x3E,0x73,
0x3F,0x3C,
0x40,0xA7,
0x41,0x3E,
0x42,0x34,
0x03,0x00,
0x55,0x42,
0x60,0xC0,
0x61,0x90,
0x62,0xFF,
-1,-1,
};
extern struct i2c_device *iic_test;
static void XCG532_rotate(uint32 r)
{
}
uint32 XCG532_hvblank(int8 dh,int8 dv)
{
}
SENSOR_OP_SECTION const _Sensor_Adpt_ xcg532_cmd=
{
.typ = 1, //YUV
.pixelw = 1280,
.pixelh= 720,
.hsyn = 1,
.vsyn = 1,
.rduline = 0,//
.rawwide = 1,//10bit
.colrarray = 2,//0:_RGRG_ 1:_GRGR_,2:_BGBG_,3:_GBGB_
.init = (uint8 *)XCG532InitTable,
.rotate_adapt = {0},
//.hvb_adapt = {0x6a,0x12,0x6a,0x12},
. mclk = 24000000,
.p_fun_adapt = {XCG532_rotate,XCG532_hvblank,NULL},
//.p_xc7016_adapt = NULL,
};
const _Sensor_Ident_ xcg532_init=
{
0x41,0x64,0x65,0x01,0x01,0x00
};
#endif