change files to initialize, add some APIs, etc.

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@205 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
yutaka 2007-07-23 09:26:32 +00:00
parent 1ad8d2df68
commit 84b2da973c
19 changed files with 1879 additions and 1192 deletions

View File

@ -71,9 +71,11 @@
[Default Registers]
LOAD=Initialize Camera
LOAD=Image Setting ExtClk=16.75MHz Op_Pix=16.75MHz
//LOAD=Image Setting ExtClk=12MHz Op_Pix=24MHz
//LOAD=Image Setting ExtClk=6.75MHz Op_Pix=27.5MHz 15fps
//LOAD=Image Setting ExtClk=16.76MHz Op_Pix=27.5MHz 15fps
LOAD=Image Setting ExtClk=16.76MHz Op_Pix=8.38MHz
//LOAD=Image Setting ExtClk=16.76MHz Op_Pix=8.38MHz
LOAD=Lens Correction
LOAD=Auto Exposure
@ -558,6 +560,361 @@ REG = 0x990, 0x02 // = 2
REG = 0x98C, 0xA410 //Min_amplitude
REG = 0x990, 0x01 // = 1
////////////////////////////////////////////////////////////////////////////////
; This file was generated by: MT9V113 (SOC0380) Register Wizard
; Version: 2.9.0.2 Build Date: 06/29/2007
;
; [PLL PARAMETERS]
;
; Bypass PLL: Unchecked
; Input Frequency: 12.000
; Use Min Freq.: Unchecked
; Target System Frequency: 24.000
; Target VCO Frequency: Unspecified
; "M" Value: Unspecified
; "N" Value: Unspecified
;
; Target PLL Frequency: 24 MHz
; MT9V113 Input Clock Frequency: 12 MHz
; MT9V113 Internal Clock Frequency: 24 MHz
; MT9V113 SOC Clock Frequency: 24 MHz
; M = 16
; N = 0
; Fpdf = 12 MHz
; Fvco = 384 MHz
;
; [CONTEXT A PARAMETERS]
;
; Requested Frames Per Second: 15.000
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context B Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 66.6667 msec
; Max Frame Clocks: 800000.0 clocks (12 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 462 blank = 950 total
; Extra Delay: 100 clocks
;
; Actual Frame Clocks: 800000 clocks
; Row Time: 70.167 usec / 842 clocks
; Frame time: 66.666667 msec
; Frames per Sec: 15 fps
;
; 50Hz Flicker Period: 142.52 lines
; 60Hz Flicker Period: 118.76 lines
;
; [CONTEXT B PARAMETERS]
;
; Requested Frames Per Second: 14.645
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context A Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 68.2827 msec
; Max Frame Clocks: 819392.2 clocks (12 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 485 blank = 973 total
; Extra Delay: 126 clocks
;
; Actual Frame Clocks: 819392 clocks
; Row Time: 70.167 usec / 842 clocks
; Frame time: 68.282667 msec
; Frames per Sec: 14.645 fps
;
; 50Hz Flicker Period: 142.52 lines
; 60Hz Flicker Period: 118.76 lines
;
;
[Image Setting ExtClk=12MHz Op_Pix=24MHz]
BITFIELD= 0x14, 1, 1 // Bypass PLL
BITFIELD= 0X14, 2, 0 // Power-down PLL
REG = 0x0010, 0x0010 //PLL Dividers = 0x10
REG = 0x0012, 0x0000 //PLL P Dividers = 0x0
REG = 0x0014, 0x244B //PLL control: TEST_BYPASS on = 0x244B
DELAY = 1 // Allow PLL to lock
REG = 0x0014, 0x304B //PLL control: PLL_ENABLE on = 0x304B
POLL_REG=0x0014, 0x8000, ==0, DELAY=50, TIMEOUT=20 // Verify PLL lock
BITFIELD= 0x14, 1, 0 //PLL_BYPASS_OFF
REG = 0x98C, 0x2703 //Output Width (A)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2705 //Output Height (A)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x2707 //Output Width (B)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2709 //Output Height (B)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x270D //Row Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x270F //Column Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2711 //Row End (A)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2713 //Column End (A)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x2715 //Row Speed (A)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x2717 //Read Mode (A)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x2719 //sensor_fine_correction (A)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x271B //sensor_fine_IT_min (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271D //sensor_fine_IT_max_margin (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271F //Frame Lines (A)
REG = 0x990, 0x03B6 // = 950
REG = 0x98C, 0x2721 //Line Length (A)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2723 //Row Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2725 //Column Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2727 //Row End (B)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2729 //Column End (B)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x272B //Row Speed (B)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x272D //Read Mode (B)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x272F //sensor_fine_correction (B)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x2731 //sensor_fine_IT_min (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2733 //sensor_fine_IT_max_margin (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2735 //Frame Lines (B)
REG = 0x990, 0x03CD // = 973
REG = 0x98C, 0x2737 //Line Length (B)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2739 //Crop_X0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273B //Crop_X1 (A)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x273D //Crop_Y0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273F //Crop_Y1 (A)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x2747 //Crop_X0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x2749 //Crop_X1 (B)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x274B //Crop_Y0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x274D //Crop_Y1 (B)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x222D //R9 Step
REG = 0x990, 0x0077 // = 119
REG = 0x98C, 0xA408 //search_f1_50
REG = 0x990, 0x15 // = 21
REG = 0x98C, 0xA409 //search_f2_50
REG = 0x990, 0x18 // = 24
REG = 0x98C, 0xA40A //search_f1_60
REG = 0x990, 0x1A // = 26
REG = 0x98C, 0xA40B //search_f2_60
REG = 0x990, 0x1D // = 29
REG = 0x98C, 0x2411 //R9_Step_60_A
REG = 0x990, 0x0077 // = 119
REG = 0x98C, 0x2413 //R9_Step_50_A
REG = 0x990, 0x008F // = 143
REG = 0x98C, 0x2415 //R9_Step_60_B
REG = 0x990, 0x0077 // = 119
REG = 0x98C, 0x2417 //R9_Step_50_B
REG = 0x990, 0x008F // = 143
REG = 0x98C, 0xA40D //Stat_min
REG = 0x990, 0x02 // = 2
REG = 0x98C, 0xA410 //Min_amplitude
REG = 0x990, 0x01 // = 1
////////////////////////////////////////////////////////////////////////////////
; This file was generated by: MT9V113 (SOC0380) Register Wizard
; Version: 2.9.0.2 Build Date: 06/29/2007
;
; [PLL PARAMETERS]
;
; Bypass PLL: Unchecked
; Input Frequency: 20.000
; Use Min Freq.: Unchecked
; Target System Frequency: 20.000
; Target VCO Frequency: Unspecified
; "M" Value: Unspecified
; "N" Value: Unspecified
;
; Target PLL Frequency: 20 MHz
; MT9V113 Input Clock Frequency: 20 MHz
; MT9V113 Internal Clock Frequency: 20 MHz
; MT9V113 SOC Clock Frequency: 20 MHz
; M = 16
; N = 1
; Fpdf = 10 MHz
; Fvco = 320 MHz
;
; [CONTEXT A PARAMETERS]
;
; Requested Frames Per Second: 15.000
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context B Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 66.6667 msec
; Max Frame Clocks: 666666.6 clocks (10 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 303 blank = 791 total
; Extra Delay: 644 clocks
;
; Actual Frame Clocks: 666666 clocks
; Row Time: 84.200 usec / 842 clocks
; Frame time: 66.666600 msec
; Frames per Sec: 15 fps
;
; 50Hz Flicker Period: 118.76 lines
; 60Hz Flicker Period: 98.97 lines
;
; [CONTEXT B PARAMETERS]
;
; Requested Frames Per Second: 14.645
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context A Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 68.2827 msec
; Max Frame Clocks: 682826.9 clocks (10 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 322 blank = 810 total
; Extra Delay: 806 clocks
;
; Actual Frame Clocks: 682826 clocks
; Row Time: 84.200 usec / 842 clocks
; Frame time: 68.282600 msec
; Frames per Sec: 14.645 fps
;
; 50Hz Flicker Period: 118.76 lines
; 60Hz Flicker Period: 98.97 lines
;
;
[Image Setting ExtClk=16.75MHz Op_Pix=16.75MHz]
BITFIELD= 0x14, 1, 1 // Bypass PLL
BITFIELD= 0X14, 2, 0 // Power-down PLL
REG = 0x0010, 0x0110 //PLL Dividers = 0x110
REG = 0x0012, 0x0000 //PLL P Dividers = 0x0
REG = 0x0014, 0x244B //PLL control: TEST_BYPASS on = 0x244B
DELAY = 1 // Allow PLL to lock
REG = 0x0014, 0x304B //PLL control: PLL_ENABLE on = 0x304B
POLL_REG=0x0014, 0x8000, ==0, DELAY=50, TIMEOUT=20 // Verify PLL lock
BITFIELD= 0x14, 1, 0 //PLL_BYPASS_OFF
REG = 0x98C, 0x2703 //Output Width (A)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2705 //Output Height (A)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x2707 //Output Width (B)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2709 //Output Height (B)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x270D //Row Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x270F //Column Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2711 //Row End (A)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2713 //Column End (A)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x2715 //Row Speed (A)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x2717 //Read Mode (A)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x2719 //sensor_fine_correction (A)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x271B //sensor_fine_IT_min (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271D //sensor_fine_IT_max_margin (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271F //Frame Lines (A)
REG = 0x990, 0x0317 // = 791
REG = 0x98C, 0x2721 //Line Length (A)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2723 //Row Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2725 //Column Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2727 //Row End (B)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2729 //Column End (B)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x272B //Row Speed (B)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x272D //Read Mode (B)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x272F //sensor_fine_correction (B)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x2731 //sensor_fine_IT_min (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2733 //sensor_fine_IT_max_margin (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2735 //Frame Lines (B)
REG = 0x990, 0x032A // = 810
REG = 0x98C, 0x2737 //Line Length (B)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2739 //Crop_X0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273B //Crop_X1 (A)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x273D //Crop_Y0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273F //Crop_Y1 (A)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x2747 //Crop_X0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x2749 //Crop_X1 (B)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x274B //Crop_Y0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x274D //Crop_Y1 (B)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x222D //R9 Step
REG = 0x990, 0x0063 // = 99
REG = 0x98C, 0xA408 //search_f1_50
REG = 0x990, 0x11 // = 17
REG = 0x98C, 0xA409 //search_f2_50
REG = 0x990, 0x14 // = 20
REG = 0x98C, 0xA40A //search_f1_60
REG = 0x990, 0x15 // = 21
REG = 0x98C, 0xA40B //search_f2_60
REG = 0x990, 0x18 // = 24
REG = 0x98C, 0x2411 //R9_Step_60_A
REG = 0x990, 0x0063 // = 99
REG = 0x98C, 0x2413 //R9_Step_50_A
REG = 0x990, 0x0077 // = 119
REG = 0x98C, 0x2415 //R9_Step_60_B
REG = 0x990, 0x0063 // = 99
REG = 0x98C, 0x2417 //R9_Step_50_B
REG = 0x990, 0x0077 // = 119
REG = 0x98C, 0xA40D //Stat_min
REG = 0x990, 0x02 // = 2
REG = 0x98C, 0xA410 //Min_amplitude
REG = 0x990, 0x01 // = 1
[Viewfinder ON]
FIELD_WR = SEQ_CAP_MODE, VIDEO, 0 //capture parameters, VIDEO Off

File diff suppressed because it is too large Load Diff

View File

@ -1,770 +0,0 @@
;**************************************************************************************
; Copyright 2006 Micron Technology, Inc. All rights reserved.
;
;
; No permission to use, copy, modify, or distribute this software and/or
; its documentation for any purpose has been granted by Micron Technology, Inc.
; If any such permission has been granted ( by separate agreement ), it
; is required that the above copyright notice appear in all copies and
; that both that copyright notice and this permission notice appear in
; supporting documentation, and that the name of Micron Technology, Inc. or any
; of its trademarks may not be used in advertising or publicity pertaining
; to distribution of the software without specific, written prior permission.
;
;
; This software and any associated documentation are provided "AS IS" and
; without warranty of any kind. MICRON TECHNOLOGY, INC. EXPRESSLY DISCLAIMS
; ALL WARRANTIES EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, NONINFRINGEMENT
; OF THIRD PARTY RIGHTS, AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
; FOR A PARTICULAR PURPOSE. MICRON DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED
; IN THIS SOFTWARE WILL MEET YOUR REQUIREMENTS, OR THAT THE OPERATION OF THIS SOFTWARE
; WILL BE UNINTERRUPTED OR ERROR-FREE. FURTHERMORE, MICRON DOES NOT WARRANT OR
; MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE USE OF ANY
; ACCOMPANYING DOCUMENTATION IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY,
; OR OTHERWISE.
;**************************************************************************************/
;
; Default INI file for the MI-0380-REV1
; <<< MT9V113-MTM8.ini >>>
; $Revision: 1.3 $
; $Date: 2007/04/22 07:13:21 $
;
; This file holds groups of register presets (sections) specific for this sensor. The
; presets allow you to overwrite the power-on default settings with optimized register
; settings.
; The [Default Registers] section contains all optimized register settings for running
; the sensor in the demo environment. Other sections include settings optimized for a
; variety of situations like: Running at different master clock speeds, running under
; different lighting situations, running with different lenses, etc.
; Most of the demonstration software (DevWare, SensorDemo, ...) make use of this file
; to load and store the user presets.
;
; Keyname description:
; REG = assign a new register value
; BITFIELD = do a READ-MODIFY-WRITE to part of a register. The part is defined as a mask.
; LOAD = load an alternate section from this section
; STATE = set non-register state
; DELAY = delay a certain amount of milliseconds before continuing
;
; Keyname format:
; REG = [<page>,] <address>, <value> //<comment>
; BITFIELD = [<page>,] <address>, <mask>, <value>
; Some examples:
; BITFIELD=2, 0x05, 0x0020, 1 //for register 5 on page 2, set the 6th bit to 1
; BITFIELD=0x06, 0x000F, 0 //for register 6, clear the first 4 bits
; LOAD = <section>
; STATE = <state>, <value>
; DELAY = <milliseconds>
;
; <page> Optional address space for this register. Some sensors (mostly SOC's)
; have multiple register pages (see the sensor spec or developer's guide)
; <address> the register address
; <value> the new value to assign to the register
; <mask> is the part of a register value that needs to be updated with a new value
; <section> the name of another section to load
; <state> non-register program state names [do not modify]
; <milliseconds> wait for this ammount of milliseconds before continuing
; <comment> Some form of C-style comments are supported in this .ini file
;
;*************************************************************************************/
[Default Registers]
LOAD=Initialize Camera
DELAY=300
//STATE=Gamma, 9
//STATE=Black Correct, 5
//STATE=Contrast, 25
LOAD=Image Setting ExtClk=16.76MHz Op_Pix=27.5MHz 15fps
//LOAD=Image Setting ExtClk=6.75MHz Op_Pix=27.5MHz 15fps
//LOAD=Fixed 15fps
LOAD=Lens Correction
LOAD=Auto Exposure
LOAD=Auto White Balance
LOAD=Gamma Correction
LOAD=Sharpness : 0
LOAD=Refresh
[Initialize Camera]
IMAGE=320,240
REG=0x001A, 0x0011 // RESET_AND_MISC_CONTROL
DELAY=10
REG=0x001A, 0x0010 // RESET_AND_MISC_CONTROL
DELAY=10
REG=0x0018, 0x4028 // STANDBY_CONTROL
REG=0x001A, 0x0210 // RESET_AND_MISC_CONTROL
REG=0x001E, 0x0777 // PAD_SLEW
REG=0x0016, 0x42DF // CLOCKS_CONTROL
//REG=0x0010, 0x0231 // PLL_DIVIDERS
//REG=0x0012, 0x0000 // PLL_P_DIVIDERS
REG=0x0014, 0x2147 // PLL_CONTROL
DELAY=10
REG=0x0014, 0x2047 // PLL_CONTROL
DELAY=10
REG=0x0014, 0xA046 // PLL_CONTROL
DELAY=10
REG=0x3040, 0x0027 // READ_MODE
REG=0x301A, 0x1218 // RESET_REGISTER
DELAY=100
REG=0x301A, 0x121C // RESET_REGISTER
//VAR=7, 0x03, 0x0140 // MODE_OUTPUT_WIDTH_A
//VAR=7, 0x05, 0x00F0 // MODE_OUTPUT_HEIGHT_A
//VAR=7, 0x07, 0x0280 // MODE_OUTPUT_WIDTH_B
//VAR=7, 0x09, 0x01E0 // MODE_OUTPUT_HEIGHT_B
VAR=7, 0x17, 0x0026 // MODE_SENSOR_READ_MODE_A
VAR=7, 0x2D, 0x0026 // MODE_SENSOR_READ_MODE_B
VAR8=1, 0x03, 0x06 //(1) SEQ_CMD
////////////////////////////////////////////////////////////////////////////////
; This file was generated by: MT9V113 (SOC0380) Register Wizard
; Version: 2.8.0.53 Build Date: 06/06/2007
;
; [PLL PARAMETERS]
;
; Bypass PLL: Unchecked
; Input Frequency: 6.750
; Use Min Freq.: Unchecked
; Target System Frequency: 27.844
; Target VCO Frequency: Unspecified
; "M" Value: Unspecified
; "N" Value: Unspecified
;
; Target PLL Frequency: 27.500 MHz
; MT9V113 Input Clock Frequency: 6.750 MHz
; MT9V113 Internal Clock Frequency: 27.844 MHz
; MT9V113 SOC Clock Frequency: 27.844 MHz
; M = 33
; N = 0
; Fpdf = 6.750 MHz
; Fvco = 445.500 MHz
;
; [CONTEXT A PARAMETERS]
;
; Requested Frames Per Second: 14.645
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context B Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 68.2827 msec
; Max Frame Clocks: 950623.0 clocks (13.922 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 641 blank = 1129 total
; Extra Delay: 5 clocks
;
; Actual Frame Clocks: 950623 clocks
; Row Time: 60.480 usec / 842 clocks
; Frame time: 68.282685 msec
; Frames per Sec: 14.645 fps
;
; 50Hz Flicker Period: 165.34 lines
; 60Hz Flicker Period: 137.79 lines
;
; [CONTEXT B PARAMETERS]
;
; Requested Frames Per Second: 14.645
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context A Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 68.2827 msec
; Max Frame Clocks: 950623.0 clocks (13.922 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 641 blank = 1129 total
; Extra Delay: 5 clocks
;
; Actual Frame Clocks: 950623 clocks
; Row Time: 60.480 usec / 842 clocks
; Frame time: 68.282685 msec
; Frames per Sec: 14.645 fps
;
; 50Hz Flicker Period: 165.34 lines
; 60Hz Flicker Period: 137.79 lines
;
;
[Image Setting ExtClk=6.75MHz Op_Pix=27.5MHz 15fps]
BITFIELD= 0x14, 1, 1 // Bypass PLL
BITFIELD= 0X14, 2, 0 // Power-down PLL
REG = 0x0010, 0x0021 //PLL Dividers = 0x21
REG = 0x0012, 0x0000 //PLL P Dividers = 0x0
REG = 0x0014, 0x244B //PLL control: TEST_BYPASS on = 0x244B
DELAY = 1 // Allow PLL to lock
REG = 0x0014, 0x304B //PLL control: PLL_ENABLE on = 0x304B
POLL_REG=0x0014, 0x8000, ==0, DELAY=50, TIMEOUT=20 // Verify PLL lock
BITFIELD= 0x14, 1, 0 //PLL_BYPASS_OFF
REG = 0x98C, 0x2703 //Output Width (A)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2705 //Output Height (A)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x2707 //Output Width (B)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2709 //Output Height (B)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x270D //Row Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x270F //Column Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2711 //Row End (A)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2713 //Column End (A)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x2715 //Row Speed (A)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x2717 //Read Mode (A)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x2719 //sensor_fine_correction (A)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x271B //sensor_fine_IT_min (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271D //sensor_fine_IT_max_margin (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271F //Frame Lines (A)
REG = 0x990, 0x0469 // = 1129
REG = 0x98C, 0x2721 //Line Length (A)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2723 //Row Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2725 //Column Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2727 //Row End (B)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2729 //Column End (B)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x272B //Row Speed (B)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x272D //Read Mode (B)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x272F //sensor_fine_correction (B)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x2731 //sensor_fine_IT_min (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2733 //sensor_fine_IT_max_margin (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2735 //Frame Lines (B)
REG = 0x990, 0x0469 // = 1129
REG = 0x98C, 0x2737 //Line Length (B)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2739 //Crop_X0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273B //Crop_X1 (A)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x273D //Crop_Y0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273F //Crop_Y1 (A)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x2747 //Crop_X0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x2749 //Crop_X1 (B)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x274B //Crop_Y0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x274D //Crop_Y1 (B)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x222D //R9 Step
REG = 0x990, 0x008A // = 138
REG = 0x98C, 0xA408 //search_f1_50
REG = 0x990, 0x19 // = 25
REG = 0x98C, 0xA409 //search_f2_50
REG = 0x990, 0x1C // = 28
REG = 0x98C, 0xA40A //search_f1_60
REG = 0x990, 0x1F // = 31
REG = 0x98C, 0xA40B //search_f2_60
REG = 0x990, 0x22 // = 34
REG = 0x98C, 0x2411 //R9_Step_60_A
REG = 0x990, 0x008A // = 138
REG = 0x98C, 0x2413 //R9_Step_50_A
REG = 0x990, 0x00A5 // = 165
REG = 0x98C, 0x2415 //R9_Step_60_B
REG = 0x990, 0x008A // = 138
REG = 0x98C, 0x2417 //R9_Step_50_B
REG = 0x990, 0x00A5 // = 165
REG = 0x98C, 0xA40D //Stat_min
REG = 0x990, 0x02 // = 2
REG = 0x98C, 0xA410 //Min_amplitude
REG = 0x990, 0x01 // = 1
////////////////////////////////////////////////////////////////////////////////
; This file was generated by: MT9V113 (SOC0380) Register Wizard
; Version: 2.9.0.2 Build Date: 06/29/2007
;
; [PLL PARAMETERS]
;
; Bypass PLL: Unchecked
; Input Frequency: 16.760
; Use Min Freq.: Unchecked
; Target System Frequency: 27.759
; Target VCO Frequency: Unspecified
; "M" Value: Unspecified
; "N" Value: Unspecified
;
; Target PLL Frequency: 27.500 MHz
; MT9V113 Input Clock Frequency: 16.760 MHz
; MT9V113 Internal Clock Frequency: 27.759 MHz
; MT9V113 SOC Clock Frequency: 27.759 MHz
; M = 53
; N = 3
; Fpdf = 4.190 MHz
; Fvco = 444.140 MHz
;
; [CONTEXT A PARAMETERS]
;
; Requested Frames Per Second: 15.000
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context B Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 66.6667 msec
; Max Frame Clocks: 925291.6 clocks (13.879 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 610 blank = 1098 total
; Extra Delay: 775 clocks
;
; Actual Frame Clocks: 925291 clocks
; Row Time: 60.666 usec / 842 clocks
; Frame time: 66.666619 msec
; Frames per Sec: 15 fps
;
; 50Hz Flicker Period: 164.84 lines
; 60Hz Flicker Period: 137.37 lines
;
; [CONTEXT B PARAMETERS]
;
; Requested Frames Per Second: 15.000
; Output Columns: 640
; Output Rows: 480
; Allow Skipping: Unchecked
; Use Context A Line Time: Unchecked
; Low Power: Unchecked
; Blanking Computation: HB Min then VB
;
; Max Frame Time: 66.6667 msec
; Max Frame Clocks: 925291.6 clocks (13.879 MHz)
; Pixel Clock: divided by 1
; Skip Mode: 1x cols, 1x rows, Bin Mode: No
; Horiz clks: 648 active + 194 blank = 842 total
; Vert rows: 488 active + 610 blank = 1098 total
; Extra Delay: 775 clocks
;
; Actual Frame Clocks: 925291 clocks
; Row Time: 60.666 usec / 842 clocks
; Frame time: 66.666619 msec
; Frames per Sec: 15 fps
;
; 50Hz Flicker Period: 164.84 lines
; 60Hz Flicker Period: 137.37 lines
;
;
[Image Setting ExtClk=16.76MHz Op_Pix=27.5MHz 15fps]
BITFIELD= 0x14, 1, 1 // Bypass PLL
BITFIELD= 0X14, 2, 0 // Power-down PLL
REG = 0x0010, 0x0335 //PLL Dividers = 0x335
REG = 0x0012, 0x0000 //PLL P Dividers = 0x0
REG = 0x0014, 0x244B //PLL control: TEST_BYPASS on = 0x244B
DELAY = 1 // Allow PLL to lock
REG = 0x0014, 0x304B //PLL control: PLL_ENABLE on = 0x304B
POLL_REG=0x0014, 0x8000, ==0, DELAY=50, TIMEOUT=20 // Verify PLL lock
BITFIELD= 0x14, 1, 0 //PLL_BYPASS_OFF
REG = 0x98C, 0x2703 //Output Width (A)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2705 //Output Height (A)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x2707 //Output Width (B)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2709 //Output Height (B)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x270D //Row Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x270F //Column Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2711 //Row End (A)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2713 //Column End (A)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x2715 //Row Speed (A)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x2717 //Read Mode (A)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x2719 //sensor_fine_correction (A)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x271B //sensor_fine_IT_min (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271D //sensor_fine_IT_max_margin (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271F //Frame Lines (A)
REG = 0x990, 0x044A // = 1098
REG = 0x98C, 0x2721 //Line Length (A)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2723 //Row Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2725 //Column Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2727 //Row End (B)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2729 //Column End (B)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x272B //Row Speed (B)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x272D //Read Mode (B)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x272F //sensor_fine_correction (B)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x2731 //sensor_fine_IT_min (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2733 //sensor_fine_IT_max_margin (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2735 //Frame Lines (B)
REG = 0x990, 0x044A // = 1098
REG = 0x98C, 0x2737 //Line Length (B)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2739 //Crop_X0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273B //Crop_X1 (A)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x273D //Crop_Y0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273F //Crop_Y1 (A)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x2747 //Crop_X0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x2749 //Crop_X1 (B)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x274B //Crop_Y0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x274D //Crop_Y1 (B)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x222D //R9 Step
REG = 0x990, 0x0089 // = 137
REG = 0x98C, 0xA408 //search_f1_50
REG = 0x990, 0x19 // = 25
REG = 0x98C, 0xA409 //search_f2_50
REG = 0x990, 0x1C // = 28
REG = 0x98C, 0xA40A //search_f1_60
REG = 0x990, 0x1F // = 31
REG = 0x98C, 0xA40B //search_f2_60
REG = 0x990, 0x22 // = 34
REG = 0x98C, 0x2411 //R9_Step_60_A
REG = 0x990, 0x0089 // = 137
REG = 0x98C, 0x2413 //R9_Step_50_A
REG = 0x990, 0x00A5 // = 165
REG = 0x98C, 0x2415 //R9_Step_60_B
REG = 0x990, 0x0089 // = 137
REG = 0x98C, 0x2417 //R9_Step_50_B
REG = 0x990, 0x00A5 // = 165
REG = 0x98C, 0xA40D //Stat_min
REG = 0x990, 0x02 // = 2
REG = 0x98C, 0xA410 //Min_amplitude
REG = 0x990, 0x01 // = 1
[Viewfinder ON]
FIELD_WR = SEQ_CAP_MODE, VIDEO, 0 //capture parameters, VIDEO Off
FIELD_WR = SEQ_CMD, 1 //Back to preview
[Viewfinder OFF]
FIELD_WR = SEQ_CAP_MODE, VIDEO, 1 //capture parameters, VIDEO On
FIELD_WR = SEQ_CMD, 2 //Capture on
[Video Capture ON]
FIELD_WR = SEQ_CAP_MODE, VIDEO, 1 //capture parameters, VIDEO On
FIELD_WR = SEQ_CMD, 2 //Capture on
[Video Capture OFF]
FIELD_WR = SEQ_CMD, 1 //Back to preview
[Lens Calibration Setup]
REG=0x3330, 0x0140 //(2) OUTPUT_FORMAT_TEST
BITFIELD=0x3040, 0x002, 0
[Lens Calibration Exit]
BITFIELD=0x3040, 0x002, 1
REG=0x3330, 0x0000 //(4) OUTPUT_FORMAT_TEST
BITFIELD=0x3210, 0x08, 1
[Fixed 15fps]
VAR8=2, 0x0C, 0x08 //(1) AE_MAX_INDEX
VAR=7, 0x1F, 0x076C //(1) MODE_SENSOR_FRAME_LENGTH_A
[Refresh]
REG = 0x98C, 0xA103 //Refresh Sequencer Mode
REG = 0x990, 0x06 // = 6
POLL_FIELD=SEQ_CMD, !=0, DELAY=10, TIMEOUT=50
REG = 0x98C, 0xA103 //Refresh Sequencer
REG = 0x990, 0x05 // = 5
POLL_FIELD=SEQ_CMD, !=0, DELAY=10, TIMEOUT=50
[Auto Exposure]
VAR8=2, 0x07, 0x1A //(2) AE_GATE
VAR8=2, 0x4C, 0x10 //(1) AE_TARGETBUFFERSPEED
VAR8=2, 0x4F, 0x50 //(5) AE_BASETARGET
[Gamma Correction]
VAR8=11, 0x04, 0x80 //(1) HG_MAX_DLEVEL
VAR8=11, 0x37, 0x03 //(1) HG_GAMMA_MORPH_CTRL
VAR=11, 0x38, 0x0080 //(1) HG_GAMMASTARTMORPH
VAR=11, 0x3A, 0x00B0 //(1) HG_GAMMASTOPMORPH
VAR8=11, 0x3C, 0x00 //(2) HG_GAMMA_TABLE_A_0
VAR8=11, 0x3D, 0x02 //(2) HG_GAMMA_TABLE_A_1
VAR8=11, 0x3E, 0x08 //(2) HG_GAMMA_TABLE_A_2
VAR8=11, 0x3F, 0x18 //(2) HG_GAMMA_TABLE_A_3
VAR8=11, 0x40, 0x38 //(2) HG_GAMMA_TABLE_A_4
VAR8=11, 0x41, 0x55 //(2) HG_GAMMA_TABLE_A_5
VAR8=11, 0x42, 0x72 //(2) HG_GAMMA_TABLE_A_6
VAR8=11, 0x43, 0x8E //(2) HG_GAMMA_TABLE_A_7
VAR8=11, 0x44, 0xA5 //(2) HG_GAMMA_TABLE_A_8
VAR8=11, 0x45, 0xB6 //(2) HG_GAMMA_TABLE_A_9
VAR8=11, 0x46, 0xC5 //(2) HG_GAMMA_TABLE_A_10
VAR8=11, 0x47, 0xD0 //(2) HG_GAMMA_TABLE_A_11
VAR8=11, 0x48, 0xDA //(2) HG_GAMMA_TABLE_A_12
VAR8=11, 0x49, 0xE2 //(2) HG_GAMMA_TABLE_A_13
VAR8=11, 0x4A, 0xE9 //(2) HG_GAMMA_TABLE_A_14
VAR8=11, 0x4B, 0xF0 //(2) HG_GAMMA_TABLE_A_15
VAR8=11, 0x4C, 0xF5 //(2) HG_GAMMA_TABLE_A_16
VAR8=11, 0x4D, 0xFA //(2) HG_GAMMA_TABLE_A_17
VAR8=11, 0x4E, 0xFF //(2) HG_GAMMA_TABLE_A_18
VAR8=11, 0x4F, 0x00 //(2) HG_GAMMA_TABLE_B_0
VAR8=11, 0x50, 0x01 //(2) HG_GAMMA_TABLE_B_1
VAR8=11, 0x51, 0x02 //(2) HG_GAMMA_TABLE_B_2
VAR8=11, 0x52, 0x05 //(2) HG_GAMMA_TABLE_B_3
VAR8=11, 0x53, 0x11 //(2) HG_GAMMA_TABLE_B_4
VAR8=11, 0x54, 0x1E //(2) HG_GAMMA_TABLE_B_5
VAR8=11, 0x55, 0x2D //(2) HG_GAMMA_TABLE_B_6
VAR8=11, 0x56, 0x3F //(2) HG_GAMMA_TABLE_B_7
VAR8=11, 0x57, 0x53 //(2) HG_GAMMA_TABLE_B_8
VAR8=11, 0x58, 0x6B //(2) HG_GAMMA_TABLE_B_9
VAR8=11, 0x59, 0x87 //(2) HG_GAMMA_TABLE_B_10
VAR8=11, 0x5A, 0xA0 //(2) HG_GAMMA_TABLE_B_11
VAR8=11, 0x5B, 0xB5 //(2) HG_GAMMA_TABLE_B_12
VAR8=11, 0x5C, 0xC7 //(2) HG_GAMMA_TABLE_B_13
VAR8=11, 0x5D, 0xD6 //(2) HG_GAMMA_TABLE_B_14
VAR8=11, 0x5E, 0xE2 //(2) HG_GAMMA_TABLE_B_15
VAR8=11, 0x5F, 0xED //(2) HG_GAMMA_TABLE_B_16
VAR8=11, 0x60, 0xF6 //(2) HG_GAMMA_TABLE_B_17
VAR8=11, 0x61, 0xFF //(2) HG_GAMMA_TABLE_B_18
[Auto White Balance]
VAR=3, 0x06, 0x019B //AWB_CCM_L_0
VAR=3, 0x08, 0xFF4D //AWB_CCM_L_1
VAR=3, 0x0A, 0x001C //AWB_CCM_L_2
VAR=3, 0x0C, 0xFF00 //AWB_CCM_L_3
VAR=3, 0x0E, 0x02FE //AWB_CCM_L_4
VAR=3, 0x10, 0xFF14 //AWB_CCM_L_5
VAR=3, 0x12, 0xFF24 //AWB_CCM_L_6
VAR=3, 0x14, 0xFD7F //AWB_CCM_L_7
VAR=3, 0x16, 0x03E9 //AWB_CCM_L_8
VAR=3, 0x18, 0x002A //AWB_CCM_L_9
VAR=3, 0x1A, 0x003A //AWB_CCM_L_10
VAR=3, 0x1C, 0x0020 //AWB_CCM_RL_0
VAR=3, 0x1E, 0x0065 //AWB_CCM_RL_1
VAR=3, 0x20, 0xFFB1 //AWB_CCM_RL_2
VAR=3, 0x22, 0x0063 //AWB_CCM_RL_3
VAR=3, 0x24, 0xFE8C //AWB_CCM_RL_4
VAR=3, 0x26, 0x006A //AWB_CCM_RL_5
VAR=3, 0x28, 0x0077 //AWB_CCM_RL_6
VAR=3, 0x2A, 0x0161 //AWB_CCM_RL_7
VAR=3, 0x2C, 0xFE76 //AWB_CCM_RL_8
VAR=3, 0x2E, 0x0009 //AWB_CCM_RL_9
VAR=3, 0x30, 0xFFEC //AWB_CCM_RL_10
VAR8=3, 0x5D, 0x73 //(1) AWB_STEADY_BGAIN_OUT_MIN
VAR8=3, 0x5E, 0x8D //(1) AWB_STEADY_BGAIN_OUT_MAX
[Lens Correction]
REG=0x3658, 0x7D8F //P_RD_P0Q0
REG=0x365A, 0x314D //P_RD_P0Q1
REG=0x365C, 0x7912 //P_RD_P0Q2
REG=0x365E, 0xA10F //P_RD_P0Q3
REG=0x3660, 0x6874 //P_RD_P0Q4
REG=0x3680, 0x1F0B //P_RD_P1Q0
REG=0x3682, 0xD48C //P_RD_P1Q1
REG=0x3684, 0x0E72 //P_RD_P1Q2
REG=0x3686, 0x6B51 //P_RD_P1Q3
REG=0x3688, 0x91F1 //P_RD_P1Q4
REG=0x36A8, 0x1293 //P_RD_P2Q0
REG=0x36AA, 0x04F0 //P_RD_P2Q1
REG=0x36AC, 0x40D6 //P_RD_P2Q2
REG=0x36AE, 0x1931 //P_RD_P2Q3
REG=0x36B0, 0xFCD7 //P_RD_P2Q4
REG=0x36D0, 0x34D1 //P_RD_P3Q0
REG=0x36D2, 0x5C92 //P_RD_P3Q1
REG=0x36D4, 0xEDF5 //P_RD_P3Q2
REG=0x36D6, 0x56B4 //P_RD_P3Q3
REG=0x36D8, 0x47F9 //P_RD_P3Q4
REG=0x36F8, 0x4175 //P_RD_P4Q0
REG=0x36FA, 0xC7F4 //P_RD_P4Q1
REG=0x36FC, 0xE738 //P_RD_P4Q2
REG=0x36FE, 0x8C98 //P_RD_P4Q3
REG=0x3700, 0x4D5C //P_RD_P4Q4
REG=0x364E, 0x7D0F //P_GR_P0Q0
REG=0x3650, 0x31CC //P_GR_P0Q1
REG=0x3652, 0x47D2 //P_GR_P0Q2
REG=0x3654, 0xC58F //P_GR_P0Q3
REG=0x3656, 0x2374 //P_GR_P0Q4
REG=0x3676, 0x232A //P_GR_P1Q0
REG=0x3678, 0x6186 //P_GR_P1Q1
REG=0x367A, 0x1852 //P_GR_P1Q2
REG=0x367C, 0x1F30 //P_GR_P1Q3
REG=0x367E, 0x9D14 //P_GR_P1Q4
REG=0x369E, 0x6A52 //P_GR_P2Q0
REG=0x36A0, 0x3450 //P_GR_P2Q1
REG=0x36A2, 0x3A96 //P_GR_P2Q2
REG=0x36A4, 0x93B4 //P_GR_P2Q3
REG=0x36A6, 0xF5B8 //P_GR_P2Q4
REG=0x36C6, 0x3D11 //P_GR_P3Q0
REG=0x36C8, 0x2832 //P_GR_P3Q1
REG=0x36CA, 0xA816 //P_GR_P3Q2
REG=0x36CC, 0x2BD4 //P_GR_P3Q3
REG=0x36CE, 0x7479 //P_GR_P3Q4
REG=0x36EE, 0x2175 //P_GR_P4Q0
REG=0x36F0, 0xC714 //P_GR_P4Q1
REG=0x36F2, 0xC339 //P_GR_P4Q2
REG=0x36F4, 0x47B6 //P_GR_P4Q3
REG=0x36F6, 0x0BBD //P_GR_P4Q4
REG=0x3662, 0x7CAF //P_BL_P0Q0
REG=0x3664, 0x6BEC //P_BL_P0Q1
REG=0x3666, 0x4CD2 //P_BL_P0Q2
REG=0x3668, 0xE80F //P_BL_P0Q3
REG=0x366A, 0x7B53 //P_BL_P0Q4
REG=0x368A, 0x2B8B //P_BL_P1Q0
REG=0x368C, 0x2C0B //P_BL_P1Q1
REG=0x368E, 0x0EF2 //P_BL_P1Q2
REG=0x3690, 0x77F0 //P_BL_P1Q3
REG=0x3692, 0xA1D4 //P_BL_P1Q4
REG=0x36B2, 0x53B2 //P_BL_P2Q0
REG=0x36B4, 0x5670 //P_BL_P2Q1
REG=0x36B6, 0x1D76 //P_BL_P2Q2
REG=0x36B8, 0xAD10 //P_BL_P2Q3
REG=0x36BA, 0x8179 //P_BL_P2Q4
REG=0x36DA, 0x6611 //P_BL_P3Q0
REG=0x36DC, 0x09D3 //P_BL_P3Q1
REG=0x36DE, 0xB976 //P_BL_P3Q2
REG=0x36E0, 0x7F14 //P_BL_P3Q3
REG=0x36E2, 0x7AD9 //P_BL_P3Q4
REG=0x3702, 0x16D5 //P_BL_P4Q0
REG=0x3704, 0x8CD5 //P_BL_P4Q1
REG=0x3706, 0xD2F9 //P_BL_P4Q2
REG=0x3708, 0x9316 //P_BL_P4Q3
REG=0x370A, 0x1BDD //P_BL_P4Q4
REG=0x366C, 0x7BEF //P_GB_P0Q0
REG=0x366E, 0x300C //P_GB_P0Q1
REG=0x3670, 0x4FF2 //P_GB_P0Q2
REG=0x3672, 0xA2AF //P_GB_P0Q3
REG=0x3674, 0x1EF4 //P_GB_P0Q4
REG=0x3694, 0x570B //P_GB_P1Q0
REG=0x3696, 0xA4A7 //P_GB_P1Q1
REG=0x3698, 0x1392 //P_GB_P1Q2
REG=0x369A, 0x4430 //P_GB_P1Q3
REG=0x369C, 0x82D4 //P_GB_P1Q4
REG=0x36BC, 0x5F12 //P_GB_P2Q0
REG=0x36BE, 0x40D0 //P_GB_P2Q1
REG=0x36C0, 0x2ED6 //P_GB_P2Q2
REG=0x36C2, 0x95B4 //P_GB_P2Q3
REG=0x36C4, 0xEA18 //P_GB_P2Q4
REG=0x36E4, 0x3191 //P_GB_P3Q0
REG=0x36E6, 0x3632 //P_GB_P3Q1
REG=0x36E8, 0xA476 //P_GB_P3Q2
REG=0x36EA, 0xE411 //P_GB_P3Q3
REG=0x36EC, 0x7339 //P_GB_P3Q4
REG=0x370C, 0x2655 //P_GB_P4Q0
REG=0x370E, 0xE994 //P_GB_P4Q1
REG=0x3710, 0xA5D9 //P_GB_P4Q2
REG=0x3712, 0x4777 //P_GB_P4Q3
REG=0x3714, 0x7B9C //P_GB_P4Q4
REG=0x3644, 0x0158 //POLY_ORIGIN_C
REG=0x3642, 0x00E4 //POLY_ORIGIN_R
STATE=Lens Correction Falloff, 90
STATE=Lens Correction Center X, 344
STATE=Lens Correction Center Y, 228
BITFIELD=0x3210, 0x0008, 1 //PGA_ENABLE
[Image Size : VGA]
VAR=7, 0x03, 0x0280 //MODE_OUTPUT_WIDTH_A
VAR=7, 0x05, 0x01E0 //MODE_OUTPUT_HEIGHT_A
VAR8=1, 0x03, 0x05 //SEQ_CMD
[Image Size : QVGA]
VAR=7, 0x03, 0x0140 //MODE_OUTPUT_WIDTH_A
VAR=7, 0x05, 0x00F0 //MODE_OUTPUT_HEIGHT_A
VAR8=1, 0x03, 0x05 //SEQ_CMD
[Image Size : CIF]
VAR=7, 0x03, 0x0160 //MODE_OUTPUT_WIDTH_A
VAR=7, 0x05, 0x0120 //MODE_OUTPUT_HEIGHT_A
VAR8=1, 0x03, 0x05 //SEQ_CMD
[Image Size : QCIF]
VAR=7, 0x03, 0x00B0 //MODE_OUTPUT_WIDTH_A
VAR=7, 0x05, 0x0090 //MODE_OUTPUT_HEIGHT_A
VAR8=1, 0x03, 0x05 //SEQ_CMD
[Effect : Off]
VAR8=1, 0x03, 0x05 //SEQ_CMD
VAR=7, 0x59, 0x6440 //MODE_SPEC_EFFECTS_A
VAR=7, 0x5B, 0x6440 //MODE_SPEC_EFFECTS_B
[Effect : Mono]
VAR=7, 0x59, 0x6441 //MODE_SPEC_EFFECTS_A
VAR=7, 0x5B, 0x6441 //MODE_SPEC_EFFECTS_B
VAR8=1, 0x03, 0x05 //SEQ_CMD
[Effect : Sepia]
VAR=7, 0x59, 0x6442 //MODE_SPEC_EFFECTS_A
VAR=7, 0x5B, 0x6442 //MODE_SPEC_EFFECTS_B
VAR=7, 0x63, 0xA921 //MODE_COMMONMODESETTINGS_FX_SEPIA_SETTINGS
VAR8=1, 0x03, 0x05 //SEQ_CMD
[Manual WB -> Auto WB]
VAR8=1, 0x02, 0x0F //SEQ_MODE
[Manual White Balance : P1]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x0 //AWB_CCM_POSITION
[Manual White Balance : P2]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x12 //AWB_CCM_POSITION
[Manual White Balance : P3]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x24 //AWB_CCM_POSITION
[Manual White Balance : P4]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x36 //AWB_CCM_POSITION
[Manual White Balance : P5]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x48 //AWB_CCM_POSITION
[Manual White Balance : P6]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x5A //AWB_CCM_POSITION
[Manual White Balance : P7]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x6C //AWB_CCM_POSITION
[Manual White Balance : P8]
VAR8=1, 0x02, 0x0B //SEQ_MODE
VAR8=3, 0x53, 0x7F //AWB_CCM_POSITION
[Sharpness : 0]
REG=0x326C, 0x1600 //APERTURE_PARAMETERS

View File

@ -1,237 +0,0 @@
;**************************************************************************************
; Copyright 2006 Micron Technology, Inc. All rights reserved.
;
;
; No permission to use, copy, modify, or distribute this software and/or
; its documentation for any purpose has been granted by Micron Technology, Inc.
; If any such permission has been granted ( by separate agreement ), it
; is required that the above copyright notice appear in all copies and
; that both that copyright notice and this permission notice appear in
; supporting documentation, and that the name of Micron Technology, Inc. or any
; of its trademarks may not be used in advertising or publicity pertaining
; to distribution of the software without specific, written prior permission.
;
;
; This software and any associated documentation are provided "AS IS" and
; without warranty of any kind. MICRON TECHNOLOGY, INC. EXPRESSLY DISCLAIMS
; ALL WARRANTIES EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, NONINFRINGEMENT
; OF THIRD PARTY RIGHTS, AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
; FOR A PARTICULAR PURPOSE. MICRON DOES NOT WARRANT THAT THE FUNCTIONS CONTAINED
; IN THIS SOFTWARE WILL MEET YOUR REQUIREMENTS, OR THAT THE OPERATION OF THIS SOFTWARE
; WILL BE UNINTERRUPTED OR ERROR-FREE. FURTHERMORE, MICRON DOES NOT WARRANT OR
; MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF THE USE OF ANY
; ACCOMPANYING DOCUMENTATION IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY,
; OR OTHERWISE.
;**************************************************************************************/
;
; Default INI file for the MI-0380-REV1
;
; $Revision: 1.2 $
; $Date: 2007/02/23 23:05:39 $
;
; This file holds groups of register presets (sections) specific for this sensor. The
; presets allow you to overwrite the power-on default settings with optimized register
; settings.
; The [Default Registers] section contains all optimized register settings for running
; the sensor in the demo environment. Other sections include settings optimized for a
; variety of situations like: Running at different master clock speeds, running under
; different lighting situations, running with different lenses, etc.
; Most of the demonstration software (DevWare, SensorDemo, ...) make use of this file
; to load and store the user presets.
;
; Keyname description:
; REG = assign a new register value
; BITFIELD = do a READ-MODIFY-WRITE to part of a register. The part is defined as a mask.
; LOAD = load an alternate section from this section
; STATE = set non-register state
; DELAY = delay a certain amount of milliseconds before continuing
;
; Keyname format:
; REG = [<page>,] <address>, <value> //<comment>
; BITFIELD = [<page>,] <address>, <mask>, <value>
; Some examples:
; BITFIELD=2, 0x05, 0x0020, 1 //for register 5 on page 2, set the 6th bit to 1
; BITFIELD=0x06, 0x000F, 0 //for register 6, clear the first 4 bits
; LOAD = <section>
; STATE = <state>, <value>
; DELAY = <milliseconds>
;
; <page> Optional address space for this register. Some sensors (mostly SOC's)
; have multiple register pages (see the sensor spec or developer's guide)
; <address> the register address
; <value> the new value to assign to the register
; <mask> is the part of a register value that needs to be updated with a new value
; <section> the name of another section to load
; <state> non-register program state names [do not modify]
; <milliseconds> wait for this ammount of milliseconds before continuing
; <comment> Some form of C-style comments are supported in this .ini file
;
;*************************************************************************************/
[Default Registers]
LOAD=Initialize Camera
LOAD=Image Setting ExtClk=16.76MHz Op_Pix=8.38MHz
LOAD=Refresh
//LOAD=Parallel 320x240 ExtClk=13.5MHz Op_Pix_Clk=27.56MHz
//DELAY=300
//STATE=Gamma, 9
//STATE=Black Correct, 5
//STATE=Contrast, 25
[Initialize Camera]
REG = 0x001A, 0x0003// Activate Soft Reset & MIPI Reset
DELAY = 1 // Wait 1ms for internal reset cycle (6000 EXTCLK cycles) using a 6.75Mhz clock this will be approx 0.88ms
REG = 0x001A, 0x0000 // Deactivate both soft reset, MIPI reset
DELAY = 1
REG = 0x0018, 0x4028 // Enable STANDBY mode, Bit(3)
REG = 0x001A, 0x0200 // Enable parallel port:bit(9) & Output enable: Bit(8)
REG = 0x001E, 0x0777 // Program to slowest SLEW rate
REG = 0x0016, 0x42DF // Invert PIXCLK output to interface with Micron DEMO2 board
// Enable EXTCLK bit9
[Refresh]
REG = 0x98C, 0xA103 //Refresh Sequencer Mode
REG = 0x990, 0x06 // = 6
POLL_FIELD=SEQ_CMD, !=0, DELAY=10, TIMEOUT=50
REG = 0x98C, 0xA103 //Refresh Sequencer
REG = 0x990, 0x05 // = 5
POLL_FIELD=SEQ_CMD, !=0, DELAY=10, TIMEOUT=50
[Image Setting ExtClk=16.76MHz Op_Pix=8.38MHz]
BITFIELD= 0x14, 1, 1 // Bypass PLL
BITFIELD= 0X14, 2, 0 // Power-down PLL
REG = 0x0010, 0x0518 // PLL DIVIDERS (N=5, M=24)
REG = 0x0012, 0x0000 // PLL P3 DIVIDERS
REG = 0x0014, 0x2147 // Enable PLL and start initialization [1]
DELAY = 10 // Wait for 10us to get PLL lock
REG = 0x0014, 0x2047 // Reset the PLL internal counter [8]
DELAY = 10 // Wait for 10us
REG = 0x0014, 0x2046 // Turn off PLL initialization process [0]
DELAY = 10 // Wait for 10us
REG = 0x0016, 0x42DF // Invert Pixclk output to interface with DEMO2 board [14]
BITFIELD= 0x14, 1, 0 //PLL_BYPASS_OFF
REG = 0x98C, 0x2703 //Output Width (A)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2705 //Output Height (A)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x2707 //Output Width (B)
REG = 0x990, 0x0280 // = 640
REG = 0x98C, 0x2709 //Output Height (B)
REG = 0x990, 0x01E0 // = 480
REG = 0x98C, 0x270D //Row Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x270F //Column Start (A)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2711 //Row End (A)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2713 //Column End (A)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x2715 //Row Speed (A)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x2717 //Read Mode (A)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x2719 //sensor_fine_correction (A)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x271B //sensor_fine_IT_min (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271D //sensor_fine_IT_max_margin (A)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x271F //Frame Lines (A)
REG = 0x990, 0x02D2 // = 722
REG = 0x98C, 0x2721 //Line Length (A)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2723 //Row Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2725 //Column Start (B)
REG = 0x990, 0x004 // = 4
REG = 0x98C, 0x2727 //Row End (B)
REG = 0x990, 0x1EB // = 491
REG = 0x98C, 0x2729 //Column End (B)
REG = 0x990, 0x28B // = 651
REG = 0x98C, 0x272B //Row Speed (B)
REG = 0x990, 0x0001 // = 1
REG = 0x98C, 0x272D //Read Mode (B)
REG = 0x990, 0x0026 // = 38
REG = 0x98C, 0x272F //sensor_fine_correction (B)
REG = 0x990, 0x001A // = 26
REG = 0x98C, 0x2731 //sensor_fine_IT_min (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2733 //sensor_fine_IT_max_margin (B)
REG = 0x990, 0x006B // = 107
REG = 0x98C, 0x2735 //Frame Lines (B)
REG = 0x990, 0x02D2 // = 722
REG = 0x98C, 0x2737 //Line Length (B)
REG = 0x990, 0x034A // = 842
REG = 0x98C, 0x2739 //Crop_X0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273B //Crop_X1 (A)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x273D //Crop_Y0 (A)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x273F //Crop_Y1 (A)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x2747 //Crop_X0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x2749 //Crop_X1 (B)
REG = 0x990, 0x027F // = 639
REG = 0x98C, 0x274B //Crop_Y0 (B)
REG = 0x990, 0x0000 // = 0
REG = 0x98C, 0x274D //Crop_Y1 (B)
REG = 0x990, 0x01DF // = 479
REG = 0x98C, 0x222D //R9 Step
REG = 0x990, 0x0058 // = 88
REG = 0x98C, 0xA408 //search_f1_50
REG = 0x990, 0x0F // = 15
REG = 0x98C, 0xA409 //search_f2_50
REG = 0x990, 0x12 // = 18
REG = 0x98C, 0xA40A //search_f1_60
REG = 0x990, 0x13 // = 19
REG = 0x98C, 0xA40B //search_f2_60
REG = 0x990, 0x16 // = 22
REG = 0x98C, 0x2411 //R9_Step_60_A
REG = 0x990, 0x0058 // = 88
REG = 0x98C, 0x2413 //R9_Step_50_A
REG = 0x990, 0x006A // = 106
REG = 0x98C, 0x2415 //R9_Step_60_B
REG = 0x990, 0x0058 // = 88
REG = 0x98C, 0x2417 //R9_Step_50_B
REG = 0x990, 0x006A // = 106
REG = 0x98C, 0xA40D //Stat_min
REG = 0x990, 0x02 // = 2
REG = 0x98C, 0xA410 //Min_amplitude
REG = 0x990, 0x01 // = 1
[Parallel 320x240 ExtClk=13.5MHz Op_Pix_Clk=27.56MHz]
IMAGE=320,240
REG=0x001A, 0x0011 // RESET_AND_MISC_CONTROL
DELAY=10
REG=0x001A, 0x0010 // RESET_AND_MISC_CONTROL
DELAY=10
REG=0x0018, 0x4028 // STANDBY_CONTROL
REG=0x001A, 0x0210 // RESET_AND_MISC_CONTROL
REG=0x001E, 0x0777 // PAD_SLEW
REG=0x0016, 0x42DF // CLOCKS_CONTROL
REG=0x0010, 0x0231 // PLL_DIVIDERS
REG=0x0012, 0x0000 // PLL_P_DIVIDERS
REG=0x0014, 0x2147 // PLL_CONTROL
DELAY=10
REG=0x0014, 0x2047 // PLL_CONTROL
DELAY=10
REG=0x0014, 0xA046 // PLL_CONTROL
DELAY=10
REG=0x3040, 0x0027 // READ_MODE
REG=0x301A, 0x1218 // RESET_REGISTER
DELAY=100
REG=0x301A, 0x121C // RESET_REGISTER
VAR=7, 0x03, 0x0140 // MODE_OUTPUT_WIDTH_A
VAR=7, 0x05, 0x00F0 // MODE_OUTPUT_HEIGHT_A
VAR=7, 0x07, 0x0280 // MODE_OUTPUT_WIDTH_B
VAR=7, 0x09, 0x01E0 // MODE_OUTPUT_HEIGHT_B
VAR=7, 0x17, 0x0026 // MODE_SENSOR_READ_MODE_A
VAR=7, 0x2D, 0x0026 // MODE_SENSOR_READ_MODE_B
VAR8=1, 0x03, 0x06 //(1) SEQ_CMD

View File

@ -35,17 +35,16 @@ SRCS = \
camera_control.c \
MICRON_INI_FILE := \
MT9V113-MTM9-2.ini \
MT9V113-MTM10.ini \
MT9V113-nin00.ini \
MT9V113-MTM10-3.ini \
MT9V113-MTM11.ini \
MICRON_CONVERT_EXE := convert_micron.pl
MICRON_INIC_FILE := $(MICRON_INI_FILE:%.ini=%.autogen.c)
SHARP_DAT_FILE := \
5030_15fpsFIX_x8_CC_FilterKIM_MatrixOn3_PLL.dat \
5030_15fps_5fps_adjust2_x8_CC_FilterKIM_MatrixOn3_PLL_1676MHz-1676MHz.dat \
VGA_15fps_5fps_x8_CC_FilterKIM_MatrixOn3_PLL_QVGA_23Jul07_1676MHz.dat \
VGA_15fps_5fps_x8_CC_FilterKIM_MatrixOn3_PLL_QVGA_23Jul07_1676MHz_Improve.dat \
SHARP_CONVERT_EXE := convert_sharp.pl

View File

@ -4,8 +4,8 @@
#I2CS
# 7F
#ImageSize
# 640
# 480
# 320
# 240
# 0
@ -22,6 +22,32 @@ C8 04 #1200
E0 07 #frame width
E1 D0 #1600
#QVGA Setting 23Jul07 .KIM ---->
03 01
35 07 #WindowX1 (L)
37 04 #WindowY1 (L)
38 01 #WindowX2 (H)
39 46 #WindowX2 (L)
3A 00 #WindowY2 (H)
3B F3 #WindowY2 (L)
3D 40 #ScaleX
3E 40 #ScaleY
40 08 #Scale_th_L
19 01 #SyncControl0
03 02
5C 01 #AEWinWidth (H)
5D 40 #AEWinWidth (L)
5E 00 #AEWinHeight (H)
5F F0 #AEWinHeight (L)
60 00 #AECenterWinX (H)
61 54 #AECenterWinX (L)
62 00 #AECenterWinY (H)
63 28 #AECenterWinY (L)
64 00 #AECenterWidth (H)
65 A0 #AECenterWidth (L)
66 00 #AECenterHeight (H)
67 3C #AECenterHeight (L)
#<------ QVGA Setting 23Jul07 .KIM
03 02
11 04 #mid fh
@ -223,6 +249,7 @@ B6 24 # MatrixNo2 of Color
95 40
03 01
### “Á•Ê<E280A2>Ýè 1676MHz ##############
#Bank B
03 01
D4 08 # 01D4 referense gain1
@ -230,5 +257,3 @@ D4 08 # 01D4 referense gain1
0A 02 #03 #pre PLL1
0B 03 #00 #post PLL2

View File

@ -4,30 +4,56 @@
#I2CS
# 7F
#ImageSize
# 640
# 480
# 320
# 240
# 0
03 01
#04 A0
09 D2 #PLL
0A 03 #PLL1
0B 00 #PLL2
04 10
04 90
#09 D2 #PLL
#0A 03 #PLL1
#0B 00 #PLL2
#04 10
#04 90
C9 B0 #frame height 15fps
C8 04 #1200
C8 02 #1200
C9 38 #20 #frame height 15fps
E0 07 #frame width
E1 D0 #1600
#QVGA Setting 23Jul07 .KIM ---->
03 01
35 07 #WindowX1 (L)
37 04 #WindowY1 (L)
38 01 #WindowX2 (H)
39 46 #WindowX2 (L)
3A 00 #WindowY2 (H)
3B F3 #WindowY2 (L)
3D 40 #ScaleX
3E 40 #ScaleY
40 08 #Scale_th_L
19 01 #SyncControl0
03 02
5C 01 #AEWinWidth (H)
5D 40 #AEWinWidth (L)
5E 00 #AEWinHeight (H)
5F F0 #AEWinHeight (L)
60 00 #AECenterWinX (H)
61 54 #AECenterWinX (L)
62 00 #AECenterWinY (H)
63 28 #AECenterWinY (L)
64 00 #AECenterWidth (H)
65 A0 #AECenterWidth (L)
66 00 #AECenterHeight (H)
67 3C #AECenterHeight (L)
#<------ QVGA Setting 23Jul07 .KIM
03 02
11 04 #mid fh
12 B0
13 04 # 0E #max fh
14 B0 # 10
13 06 #0E #max fh
14 A8 #10
16 70 #mid ex
17 80
19 70 #max ex
@ -222,3 +248,14 @@ B6 24 # MatrixNo2 of Color
03 00
95 40
03 01
### “Á•Ê<E280A2>Ýè 1676MHz ##############
#Bank B
03 01
D4 08 # 01D4 referense gain1
09 D2 #PLL
0A 02 #03 #pre PLL1
0B 01 #03 00 #post PLL2
04 10
04 90

View File

@ -232,6 +232,15 @@ static void CameraThread(void *arg)
{
case CAMERA_PXI_COMMAND_INIT:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_INIT);
// NONEでなければNONE状態にする
if (cameraWork.camera != CAMERA_SELECT_NONE)
{
if (FALSE == CAMERA_I2CStandby(cameraWork.camera, TRUE))
{
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の失敗を通達
}
}
cameraWork.camera = CAMERA_SELECT_NONE;
result = CAMERA_I2CInit((CameraSelect)cameraWork.data[0]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9É<E2809A>ˆ<CB86>Ì<E2809A>¬Œ÷ðÊB
break;
@ -240,6 +249,7 @@ static void CameraThread(void *arg)
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_ACTIVATE);
if (cameraWork.camera != cameraWork.data[0])
{
// NONEでなければNONE状態にする
if (cameraWork.camera != CAMERA_SELECT_NONE)
{
if (FALSE == CAMERA_I2CStandby(cameraWork.camera, TRUE))

View File

@ -26,7 +26,7 @@ typedef enum
}
CAMERAType;
static CAMERAType cameraType = CAMERA_TYPE_SHARP;
static CAMERAType cameraType = CAMERA_TYPE_MICRON;
#if 0
CAMERA_I2CInit()

View File

@ -17,9 +17,8 @@
#include <twl/camera/ARM7/i2c_micron.h>
// insert auto-generated code
#include "MT9V113-MTM10.autogen.c"
//#include "MT9V113-MTM9-2.autogen.c"
//#include "MT9V113-nin00.autogen.c"
#include "MT9V113-MTM10-3.autogen.c"
//#include "MT9V113-MTM11.autogen.c"
/*---------------------------------------------------------------------------*
Name: CAMERAi_M_I2CInit
@ -38,11 +37,15 @@ BOOL CAMERAi_M_I2CInit(CameraSelect camera)
if (camera & CAMERA_SELECT_IN)
{
rIn = CAMERAi_M_Default_Registers(CAMERA_SELECT_IN)
&& CAMERAi_M_WriteMCU(CAMERA_SELECT_IN, 0x2755, 0x0002) // YUYV format (required to refresh)
&& CAMERAi_M_I2CResize(CAMERA_SELECT_IN, 320, 240)
&& CAMERAi_M_I2CStandby(CAMERA_SELECT_IN, TRUE);
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = CAMERAi_M_Default_Registers(CAMERA_SELECT_OUT)
&& CAMERAi_M_WriteMCU(CAMERA_SELECT_OUT, 0x2755, 0x0002) // YUYV format (required to refresh)
&& CAMERAi_M_I2CResize(CAMERA_SELECT_OUT, 320, 240)
&& CAMERAi_M_I2CStandby(CAMERA_SELECT_OUT, TRUE);
}
return (rIn && rOut);
@ -63,12 +66,14 @@ BOOL CAMERAi_M_I2CStandby(CameraSelect camera, BOOL standby)
if (standby)
{
return CAMERAi_M_ClearFlags(camera, 0x001A, 0x0200) // stop to output
// return CAMERAi_M_Stop(camera)
&& CAMERAi_M_SetFlags(camera, 0x0018, 0x0001); // go to standby
}
else
{
return CAMERAi_M_ClearFlags(camera, 0x0018, 0x0001) // leave standby
&& CAMERAi_M_SetFlags(camera, 0x001A, 0x0200); // start to output
// && CAMERAi_M_Start(camera);
}
}
@ -126,20 +131,17 @@ BOOL CAMERAi_M_I2CFrameRate(CameraSelect camera, int rate)
*---------------------------------------------------------------------------*/
BOOL CAMERAi_M_I2CEffect(CameraSelect camera, CameraEffect effect)
{
#if 0
SEPIAでガンマコレクションを変更しているので
SEPIAかどうかを覚えておく(IN/OUT別)Readするか
(B)
#endif
switch (effect)
{
case CAMERA_EFFECT_NONE:
return CAMERAi_M_Effect_Off(camera);
// return CAMERAi_M_Option_Effect_Off(camera);
case CAMERA_EFFECT_MONO:
return CAMERAi_M_Effect_Mono(camera);
// return CAMERAi_M_Option_Effect_Mono(camera);
case CAMERA_EFFECT_SEPIA:
return CAMERAi_M_Effect_Sepia(camera);
// return CAMERAi_M_Option_Effect_Sepia(camera);
case CAMERA_EFFECT_NEGATIVE:
return CAMERAi_M_WriteMCU(camera, 0x2759, 0x6443) //NEVATIVE_SPEC_EFFECTS_A
&& CAMERAi_M_WriteMCU(camera, 0x275B, 0x6443) //NEVATIVE_SPEC_EFFECTS_B

View File

@ -17,9 +17,8 @@
#include <twl/camera/ARM7/i2c_sharp.h>
// insert auto-generated code
//#include "5030_15fpsFIX_x8_CC_FilterKIM_MatrixOn3_PLL.autogen.c"
#include "5030_15fps_5fps_adjust2_x8_CC_FilterKIM_MatrixOn3_PLL_1676MHz-1676MHz.autogen.c"
//#include "VGA_15fps_5fps_x8_CC_FilterKIM_MatrixOn3_PLL_QVGA_23Jul07_1676MHz.autogen.c"
#include "VGA_15fps_5fps_x8_CC_FilterKIM_MatrixOn3_PLL_QVGA_23Jul07_1676MHz_Improve.autogen.c"
#define BANK_ADDR 0x03
typedef enum
@ -43,17 +42,24 @@ BOOL CAMERAi_S_I2CInit(CameraSelect camera)
{
BOOL rIn = TRUE;
BOOL rOut = TRUE;
// const u8 data[] = { 0xD2, 0x02, 0x03 }; // PLL parameters from 16 MHz to 16 MHz
// should not send init command same time
if (camera & CAMERA_SELECT_IN)
{
rIn = CAMERAi_S_Initialize(CAMERA_SELECT_IN)
&& CAMERAi_S_WriteRegister(CAMERA_SELECT_IN, BANK_ADDR, BANK_GROUP_B)
&& CAMERAi_S_SetFlags(CAMERA_SELECT_IN, 0x1A, 0x08) // reverse RCLK polarity
&& CAMERAi_S_WriteRegister(CAMERA_SELECT_IN, 0x18, 0x02) // force to order YUYV
// && CAMERAi_S_WriteRegisters(CAMERA_SELECT_IN, 0x09, data, 3) // force to set PLL
&& CAMERAi_S_I2CStandby(CAMERA_SELECT_IN, TRUE);
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = CAMERAi_S_Initialize(CAMERA_SELECT_OUT)
&& CAMERAi_S_WriteRegister(CAMERA_SELECT_OUT, 0x18, 0x02) // force to order YUYV
&& CAMERAi_S_WriteRegister(CAMERA_SELECT_OUT, BANK_ADDR, BANK_GROUP_B)
&& CAMERAi_S_SetFlags(CAMERA_SELECT_OUT, 0x1A, 0x08) // reverse RCLK polarity
&& CAMERAi_S_WriteRegister(CAMERA_SELECT_OUT, 0x18, 0x02) // force to order YUYV
// && CAMERAi_S_WriteRegisters(CAMERA_SELECT_OUT, 0x09, data, 3) // force to set PLL
&& CAMERAi_S_I2CStandby(CAMERA_SELECT_OUT, TRUE);
}
return (rIn && rOut);
@ -96,24 +102,16 @@ BOOL CAMERAi_S_I2CStandby(CameraSelect camera, BOOL standby)
*---------------------------------------------------------------------------*/
BOOL CAMERAi_S_I2CResize(CameraSelect camera, u16 width, u16 height)
{
u8 data[2] = { 0, 0 };
switch (width)
u8 data[2];
if ( width <= 80 || width > 640 || height <= 60 || height > 480
|| (640*32) % width != 0 || (480*32) % height != 0 )
{
case 640: data[0] = 32; break;
case 320: data[0] = 64; break;
case 160: data[0] = 128; break;
return FALSE; // cannnot match for scale-down parameters
}
switch (height)
{
case 480: data[1] = 32; break;
case 240: data[1] = 64; break;
case 120: data[1] = 128; break;
}
if (data[0] && data[1])
{
return CAMERAi_S_WriteRegister(camera, BANK_ADDR, BANK_GROUP_B)
data[0] = (u8)((640*32) / width);
data[1] = (u8)((480*32) / height);
return CAMERAi_S_WriteRegister(camera, BANK_ADDR, BANK_GROUP_B)
&& CAMERAi_S_WriteRegisters(camera, 0x3D, data, 2);
}
return FALSE;
}
@ -129,8 +127,13 @@ BOOL CAMERAi_S_I2CResize(CameraSelect camera, u16 width, u16 height)
*---------------------------------------------------------------------------*/
BOOL CAMERAi_S_I2CFrameRate(CameraSelect camera, int rate)
{
(void)rate;
(void)camera;
if (rate == 0)
{
}
else if (rate > 0 && rate <= 30)
{
}
return FALSE;
}
@ -146,8 +149,15 @@ BOOL CAMERAi_S_I2CFrameRate(CameraSelect camera, int rate)
*---------------------------------------------------------------------------*/
BOOL CAMERAi_S_I2CEffect(CameraSelect camera, CameraEffect effect)
{
(void)effect;
(void)camera;
switch (effect)
{
case CAMERA_EFFECT_NONE:
case CAMERA_EFFECT_MONO:
case CAMERA_EFFECT_SEPIA:
case CAMERA_EFFECT_NEGATIVE:
return FALSE;
}
return FALSE;
}
@ -163,7 +173,14 @@ BOOL CAMERAi_S_I2CEffect(CameraSelect camera, CameraEffect effect)
*---------------------------------------------------------------------------*/
BOOL CAMERAi_S_I2CFlip(CameraSelect camera, CameraFlip flip)
{
(void)flip;
(void)camera;
return FALSE;
u8 data = 0;
switch (flip)
{
case CAMERA_FLIP_NONE: data = 0x00; break;
case CAMERA_FLIP_VERTICAL: data = 0x02; break;
case CAMERA_FLIP_HORIZONTAL:data = 0x01; break;
case CAMERA_FLIP_REVERSE: data = 0x03; break;
}
return CAMERAi_S_WriteRegister(camera, BANK_ADDR, BANK_GROUP_B)
&& CAMERAi_S_SetParams(camera, 0x0F, data, 0x03);
}

View File

@ -248,8 +248,12 @@ sub regmap_init {
# API名の整形
sub name_conv {
$_ = $_[0];
s/\<o\>/Option/g;
s/\%/Percent/g;
s/\-/Minus/g;
s/\+/Plus/g;
s/\>/To/g;
s/[\s\.\:\+\-\=\*\/]+/_/g;
s/[\s\.\:\=\*\/\(\)]+/_/g;
return $_;
}

View File

@ -62,26 +62,7 @@ my $multi_foot_format =<<'EOF';
}
EOF
sub print_data {
my $result = "";
for (my $i = 0; $i < @_; $i++)
{
if (($i % 16) == 0) {
$result .= " " ;
} else {
$result .= " " ;
}
$result .= sprintf("0x%02X,", $_[$i]);
if (($i % 16) == 15) {
$result .= "\r\n";
}
}
if ((@_ % 16) != 0) {
$result .= "\r\n";
}
return $result;
}
my $row_nums = 8;
sub print_command {
my($addr, @value) = @_;
if (@value == 1) {
@ -90,17 +71,17 @@ sub print_command {
my $result = $multi_head_format;
for (my $i = 0; $i < @value; $i++)
{
if (($i % 16) == 0) {
if (($i % $row_nums) == 0) {
$result .= " " ;
} else {
$result .= " " ;
}
$result .= sprintf("0x%02X,", $value[$i]);
if (($i % 16) == 15) {
if (($i % $row_nums) == ($row_nums-1) ) {
$result .= "\r\n";
}
}
if ((@value % 16) != 0) {
if ((@value % $row_nums) != 0) {
$result .= "\r\n";
}
$result .= sprintf($multi_foot_format, $addr, scalar(@value));

View File

@ -20,7 +20,7 @@
è<EFBFBD>è`
*---------------------------------------------------------------------------*/
#define SYNC_TYPE (0 << REG_CAM_CAM_MCNT_SYNC_SHIFT) // 1 if low active
#define RCLK_TYPE (1 << REG_CAM_CAM_MCNT_IRCLK_SHIFT) // 1 if negative edge
#define RCLK_TYPE (0 << REG_CAM_CAM_MCNT_IRCLK_SHIFT) // 1 if negative edge
/*---------------------------------------------------------------------------*
Œ^è`
@ -52,7 +52,9 @@ void CAMERA_PowerOn( void )
reg_CFG_CLK |= REG_CFG_CLK_CAM_MASK;
if ((reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) == 0)
{
reg_CAM_CAM_MCNT |= (SYNC_TYPE | RCLK_TYPE); // set polarities
// (re)set polarities first
reg_CAM_CAM_MCNT = (u16)((reg_CAM_CAM_MCNT & ~(REG_CAM_CAM_MCNT_SYNC_MASK | REG_CAM_CAM_MCNT_IRCLK_MASK))
| SYNC_TYPE | RCLK_TYPE);
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_V28_MASK; // VDD2.8 POWER ON
CAMERAi_Wait( 10 ); // wait for over 10 MCLKs (M:10-20)(S:10ns?)
@ -61,7 +63,11 @@ void CAMERA_PowerOn( void )
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_RSTN_MASK; // RSTN => Hi
CAMERAi_Wait( 6000 ); // wait for over 6000 MCLKs
reg_CAM_CAM_CNT = REG_CAM_CAM_CNT_CL_MASK; // full reset CNT
CAMERA_StopCapture(); // stop cmaera output
while (CAMERA_IsBusy() != FALSE)
{
}
CAMERA_ClearBuffer(); // clear buffer and error
}
}
@ -78,7 +84,10 @@ void CAMERA_PowerOff( void )
{
if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK)
{
reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_E_MASK; // stop cmaera output
CAMERA_StopCapture(); // stop cmaera output
while (CAMERA_IsBusy() != FALSE)
{
}
reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_RSTN_MASK;// RSTN => Lo
CAMERAi_Wait( 10 ); // wait for over 10 MCLKs (M:10)(S:10ns?)
@ -106,7 +115,7 @@ BOOL CAMERA_IsBusy( void )
}
/*---------------------------------------------------------------------------*
Name: CAMERA_Start
Name: CAMERA_StartCapture
Description: start to receive camera data
@ -114,13 +123,13 @@ BOOL CAMERA_IsBusy( void )
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Start( void )
void CAMERA_StartCapture( void )
{
reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_E_MASK;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_Stop
Name: CAMERA_StopCapture
Description: stop to receive camera data
@ -128,7 +137,7 @@ void CAMERA_Start( void )
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Stop( void )
void CAMERA_StopCapture( void )
{
reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_E_MASK;
}

View File

@ -95,6 +95,91 @@ void CAMERA_Init(void)
{
}
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_CAMERA, CameraPxiCallback);
// 電源On
CAMERA_PowerOn();
// カメラ初期化
//CAMERA_I2CInit(CAMERA_SELECT_BOTH);
CAMERA_I2CInit(CAMERA_SELECT_IN);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_End
Description: CAMERAライブラリを終了する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void CAMERA_End(void)
{
// 初期化済みを確認
if (cameraInitialized == 0)
{
return;
}
cameraInitialized = 0;
// カメラ停止
CAMERA_Stop();
// PXI関連停止
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_CAMERA, NULL);
// 電源Off
CAMERA_PowerOff();
}
/*---------------------------------------------------------------------------*
Name: CAMERA_Start
Description: API使
sync version only
Arguments: camera - one of CameraSelect
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Start(CameraSelect camera)
{
CAMERAResult result;
if (camera == CAMERA_SELECT_NONE || camera == CAMERA_SELECT_BOTH)
{
return CAMERA_RESULT_ILLEGAL_PARAMETER;
}
result = CAMERA_I2CActivate(camera);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
return result;
}
CAMERA_StopCapture();
while ( CAMERA_IsBusy() != FALSE)
{
}
CAMERA_ClearBuffer();
CAMERA_StartCapture();
return CAMERA_RESULT_SUCCESS_TRUE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_Stop
Description: API
sync version only
Arguments: None
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Stop(void)
{
CAMERA_StopCapture();
while ( CAMERA_IsBusy() != FALSE)
{
}
return CAMERA_I2CActivate(CAMERA_SELECT_NONE);
}
/*---------------------------------------------------------------------------*

View File

@ -28,6 +28,7 @@
static void VBlankIntr(void);
static void CameraIntr(void);
static BOOL startRequest = FALSE;
/*---------------------------------------------------------------------------*
Name: TwlMain
@ -63,17 +64,7 @@ void TwlMain()
GX_DispOn();
// カメラ初期化
CAMERA_Init(); // create camera thread
CAMERA_PowerOn(); // wakeup camera module
result = CAMERA_I2CInit(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CInit was failed. (%d)\n", result);
CAMERA_PowerOff();
OS_Terminate();
}
OS_TPrintf("CAMERA_I2CInit was done successfully.\n");
CAMERA_Init(); // wakeup camera module
result = CAMERA_I2CActivate(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
@ -100,10 +91,8 @@ void TwlMain()
OS_SetIrqFunction(OS_IE_CAM, CameraIntr);
(void)OS_EnableIrqMask(OS_IE_CAM);
// カメラスタート (DMAはここで開始してもしなくても良い)
CAMERA_ClearBuffer();
CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, BYTES_PER_LINE * LINES_AT_ONCE, BYTES_PER_LINE * HEIGHT);
CAMERA_Start();
// カメラスタート (リクエストのみ)
startRequest = TRUE;
OS_TPrintf("Camera is shooting a movie...\n");
while (1)
@ -136,65 +125,51 @@ void TwlMain()
result = CAMERA_I2CActivate(CAMERA_SELECT_NONE);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
}
if (trg & PAD_BUTTON_START) // start/stop to capture
if (trg & PAD_BUTTON_START) // start/stop to capture w/o Activate API
{
if (OS_GetIrqMask() & OS_IE_CAM)
if (CAMERA_IsBusy())
{
// clear the handler
(void)OS_DisableIrqMask(OS_IE_CAM);
OS_TPrintf("call CAMERA_Stop()... ");
CAMERA_Stop();
CAMERA_StopCapture();
while (CAMERA_IsBusy())
{
}
OS_TPrintf("Camera was stopped.\n");
MIi_StopExDma(DMA_NO);
}
else
{
// set the handler
OS_SetIrqFunction(OS_IE_CAM, CameraIntr);
(void)OS_EnableIrqMask(OS_IE_CAM);
CAMERA_ClearBuffer();
CAMERA_Start();
startRequest = TRUE;
OS_TPrintf("Camera is shooting a movie...\n");
while (CAMERA_IsBusy() == FALSE)
{
}
}
}
if (trg & PAD_BUTTON_SELECT) // power on/off
{
if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK)
{
OS_TPrintf("call CAMERA_I2CActivate(CAMERA_SELECT_NONE)... ");
result = CAMERA_I2CActivate(CAMERA_SELECT_NONE);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
OS_TPrintf("call CAMERA_PowerOff()... ");
CAMERA_PowerOff();
OS_TPrintf("call CAMERA_End()... ");
CAMERA_End();
OS_TPrintf("Done.\n");
MIi_StopExDma(DMA_NO);
}
else
{
OS_TPrintf("call CAMERA_PowerOn()... ");
CAMERA_PowerOn();
OS_TPrintf("call CAMERA_Init()... ");
CAMERA_Init();
OS_TPrintf("Done.\n");
OS_TPrintf("call CAMERA_I2CInit(CAMERA_SELECT_IN)... ");
result = CAMERA_I2CInit(CAMERA_SELECT_IN);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
#if 0
// resize
OS_TPrintf("call CAMERA_I2CResize(CAMERA_SELECT_IN)... ");
result = CAMERA_I2CResize(CAMERA_SELECT_IN, 320, 240);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
#endif
// activate inside camera first
OS_TPrintf("call CAMERA_I2CActivate(CAMERA_SELECT_IN)... ");
result = CAMERA_I2CActivate(CAMERA_SELECT_IN);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
// set misc registers
CAMERA_SetTrimmingParamsCenter(WIDTH, HEIGHT, 320, 240); // clipped by camera i/f
CAMERA_SetTrimming(TRUE);
CAMERA_SetOutputFormat(CAMERA_OUTPUT_RGB);
CAMERA_SetTransferLines(CAMERA_GET_MAX_LINES(WIDTH));
CAMERA_SetVsyncIntrrupt(CAMERA_INTR_VSYNC_POSITIVE_EDGE); // almost end of vblank
CAMERA_SetBufferErrorIntrrupt(TRUE);
CAMERA_SetMasterIntrrupt(TRUE);
}
}
}
@ -215,42 +190,54 @@ void VBlankIntr(void)
Start時にDMAを開始しない場合Startのタイミングによっては
Start時にDMAを開始している場合StartのタイミングによってはDMAが停止していないから始まる
DMA周りの管理をカメラのVsyncからDMA割り込みに変えても良いかも
Vsync自体はCAMERA_Start/Stopとは関係なく発生している(Acitavate(NONE))
StartやStopはメインルーチンではフラグを立てるだけとし
(Startだけフラグとして実装している)
Acitivate(NONE) I2CInit中はVsyncが発生するので注意
Activate(NONE)Stopを呼んでもずっとBUSYのままとなるので注意
(Vsyncで状態が切り替わるのにVsyncがこなくなるので ())
DMAが動いている場合と止まっている場合がある
#endif
#define PRINT_RATE 32
void CameraIntr(void)
{
OS_TPrintf(".");
OS_SetIrqCheckFlag(OS_IE_CAM); // checking camera interrupt
if (CAMERA_GetErrorStatus()) // error?
{
OS_TPrintf("Error was occurred.\n");
// 停止処理
CAMERA_Stop(); // カメラ停止
CAMERA_StopCapture(); // カメラ停止
CAMERA_ClearBuffer(); // クリア (すぐにできる?)
MIi_StopExDma(DMA_NO); // DMA停止
while (CAMERA_IsBusy()) // 待ち
{
}
// カメラ再開
CAMERA_ClearBuffer();
CAMERA_Start();
return; // waiting next frame (skip current frame)
startRequest = TRUE; // カメラ再開要求
return; // waiting next frame (skip current frame)
}
// 以降はVsync時の処理
if (MIi_IsExDmaBusy(DMA_NO)) // NOT done to capture last frame?
if (startRequest)
{
OS_TPrintf("DMA was not done until VBlank.\n");
return; // waiting next frame (skip current frame)
CAMERA_ClearBuffer();
CAMERA_StartCapture();
startRequest = FALSE;
}
if (CAMERA_IsBusy() == FALSE) // done to execute stop command?
{
OS_TPrintf("Finished receiving final frame.\n");
// disable this handler?
//OS_TPrintf("while stopping the capture or just finished\n");
}
else
{
OS_TPrintf(".");
if (MIi_IsExDmaBusy(DMA_NO)) // NOT done to capture last frame?
{
OS_TPrintf("DMA was not done until VBlank.\n");
return; // waiting next frame (skip current frame)
}
// start to capture for next frame
CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, BYTES_PER_LINE * LINES_AT_ONCE, BYTES_PER_LINE * HEIGHT);
}
@ -266,7 +253,8 @@ void CameraIntr(void)
else if (++count == PRINT_RATE)
{
OSTick uspf = OS_TicksToMicroSeconds(OS_GetTick() - begin) / count;
OS_TPrintf("%2d.%03d fps\n", (int)(1000000LL / uspf), (int)(1000000000LL / uspf) % 1000);
int mfps = (int)(1000000000LL / uspf);
OS_TPrintf("%2d.%03d fps\n", mfps / 1000, mfps % 1000);
count = 0;
begin = OS_GetTick();
}

View File

@ -35,11 +35,9 @@ static void VBlankIntr(void);
static void CameraDmaIntr(void);
static void CameraErrIntr(void);
#include <nitro/dtcm_begin.h>
volatile int lineNumber = 0;
#include <nitro/dtcm_end.h>
static BOOL effect = FALSE;
static u16 pipeBuffer[BYTES_PER_LINE * LINES_AT_ONCE / sizeof(u16)] ATTRIBUTE_ALIGN(4);
static int lineNumber = 0;
static BOOL effectFlag = FALSE;
static u16 pipeBuffer[BYTES_PER_LINE * LINES_AT_ONCE / sizeof(u16)] ATTRIBUTE_ALIGN(32);
/*---------------------------------------------------------------------------*
Name: TwlMain
@ -75,17 +73,7 @@ void TwlMain()
GX_DispOn();
// カメラ初期化
CAMERA_Init(); // create camera thread
CAMERA_PowerOn(); // wakeup camera module
result = CAMERA_I2CInit(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CInit was failed. (%d)\n", result);
CAMERA_PowerOff();
OS_Terminate();
}
OS_TPrintf("CAMERA_I2CInit was done successfully.\n");
CAMERA_Init(); // wakeup camera module
result = CAMERA_I2CActivate(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
@ -121,14 +109,14 @@ void TwlMain()
// カメラスタート
lineNumber = 0;
CAMERA_ClearBuffer();
CAMERA_Start();
CAMERA_StartCapture();
OS_TPrintf("Camera is shooting a movie...\n");
while (1)
{
u16 pad;
u16 trg;
static u16 old = 0;//0xffff; // ignore the trigger by first data
static u16 old = 0xffff; // ignore the trigger by first data
OS_WaitVBlankIntr();
@ -138,9 +126,8 @@ void TwlMain()
if (trg & PAD_BUTTON_A)
{
effect ^= 1;
DC_StoreRange(&effect, sizeof(effect));
OS_TPrintf("Effect %s\n", effect ? "ON" : "OFF");
effectFlag ^= 1;
OS_TPrintf("Effect %s\n", effectFlag ? "ON" : "OFF");
}
}
}
@ -159,7 +146,7 @@ void VBlankIntr(void)
#define PRINT_RATE 32
void CameraDmaIntr(void)
{
int line = lineNumber;
static BOOL effect = FALSE;
OS_SetIrqCheckFlag(DMA_IE); // checking dma interrupt
// 必要な処理をしてフレームバッファにコピーする
@ -167,24 +154,26 @@ void CameraDmaIntr(void)
{
int i;
u32 *src = (u32*)pipeBuffer;
u32 *dest = (u32*)HW_LCDC_VRAM_A + line * WIDTH / 2;
u32 *dest = (u32*)HW_LCDC_VRAM_A + lineNumber * WIDTH / 2;
for (i = 0; i < WIDTH * LINES_AT_ONCE / 2; i++) // pack 2 pixel data
{
dest[i] = ~src[i]; // reverse (if using RGBA format, set bitOR with 0x10001000)
dest[i] = ~src[i]; // reverse (if using RGBA format, should bitORed with 0x10001000)
}
}
else
{
MI_CpuCopy8(pipeBuffer, (u16*)HW_LCDC_VRAM_A + line * WIDTH, sizeof(pipeBuffer));
MI_CpuCopy8(pipeBuffer, (u16*)HW_LCDC_VRAM_A + lineNumber * WIDTH, sizeof(pipeBuffer));
}
DC_InvalidateRange(pipeBuffer, sizeof(pipeBuffer));
line += LINES_AT_ONCE;
if (line >= HEIGHT)
lineNumber += LINES_AT_ONCE;
if (lineNumber >= HEIGHT)
{
static OSTick begin = 0;
static int count = 0;
// 必要ならdestFrameのスワップなど
// 必要ならフレームバッファのスワップなど
effect = effectFlag; // このタイミングで反映
// debug print
OS_TPrintf(".");
@ -195,19 +184,14 @@ void CameraDmaIntr(void)
else if (++count == PRINT_RATE)
{
OSTick uspf = OS_TicksToMicroSeconds(OS_GetTick() - begin) / count;
OS_TPrintf("%2d.%03d fps\n", (int)(1000000LL / uspf), (int)(1000000000LL / uspf) % 1000);
int mfps = (int)(1000000000LL / uspf);
OS_TPrintf("%2d.%03d fps\n", mfps / 1000, mfps % 1000);
count = 0;
begin = OS_GetTick();
}
DC_StoreRange(&begin, sizeof(begin));
DC_StoreRange(&count, sizeof(count));
lineNumber = 0;
}
else
{
lineNumber = line;
}
}
//--------------------------------------------------------------------------------
@ -223,10 +207,10 @@ void CameraErrIntr(void)
OS_TPrintf("Error was occurred.\n");
// カメラ停止
CAMERA_Stop();
CAMERA_StopCapture();
lineNumber = 0;
// カメラ再開
CAMERA_ClearBuffer();
CAMERA_Start();
CAMERA_StartCapture();
}

View File

@ -84,7 +84,7 @@ BOOL CAMERA_IsBusy( void );
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Start( void );
void CAMERA_StartCapture( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_Stop
@ -95,7 +95,7 @@ void CAMERA_Start( void );
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Stop( void );
void CAMERA_StopCapture( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimmingParamsCenter

View File

@ -55,6 +55,41 @@ typedef void (*CAMERACallback)(CAMERAResult result, void *arg);
*---------------------------------------------------------------------------*/
void CAMERA_Init(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_End
Description: CAMERAライブラリを終了する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void CAMERA_End(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_Start
Description: API使
sync version only
Arguments: camera - one of CameraSelect
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Start(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_Stop
Description: API
sync version only
Arguments: None
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Stop(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInitAsync