;	Copyright (c) 2002 ALi Corp. 
;		ALi M5602 Pc-Camera inital setting
; 	Format
;		R 	register	data
;		I	device		address		data	
;  		P	register	and_data	compare_data	
;		O	register	Or_data				
;		A	register	And_data
;		C	register	min(0%)		max(100%)
;
;	Sensor: OV7640
;	Version: 1.000


[BEGIN]


[R_SXGA]
[R_SGA]
[R_VGA]
[R_CIF]
[R_QVGA]
R	xbSenClkDiv		0x00	;
R	xbSenClkCtrl		0xB0	; 24M bit6:5 clock select 00:12M, 01:48M, 10:60M, 11:80M, bit4: diven
R	xbLineOfFrameH		0x00	; 0x8102 240 lines = 0x0F0
R	xbLineOfFrameL		0xF0	; 0x8103
R	xbPixOfLineH		0x01	; 0x8104 320 pixels = 0x140 	
R	xbPixOfLineL		0x40	; 0x8105

R       xbSigIni                0x08    ;
R       xbDsPara                0x84    ;
R       xbDsPara                0xF0    ;
R       xbDsPara                0x00    ;
R       xbDsPara                0x84    ;
R       xbDsPara                0xF0    ;
R       xbDsPara                0x00    ;

I	0x42	0x11	0x05		; Clock Divider(hsync=neg,vsync=pos)
I	0x42	0x14	0x24		; QVGA MODE,HSYNC=NEG,RGB GAMMA=DISABLE
I       0x42    0x23    0x01            ; QVGA Output Format bit[0] 0:YCbCr 1:Raw RGB

[R_QCIF]
[R_QQVGA]
R	xbSenClkDiv		0x00	;
R	xbSenClkCtrl		0xB0	; 24M bit6:5 clock select 00:12M, 01:48M, 10:60M, 11:80M, bit4: diven
R	xbLineOfFrameH		0x00	; 0x8102 240 lines = 0x0F0
R	xbLineOfFrameL		0xF0	; 0x8103
R	xbPixOfLineH		0x01	; 0x8104 320 pixels = 0x140 	
R	xbPixOfLineL		0x40	; 0x8105

R       xbSigIni                0x08    ;
R       xbDsPara                0x84    ;
R       xbDsPara                0xC0    ;
R       xbDsPara                0x00    ;
R       xbDsPara                0x84    ;
R       xbDsPara                0xC0    ;
R       xbDsPara                0x00    ;

I	0x42	0x11	0x05		; Clock Divider(hsync=neg,vsync=pos)
I	0x42	0x14	0x24		; QVGA MODE,HSYNC=NEG,RGB GAMMA=DISABLE
I       0x42    0x23    0x01            ; QVGA Output Format bit[0] 0:YCbCr 1:Raw RGB

[CONTRAST0]
[CONTRAST10]
[CONTRAST20]
[CONTRAST30]
[CONTRAST40]
[CONTRAST50]
[CONTRAST60]
[CONTRAST70]
[CONTRAST80]
[CONTRAST90]
[CONTRAST100]


[SATURATION0]
[SATURATION10]
[SATURATION20]
[SATURATION30]
[SATURATION40]
[SATURATION50]
[SATURATION60]
[SATURATION70]
[SATURATION80]
[SATURATION90]
[SATURATION100]


[BRIGHTNESS0]
[BRIGHTNESS10]
[BRIGHTNESS20]
[BRIGHTNESS30]
[BRIGHTNESS40]
[BRIGHTNESS50]
[BRIGHTNESS60]
[BRIGHTNESS70]
[BRIGHTNESS80]
[BRIGHTNESS90]
[BRIGHTNESS100]


[SHARPNESS0]
[SHARPNESS10]
[SHARPNESS20]
[SHARPNESS30]
[SHARPNESS40]
[SHARPNESS50]
[SHARPNESS60]
[SHARPNESS70]
[SHARPNESS80]
[SHARPNESS90]
[SHARPNESS100]


[VGA_FLICKER_DISABLE_HS]
[VGA_FLICKER_60HZ_HS]
[VGA_FLICKER_50HZ_HS]
[VGA_FLICKER_DISABLE_FS]
[VGA_FLICKER_60HZ_FS]
[VGA_FLICKER_50HZ_FS]
[CIF_FLICKER_DISABLE_HS]
[CIF_FLICKER_60HZ_HS]
[CIF_FLICKER_50HZ_HS]
[CIF_FLICKER_DISABLE_FS]
[CIF_FLICKER_60HZ_FS]
[CIF_FLICKER_50HZ_FS]


[AWB]
[TUNGSTEN]	
[FLUORESCENT]
[DAYLIGHT]


[DSP_INIT]
R	xbSenClkDiv		0x00	; 0x8115
R	xbSenClkCtrl		0xB0	; 0x8114 24M
R	xbAdcCtrl		0xC0	; 0x8160 sensor enable and adc power down
R	xbLineOfFrameH		0x01	; 0x8102 480 lines = 0x1E0
R	xbLineOfFrameL		0xE0	; 0x8103
R	xbPixOfLineH		0x02	; 0x8104 640 pixels = 0x280 	
R	xbPixOfLineL		0x80	; 0x8105
R	xbSensorType		0x0D	; 0x8100 Clock enable, 80M, division disable	
R	xbSensorCtrl		0x00	; 0x8101 release reset
R	xbVsyncPara		0x00	; 0x8106 V_assert
R	xbVsyncPara		0x18	; 0x8106
R	xbVsyncPara		0x00	; 0x8106 V_rise
R	xbVsyncPara		0x01	; 0x8106
R	xbVsyncPara		0xFF	; 0x8106 V_fall
R	xbVsyncPara		0xFF	; 0x8106
R	xbHsyncPara		0x00	; 0x8106 H_rise
R	xbHsyncPara		0x02	; 0x8106
R	xbHsyncPara		0x02	; 0x8106 H_fall
R	xbHsyncPara		0x82	; 0x8106
R	xbGpioaEnH		0x06	; 0x8174
R	xbGpioaEnL		0x00	; 0x8175
R	xbGpioDat		0x10	; 0x8176 bit2 = sensor power down

I	0x42	0x12	0x80		;? AGC Gain  0x34 = 5  ; 0x18 =3 
I	0x42	0x00	0x08		;? AGC Gain  0x34 = 5  ; 0x18 =3 
I	0x42	0x01	0x80		; Blue Gain 
I	0x42	0x02	0x80		; Red Gain
I	0x42	0x05	0x00		; Pre-amp
I	0x42	0x10	0xFF		; Exposure Lines msb, // KKKKK
I	0x42	0x11	0x00		; Clock Divider(hsync=neg,vsync=pos)
I	0x42	0x12	0x48		; Bit6: Mirror Image, Bit3 : Raw Mode, Bit2: AWB Enable
I	0x42	0x13	0xE0		; Bit1: AGC enable, Bit0: AEC enable
I	0x42	0x14	0x04		; VGA MODE,HSYNC=NEG,RGB GAMMA=DISABLE
I	0x42	0x17	0x1A		; Horizontal Window Start
I	0x42	0x18	0xBA		; Horizontal Window End
I	0x42	0x19	0x03		; Vertical Window Start
I	0x42	0x1A	0xF3		; Vertical Window End
I	0x42	0x20	0x00		; bit2: Manual AWB, Bit0: Pixel Data PAD driver capability
I	0x42	0x26	0xA2		; bit1: BLC Enable
I	0x42	0x27	0xEE		; bit3: Digital offset enable, bit2: BLC manual calibration
I	0x42	0x21	0x80		; Green black
I 	0x42	0x22	0x80		; Blue black
I	0x42	0x2E	0x80		; Red black
I	0x42	0x78	0x80		; Green offset
I	0x42	0x79	0x80		; Blue offset
I	0x42	0x7A	0x80		; Red Offset
I	0x42	0x28	0xA0		; Bit7: Raw RGB, Bit6: Device Select 0: 7640,  Bit5:Progressive Mode, Bit3: AGC Disable, Bit1: 2X PreAmp
I	0x42	0x60	0x80		; Bit7: 1.5x Gain boost
I	0x42	0x6F	0x10		; even/odd dc


[AP_ON]
R	xbSenClkDiv		0xB0	; 0x8115
R	xbSenClkCtrl		0x80	; 0x8114 24M
R	xbAdcCtrl		0xC0	; 0x8160 sensor enable and adc power down
R	xbLineOfFrameH		0x00	; 0x8102 480 lines = 0x1E0
R	xbLineOfFrameL		0x00	; 0x8103
R	xbPixOfLineH		0x00	; 0x8104 640 pixels = 0x280 	
R	xbPixOfLineL		0x00	; 0x8105
R	xbSensorType		0x0D	; 0x8100 Clock enable, 80M, division disable	
R	xbSensorCtrl		0x00	; 0x8101 release reset
R	xbGpioaEnH		0x06	; 0x8174
R	xbGpioaEnL		0x00	; 0x8175
R	xbGpioDat		0x10	; 0x8176 bit2 = sensor power down

I	0x42	0x12	0x80		;? AGC Gain  0x34 = 5  ; 0x18 =3 
I	0x42	0x00	0x08		;? AGC Gain  0x34 = 5  ; 0x18 =3 
I	0x42	0x01	0x80		; Blue Gain 
I	0x42	0x02	0x80		; Red Gain
I	0x42	0x05	0x00		; Pre-amp
I	0x42	0x10	0xFF		; Exposure Lines msb, // KKKKK
I	0x42	0x11	0x00		; Clock Divider(hsync=neg,vsync=pos)
I	0x42	0x12	0x48		; Bit6: Mirror Image, Bit3 : Raw Mode, Bit2: AWB Enable
I	0x42	0x13	0xE0		; Bit1: AGC enable, Bit0: AEC enable
I	0x42	0x14	0x04		; VGA MODE,HSYNC=NEG,RGB GAMMA=DISABLE
I	0x42	0x17	0x1A		; Horizontal Window Start
I	0x42	0x18	0xBA		; Horizontal Window End
I	0x42	0x19	0x03		; Vertical Window Start
I	0x42	0x1A	0xF3		; Vertical Window End
I	0x42	0x20	0x00		; bit2: Manual AWB, Bit0: Pixel Data PAD driver capability
I	0x42	0x26	0xA2		; bit1: BLC Enable
I	0x42	0x27	0xEE		; bit3: Digital offset enable, bit2: BLC manual calibration
I	0x42	0x21	0x80		; Green black
I 	0x42	0x22	0x80		; Blue black
I	0x42	0x2E	0x80		; Red black
I	0x42	0x78	0x80		; Green offset
I	0x42	0x79	0x80		; Blue offset
I	0x42	0x7A	0x80		; Red Offset
I	0x42	0x28	0xA0		; Bit7: Raw RGB, Bit6: Device Select 0: 7640,  Bit5:Progressive Mode, Bit3: AGC Disable, Bit1: 2X PreAmp
I	0x42	0x60	0x80		; Bit7: 1.5x Gain boost
I	0x42	0x6F	0x10		; even/odd dc

[AP_OFF]
[SUSPEND]
[RESUME]
[END]
