📄 l2_fadjust.c
字号:
UCHAR temp1, temp2;
temp1 = (UCHAR)Hsize & 0xFF;
temp2 = (UCHAR)(Hsize >> 8) & 0x0F;
XBYTE[0x2A24] = temp1; //Set Hsizec
XBYTE[0x2A25] = temp2;
temp1 = (UCHAR)Vsize & 0xFF;
temp2 = (UCHAR)(Vsize >> 8) & 0x0F;
XBYTE[0x2A26] = temp1; //Set Vsizec
XBYTE[0x2A27] = temp2;
return 0;
}
UCHAR L2_SetFrontImgOffsetm(USHORT Hoffset, USHORT Voffset) USING_0
{
UCHAR temp1, temp2, hoffesthi;
//printf("Hoffset=%d,Voffset=%d\n",Hoffset,Voffset);
#ifdef OV13
{
UCHAR reg_data[1];
L2_ReadSSC(0x2B, reg_data, 1, 1);
Hoffset = Hoffset + (reg_data[0] << 1) + 0x7E;
Voffset = Voffset + 0x05;
}
#endif
#ifdef OV2610
Hoffset = Hoffset + 0x79;
Voffset = Voffset + 0x09;
#endif
#ifdef OV3610 //patch5.2.1@jhyu@OV3610
Hoffset = Hoffset + 0x218;//0x1ea; //Jane@050308
Voffset = Voffset + 0x02;
#endif
//-------------------Davis:patch4.0.0.0_2005/Jun/07 begin
#ifdef OV3620
Hoffset = Hoffset + 0x1e0;
Voffset = Voffset + 0x03;
#endif
//-------------------Davis:patch4.0.0.0_2005/Jun/07 end
#ifdef MCM20027
Hoffset = Hoffset + 0x31;
Voffset = Voffset + 0x0C;
#endif
#ifdef ICM107B
Hoffset = Hoffset + 0x24;
Voffset = Voffset + 0x0C;
#endif
#ifdef ICM108
Hoffset = Hoffset + 0x23;
Voffset = Voffset + 0x0b;
#endif
//patch4.4@andrew@ICM109
#ifdef ICM109
Hoffset = Hoffset + 0x38;
Voffset = Voffset + 0x0b;
#endif
#ifdef TASC5130
Hoffset = Hoffset + 0x5A;
Voffset = Voffset + 0x0E;
#endif
#ifdef TASC5160
Hoffset = Hoffset + 0x29;
Voffset = Voffset + 0x0f;
#endif
#ifdef HP2020
Hoffset = Hoffset + 0x18;
Voffset = Voffset + 0x07;
#endif
#ifdef PB111
Hoffset = Hoffset + 0x18;
Voffset = Voffset + 0x0C;
#endif
#ifdef SONY442
Hoffset = Hoffset + 0x144;
Voffset = Voffset + 0x05;
#endif
#ifdef RJ23N3
Hoffset = Hoffset + 0x275;
Voffset = Voffset + 0x02;
#endif
#ifdef SONY262
Hoffset = Hoffset + 0xC6;
Voffset = Voffset + 0x03;
#endif
#ifdef SONY224
Hoffset = Hoffset + 0xA8;
Voffset = Voffset + 0x06;
#endif
#ifdef SONY432
Hoffset = Hoffset + 0x41A;
Voffset = Voffset + 0x07;
#endif
#ifdef MN39472
Hoffset = Hoffset + 0xFE;
Voffset = Voffset + 0x03;
#endif
#ifdef MN39470
Hoffset = Hoffset + 0xFE;
Voffset = Voffset + 0x03;
#endif
//patch4.4@andrew@SHARP_LZ24
#ifdef SHARP_LZ24BP
//patch4.5@andrew@IR3Y48A_A
//patch4.4@andrew@IR3Y48A
#ifdef IR3Y48A
Hoffset = Hoffset +0x88;
Voffset = Voffset + 0x18;
#endif
#ifdef IR3Y38M
Hoffset = Hoffset + 0x81;
Voffset = Voffset + 0x18;
#endif
#endif
// patch4.5@andrew@MN39592
#ifdef MN39592
Hoffset = Hoffset + 0x0304;
Voffset = Voffset + 0x04;
#endif
hoffesthi = 0;
if (Hoffset > 1023)
{
hoffesthi = Hoffset >> 10;
Hoffset = Hoffset - 1024;
}
temp1 = (UCHAR)Voffset & 0xFF;
temp2 = (UCHAR)(Voffset >> 8) & 0x0F;
XBYTE[0x2A34] = temp1; //Set Voffsetm
XBYTE[0x2A35] = temp2;
temp1 = (UCHAR)Hoffset & 0xFF;
temp2 = (UCHAR)(Hoffset >> 8) & 0x0F;
XBYTE[0x2A30] = temp1; //Set Hoffsetm
XBYTE[0x2A31] = temp2;
XBYTE[0x2926] = hoffesthi;
return 0;
}
UCHAR L2_SetFrontImgSizem(USHORT Hsizem, USHORT Vsizem) USING_0
{
UCHAR temp1, temp2;
temp1 = (UCHAR)Hsizem & 0xFF;
temp2 = (UCHAR)(Hsizem >> 8) & 0x0F;
XBYTE[0x2A32] = temp1; //Set Hsizem
XBYTE[0x2A33] = temp2;
temp1 = (UCHAR)Vsizem & 0xFF;
temp2 = (UCHAR)(Vsizem >> 8) & 0x0F;
XBYTE[0x2A36] = temp1; //Set Vsizem
XBYTE[0x2A37] = temp2;
return 0;
}
#ifdef IR3Y38M
void Dummy_Delay(USHORT delay){
while(delay)
delay--;
}
//#define Dummy_Delay //
UCHAR L2_IR3Y38M_Serial(UCHAR value,UCHAR mode)
/*
Routine Description:
IR3Y38M serial interface function
Arguments:
value:setting value
mode 0 --->Gain sel
1---->offset
2----> agc gain
Return Value:
0--->OK
1--->error
--*/
{
USHORT output_v=0;
USHORT i;
L2_WaitVD(0,1);
if(mode==0){
output_v=((USHORT)(value<<5)&0xE0)|(0x0000);
}
else if(mode==1){
output_v=((USHORT)(value<<2)&0xfc)|(0x0100);
}
else if(mode==2){
output_v=value|(0x0200);
}else {
return 1;
}
XBYTE[0x290B]=0x00; //sd pin low
XBYTE[0x290A]=0x00; //sclk pin low
Dummy_Delay(2); // 2 micro sec delay
XBYTE[0x290A]=0x01; //sclk pin high
Dummy_Delay(4);
XBYTE[0x290A]=0x00; //sclk pin low
Dummy_Delay(6); // 1 micro sec delay
for(i=0;i<10;i++){
if(output_v&0x01)
XBYTE[0x290B]=0x01; //sd pin high
else
XBYTE[0x290B]=0x00; //sd pin low
Dummy_Delay(1);
XBYTE[0x290A]=0x01; //sclk pin high
Dummy_Delay(1);
if(i==9)//last time s data high , then register will store in IR3Y38M
XBYTE[0x290B]=0x01; //sd pin high
else
XBYTE[0x290B]=0x00; //sd pin low
Dummy_Delay(1);
XBYTE[0x290A]=0x00; //sclk pin low
Dummy_Delay(1);
output_v=output_v>>1;
}
Dummy_Delay(1);
XBYTE[0x290B]=0x00; //sd pin low
return 0;
}
#endif
//patch4.4@andrew@IR3Y48A
//patch4.5@andrew@IR3Y48A_A
#ifdef IR3Y48A
UCHAR L2_IR3Y48A_OB(UCHAR obvalue)
{
UCHAR reg_data[2];
USHORT temp;
if(obvalue>127)
return 1;
temp=(obvalue<<6)|0x10;
reg_data[0]=(UCHAR)(temp&0xff);
reg_data[1]=(UCHAR)(temp>>8);
//printf(" ob data [0]=%bx\n", reg_data[0]);
//printf(" ob data [1]=%bx\n", reg_data[1]);
L2_WriteSI(reg_data, 0);
return 0;
}
/***************************
Set CDS Gain
Not PGA Gain
Please reference Spec.
mode 0 0db
1 6.02 db
2 12.04 db
3 -1.94 db
****************************/
UCHAR L2_IR3Y48A_CDS_GAIN(UCHAR mode)
{
UCHAR reg_data[2];
USHORT temp;
if(mode>3)
return 1;
temp=(mode<<10)|0x08;
reg_data[0]=(UCHAR)(temp&0xff);
reg_data[1]=(UCHAR)(temp>>8);
//printf(" ob data [0]=%bx\n", reg_data[0]);
//printf(" ob data [1]=%bx\n", reg_data[1]);
L2_WriteSI(reg_data, 0);
return 0;
}
#endif
//patch4.5@andrew@sony442_AE/AWB_1
#ifdef AD9843
UCHAR L2_AD9843_CDS_GAIN(char value)
{
UCHAR reg_data[2];
USHORT temp;
//printf("Enter CDS gain\n");
if((value>31) || (value <-32))
return 0;
reg_data[0]=0x06; /* enable CDS gain*/
reg_data[1]=0x01;
L2_WriteSI(reg_data, 0);
//printf("value=%bx\n",value);
temp= (((USHORT)(value&0x3f))<<5)|0x0008;
reg_data[0]=(UCHAR)(temp&0xff);
reg_data[1]=(UCHAR)(temp>>8);
// printf(" ob data [0]=%bx\n", reg_data[0]);
//printf(" ob data [1]=%bx\n", reg_data[1]);
L2_WriteSI(reg_data, 0);
return 0;
}
#endif
//patch4.5@andrew@VSP1021
#ifdef VSP1021 // TI CDSAGC
L2_SetCDSAGC_VSP1021(UCHAR address,USHORT Value,UCHAR Option) using 0
{
UCHAR reg_data[2];
UCHAR xdata i=0,temp2,result=0x00,temp3;
USHORT xdata temp1=0x0200;
// printf("Enter L2_AdjustGain_1.\n");
i=0;temp3=0x08;
temp2=0x04;
// printf("======================\n");
// printf("result= %bx\n",result);
// printf("temp3= %bx\n",temp3);
// printf("temp2= %bx\n",temp2);
do
{
if((address & temp3))result=(result |temp2);
// printf("result= %bx\n",result);
// printf("temp3= %bx\n",temp3);
// printf("temp2= %bx\n",temp2);
temp3=(temp3>>1);
temp2=(temp2<<1);
i++;
}while(i<=0x03);
//PRINT_FRONT (" Enter L2_AdjustGain \n");
//if (Value > 1023) return 1;
i=0;temp2=0x40;
do
{
if((Value & temp1))result=(result |temp2);
// printf("result= %bx\n",result);
// printf("temp1= %x\n",temp1);
// printf("temp2= %bx\n",temp2);
temp1=(temp1>>1);
temp2=(temp2<<1);
i++;
}while(i<=0x01);
//reg_data[0] =result |0x20; //Set CDS GAIN
reg_data[0] =result;
/////////////////////////////////////////////////////////////////
i=0;
temp2=1;
result=0;
// printf("======================\n");
// printf("result= %bx\n",result);
// printf("temp1= %x\n",temp1);
// printf("temp2= %bx\n",temp2);
do
{
if((Value & temp1))result=(result |temp2);
// printf("result= %bx\n",result);
// printf("temp1= %x\n",temp1);
// printf("temp2= %bx\n",temp2);
temp1=(temp1>>1);
temp2=(temp2<<1);
i++;
}while(i<=0x07);
reg_data[1] =result; //Set CDS GAIN
// printf("result= %x\n",result);
// printf("reg[0]= %bx\n",reg_data[0]);
// printf("reg[1]= %bx\n",reg_data[1]);
L2_WriteSI(reg_data, 1);//Option);
//return 0;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -