add camera

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@92 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
yutaka 2007-05-28 10:17:36 +00:00
parent 4dbd151f6d
commit 9194271a66
34 changed files with 7818 additions and 5 deletions

View File

@ -459,9 +459,9 @@
0x1052,,DB_BLDALPHA,16,rw,G2S,volatile,EVB,8,5,EVA,0,5,,,,,,,,,,,,,,,,,,,,,,,,
0x1054,,DB_BLDY,16,rw,G2S,volatile,EVY,0,5,,,,,,,,,,,,,,,,,,,,,,,,,,,
#twl p79 <20>` 84,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
0x4200,,MCNT,16,rw,CAM,volatile,INI,7,1,V28,6,1,VIO,5,1,V18,4,1,IRCLK,3,1,SYNC,2,1,RSTN,1,1,STBYN,0,1,,,,,,
0x4202,,CNT,16,rw,CAM,volatile,E,15,1,T,14,1,F,13,1,IREQ_I,11,1,IREQ_BE,10,1,IREQ_VS1,9,1,IREQ_VS0,8,1,CL,7,1,ERR,6,1,TL,0,4
0x4204,,DAT,32,r,CAM,volatile,DATA,0,32,,,,,,,,,,,,,,,,,,,,,,,,,,,
0x4200,,CAM_MCNT,16,rw,CAM,volatile,INI,7,1,V28,6,1,VIO,5,1,V18,4,1,IRCLK,3,1,SYNC,2,1,RSTN,1,1,STBYN,0,1,,,,,,
0x4202,,CAM_CNT,16,rw,CAM,volatile,E,15,1,T,14,1,F,13,1,IREQ_I,11,1,IREQ_BE,10,1,IREQ_VS,8,2,CL,5,1,ERR,4,1,TL,0,4
0x4204,,CAM_DAT,32,r,CAM,volatile,DATA,0,32,,,,,,,,,,,,,,,,,,,,,,,,,,,
0x4210,,SOFS_H,16,rw,CAM,volatile,OFFSET,0,10
0x4212,,SOFS_V,16,rw,CAM,volatile,OFFSET,0,9
0x4214,,EOFS_H,16,rw,CAM,volatile,OFFSET,0,10

Can't render this file because it has a wrong number of fields in line 17.

View File

@ -159,6 +159,7 @@ TWL_LIBS_BASE ?= \
libvlink \
libctrdg \
libaes \
libcamera \
ifdef TWL_PROFILE_TYPE
TWL_LIBS_BASE += libos.$(TWL_PROFILE_TYPE)
@ -176,6 +177,7 @@ TWL_LIBS_BASE ?= \
libi2c_sp \
libcdc_sp \
libsnd_sp \
libcamera_sp \
ifdef TWL_PROFILE_TYPE
TWL_LIBS_BASE += libos_sp.$(TWL_PROFILE_TYPE)

View File

@ -32,7 +32,7 @@ SUBDIRS = \
i2c \
cdc \
snd \
camera \
#----------------------------------------------------------------------------
export NITRO_BLXCHECKED = yes

View File

@ -0,0 +1,31 @@
sef00
s8000 // for 320x240
s8101
sc400
sc5f0
sc601
sc740
sef02
s5821 // PLL 33Mhz 30fps
s590c
s5a24 // for 33MHz
//s5821 // PLL on
//s591A // pll_s=0, pll_p=26,
//s5A1A // pll_m=26
//s289B // CFPN on **** Revised at EVT1
sef01
sd189 // 0209 16.7Mhz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000
sef01
s7167 // AE Target similar to 20fps noPLL setting
sd915 //AE saturation CHIP_DEBUG

View File

@ -0,0 +1,28 @@
sef00
s8000 // for 320x240
s8101
sc400
sc5f0
sc601
sc740
sef01
se400 // 0209 for PLL off 20fps // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps)
se525 // 0209 //ea // 24MHz NT VblankL (H.L)
//
//s5861 // PLL off
//s594c
//s5a30 // for 48MHz
//
//s289B // CFPN on **** Revised at EVT1
//
////061011
//sef01
//sd189 // 0209 16.7Mhz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000
sef01
s7173 // AE Target Default (73h)

View File

@ -0,0 +1,708 @@
// 10.18 X shading, Color correction, RGB shading
// <0. D9> 50->C0
// <1. E0> 04 -> 07, <0. D1>설정값이 B2미만시 영상 흘러내림 관련.
// 07로 변경시 63이하에 대해 흘러내림 발생. 13M이상에 대해 만족함.
// <1. B7> 68 -> 58, NL color saturation level
// <2. 23> DB -> D8, Tx width Sel
// <2. 3A> 60 -> 20, double shutter OFF
// <2. 0B> 81 -> 85 Negative (subsampling시)
//------------------------------------------------------------------
// Set File
// - S5KA3AFX_xshade_060913.xls generates
// - date : 2007-01-08오후 2:45:52
//------------------------------------------------------------------
// Page : 00
sef00
s0b39 // B gain
s0d03
s0e00
s0f1F
s1000
s1137
s1208
s1342
s1400
s1512
s169E
s1900
s1707
s18F2
s1901
s1707
s18F5
s1902
s1707
s18E8
s1903
s1707
s18E6
s1904
s1707
s18E2
s1905
s1707
s18D9
s1906
s1707
s18DB
s1907
s1700
s1806
s1908
s1707
s18FF
s1909
s1707
s18FF
s190A
s1707
s18FC
s190B
s1707
s18F4
s190C
s1707
s18F5
s190D
s1707
s18ED
s190E
s1700
s181C
s190F
s1700
s1811
s1910
s1700
s1812
s1911
s1700
s1813
s1912
s1700
s1808
s1913
s1700
s180A
s1914
s1700
s1806
s1915
s1700
s1827
s1916
s1700
s182F
s1917
s1700
s1828
s1918
s1700
s181E
s1919
s1700
s181A
s191A
s1700
s1817
s191B
s1700
s181B
s191C
s1700
s1843
s191D
s1700
s1838
s191E
s1700
s183B
s191F
s1700
s1835
s1920
s1700
s1835
s1921
s1700
s1830
s1922
s1700
s182E
s1940
//////////////////////////////////////////////////////////
//sef00
//sca02 //Raw data out
//sef00
//scb00 // Normal mode
//
//sef01
//s7000 // AE/AWB off //Jee hwan: 06.10.27
//
//sef02 //shutter off //Jee hwan: 06.10.27
//s0122
sef02 // CIS page
//s4b5E // PCLK driving current max
s23d8 // Tx width
s3a20 // double shutter off
s6508 // CIS mode
s0a90 // Display WCW
s0126 // E-shutter enable
s0378 // S1R END **** Revised at EVT1
s0500 // S1S end value control
s07E5 // S2 END
s090E // S4 END
s0b81 //85 //81 // Analog offset
s1320 //a0 // R_REF
//s1580 // EC COMP 100'b
s1c57 // global gain **** Revised at EVT1
s243d // i_cds **** Revised at EVT1
s2625 // clamp level control **** Revised at EVT1
s298f // CFPN start frame (16)
s4b5b // IO driving current
s5605 // Line ADLC
s5861 // amp bias current source select (71h : self bias)
s5f06 // aps bias current
s673c // EC_COMP & SAVG_END
s6810 // i_rmp control
s6913 // i_mid
s5821 // PLL for 30MHz 20fps
s5950
s5a3c
//s5821 // PLL on
//s591A // pll_s=0, pll_p=26,
//s5A1A // pll_m=26
s289B // CFPN on **** Revised at EVT1
//061011
sef01
sd18a // for 16.8MHz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000
//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000
//sd915 //AE saturation CHIP_DEBUG
//////////
//page 0
//////////
sef00
//s093e //gr gain
sef00
s2960 //GrGb
// AE Window
sef00
s5500 // AE window
s5800
s5931
s5a02
s5b47
s5c00
s5d64
s5e01
s5fac
s6000
s6173
s6202
s630c
s6400
s65ab
s6601
s677e
sef01 // AE weight
s7701
s7801
//s7903
//s7a03
//s7b04
//s7c04
sef00
s5718 // AE Lux min threshold
sd9c0 // color edge threshold
/////////////////////////////////////////////////////
//page 1/////////////////////////////////////////////
/////////////////////////////////////////////////////
sef01
s837d // R gain max
s8430 // B gain max
saf00 //L.L Brightness
sb4b0 //a0 // N.L contrast
sb5b0 //a0 // L.L contrast
sb746 //58 //68 // N.L color saturation
sb830 //52 // L.L color saturation
s7097 //17 // fix PAL(50Hz)
s715a //68 //70 //6f //4d //60 //78 //AE target
s720c //12 //0a //05 //12 // AE threshold
s7463 //60 //70 //74 //70 // low agc max
s7540 // normal agc max
sa640 //80 //N.L sharpness H/V Gain
sab24 //18 //60 //N.L NR Edge
sad40 //20 //L.L NR Edge
//sa330 //AWB speed //EVT0은 고정되어 있음.(0x03) //EVT1은 변경 가능.
scc09 //08 //Flicker threshold 12
sd522 //32 //Chip_Debug2
se008 // NT Max
se208 //07 //18 // Low NT max
se106 // PAL Max
se306 //07 //18 // Low PAL max
se401 // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps)
se5a9 //ea // 24MHz NT VblankL (H.L)
//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 28~5fps)
//se52a // 13MHz VblankL (H.L)
se843 //44 //84 //97 // ae speed
sef00
//s8c0e //skin color detection
sc80a //YC delay
////////////////////////////////////////
// Color Correction -> Shading -> Gamma -> AWB -> Hue
////////////////////////////////////////
// Color Correction
sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old
s4c40 //95 //95 //81 //8a //50 //62 //56
s4d92 //c2 //c2 //ba //d2 //af //a9 //8d
s4e0f //92 //92 //87 //07 //1f //07 //89
s4f9a //9b //9b //98 //9e //9e //a2 //94
s503b //73 //73 //64 //4c //2e //47 //5c
s511e //98 //98 //8c //12 //30 //1b //8b
s5282 //80 //80 //80 //80 //86 //85 //80
s53bf //b3 //b3 //ad //cd //eb //f2 //91
s547f //73 //73 //6d //8e //b2 //b8 //51
//////CW
//sef00
//s4c92
//s4dcf
//s4e82
//s4fad
//s506e
//s5180
//s5287
//s53eb
//s54b2
//
////D65
//sef00
//s4c8a
//s4dc2
//s4e88
//s4f9f
//s5072
//s5193
//s5281
//s53ca
//s548c
//Default
//sef00
//s4c56
//s4d8d
//s4e89
//s4f96
//s505d
//s5188
//s5294
//s5389
//s545d
// Shading2 //// RGB Shading// RGB Shading// RGB Shading
// // //linear//old
sef00 //sef00 //sef00 //00 //00 //00 //00
s3001 //s3001 //s3001 //01 //01 //01 //01
s322a //0a //s3200 //s3200 //00 //00 //00 //00
s360a //s3600 //s3600 //00 //00 //00 //00
s3a0a //s3a00 //s3a00 //00 //00 //00 //00
s3300 //s3301 //s3300 //00 //01 //00 //01
s3400 //s3450 //s3400 //32 //50 //00 //50
s3700 //s3701 //s3700 //00 //01 //00 //01
s3800 //s3850 //s3800 //50 //50 //00 //50
s3b00 //s3b01 //s3b00 //00 //01 //00 //01
s3c00 //s3c50 //s3c00 //00 //50 //00 //50
s31b6 //fd //s31df //s3187 //ff //ff //5e //ff
s35df //da //s35b8 //s3569 //d7 //da //54 //da
s39bf //c1 //s39a9 //s395a //be //e6 //4d //e6
s3f01 //s3f01 //s3f01 //01 //01 //01 //01
s4036 //4a //s4040 //s4040 //4a //40 //40 //40
s3d01 //s3d00 //s3d01 //00 //00 //01 //00
s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0
//sef00
////Gamma(Red)
//s4800
//s4900
//s4A08
//s4BF0
//s4801
//s4900
//s4A10
//s4BB6
//s4802
//s4900
//s4A20
//s4B5F
//s4803
//s4900
//s4A40
//s4B4F
//s4804
//s4900
//s4A80
//s4B37
//s4805
//s4901
//s4A00
//s4B27
//s4806
//s4901
//s4AC0
//s4B1C
//s4807
//s4902
//s4A80
//s4B14
//s4808
//s4903
//s4A00
//s4B14
//s4809
//s4903
//s4A80
//s4B12
//s480A
//s4903
//s4AC0
//s4B10
//s480D
//s4B14
////Gamma(Green)
//s4810
//s4900
//s4A08
//s4BF0
//s4811
//s4900
//s4A10
//s4BB6
//s4812
//s4900
//s4A20
//s4B5F
//s4813
//s4900
//s4A40
//s4B4F
//s4814
//s4900
//s4A80
//s4B37
//s4815
//s4901
//s4A00
//s4B27
//s4816
//s4901
//s4AC0
//s4B1C
//s4817
//s4902
//s4A80
//s4B14
//s4818
//s4903
//s4A00
//s4B14
//s4819
//s4903
//s4A80
//s4B12
//s481A
//s4903
//s4AC0
//s4B10
//s481D
//s4B14
////Gamma(Blue)
//s4820
//s4900
//s4A08
//s4BF0
//s4821
//s4900
//s4A10
//s4BB6
//s4822
//s4900
//s4A20
//s4B5F
//s4823
//s4900
//s4A40
//s4B4F
//s4824
//s4900
//s4A80
//s4B37
//s4825
//s4901
//s4A00
//s4B27
//s4826
//s4901
//s4AC0
//s4B1C
//s4827
//s4902
//s4A80
//s4B14
//s4828
//s4903
//s4A00
//s4B14
//s4829
//s4903
//s4A80
//s4B12
//s482A
//s4903
//s4AC0
//s4B10
//s482D
//s4B14
//s4880
//gamma5
sef00
//Gamma(Red)
s4800
s4900
s4A08
s4B1B
s4801
s4900
s4A10
s4B4E
s4802
s4900
s4A20
s4B6F
s4803
s4900
s4A40
s4B59
s4804
s4900
s4A80
s4B33
s4805
s4901
s4A00
s4B2B
s4806
s4901
s4AC0
s4B20
s4807
s4902
s4A80
s4B19
s4808
s4903
s4A00
s4B16
s4809
s4903
s4A80
s4B13
s480A
s4903
s4AC0
s4B12
s480B
s4B14
//Gamma(Green)
s4810
s4900
s4A08
s4B1B
s4811
s4900
s4A10
s4B4E
s4812
s4900
s4A20
s4B6F
s4813
s4900
s4A40
s4B59
s4814
s4900
s4A80
s4B33
s4815
s4901
s4A00
s4B2B
s4816
s4901
s4AC0
s4B20
s4817
s4902
s4A80
s4B19
s4818
s4903
s4A00
s4B16
s4819
s4903
s4A80
s4B13
s481A
s4903
s4AC0
s4B12
s481B
s4B14
//Gamma(Blue)
s4820
s4900
s4A08
s4B1B
s4821
s4900
s4A10
s4B4E
s4822
s4900
s4A20
s4B6F
s4823
s4900
s4A40
s4B59
s4824
s4900
s4A80
s4B33
s4825
s4901
s4A00
s4B2B
s4826
s4901
s4AC0
s4B20
s4827
s4902
s4A80
s4B19
s4828
s4903
s4A00
s4B16
s4829
s4903
s4A80
s4B13
s482A
s4903
s4AC0
s4B12
s482B
s4B14
s4880
//AWB
//sef00
//s9301 // AWB map
//sa00f
//s9f0f
//s9300
//AWB mode : auto(??)
//sef01
//s8000
// Hue
sef00
s8c0c //Skin Color Detection On/Off
s7400 //00 //Hue & Saturation Off=00, On=01
s7958 //Saturation Gain
s7501 //Hue & Saturation Cosine 1
s7660 //ff //Hue & Saturation Cosine 2
s7702 //Hue & Saturation Sine 1
s7811 //Hue & Saturation Sine 2
s7295 //b0 //90 //Contrast Gain
//s7389 //Brightness Gain
sd800 //Edge color suppress
//sef02
//s0f40
//AWB white's count low 0f00 --> 0708
sef01
s8507 //0f //07
s8608 //00 //08
//AWB boundary
//sef00
//sb100
//sb221
//sb300
//sb42c
//sb501
//sb6e0
//sb702
//sb870
// Bad Pixel Replacement
//sef00
//s1a01
//s1b00
//s1e00
//s1c00
//s1f00
//s1d00
//s2000
sef01
sb930
sba00
seb40 //6f //Low Light Indication AGC
//
//sef02 //shutter on //Jee hwan: 06.10.27
//s0126
//
//sef01 // AE/AWB on //Jee hwan: 06.10.27
//s7017

View File

@ -0,0 +1,512 @@
// 10.18 X shading, Color correction, RGB shading
// <0. D9> 50->C0
// <1. E0> 04 -> 07, <0. D1>설정값이 B2미만시 영상 흘러내림 관련.
// 07로 변경시 63이하에 대해 흘러내림 발생. 13M이상에 대해 만족함.
// <1. B7> 68 -> 58, NL color saturation level
// <2. 23> DB -> D8, Tx width Sel
// <2. 3A> 60 -> 20, double shutter OFF
// <2. 0B> 81 -> 85 Negative (subsampling시)
//------------------------------------------------------------------
// Set File
// - S5KA3AFX_xshade_060913.xls generates
// - date : 2007-01-08오후 2:45:52
//------------------------------------------------------------------
// Page : 00
sef00
sc3a0 // 320x480
sc601
sc740
s0d03
s0e00
s0f1F
s1000
s1137
s1208
s1342
s1400
s1512
s169E
s1900
s1707
s18F2
s1901
s1707
s18F5
s1902
s1707
s18E8
s1903
s1707
s18E6
s1904
s1707
s18E2
s1905
s1707
s18D9
s1906
s1707
s18DB
s1907
s1700
s1806
s1908
s1707
s18FF
s1909
s1707
s18FF
s190A
s1707
s18FC
s190B
s1707
s18F4
s190C
s1707
s18F5
s190D
s1707
s18ED
s190E
s1700
s181C
s190F
s1700
s1811
s1910
s1700
s1812
s1911
s1700
s1813
s1912
s1700
s1808
s1913
s1700
s180A
s1914
s1700
s1806
s1915
s1700
s1827
s1916
s1700
s182F
s1917
s1700
s1828
s1918
s1700
s181E
s1919
s1700
s181A
s191A
s1700
s1817
s191B
s1700
s181B
s191C
s1700
s1843
s191D
s1700
s1838
s191E
s1700
s183B
s191F
s1700
s1835
s1920
s1700
s1835
s1921
s1700
s1830
s1922
s1700
s182E
s1940
//////////////////////////////////////////////////////////
//sef00
//sca02 //Raw data out
//sef00
//scb00 // Normal mode
//
//sef01
//s7000 // AE/AWB off //Jee hwan: 06.10.27
//
//sef02 //shutter off //Jee hwan: 06.10.27
//s0122
sef02 // CIS page
//s4b5E // PCLK driving current max
s23d8 // Tx width
s3a20 // double shutter off
s6508 // CIS mode
s0a90 // Display WCW
s0126 // E-shutter enable
s0378 // S1R END **** Revised at EVT1
s0500 // S1S end value control
s07E5 // S2 END
s090E // S4 END
s0b81 //85 //81 // Analog offset
s1320 //a0 // R_REF
//s1580 // EC COMP 100'b
s1c57 // global gain **** Revised at EVT1
s243d // i_cds **** Revised at EVT1
s2625 // clamp level control **** Revised at EVT1
s298f // CFPN start frame (16)
s4b5b // IO driving current
s5605 // Line ADLC
s5861 // amp bias current source select (71h : self bias)
s5f06 // aps bias current
s673c // EC_COMP & SAVG_END
s6810 // i_rmp control
s6913 // i_mid
s5861 // PLL off
s594c
s5a30 // for 48MHz
s289B // CFPN on **** Revised at EVT1
//061011
sef01
sd189 // 0209 16.7Mhz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000
//////////
//page 0
//////////
sef00
//s093e //gr gain
s093d // 0208
s0a3d // 0208
sef00
s2960 //GrGb
// AE Window
sef00
s5500 // AE window
s5800
s5931
s5a02
s5b47
s5c00
s5d64
s5e01
s5fac
s6000
s6173
s6202
s630c
s6400
s65ab
s6601
s677e
sef01 // AE weight
s7701
s7801
//s7903
//s7a03
//s7b04
//s7c04
sef00
s5718 // AE Lux min threshold
sd9c0 // color edge threshold
/////////////////////////////////////////////////////
//page 1/////////////////////////////////////////////
/////////////////////////////////////////////////////
sef01
s837d // R gain max
s8430 // B gain max
saf00 //L.L Brightness
sb4b0 //a0 // N.L contrast
sb5b0 //a0 // L.L contrast
sb746 //58 //68 // N.L color saturation
sb830 //52 // L.L color saturation
s7097 //17 // fix PAL(50Hz)
s715a //68 //70 //6f //4d //60 //78 //AE target
s720c //12 //0a //05 //12 // AE threshold
s746a //60 //70 //74 //70 // low agc max
s7540 // normal agc max
sa640 //80 //N.L sharpness H/V Gain
sab24 //18 //60 //N.L NR Edge
sad40 //20 //L.L NR Edge
//sa330 //AWB speed //EVT0은 고정되어 있음.(0x03) //EVT1은 변경 가능.
scc09 //08 //Flicker threshold 12
sd522 //32 //Chip_Debug2
se008 // NT Max
se208 //07 //18 // Low NT max
se106 // PAL Max
se306 //07 //18 // Low PAL max
se400 // 0209 for PLL off 20fps // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps)
se525 // 0209 //ea // 24MHz NT VblankL (H.L)
se843 //44 //84 //97 // ae speed
sef00
//s8c0e //skin color detection
sc80a //YC delay
////////////////////////////////////////
// Color Correction -> Shading -> Gamma -> AWB -> Hue
////////////////////////////////////////
// Color Correction
sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old
s4c40 //95 //95 //81 //8a //50 //62 //56
s4d92 //c2 //c2 //ba //d2 //af //a9 //8d
s4e0f //92 //92 //87 //07 //1f //07 //89
s4f9a //9b //9b //98 //9e //9e //a2 //94
s503b //73 //73 //64 //4c //2e //47 //5c
s511e //98 //98 //8c //12 //30 //1b //8b
s5282 //80 //80 //80 //80 //86 //85 //80
s53bf //b3 //b3 //ad //cd //eb //f2 //91
s547f //73 //73 //6d //8e //b2 //b8 //51
// Shading2 //// RGB Shading// RGB Shading// RGB Shading
// // //linear//old
sef00 //sef00 //sef00 //00 //00 //00 //00
s3001 //s3001 //s3001 //01 //01 //01 //01
s322a //0a //s3200 //s3200 //00 //00 //00 //00
s360a //s3600 //s3600 //00 //00 //00 //00
s3a0a //s3a00 //s3a00 //00 //00 //00 //00
s3300 //s3301 //s3300 //00 //01 //00 //01
s3400 //s3450 //s3400 //32 //50 //00 //50
s3700 //s3701 //s3700 //00 //01 //00 //01
s3800 //s3850 //s3800 //50 //50 //00 //50
s3b00 //s3b01 //s3b00 //00 //01 //00 //01
s3c00 //s3c50 //s3c00 //00 //50 //00 //50
s31b6 //fd //s31df //s3187 //ff //ff //5e //ff
s35df //da //s35b8 //s3569 //d7 //da //54 //da
s39bf //c1 //s39a9 //s395a //be //e6 //4d //e6
s3f01 //s3f01 //s3f01 //01 //01 //01 //01
s4036 //4a //s4040 //s4040 //4a //40 //40 //40
s3d01 //s3d00 //s3d01 //00 //00 //01 //00
s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0
//gamma5
sef00
//Gamma(Red)
s4800
s4900
s4A08
s4B1B
s4801
s4900
s4A10
s4B4E
s4802
s4900
s4A20
s4B6F
s4803
s4900
s4A40
s4B59
s4804
s4900
s4A80
s4B33
s4805
s4901
s4A00
s4B2B
s4806
s4901
s4AC0
s4B20
s4807
s4902
s4A80
s4B19
s4808
s4903
s4A00
s4B16
s4809
s4903
s4A80
s4B13
s480A
s4903
s4AC0
s4B12
s480B
s4B14
//Gamma(Green)
s4810
s4900
s4A08
s4B1B
s4811
s4900
s4A10
s4B4E
s4812
s4900
s4A20
s4B6F
s4813
s4900
s4A40
s4B59
s4814
s4900
s4A80
s4B33
s4815
s4901
s4A00
s4B2B
s4816
s4901
s4AC0
s4B20
s4817
s4902
s4A80
s4B19
s4818
s4903
s4A00
s4B16
s4819
s4903
s4A80
s4B13
s481A
s4903
s4AC0
s4B12
s481B
s4B14
//Gamma(Blue)
s4820
s4900
s4A08
s4B1B
s4821
s4900
s4A10
s4B4E
s4822
s4900
s4A20
s4B6F
s4823
s4900
s4A40
s4B59
s4824
s4900
s4A80
s4B33
s4825
s4901
s4A00
s4B2B
s4826
s4901
s4AC0
s4B20
s4827
s4902
s4A80
s4B19
s4828
s4903
s4A00
s4B16
s4829
s4903
s4A80
s4B13
s482A
s4903
s4AC0
s4B12
s482B
s4B14
s4880
// Hue
sef00
s8c0c //Skin Color Detection On/Off
s7400 //00 //Hue & Saturation Off=00, On=01
s7958 //Saturation Gain
s7501 //Hue & Saturation Cosine 1
s7660 //ff //Hue & Saturation Cosine 2
s7702 //Hue & Saturation Sine 1
s7811 //Hue & Saturation Sine 2
s72a5 //95 //b0 //90 //Contrast Gain 0208
//s7389 //Brightness Gain
sd800 //Edge color suppress
//sef02
//s0f40
//AWB white's count low 0f00 --> 0708
sef01
s8507 //0f //07
s8608 //00 //08
// Bad Pixel Replacement
sef00 // 0208
s1a01
s1b20
s1e20
s1c20
s1f20
s1d20
s2020
s2b01 // 0208 NR
s2d15
sef01
sb930
sba00
seb40 //6f //Low Light Indication AGC
sef00 // 0209 sharpness
sb902
sbe80
sbf30
sc080
sc130
sef01
sa680

View File

@ -0,0 +1,715 @@
// 10.18 X shading, Color correction, RGB shading
// <0. D9> 50->C0
// <1. E0> 04 -> 07, <0. D1>설정값이 B2미만시 영상 흘러내림 관련.
// 07로 변경시 63이하에 대해 흘러내림 발생. 13M이상에 대해 만족함.
// <1. B7> 68 -> 58, NL color saturation level
// <2. 23> DB -> D8, Tx width Sel
// <2. 3A> 60 -> 20, double shutter OFF
// <2. 0B> 81 -> 85 Negative (subsampling시)
//------------------------------------------------------------------
// Set File
// - S5KA3AFX_xshade_060913.xls generates
// - date : 2007-01-08오후 2:45:52
//------------------------------------------------------------------
// Page : 00
sef00
s8000 // for 256x192
s8101
sc400
sc5c0
sc601
sc700
s0d03
s0e00
s0f1F
s1000
s1137
s1208
s1342
s1400
s1512
s169E
s1900
s1707
s18F2
s1901
s1707
s18F5
s1902
s1707
s18E8
s1903
s1707
s18E6
s1904
s1707
s18E2
s1905
s1707
s18D9
s1906
s1707
s18DB
s1907
s1700
s1806
s1908
s1707
s18FF
s1909
s1707
s18FF
s190A
s1707
s18FC
s190B
s1707
s18F4
s190C
s1707
s18F5
s190D
s1707
s18ED
s190E
s1700
s181C
s190F
s1700
s1811
s1910
s1700
s1812
s1911
s1700
s1813
s1912
s1700
s1808
s1913
s1700
s180A
s1914
s1700
s1806
s1915
s1700
s1827
s1916
s1700
s182F
s1917
s1700
s1828
s1918
s1700
s181E
s1919
s1700
s181A
s191A
s1700
s1817
s191B
s1700
s181B
s191C
s1700
s1843
s191D
s1700
s1838
s191E
s1700
s183B
s191F
s1700
s1835
s1920
s1700
s1835
s1921
s1700
s1830
s1922
s1700
s182E
s1940
//////////////////////////////////////////////////////////
//sef00
//sca02 //Raw data out
//sef00
//scb00 // Normal mode
//
//sef01
//s7000 // AE/AWB off //Jee hwan: 06.10.27
//
//sef02 //shutter off //Jee hwan: 06.10.27
//s0122
sef02 // CIS page
//s4b5E // PCLK driving current max
s23d8 // Tx width
s3a20 // double shutter off
s6508 // CIS mode
s0a90 // Display WCW
s0126 // E-shutter enable
s0378 // S1R END **** Revised at EVT1
s0500 // S1S end value control
s07E5 // S2 END
s090E // S4 END
s0b81 //85 //81 // Analog offset
s1320 //a0 // R_REF
//s1580 // EC COMP 100'b
s1c57 // global gain **** Revised at EVT1
s243d // i_cds **** Revised at EVT1
s2625 // clamp level control **** Revised at EVT1
s298f // CFPN start frame (16)
s4b5b // IO driving current
s5605 // Line ADLC
s5861 // amp bias current source select (71h : self bias)
s5f06 // aps bias current
s673c // EC_COMP & SAVG_END
s6810 // i_rmp control
s6913 // i_mid
s5821 // PLL for 45MHz 20fps
s5910
s5a2d
//s5821 // PLL on
//s591A // pll_s=0, pll_p=26,
//s5A1A // pll_m=26
s289B // CFPN on **** Revised at EVT1
//061011
sef01
sd18a // for 16.8MHz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000
//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000
//sd915 //AE saturation CHIP_DEBUG
//////////
//page 0
//////////
sef00
//s093e //gr gain
sef00
s2960 //GrGb
// AE Window
sef00
s5500 // AE window
s5800
s5931
s5a02
s5b47
s5c00
s5d64
s5e01
s5fac
s6000
s6173
s6202
s630c
s6400
s65ab
s6601
s677e
sef01 // AE weight
s7701
s7801
//s7903
//s7a03
//s7b04
//s7c04
sef00
s5718 // AE Lux min threshold
sd9c0 // color edge threshold
/////////////////////////////////////////////////////
//page 1/////////////////////////////////////////////
/////////////////////////////////////////////////////
sef01
s837d // R gain max
s8430 // B gain max
saf00 //L.L Brightness
sb4b0 //a0 // N.L contrast
sb5b0 //a0 // L.L contrast
sb746 //58 //68 // N.L color saturation
sb830 //52 // L.L color saturation
s7097 //17 // fix PAL(50Hz)
s715a //68 //70 //6f //4d //60 //78 //AE target
s720c //12 //0a //05 //12 // AE threshold
s7460 //70 //74 //70 // low agc max
s7540 // normal agc max
sa640 //80 //N.L sharpness H/V Gain
sab24 //18 //60 //N.L NR Edge
sad40 //20 //L.L NR Edge
//sa330 //AWB speed //EVT0은 고정되어 있음.(0x03) //EVT1은 변경 가능.
scc09 //08 //Flicker threshold 12
sd522 //32 //Chip_Debug2
se008 // NT Max
se208 //07 //18 // Low NT max
se106 // PAL Max
se306 //07 //18 // Low PAL max
se401 // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps)
se5a9 //ea // 24MHz NT VblankL (H.L)
//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 28~5fps)
//se52a // 13MHz VblankL (H.L)
se843 //44 //84 //97 // ae speed
sef00
//s8c0e //skin color detection
sc80a //YC delay
////////////////////////////////////////
// Color Correction -> Shading -> Gamma -> AWB -> Hue
////////////////////////////////////////
// Color Correction
sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old
s4c40 //95 //95 //81 //8a //50 //62 //56
s4d92 //c2 //c2 //ba //d2 //af //a9 //8d
s4e0f //92 //92 //87 //07 //1f //07 //89
s4f9a //9b //9b //98 //9e //9e //a2 //94
s503b //73 //73 //64 //4c //2e //47 //5c
s511e //98 //98 //8c //12 //30 //1b //8b
s5282 //80 //80 //80 //80 //86 //85 //80
s53bf //b3 //b3 //ad //cd //eb //f2 //91
s547f //73 //73 //6d //8e //b2 //b8 //51
//////CW
//sef00
//s4c92
//s4dcf
//s4e82
//s4fad
//s506e
//s5180
//s5287
//s53eb
//s54b2
//
////D65
//sef00
//s4c8a
//s4dc2
//s4e88
//s4f9f
//s5072
//s5193
//s5281
//s53ca
//s548c
//Default
//sef00
//s4c56
//s4d8d
//s4e89
//s4f96
//s505d
//s5188
//s5294
//s5389
//s545d
// Shading2 //// RGB Shading// RGB Shading// RGB Shading
// // //linear//old
sef00 //sef00 //sef00 //00 //00 //00 //00
s3001 //s3001 //s3001 //01 //01 //01 //01
s322a //0a //s3200 //s3200 //00 //00 //00 //00
s360a //s3600 //s3600 //00 //00 //00 //00
s3a0a //s3a00 //s3a00 //00 //00 //00 //00
s3300 //s3301 //s3300 //00 //01 //00 //01
s3400 //s3450 //s3400 //32 //50 //00 //50
s3700 //s3701 //s3700 //00 //01 //00 //01
s3800 //s3850 //s3800 //50 //50 //00 //50
s3b00 //s3b01 //s3b00 //00 //01 //00 //01
s3c00 //s3c50 //s3c00 //00 //50 //00 //50
s31b6 //fd //s31df //s3187 //ff //ff //5e //ff
s35df //da //s35b8 //s3569 //d7 //da //54 //da
s39bf //c1 //s39a9 //s395a //be //e6 //4d //e6
s3f01 //s3f01 //s3f01 //01 //01 //01 //01
s4036 //4a //s4040 //s4040 //4a //40 //40 //40
s3d01 //s3d00 //s3d01 //00 //00 //01 //00
s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0
//sef00
////Gamma(Red)
//s4800
//s4900
//s4A08
//s4BF0
//s4801
//s4900
//s4A10
//s4BB6
//s4802
//s4900
//s4A20
//s4B5F
//s4803
//s4900
//s4A40
//s4B4F
//s4804
//s4900
//s4A80
//s4B37
//s4805
//s4901
//s4A00
//s4B27
//s4806
//s4901
//s4AC0
//s4B1C
//s4807
//s4902
//s4A80
//s4B14
//s4808
//s4903
//s4A00
//s4B14
//s4809
//s4903
//s4A80
//s4B12
//s480A
//s4903
//s4AC0
//s4B10
//s480D
//s4B14
////Gamma(Green)
//s4810
//s4900
//s4A08
//s4BF0
//s4811
//s4900
//s4A10
//s4BB6
//s4812
//s4900
//s4A20
//s4B5F
//s4813
//s4900
//s4A40
//s4B4F
//s4814
//s4900
//s4A80
//s4B37
//s4815
//s4901
//s4A00
//s4B27
//s4816
//s4901
//s4AC0
//s4B1C
//s4817
//s4902
//s4A80
//s4B14
//s4818
//s4903
//s4A00
//s4B14
//s4819
//s4903
//s4A80
//s4B12
//s481A
//s4903
//s4AC0
//s4B10
//s481D
//s4B14
////Gamma(Blue)
//s4820
//s4900
//s4A08
//s4BF0
//s4821
//s4900
//s4A10
//s4BB6
//s4822
//s4900
//s4A20
//s4B5F
//s4823
//s4900
//s4A40
//s4B4F
//s4824
//s4900
//s4A80
//s4B37
//s4825
//s4901
//s4A00
//s4B27
//s4826
//s4901
//s4AC0
//s4B1C
//s4827
//s4902
//s4A80
//s4B14
//s4828
//s4903
//s4A00
//s4B14
//s4829
//s4903
//s4A80
//s4B12
//s482A
//s4903
//s4AC0
//s4B10
//s482D
//s4B14
//s4880
//gamma5
sef00
//Gamma(Red)
s4800
s4900
s4A08
s4B1B
s4801
s4900
s4A10
s4B4E
s4802
s4900
s4A20
s4B6F
s4803
s4900
s4A40
s4B59
s4804
s4900
s4A80
s4B33
s4805
s4901
s4A00
s4B2B
s4806
s4901
s4AC0
s4B20
s4807
s4902
s4A80
s4B19
s4808
s4903
s4A00
s4B16
s4809
s4903
s4A80
s4B13
s480A
s4903
s4AC0
s4B12
s480B
s4B14
//Gamma(Green)
s4810
s4900
s4A08
s4B1B
s4811
s4900
s4A10
s4B4E
s4812
s4900
s4A20
s4B6F
s4813
s4900
s4A40
s4B59
s4814
s4900
s4A80
s4B33
s4815
s4901
s4A00
s4B2B
s4816
s4901
s4AC0
s4B20
s4817
s4902
s4A80
s4B19
s4818
s4903
s4A00
s4B16
s4819
s4903
s4A80
s4B13
s481A
s4903
s4AC0
s4B12
s481B
s4B14
//Gamma(Blue)
s4820
s4900
s4A08
s4B1B
s4821
s4900
s4A10
s4B4E
s4822
s4900
s4A20
s4B6F
s4823
s4900
s4A40
s4B59
s4824
s4900
s4A80
s4B33
s4825
s4901
s4A00
s4B2B
s4826
s4901
s4AC0
s4B20
s4827
s4902
s4A80
s4B19
s4828
s4903
s4A00
s4B16
s4829
s4903
s4A80
s4B13
s482A
s4903
s4AC0
s4B12
s482B
s4B14
s4880
//AWB
//sef00
//s9301 // AWB map
//sa00f
//s9f0f
//s9300
//AWB mode : auto(??)
//sef01
//s8000
// Hue
sef00
s8c0c //Skin Color Detection On/Off
s7400 //00 //Hue & Saturation Off=00, On=01
s7958 //Saturation Gain
s7501 //Hue & Saturation Cosine 1
s7660 //ff //Hue & Saturation Cosine 2
s7702 //Hue & Saturation Sine 1
s7811 //Hue & Saturation Sine 2
s72b0 //90 //Contrast Gain
//s7389 //Brightness Gain
sd800 //Edge color suppress
//sef02
//s0f40
//AWB white's count low 0f00 --> 0708
sef01
s8507 //0f //07
s8608 //00 //08
//AWB boundary
//sef00
//sb100
//sb221
//sb300
//sb42c
//sb501
//sb6e0
//sb702
//sb870
// Bad Pixel Replacement
//sef00
//s1a01
//s1b00
//s1e00
//s1c00
//s1f00
//s1d00
//s2000
sef01
sb930
sba00
seb40 //6f //Low Light Indication AGC
//
//sef02 //shutter on //Jee hwan: 06.10.27
//s0126
//
//sef01 // AE/AWB on //Jee hwan: 06.10.27
//s7017

View File

@ -0,0 +1,649 @@
//3.13 Pearl setting으로 시작.
//------------------------------------------------------------------
// Set File
// - S5KA3AFX_xshade_061018.xls generates
// - date : 2007-03-12오후 3:20:55
//------------------------------------------------------------------
sef01
s7000 //AE,AWB OFF
//QVGA
sef00
s7ce0
s8101
s8250
s7f00
s80f0
sc209
sc601
sc740
sc400
sc5F0
//// Page : 00
//sef00
//s0d03
//s0e00
//s0f1F
//s1000
//s1137
//s1208
//s1342
//s1400
//s1512
//s169E
//s1900
//s1707
//s18E0
//s1901
//s1707
//s18E3
//s1902
//s1707
//s18ED
//s1903
//s1707
//s18CA
//s1904
//s1707
//s18D2
//s1905
//s1707
//s18EC
//s1906
//s1707
//s18E5
//s1907
//s1700
//s1812
//s1908
//s1707
//s18E6
//s1909
//s1700
//s1808
//s190A
//s1707
//s18EA
//s190B
//s1707
//s18DA
//s190C
//s1707
//s18E3
//s190D
//s1707
//s18F9
//s190E
//s1700
//s181C
//s190F
//s1700
//s1812
//s1910
//s1700
//s1818
//s1911
//s1700
//s1808
//s1912
//s1707
//s18EB
//s1913
//s1707
//s18F9
//s1914
//s1707
//s18F4
//s1915
//s1700
//s181F
//s1916
//s1700
//s1815
//s1917
//s1700
//s1811
//s1918
//s1700
//s180E
//s1919
//s1700
//s1808
//s191A
//s1707
//s18FE
//s191B
//s1707
//s18F4
//s191C
//s1700
//s1824
//s191D
//s1700
//s1803
//s191E
//s1700
//s1802
//s191F
//s1707
//s18FF
//s1920
//s1700
//s1812
//s1921
//s1707
//s18E5
//s1922
//s1707
//s18D1
//s1940
//
sef02
s5950 //P, S
s5a32 //M
s5821 //PLL
//////////////////////////////////////////////////////////
sef02 // CIS page
//s4b5E // PCLK driving current max
//s23d8 // Tx width
s3a20 // double shutter off
s6508 // CIS mode
s0a90 // Display WCW
s0126 // E-shutter enable
s0378 // S1R END **** Revised at EVT1
s0500 // S1S end value control
s07E5 // S2 END
s090E // S4 END
s0b84 //85 //81 // Analog offset
s13a0 //20 // R_REF
//s1580 // EC COMP 100'b
s1c58 //20070304AM //57 // global gain **** Revised at EVT1
s243d // i_cds **** Revised at EVT1
s2625 // clamp level control **** Revised at EVT1
s298f // CFPN start frame (16)
s4b5b // IO driving current
s5605 // Line ADLC
//s5861 // amp bias current source select (71h : self bias)
s5f06 // aps bias current
s673c // EC_COMP & SAVG_END
s6810 // i_rmp control
s6913 // i_mid
//s5821 // PLL on
//s591A // pll_s=0, pll_p=26,
//s5A1A // pll_m=26
s289B // CFPN on **** Revised at EVT1
//061011
sef01
sd1e6 //89:16.7MHz, d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000
//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000
//sd915 //AE saturation CHIP_DEBUG
//////////
//page 0
//////////
sef00
//s093e //gr gain
sef00
s2740 //08 //GR/GB Correction Limitation Value
s2960 //GrGb Edge Threshold Value
// AE Window
sef00
s5500 //Window diplay off
s5800
s5900
s5a02
s5b80
s5c00
s5d00
s5e01
s5fe0
s6000
s6100
s6202
s6380
s6400
s6500
s6601
s67e0
sef01 // AE weight
s7701
s7801
//s7903
//s7a03
//s7b04
//s7c04
sef00
//s5718 // AE Lux min threshold
sd9c0 // color edge threshold
////AWB Luminance check
////20070212 Added for low light starting env.
sef00
sad03 //Luminance upper_level[9:8]
sae20 //Luminance upper_level[7:0]
saf00 //Luminance lower_level[9:8]
sb090 //Luminance lower_level[7:0]
/////////////////////////////////////////////////////
//page 1/////////////////////////////////////////////
/////////////////////////////////////////////////////
sef01
////20070212 Modified for low light starting env.
s8372 //7d //AWB R/B Max Gain : <0.44>'s max
s8438 //30 //AWB R/B Min Gain : <0.42>'s max
sa841 //20070222 //shutter Control
sa9d4 //20070222 //Shutter Threshold
saf04 //20070213PM //00 //L.L Brightness
sb488 //20070213 //b0 //a0 // N.L contrast
sb588 //20070213 //b0 //a0 // L.L contrast
sbc56 //20070305PM //26 //20070213 //AWB skip point (default:16)
sb746 //58 //68 // N.L color saturation
sb846 //20070305PM //30 //52 // L.L color saturation
//s7097 //17 // fix PAL(50Hz)
s716a //20070213PM //55 //5a //68 //70 //6f //4d //60 //78 //AE target
s7209 //20070214PM //07 //0c //12 //0a //05 //12 // AE threshold
//s7334 //20070214PM //AE Step Guard Value
s7466 //6b //60 //70 //74 //70 // low agc max
s7540 // normal agc max
sa640 //80 //N.L sharpness H/V Gain
sab40 //38 //18 //60 //N.L NR Edge
sad80 //40 //20 //L.L NR Edge
//sa330 //AWB speed //EVT0은 고정되어 있음.(0x03) //EVT1은 변경 가능.
scc09 //08 //Flicker threshold 12
sd522 //23 //32 //Chip_Debug2
se004 // NT Max
se204 //07 //18 // Low NT max
se103 // PAL Max
se303 //07 //18 // Low PAL max
se400 // 24MHz VblankH (H.L) //FPS (24MHz, 15fps)
se527 //ea // 24MHz NT VblankL (H.L)
//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 15fps)
//se52a // 13MHz VblankL (H.L)
se600 //20070215AM // 24MHz VblankH (H.L) //FPS (24MHz, 15fps)
se727 //20070215AM //ea // 24MHz NT VblankL (H.L)
se868 //44 //84 //97 // ae speed
se984 //Double shutter ON
//se987
sef00
//s8c0e //skin color detection
sc80a //YC delay
////////////////////////////////////////
// Color Correction -> Shading -> Gamma -> AWB -> Hue
////////////////////////////////////////
// Color Correction
//sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old
//s4c40 //95 //95 //81 //8a //50 //62 //56
//s4d92 //c2 //c2 //ba //d2 //af //a9 //8d
//s4e0f //92 //92 //87 //07 //1f //07 //89
//s4f9a //9b //9b //98 //9e //9e //a2 //94
//s503b //73 //73 //64 //4c //2e //47 //5c
//s511e //98 //98 //8c //12 //30 //1b //8b
//s5282 //80 //80 //80 //80 //86 //85 //80
//s53bf //b3 //b3 //ad //cd //eb //f2 //91
//s547f //73 //73 //6d //8e //b2 //b8 //51
////CW
sef00
s4c92
s4dcf
s4e82
s4fad
s506e
s5180
s5287
s53eb
s54b2
//
////D65
//sef00
//s4c8a
//s4dc2
//s4e88
//s4f9f
//s5072
//s5193
//s5281
//s53ca
//s548c
//Default
//sef00
//s4c56
//s4d8d
//s4e89
//s4f96
//s505d
//s5188
//s5294
//s5389
//s545d
//// Shading2 //// RGB Shading// RGB Shading// RGB Shading
// // // //linear//old
sef00 //sef00 //sef00 //00 //00 //00 //00
s3001 //s3001 //s3001 //01 //01 //01 //01
s32b8 //s3200 //s3200 //00 //00 //00 //00
s3690 //s3600 //s3600 //00 //00 //00 //00
s3a90 //s3a00 //s3a00 //00 //00 //00 //00
s3301 //s3301 //s3300 //00 //01 //00 //01
s3422 //s3450 //s3400 //32 //50 //00 //50
s3701 //s3701 //s3700 //00 //01 //00 //01
s3822 //s3850 //s3800 //50 //50 //00 //50
s3b01 //s3b01 //s3b00 //00 //01 //00 //01
s3c22 //s3c50 //s3c00 //00 //50 //00 //50
s31f8 //s31df //s3187 //ff //ff //5e //ff
s35ce //s35b8 //s3569 //d7 //da //54 //da
s39ca //s39a9 //s395a //be //e6 //4d //e6
s3f01 //s3f01 //s3f01 //01 //01 //01 //01
s4054 //s4040 //s4040 //4a //40 //40 //40
s3d01 //s3d00 //s3d01 //00 //00 //01 //00
s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0
//gamma5
sef00
//Gamma(Red)
s4800
s4900
s4A08
s4B1B
s4801
s4900
s4A10
s4B4E
s4802
s4900
s4A20
s4B6F
s4803
s4900
s4A40
s4B59
s4804
s4900
s4A80
s4B33
s4805
s4901
s4A00
s4B2B
s4806
s4901
s4AC0
s4B20
s4807
s4902
s4A80
s4B19
s4808
s4903
s4A00
s4B16
s4809
s4903
s4A80
s4B13
s480A
s4903
s4AC0
s4B12
s480B
s4B14
//Gamma(Green)
s4810
s4900
s4A08
s4B1B
s4811
s4900
s4A10
s4B4E
s4812
s4900
s4A20
s4B6F
s4813
s4900
s4A40
s4B59
s4814
s4900
s4A80
s4B33
s4815
s4901
s4A00
s4B2B
s4816
s4901
s4AC0
s4B20
s4817
s4902
s4A80
s4B19
s4818
s4903
s4A00
s4B16
s4819
s4903
s4A80
s4B13
s481A
s4903
s4AC0
s4B12
s481B
s4B14
//Gamma(Blue)
s4820
s4900
s4A08
s4B1B
s4821
s4900
s4A10
s4B4E
s4822
s4900
s4A20
s4B6F
s4823
s4900
s4A40
s4B59
s4824
s4900
s4A80
s4B33
s4825
s4901
s4A00
s4B2B
s4826
s4901
s4AC0
s4B20
s4827
s4902
s4A80
s4B19
s4828
s4903
s4A00
s4B16
s4829
s4903
s4A80
s4B13
s482A
s4903
s4AC0
s4B12
s482B
s4B14
s4880
//AWB
//sef00
//s9301 // AWB map
//sa00f
//s9f0f
//s9300
//AWB mode : auto(??)
//sef01
//s8000
// Hue
sef00
s8c0c //Skin Color Detection On/Off
s7401 //20070214 //00 //Hue & Saturation Off=00, On=01
s7946 //20070214 //58 //Saturation Gain
s7501 //Hue & Saturation Cosine 1
s7600 //a0 //20070214 //ff //Hue & Saturation Cosine 2
s7702 //Hue & Saturation Sine 1
s7800 //20070214 //11 //Hue & Saturation Sine 2
s7288 //20070213 //b0 //90 //Contrast Gain
//s7389 //Brightness Gain
sd800 //Edge color suppress
//sef02
//s0f40
//AWB white's count low 0f00 --> 0708
sef01
s8500 //07 //0f //07
s86f0 //08 //00 //08
//AWB boundary
//sef00
//sb100
//sb221
//sb300
//sb42c
//sb501
//sb6e0
//sb702
//sb870
// Bad Pixel Replacement
//sef00
//s1a01
//s1b00
//s1e00
//s1c00
//s1f00
//s1d00
//s2000
sef01
sb908 //10 //30 //BPR Gain Setting
sba00
sbd00
seb50 //40 //6f //Low Light Indication AGC
//20070213
//AWB Map 1
sef01
s9480 //00
s95c0 //c0
s96c0 //f0
s97f0 //c0
s9878 //78
s9978 //78
s9a7c //7c
s9b3c //3f
s9c1e //1f
s9d0f //0f
s9e07 //07
s9f03 //03
sa000 //01
sa1c8
sa202
s9302
//20070213
//AWB Map Direct Write
sef00
s9480 //00
s95c0 //c0
s96c0 //f0
s97f0 //c0
s9878 //78
s9978 //78
sa07c //7c
sa13c //3f
sa21e //1f
sa30f //0f
sa407 //07
sa503 //03
sa600 //01
//Auto Flicker Correction
sef01
sdd31
scd21
sde31
//Frame AE Control - L.L 5fps
//*** Frame 고정시는 아래 부분을 모두 주석처리 할 것.***
sef00
s5700
//sef01
//se218
//se316
//se888
//******************************************************
//sef00
//s4340 //20070222 //fixed value
//s423d //AWB R start point
//s446b //AWB B start point
sef01 //shadow line
sa500
s7097 //17 // fix PAL(50Hz)
sef00
sb902
sba80
sbb80
sbc98
sbd30

View File

@ -0,0 +1,655 @@
// 3.13 Pearl setting부터 시작.
// AWB_Low/High_CNT 조정(subsampling에 맞도록)
//------------------------------------------------------------------
// Set File
// - S5KA3AFX_xshade_061018.xls generates
// - date : 2007-03-12오후 3:20:55
//------------------------------------------------------------------
sef01
s7000 //AE,AWB OFF
//// Page : 00
//sef00
//s0d03
//s0e00
//s0f1F
//s1000
//s1137
//s1208
//s1342
//s1400
//s1512
//s169E
//s1900
//s1707
//s18E0
//s1901
//s1707
//s18E3
//s1902
//s1707
//s18ED
//s1903
//s1707
//s18CA
//s1904
//s1707
//s18D2
//s1905
//s1707
//s18EC
//s1906
//s1707
//s18E5
//s1907
//s1700
//s1812
//s1908
//s1707
//s18E6
//s1909
//s1700
//s1808
//s190A
//s1707
//s18EA
//s190B
//s1707
//s18DA
//s190C
//s1707
//s18E3
//s190D
//s1707
//s18F9
//s190E
//s1700
//s181C
//s190F
//s1700
//s1812
//s1910
//s1700
//s1818
//s1911
//s1700
//s1808
//s1912
//s1707
//s18EB
//s1913
//s1707
//s18F9
//s1914
//s1707
//s18F4
//s1915
//s1700
//s181F
//s1916
//s1700
//s1815
//s1917
//s1700
//s1811
//s1918
//s1700
//s180E
//s1919
//s1700
//s1808
//s191A
//s1707
//s18FE
//s191B
//s1707
//s18F4
//s191C
//s1700
//s1824
//s191D
//s1700
//s1803
//s191E
//s1700
//s1802
//s191F
//s1707
//s18FF
//s1920
//s1700
//s1812
//s1921
//s1707
//s18E5
//s1922
//s1707
//s18D1
//s1940
//
//////////////////////////////////////////////////////////
sef02 // CIS page
s0205 //sub
//s4b5E // PCLK driving current max
//s23d8 // Tx width
s3a20 // double shutter off
s6508 // CIS mode
s0a90 // Display WCW
s0126 // E-shutter enable
s0378 // S1R END **** Revised at EVT1
s0580 //00 // S1S end value control
s07E5 // S2 END
s090E // S4 END
s0b87 //85 //81 // Analog offset
s13a0 //20 // R_REF
//s1580 // EC COMP 100'b
s1c52 //58 //20070304AM //57 // global gain **** Revised at EVT1
s243d // i_cds **** Revised at EVT1
s2625 // clamp level control **** Revised at EVT1
s298f // CFPN start frame (16)
s4b5b // IO driving current
s5605 // Line ADLC
s5861 // amp bias current source select (71h : self bias)
s5f06 // aps bias current
s673c // EC_COMP & SAVG_END
s6810 // i_rmp control
s6913 // i_mid
//s5821 // PLL on
//s591A // pll_s=0, pll_p=26,
//s5A1A // pll_m=26
s288b //9B // CFPN on
**** Revised at EVT1
//061011
sef01
sd189 //89:16.7MHz, d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000
//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000
//sd915 //AE saturation CHIP_DEBUG
//////////
//page 0
//////////
sef00
//s093e //gr gain
sef00
s2740 //08 //GR/GB Correction Limitation Value
s2960 //GrGb Edge Threshold Value
// AE Window //// AE Window
sef00 //sef00
s5500 //s5500 //Window diplay off
s5800 //s5800
s591f //s5900
s5a01 //s5a02
s5b44 //s5b80
s5c00 //s5c00
s5d1d //s5d00
s5e00 //s5e01
s5fec //s5fe0
s6000 //s6000
s6128 //s6100
s6201 //s6202
s633b //s6380
s6400 //s6400
s6523 //s6500
s6600 //s6601
s67e6 //s67e0
//
sef01 //sef01 // AE weight
s7701 //s7701
s7801 //s7801
s7900 ////s7903
s7a00 ////s7a03
s7b00 ////s7b04
s7c00 ////s7c04
sef00
//s5718 // AE Lux min threshold
sd9c0 // color edge threshold
////AWB Luminance check
////20070212 Added for low light starting env.
sef00
sad03 //Luminance upper_level[9:8]
sae20 //Luminance upper_level[7:0]
saf00 //Luminance lower_level[9:8]
sb090 //Luminance lower_level[7:0]
/////////////////////////////////////////////////////
//page 1/////////////////////////////////////////////
/////////////////////////////////////////////////////
sef01
////20070212 Modified for low light starting env.
s8372 //7d //AWB R/B Max Gain : <0.44>'s max
s8438 //30 //AWB R/B Min Gain : <0.42>'s max
sa841 //20070222 //shutter Control
sa9d4 //20070222 //Shutter Threshold
saf04 //0f //20070213PM //00 //L.L Brightness
sb488 //20070213 //b0 //a0 // N.L contrast
sb588 //20070213 //b0 //a0 // L.L contrast
sbc56 //20070305PM //26 //20070213 //AWB skip point (default:16)
sb746 //58 //68 // N.L color saturation
sb846 //20070305PM //30 //52 // L.L color saturation
//s7097 //17 // fix PAL(50Hz)
s716a //20070213PM //55 //5a //68 //70 //6f //4d //60 //78 //AE target
s7209 //20070214PM //07 //0c //12 //0a //05 //12 // AE threshold
//s7334 //20070214PM //AE Step Guard Value
s7466 //6b //60 //70 //74 //70 // low agc max
s7540 // normal agc max
sa640 //80 //N.L sharpness H/V Gain
sab40 //38 //18 //60 //N.L NR Edge
sad80 //40 //20 //L.L NR Edge
//sa330 //AWB speed //EVT0은 고정되어 있음.(0x03) //EVT1은 변경 가능.
scc09 //08 //Flicker threshold 12
sd522 //23 //32 //Chip_Debug2
se004 // NT Max
se204 //07 //18 // Low NT max
se103 // PAL Max
se303 //07 //18 // Low PAL max
se400 // 24MHz VblankH (H.L) //FPS (24MHz, 15fps)
se55e //ea // 24MHz NT VblankL (H.L)
//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 15fps)
//se52a // 13MHz VblankL (H.L)
se600 //20070215AM // 24MHz VblankH (H.L) //FPS (24MHz, 15fps)
se75e //20070215AM //ea // 24MHz NT VblankL (H.L)
se868 //44 //84 //97 // ae speed
se984 //87
sef00
//s8c0e //skin color detection
sc80a //YC delay
////////////////////////////////////////
// Color Correction -> Shading -> Gamma -> AWB -> Hue
////////////////////////////////////////
// Color Correction
//sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old
//s4c40 //95 //95 //81 //8a //50 //62 //56
//s4d92 //c2 //c2 //ba //d2 //af //a9 //8d
//s4e0f //92 //92 //87 //07 //1f //07 //89
//s4f9a //9b //9b //98 //9e //9e //a2 //94
//s503b //73 //73 //64 //4c //2e //47 //5c
//s511e //98 //98 //8c //12 //30 //1b //8b
//s5282 //80 //80 //80 //80 //86 //85 //80
//s53bf //b3 //b3 //ad //cd //eb //f2 //91
//s547f //73 //73 //6d //8e //b2 //b8 //51
////CW
sef00
s4c92
s4dcf
s4e82
s4fad
s506e
s5180
s5287
s53eb
s54b2
//
////D65
//sef00
//s4c8a
//s4dc2
//s4e88
//s4f9f
//s5072
//s5193
//s5281
//s53ca
//s548c
//Default
//sef00
//s4c56
//s4d8d
//s4e89
//s4f96
//s505d
//s5188
//s5294
//s5389
//s545d
// RGB Shading //// RGB Shading ////// Shading2 //// RGB Shading// RGB Shading// RGB Shading
// //// // // //linear//old
sef00 //sef00 //sef00 //sef00 //sef00 //00 //00 //00 //00
s3001 //s3001 //s3001 //s3001 //s3001 //01 //01 //01 //01
s3264 //s323c //s32b8 //s3200 //s3200 //00 //00 //00 //00
s363c //s363c //s3690 //s3600 //s3600 //00 //00 //00 //00
s3a3c //s3a3c //s3a90 //s3a00 //s3a00 //00 //00 //00 //00
s3300 //s3300 //s3301 //s3301 //s3300 //00 //01 //00 //01
s3400 //s3400 //s3422 //s3450 //s3400 //32 //50 //00 //50
s3700 //s3700 //s3701 //s3701 //s3700 //00 //01 //00 //01
s3800 //s3800 //s3822 //s3850 //s3800 //50 //50 //00 //50
s3b00 //s3b00 //s3b01 //s3b01 //s3b00 //00 //01 //00 //01
s3c00 //s3c00 //s3c22 //s3c50 //s3c00 //00 //50 //00 //50
s31f8 //s31f8 //s31f8 //s31df //s3187 //ff //ff //5e //ff
s35ce //s35ce //s35ce //s35b8 //s3569 //d7 //da //54 //da
s39c8 //s39ca //s39ca //s39a9 //s395a //be //e6 //4d //e6
s3f00 //s3f00 //s3f01 //s3f01 //s3f01 //01 //01 //01 //01
s40a0 //s40a0 //s4054 //s4040 //s4040 //4a //40 //40 //40
s3d00 //s3d00 //s3d01 //s3d00 //s3d01 //00 //00 //01 //00
s3e78 //s3e78 //s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0
//
//gamma5
sef00
//Gamma(Red)
s4800
s4900
s4A08
s4B1B
s4801
s4900
s4A10
s4B4E
s4802
s4900
s4A20
s4B6F
s4803
s4900
s4A40
s4B59
s4804
s4900
s4A80
s4B33
s4805
s4901
s4A00
s4B2B
s4806
s4901
s4AC0
s4B20
s4807
s4902
s4A80
s4B19
s4808
s4903
s4A00
s4B16
s4809
s4903
s4A80
s4B13
s480A
s4903
s4AC0
s4B12
s480B
s4B14
//Gamma(Green)
s4810
s4900
s4A08
s4B1B
s4811
s4900
s4A10
s4B4E
s4812
s4900
s4A20
s4B6F
s4813
s4900
s4A40
s4B59
s4814
s4900
s4A80
s4B33
s4815
s4901
s4A00
s4B2B
s4816
s4901
s4AC0
s4B20
s4817
s4902
s4A80
s4B19
s4818
s4903
s4A00
s4B16
s4819
s4903
s4A80
s4B13
s481A
s4903
s4AC0
s4B12
s481B
s4B14
//Gamma(Blue)
s4820
s4900
s4A08
s4B1B
s4821
s4900
s4A10
s4B4E
s4822
s4900
s4A20
s4B6F
s4823
s4900
s4A40
s4B59
s4824
s4900
s4A80
s4B33
s4825
s4901
s4A00
s4B2B
s4826
s4901
s4AC0
s4B20
s4827
s4902
s4A80
s4B19
s4828
s4903
s4A00
s4B16
s4829
s4903
s4A80
s4B13
s482A
s4903
s4AC0
s4B12
s482B
s4B14
s4880
//AWB
//sef00
//s9301 // AWB map
//sa00f
//s9f0f
//s9300
//AWB mode : auto(??)
//sef01
//s8000
// Hue
sef00
s8c0c //Skin Color Detection On/Off
s7401 //20070214 //00 //Hue & Saturation Off=00, On=01
s7946 //20070214 //58 //Saturation Gain
s7501 //Hue & Saturation Cosine 1
s7600 //a0 //20070214 //ff //Hue & Saturation Cosine 2
s7702 //Hue & Saturation Sine 1
s7800 //20070214 //11 //Hue & Saturation Sine 2
s7288 //20070213 //b0 //90 //Contrast Gain
//s7389 //Brightness Gain
sd800 //Edge color suppress
//sef02
//s0f40
//AWB white's count low 0f00 --> 0708
sef01
s8500 //07 //0f //07
s863c //2d //08 //00 //08
s8713 //0e
s88c0 //d0
//AWB boundary
sef00
sb100
sb200
sb300
sb400
sb500
sb6f0
sb701
sb840
// Bad Pixel Replacement
//sef00
//s1a01
//s1b00
//s1e00
//s1c00
//s1f00
//s1d00
//s2000
sef01
sb908 //10 //30 //BPR Gain Setting
sba00
sbd00
seb60 //40 //6f //Low Light Indication AGC
//20070213
//AWB Map 1
sef01
s9480 //00
s95c0 //c0
s96c0 //f0
s97f0 //c0
s9878 //78
s9978 //78
s9a7c //7c
s9b3c //3f
s9c1e //1f
s9d0f //0f
s9e07 //07
s9f03 //03
sa000 //01
sa1c8
sa202
s9382 //AWB window //02
//20070213
//AWB Map Direct Write
sef00
s9480 //00
s95c0 //c0
s96c0 //f0
s97f0 //c0
s9878 //78
s9978 //78
sa07c //7c
sa13c //3f
sa21e //1f
sa30f //0f
sa407 //07
sa503 //03
sa600 //01
//Auto Flicker Correction
sef01
sdd31
scd21
sde31
//Frame AE Control - L.L 5fps
//*** Frame 고정시는 아래 부분을 모두 주석처리 할 것.***
sef00
s5700
//sef01
//se218
//se316
//se888
//******************************************************
//sef00
//s4340 //20070222 //fixed value
//s423d //AWB R start point
//s446b //AWB B start point
sef01 //shadow line
sa500
sef00
sb902
sba80
sbb80
sbc98
sbd30
//
sef00
s0400
s05f8
sc208
sc308
sc400
sc5f0
sc601
sc740
sef02
s0a9a
s08f7
s1a01
s1be6
sef01
sca01
scbe6
s7097 //17 // fix PAL(50Hz)

View File

@ -0,0 +1,74 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - libraries - camera/ARM7
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Log: $
# $NoKeywords: $
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
# build ARM & THUMB libraries
TWL_CODEGEN_ALL ?= True
# Codegen for sub processer
TWL_PROC = ARM7
SRCDIR = ../common .
SRCS = \
camera_i2c.c \
camera_control.c \
L_SET_FILE := A3AFX_EVT2_20fps_16M_PLLoff_hVGA_070209.set \
A3AFX_EVT2_30fps_16M_QVGA_070206.set \
A3AFX_EVT2_20fps_16M_070206.set \
320x240_noPLL_20fps_070306.set \
320x240_PLL_30fps_070306.set \
A3AFX_EVT3_30fps_Scaledown_16.7M_50Hz.set \
A3AFX_EVT3_30fps_Subsampling_16.7M_50Hz.set \
L_CONVERT_EXE := convert.pl
L_SETC_FILE := $(L_SET_FILE:%.set=%.autogen.c)
SRCS += $(L_SETC_FILE)
TARGET_LIB = libcamera_sp$(TWL_LIBSUFFIX).a
#----------------------------------------------------------------------------
# DEBUG版ビルドの場合、RELEASE版でビルドして
# DEBUG版のライブラリを装います。
ifdef NITRO_DEBUG
NITRO_BUILD_TYPE = RELEASE
endif
include $(TWLSDK_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(TWL_INSTALL_LIBDIR)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
%.autogen.c: %.set $(L_CONVERT_EXE)
perl $(L_CONVERT_EXE) $< > $@
#===== End of Makefile =====

View File

@ -0,0 +1,357 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - library - camera
File: camera_sp.c
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/camera.h>
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define CAMERA_STBYN_MASK REG_EXI_GPIO2DATA_IO18_1_MASK
#define CAMERA_PXI_SIZE_CHECK(nums) \
if (cameraWork.total != (nums)) { \
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_PARAMETER); \
break; \
}
// アライメント調整してコピーする
#define CAMERA_UNPACK_U16(d, s) \
(*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8)))
#define CAMERA_UNPACK_U32(d, s) \
(*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24)))
#define CAMERA_SET_GPIO(r) ((r) |= CAMERA_STBYN_MASK)
#define CAMERA_CLEAR_GPIO(r) ((r) &= ~CAMERA_STBYN_MASK)
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static BOOL cameraInitialized; // 初期化確認フラグ
static CAMERAWork cameraWork; // ワーク変数をまとめた構造体
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static void CameraPxiCallback(PXIFifoTag tag, u32 data, BOOL err);
static void CameraReturnResult(CAMERAPxiCommand command, CAMERAPxiResult result);
static void CameraReturnResultEx(CAMERAPxiCommand command, CAMERAPxiResult result, u8 size, u8* data);
static void CameraThread(void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_Init
Description: CAMERAライブラリを初期化する
Arguments: priority
Returns: None.
*---------------------------------------------------------------------------*/
void CAMERA_Init(u32 priority)
{
// 初期化済みを確認
if (cameraInitialized)
{
return;
}
cameraInitialized = 1;
// GPIO初期設定
CAMERA_CLEAR_GPIO(reg_EXI_GPIO2IE); // 割り込みなし
CAMERA_SET_GPIO(reg_EXI_GPIO2DIR); // 出力設定
CAMERA_CLEAR_GPIO(reg_EXI_GPIO2DATA); // 初期値0
// PXI関連を初期化
PXI_Init();
PXI_SetFifoRecvCallback(PXI_FIFO_TAG_CAMERA, CameraPxiCallback);
// 実処理を行うスレッドを作成
OS_InitMessageQueue(&cameraWork.msgQ, cameraWork.msgArray, CAMERA_MESSAGE_ARRAY_MAX);
OS_CreateThread(&cameraWork.thread,
CameraThread,
0,
(void *)(cameraWork.stack + (CAMERA_THREAD_STACK_SIZE / sizeof(u64))),
CAMERA_THREAD_STACK_SIZE, priority);
OS_WakeupThreadDirect(&cameraWork.thread);
}
/*---------------------------------------------------------------------------*
Name: CameraPxiCallback
Description: PXI経由で受信したデータを解析する
Arguments: tag - PXI種別を示すタグ
data - 26bitが有効
err - PXI通信におけるエラーフラグ
ARM9側にて同種別のPXIが初期化されていないことを示す
Returns: None.
*---------------------------------------------------------------------------*/
static void CameraPxiCallback(PXIFifoTag tag, u32 data, BOOL err)
{
#pragma unused( tag )
// PXI通信エラーをチェック
if (err)
{
return;
}
// 先頭データ
if (data & CAMERA_PXI_START_BIT)
{
cameraWork.total = (u8)((data & CAMERA_PXI_DATA_NUMS_MASK) >> CAMERA_PXI_DATA_NUMS_SHIFT);
cameraWork.current = 0;
cameraWork.command = (CAMERAPxiCommand)((data & CAMERA_PXI_COMMAND_MASK) >> CAMERA_PXI_COMMAND_SHIFT);
cameraWork.data[cameraWork.current++] = (u8)((data & CAMERA_PXI_1ST_DATA_MASK) >> CAMERA_PXI_1ST_DATA_SHIFT);
//OS_TPrintf("START_BIT (total=%d, command=%X).\n", cameraWork.total, cameraWork.command);
}
// 後続データ
else
{
cameraWork.data[cameraWork.current++] = (u8)((data & 0xFF0000) >> 16);
cameraWork.data[cameraWork.current++] = (u8)((data & 0x00FF00) >> 8);
cameraWork.data[cameraWork.current++] = (u8)((data & 0x0000FF) >> 0);
}
// パケット完成
if (cameraWork.current >= cameraWork.total) // 最大で2つ余分に取得する
{
// 受信したコマンドを解析
switch (cameraWork.command)
{
// 既知のコマンド群
case CAMERA_PXI_COMMAND_SET_STBYN:
// I2C基本操作
case CAMERA_PXI_COMMAND_WRITE_REGISTERS:
case CAMERA_PXI_COMMAND_READ_REGISTERS:
case CAMERA_PXI_COMMAND_SET_PARAMS:
case CAMERA_PXI_COMMAND_SET_FLAGS:
case CAMERA_PXI_COMMAND_CLEAR_FLAGS:
// I2C応用操作
case CAMERA_PXI_COMMAND_I2C_INIT:
case CAMERA_PXI_COMMAND_I2C_PRESET:
case CAMERA_PXI_COMMAND_I2C_PRE_SLEEP:
case CAMERA_PXI_COMMAND_I2C_POST_SLEEP:
case CAMERA_PXI_COMMAND_I2C_SET_CROPPING:
case CAMERA_PXI_COMMAND_I2C_PAUSE:
case CAMERA_PXI_COMMAND_I2C_RESUME:
// スレッドを再開
if (!OS_SendMessage(&cameraWork.msgQ, NULL, OS_MESSAGE_NOBLOCK))
{
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_FATAL_ERROR);
}
break;
// 未知のコマンド
default:
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_COMMAND);
}
}
}
/*---------------------------------------------------------------------------*
Name: CameraReturnResult
Description: PXI経由で処理結果をARM9に送信する
Arguments: command -
result - CAMERAPxiResultのひとつ
Returns: None.
*---------------------------------------------------------------------------*/
static void CameraReturnResult(CAMERAPxiCommand command, CAMERAPxiResult result)
{
u32 pxiData = (u32)(CAMERA_PXI_START_BIT | CAMERA_PXI_RESULT_BIT |
((command << CAMERA_PXI_COMMAND_SHIFT) & CAMERA_PXI_COMMAND_MASK) |
((1 << CAMERA_PXI_DATA_NUMS_SHIFT) & CAMERA_PXI_DATA_NUMS_MASK) |
((result << CAMERA_PXI_1ST_DATA_SHIFT) & CAMERA_PXI_1ST_DATA_MASK));
while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0))
{
}
}
/*---------------------------------------------------------------------------*
Name: CameraReturnResultEx
Description: PXI経由でARM7に送信する
Arguments: command -
result - CAMERAPxiResultのひとつ
size -
data -
Returns: None.
*---------------------------------------------------------------------------*/
static void CameraReturnResultEx(CAMERAPxiCommand command, CAMERAPxiResult result, u8 size, u8* data)
{
u32 pxiData = (u32)(CAMERA_PXI_START_BIT | CAMERA_PXI_RESULT_BIT |
((command << CAMERA_PXI_COMMAND_SHIFT) & CAMERA_PXI_COMMAND_MASK) |
(((size+1) << CAMERA_PXI_DATA_NUMS_SHIFT) & CAMERA_PXI_DATA_NUMS_MASK) |
((result << CAMERA_PXI_1ST_DATA_SHIFT) & CAMERA_PXI_1ST_DATA_MASK));
int i;
while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0))
{
}
for (i = 0; i < size; i += 3)
{
pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]);
while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0))
{
}
}
}
/*---------------------------------------------------------------------------*
Name: CameraThread
Description: CAMERA操作の実処理を行うスレッド
Arguments: arg - 使
Returns: None.
*---------------------------------------------------------------------------*/
static void CameraThread(void *arg)
{
#pragma unused( arg )
OSMessage msg;
BOOL result;
u16 data16a;
u16 data16b;
u16 data16c;
u16 data16d;
u8 dataArray[CAMERA_PXI_DATA_SIZE_MAX]; // 不定長データ格納用
while (TRUE)
{
// メッセージが発行されるまで寝る
(void)OS_ReceiveMessage(&(cameraWork.msgQ), &msg, OS_MESSAGE_BLOCK);
// コマンドに従って各種処理を実行
switch (cameraWork.command)
{
case CAMERA_PXI_COMMAND_SET_STBYN:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_SET_STBYN);
if (cameraWork.data[0])
{
CAMERA_SET_GPIO(reg_EXI_GPIO2DATA); // High
}
else
{
CAMERA_CLEAR_GPIO(reg_EXI_GPIO2DATA); // Low
}
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS); // ARM9に処理の成功を通達
break;
// I2C基本操作
case CAMERA_PXI_COMMAND_WRITE_REGISTERS: // IN: addr, data... OUT: TRUE/FALSE
if (cameraWork.total <= 1)
{
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_PARAMETER);
break;
}
result = CAMERA_WriteRegisters(cameraWork.data[0], &cameraWork.data[1], (size_t)(cameraWork.total-1));
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_READ_REGISTERS: // IN: addr, size OUT: TRUE/FALSE, data...
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_READ_REGISTERS);
result = CAMERA_ReadRegisters(cameraWork.data[0], dataArray, cameraWork.data[1]);
if (result)
{
CameraReturnResultEx(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_TRUE, cameraWork.data[1], dataArray);
}
else
{
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の失敗を通達
}
break;
case CAMERA_PXI_COMMAND_SET_PARAMS:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_SET_PARAMS);
result = CAMERA_SetParams(cameraWork.data[0], cameraWork.data[1], cameraWork.data[2]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_SET_FLAGS:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_SET_FLAGS);
result = CAMERA_SetFlags(cameraWork.data[0], cameraWork.data[1]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_CLEAR_FLAGS:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_CLEAR_FLAGS);
result = CAMERA_ClearFlags(cameraWork.data[0], cameraWork.data[1]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_I2C_INIT:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_INIT);
result = CAMERA_I2CInit();
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_I2C_PRESET:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PRESET);
result = CAMERA_I2CPreset((CameraPreset)cameraWork.data[0]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_I2C_PRE_SLEEP:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PRE_SLEEP);
result = CAMERA_I2CPreSleep();
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_I2C_POST_SLEEP:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_POST_SLEEP);
result = CAMERA_I2CPostSleep();
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_I2C_SET_CROPPING:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_SET_CROPPING);
CAMERA_UNPACK_U16(&data16a, &cameraWork.data[0]);
CAMERA_UNPACK_U16(&data16b, &cameraWork.data[2]);
CAMERA_UNPACK_U16(&data16c, &cameraWork.data[4]);
CAMERA_UNPACK_U16(&data16d, &cameraWork.data[6]);
result = CAMERA_I2CSetCropping(data16a, data16b, data16c, data16d);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_I2C_PAUSE:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PAUSE);
result = CAMERA_I2CPause();
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_I2C_RESUME:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_RESUME);
result = CAMERA_I2CResume();
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
// サポートしないコマンド
default:
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_COMMAND);
}
}
}

View File

@ -0,0 +1,266 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - libraties - camera
File: camera_i2c.c
Copyright 2006 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/camera.h>
//#define USE_MULTIPLE_IO // use [Read|Write]Registers();
// for samsung 1/10
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M_PLLoff_hVGA( void );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_30fps_16M_QVGA( void );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M( void );
extern BOOL CAMERAi_I2CPreset_320x240_noPLL_20fps( void );
extern BOOL CAMERAi_I2CPreset_320x240_PLL_30fps( void );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Scaledown_16_7M_50Hz( void );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Subsampling_16_7M_50Hz( void );
typedef BOOL (*CameraI2CPresetFunc)(void);
static CameraI2CPresetFunc gs_preset[] = {
CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M_PLLoff_hVGA,
CAMERAi_I2CPreset_A3AFX_EVT2_30fps_16M_QVGA,
CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M,
CAMERAi_I2CPreset_320x240_noPLL_20fps,
CAMERAi_I2CPreset_320x240_PLL_30fps,
CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Scaledown_16_7M_50Hz,
CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Subsampling_16_7M_50Hz,
};
BOOL CAMERA_I2CPreset(CameraPreset preset)
{
if (preset >= CAMERA_PRESET_MAX) {
return FALSE;
}
if (gs_preset[preset] == NULL) {
return FALSE;
}
(void)I2C_Lock();
if (gs_preset[preset]() == FALSE) {
(void)I2C_Unlock();
return FALSE;
}
(void)I2C_Unlock();
return TRUE;
}
#define PAGE_ADDR 0xef
#define MIRROR_MODE 0x02 //[6:7] only?
#define WRP_DOWN 0x04
#define WCP_DOWN 0x06
BOOL CAMERA_I2CSetFlipMode(CameraFlipMode mode)
{
(void)I2C_Lock();
switch (mode)
{
case CAMERA_FLIPMODE_NONE:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(MIRROR_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(WRP_DOWN, 0x00) == FALSE ||
CAMERAi_WriteRegister(WCP_DOWN, 0x00) == FALSE) {
goto error;
}
break;
case CAMERA_FLIPMODE_HORIZONTAL:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(MIRROR_MODE, 0x40) == FALSE ||
CAMERAi_WriteRegister(WRP_DOWN, 0x00) == FALSE ||
CAMERAi_WriteRegister(WCP_DOWN, 0x01) == FALSE) {
goto error;
}
break;
case CAMERA_FLIPMODE_VERTICAL:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(MIRROR_MODE, 0x80) == FALSE ||
CAMERAi_WriteRegister(WRP_DOWN, 0x01) == FALSE ||
CAMERAi_WriteRegister(WCP_DOWN, 0x00) == FALSE) {
goto error;
}
break;
case CAMERA_FLIPMODE_HORIZONTAL_VERTICAL:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(MIRROR_MODE, 0xC0) == FALSE ||
CAMERAi_WriteRegister(WRP_DOWN, 0x01) == FALSE ||
CAMERAi_WriteRegister(WCP_DOWN, 0x01) == FALSE) {
goto error;
}
break;
default:
goto error;
}
(void)I2C_Unlock();
return TRUE;
error:
(void)I2C_Unlock();
return FALSE;
}
#define NEVAGIVE_EFFECT_MODE 0xD3
#define SEPIA_EFFECT_MODE 0xD4
#define SEPIA_EFFECT_CB 0xD5
#define SEPIA_EFFECT_CR 0xD6
BOOL CAMERA_I2CSetSpecialMode(CameraSpecialMode mode)
{
(void)I2C_Lock();
switch (mode)
{
case CAMERA_SPECIALMODE_NONE:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0x2C) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_NEVATIVE:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x01) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0x2C) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_SEPIA:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0x2C) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
//case CAMERA_SPECIALMODE_AQUA:
case CAMERA_SPECIALMODE_BLUISH:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0xAC) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_REDDISH:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0xAC) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0xC1) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_GREENISH:
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0xAC) == FALSE ||
CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x41) == FALSE) {
goto error;
}
break;
default:
goto error;
}
(void)I2C_Unlock();
return TRUE;
error:
(void)I2C_Unlock();
return FALSE;
}
#define DEST_ADDR 0x7F
#define CAPT_ADDR 0xC4
BOOL CAMERA_I2CSetCroppingParams(u16 width, u16 height)
{
#ifdef USE_MULTIPLE_IO
u8 data[4];
#endif
if (width > 640 || height > 480) {
return FALSE;
}
(void)I2C_Lock();
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE) {
(void)I2C_Unlock();
return FALSE;
}
// set destination registers
#ifdef USE_MULTIPLE_IO
data[0] = (height + 0x10) >> 8;
data[1] = (height + 0x10) & 0xFF;
data[2] = (width + 0x10) >> 8;
data[3] = (width + 0x10) & 0xFF;
if (CAMERAi_WriteRegisters(DEST_ADDR, data, 4) == FALSE) {
#else
if (CAMERAi_WriteRegister(DEST_ADDR, (u8)((height + 0x10) >> 8)) == FALSE ||
CAMERAi_WriteRegister(DEST_ADDR+1, (u8)((height + 0x10) & 0xFF)) ==FALSE ||
CAMERAi_WriteRegister(DEST_ADDR+2, (u8)((width + 0x10) >> 8)) == FALSE ||
CAMERAi_WriteRegister(DEST_ADDR+3, (u8)((width + 0x10) & 0xFF)) == FALSE) {
#endif
(void)I2C_Unlock();
return FALSE;
}
// set capture registers
#ifdef USE_MULTIPLE_IO
data[0] = height >> 8;
data[1] = height & 0xFF;
data[2] = width >> 8;
data[3] = width & 0xFF;
if (CAMERAi_WriteRegisters(CAPT_ADDR, data, 4) == FALSE) {
#else
if (CAMERAi_WriteRegister(CAPT_ADDR, (u8)(height >> 8)) == FALSE ||
CAMERAi_WriteRegister(CAPT_ADDR+1, (u8)(height & 0xFF)) ==FALSE ||
CAMERAi_WriteRegister(CAPT_ADDR+2, (u8)(width >> 8)) == FALSE ||
CAMERAi_WriteRegister(CAPT_ADDR+3, (u8)(width & 0xFF)) == FALSE) {
#endif
(void)I2C_Unlock();
return FALSE;
}
(void)I2C_Unlock();
return TRUE;
}
BOOL CAMERA_I2CGetCroppingParams(u16 *pWidth, u16 *pHeight)
{
u8 data[4];
(void)I2C_Lock();
if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE) {
(void)I2C_Unlock();
return FALSE;
}
data[0] = CAMERAi_ReadRegister(CAPT_ADDR);
data[1] = CAMERAi_ReadRegister(CAPT_ADDR+1);
data[2] = CAMERAi_ReadRegister(CAPT_ADDR+2);
data[3] = CAMERAi_ReadRegister(CAPT_ADDR+3);
(void)I2C_Unlock();
if (pWidth) {
*pWidth = (u16)(data[3] | (data[2] << 8));
}
if (pHeight) {
*pHeight = (u16)(data[1] | (data[0] << 8));
}
return TRUE;
}

View File

@ -0,0 +1,146 @@
#!/usr/bin/perl --
my $support_multiple_write = undef;
my $file_head_format =<<'EOF';
/*---------------------------------------------------------------------------*
Project: TwlSDK - libraties - camera
File: %1$s
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl/camera/ARM7/i2c.h>
//#define PRINT_DEBUG
#ifdef PRINT_DEBUG
#include <twl/vlink.h>
#define DBG_PRINTF vlink_dos_printf
#define DBG_CHAR vlink_dos_put_console
#else
#define DBG_PRINTF( ... ) ((void)0)
#define DBG_CHAR( c ) ((void)0)
#endif
BOOL %2$s( void );
BOOL %2$s( void )
{
EOF
my $file_foot_format =<<'EOF';
return TRUE;
}
EOF
my $packet_first_format =<<'EOF';
{
const u8 data[] = {
EOF
my $packet_last_format =<<'EOF';
};
if (CAMERAi_WriteRegisters(0x%s, data, %d) == FALSE) {
DBG_PRINTF("Failed to initialize! (%%d)\n", __LINE__);
return FALSE;
}
}
EOF
my $packet_single_format =<<'EOF';
if (CAMERAi_WriteRegister(0x%s, 0x%s) == FALSE) {
DBG_PRINTF("Failed to initialize! (%%d)\n", __LINE__);
return FALSE;
}
EOF
sub print_data {
my $text = '';
my $i = 0;
foreach my $data (@_) {
if ($i % 8 == 0) {
$text .= ' ';
} else {
$text .= ' ';
}
$text .= sprintf('0x%s,', $data);
$i++;
if ($i % 8 == 0) {
$text .= "\n";
}
}
if ($i % 8 != 0) {
$text .= "\n";
}
return $text;
}
sub print_single {
return sprintf($packet_single_format, $_[0], $_[1]);
}
sub print_packet {
my($first, @data) = @_;
if (@data == 1) {
return print_single($first, $data[0]);
} else {
return $packet_first_format,
print_data(@data),
sprintf($packet_last_format, $first, scalar(@data));
}
}
die "USAGE: convert.pl [INFILE] > [OUTFILE]\n" if ($#ARGV != 0);
my $infile = $ARGV[0];
(my $funcname = $infile) =~ s/(_\d{6})?\.set$//;
$funcname =~ s/[^0-9a-zA-Z_]/_/g; #
my $outfile = $funcname . ".autogen.c";
my $funcname = "CAMERAi_I2CPreset_" . $funcname;
open IN, $infile or die "Cannot open the file!\n";
my @packets; # パケットヘッダ+パケットの中身の集まり
my @data; # データ群
my $first = -1; # 先頭アドレス
my $current = -1; # 期待アドレス
if ($support_multiple_write) {
while (<IN>) {
if (/^s([0-9a-f]{2})([0-9a-f]{2})/i) {
if ($current != hex($1)) {
if ($current >= 0) {
push @packets, print_packet($first, @data);
}
$first = $1;
$current = hex($first);
@data = ();
}
push @data, $2;
$current++;
}
}
# last data
push @packets, print_packet($first, @data);
} else { # 連続書き込み非対応版
while (<IN>) {
if (/^s([0-9a-f]{2})([0-9a-f]{2})/i) {
push @packets, print_packet($1, $2);
}
}
}
close(IN);
# output
printf $file_head_format, $outfile, $funcname;
print @packets;
printf $file_foot_format;

View File

@ -0,0 +1,56 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - libraries - camera/ARM9
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Log: $
# $NoKeywords: $
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
# build ARM & THUMB libraries
TWL_CODEGEN_ALL ?= True
SRCDIR = ../common .
SRCS = camera_api.c \
camera.c
TARGET_LIB = libcamera$(TWL_LIBSUFFIX).a
#----------------------------------------------------------------------------
# DEBUG版ビルドの場合、RELEASE版でビルドして
# DEBUG版のライブラリを装います。
ifdef NITRO_DEBUG
NITRO_BUILD_TYPE = RELEASE
endif
include $(TWLSDK_ROOT)/build/buildtools/commondefs
INSTALL_TARGETS = $(TARGETS)
INSTALL_DIR = $(TWL_INSTALL_LIBDIR)
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,465 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - library - camera
File: camera.c
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/camera.h>
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static CameraSelect currentCamera;
static BOOL prestate;
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: CAMERA_SelectCamera
Description: set stbyn
Arguments: camera one of CameraSelect
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SelectCamera( CameraSelect camera )
{
if (currentCamera == camera)
{
return;
}
switch (camera)
{
case CAMERA_SELECT_FIRST:
CAMERA_SetStbyn2(FALSE);
break;
case CAMERA_SELECT_SECOND:
CAMERA_SetStbyn(FALSE);
break;
default:
return;
}
currentCamera = camera;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetStbyn
Description: set STBYn for current camera
Arguments: BOOL High/Low
Returns: BOOL last state
*---------------------------------------------------------------------------*/
BOOL CAMERA_SetStbyn( BOOL high )
{
static BOOL prev = FALSE;
BOOL temp = prev;
switch (currentCamera)
{
case CAMERA_SELECT_FIRST:
if (high)
{
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_STBYN_MASK;
}
else
{
reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_STBYN_MASK;
}
break;
case CAMERA_SELECT_SECOND:
CAMERA_SetStbyn2(high);
break;
default:
return temp;
}
prev = high;
return temp;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_PowerOn
Description: power camera on
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
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 |= (REG_CAM_CAM_MCNT_V28_MASK // VDD2.8 POWER ON
| REG_CAM_CAM_MCNT_INI_MASK);// setup data line after CPU is powered on
OS_SpinWaitSysCycles( 4 ); // wait to raise VDD2.8
reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_V18_MASK; // VDD1.8 POWER ON
OS_SpinWaitSysCycles( 4 ); // wait to raise VDD1.8
reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_VIO_MASK; // VDDIO POWER ON
OS_SpinWaitSysCycles( 4 ); // wait to raise VDDIO
reg_CFG_CLK |= REG_CFG_CLK_CAM_CKI_MASK;// MCLK on
OS_SpinWaitSysCycles( 100 ); // wait for over 100 MCLK cycles
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_RSTN_MASK; // RSTN => Hi
CAMERA_SetStbyn(TRUE); // STBYN => Hi
OS_SpinWaitSysCycles( 1800000 ); // wait for over 1800000 MCLK cycles (over 100msec!!!)
reg_CAM_CAM_CNT = REG_CAM_CAM_CNT_CL_MASK; // full reset CNT
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_PowerOff
Description: power camera off
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
static inline 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_SetStbyn(FALSE); // STBYN => Lo
OS_SpinWaitSysCycles( 20 ); // wait for over 20 MCLK cycles
reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_RSTN_MASK;
OS_SpinWaitSysCycles( 20 ); // wait for over 20 MCLK cycles
reg_CFG_CLK &= ~REG_CFG_CLK_CAM_CKI_MASK; // MCLK off
// no wait
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_VIO_MASK; // VDDIO POWER OFF
OS_SpinWaitSysCycles( 4 ); // wait a moment
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_V18_MASK; // VDD1.8 POWER OFF
OS_SpinWaitSysCycles( 4 ); // wait a moment
reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_V28_MASK; // VDD2.8 POWER OFF
OS_SpinWaitSysCycles( 4 ); // wait a moment
}
reg_CFG_CLK &= ~REG_CFG_CLK_CAM_MASK; /* 必要ある? */
}
/*---------------------------------------------------------------------------*
Name: CAMERA_PreSleep
Description: pre-sleep process for CAMERA without power off
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_PreSleep( void )
{
if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) {
prestate = CAMERA_SetStbyn(FALSE);
OS_SpinWaitSysCycles( 20 ); // wait for over 20 MCLK cycles
// MCLK will stop automatically
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_PostSleep
Description: pre-sleep process for CAMERA without power off
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_PostSleep( void )
{
if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) {
// MCLK started automatically
if (prestate)
{
CAMERA_SetStbyn(TRUE);
OS_SpinWaitSysCycles( 100000 ); // wait for over 100000 MCLK cycles
}
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_IsBusy
Description: whether camera is busy
Arguments: None
Returns: TRUE if camera is busy
*---------------------------------------------------------------------------*/
BOOL CAMERA_IsBusy( void )
{
return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_E_MASK) ? TRUE : FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_Start
Description: start to receive camera data
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Start( void )
{
reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_E_MASK;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_Stop
Description: stop to receive camera data
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Stop( void )
{
reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_E_MASK;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetSyncLowActive
Description: set CAMERA sync polarity
Arguments: isLowActive if low active, set TRUE
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetSyncLowActive( BOOL isLowActive )
{
if (isLowActive) {
reg_CAM_CAM_CNT |= (1 << REG_CAM_CAM_MCNT_SYNC_SHIFT);
} else {
reg_CAM_CAM_CNT &= ~(1 << REG_CAM_CAM_MCNT_SYNC_SHIFT);
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetRclkNegativeEdge
Description: set CAMERA rclk edge.
Should call while master clock is stopping.
Arguments: isNegativeEdge if negative edge, set TRUE
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetRclkNegativeEdge( BOOL isNegativeEdge )
{
if ((reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) == 0) {
if (isNegativeEdge) {
reg_CAM_CAM_CNT |= (1 << REG_CAM_CAM_MCNT_IRCLK_SHIFT);
} else {
reg_CAM_CAM_CNT &= ~(1 << REG_CAM_CAM_MCNT_IRCLK_SHIFT);
}
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimmingParamsCenter
Description: set camera trimming by centering
expecting original image size is VGA.
Arguments: destWidth width of image to output
destHeight height of image to output
srcWidth original width of image
srcHeight original height of image
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTrimmingParamsCenter(u16 destWidth, u16 destHeight, u16 srcWidth, u16 srcHeight)
{
destWidth -= 2;
destHeight -= 1;
reg_CAM_SOFS_H = (u16)((srcWidth-destWidth) >> 1);
reg_CAM_SOFS_V = (u16)((srcHeight-destHeight) >> 1);
reg_CAM_EOFS_H = (u16)((srcWidth+destWidth) >> 1);
reg_CAM_EOFS_V = (u16)((srcHeight+destHeight) >> 1);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimmingParams
Description: set camera trimming
NOTE: widht = x2 - x1; height = y2 - y1;
Arguments: x1 X of top-left trimming point (multiple of 2)
y1 Y of top-left trimming point
x2 X of bottom-right trimming point (multiple of 2)
y2 Y of bottom-right trimming point
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTrimmingParams(u16 x1, u16 y1, u16 x2, u16 y2)
{
reg_CAM_SOFS_H = x1;
reg_CAM_SOFS_V = y1;
reg_CAM_EOFS_H = (u16)(x2 - 2);
reg_CAM_EOFS_V = (u16)(y2 - 1);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimming
Description: set trimming enable/disable
Arguments: enabled TRUE if set trimming will be enabled
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTrimming( BOOL enabled )
{
if (enabled) {
reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_T_MASK;
} else {
reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_T_MASK;
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetOutputFormat
Description: set CAMERA output format.
Arguments: output one of CameraOutput to set.
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetOutputFormat( CameraOutput output )
{
switch (output) {
case CAMERA_OUTPUT_YUV:
reg_CAM_CAM_CNT &= ~(1 << REG_CAM_CAM_CNT_F_SHIFT);
break;
case CAMERA_OUTPUT_RGB:
reg_CAM_CAM_CNT |= (1 << REG_CAM_CAM_CNT_F_SHIFT);
break;
default:
break;
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_GetErrorStatus
Description: whether line buffer has occurred some errors or not
Arguments: None
Returns: TRUE if error has occurred
*---------------------------------------------------------------------------*/
BOOL CAMERA_GetErrorStatus( void )
{
return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_ERR_MASK) ? TRUE : FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearBuffer
Description: clear line buffer and error status
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_ClearBuffer( void )
{
reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_CL_MASK;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetMasterIntrrupt
Description: set interrupt mode
Arguments: enabled TRUE if set master interrupt will be enabled
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetMasterIntrrupt( BOOL enabled )
{
if (enabled) {
reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_IREQ_I_MASK;
} else {
reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_IREQ_I_MASK;
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetVsyncIntrrupt
Description: set vsync interrupt mode
Arguments: type one of CameraIntrVsync to set
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetVsyncIntrrupt( CameraIntrVsync type )
{
reg_CAM_CAM_CNT = (u16)((reg_CAM_CAM_CNT & ~REG_CAM_CAM_CNT_IREQ_VS_MASK) | type);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetBufferErrorIntrrupt
Description: set buffer error interrupt mode
Arguments: enabled TRUE if set buffer error interrupt will be enabled
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetBufferErrorIntrrupt( BOOL enabled )
{
if (enabled) {
reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_IREQ_BE_MASK;
} else {
reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_IREQ_BE_MASK;
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTransferLines
Description: set number of lines to store the buffer at once.
Arguments: lines number of lines
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTransferLines( int lines )
{
if (lines >= 1 && lines <= 16)
{
u16 bits = (u16)((lines - 1) << REG_CAM_CAM_CNT_TL_SHIFT);
reg_CAM_CAM_CNT = (u16)((reg_CAM_CAM_CNT & ~REG_CAM_CAM_CNT_TL_MASK) | bits);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - libraries - aes
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Log: $
# $NoKeywords: $
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = ARM9
ifdef TWL_WITH_ARM7
SUBDIRS += ARM7
endif
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -23,7 +23,8 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs
SUBDIRS = os \
mi \
aes \
snd
snd \
camera \
#----------------------------------------------------------------------------

View File

@ -0,0 +1,31 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - tests - camera
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Log: $
# $NoKeywords: $
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = camera-1
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,44 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - CAMERA - demos - camera-1
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Log: $
# $NoKeywords: $
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
#TWL_CODEGEN = THUMB
TWL_PROC = ARM7
TARGET_BIN = main.axf
SRCS = main.c
#SRCDIR = # using default
#LCFILE = # using default
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - tests - snd - channel
File: main.c
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: main.c,v $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl_sp.h>
#include <twl/camera.h>
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
// ===== スレッド優先度 =====
#define THREAD_PRIO_SPI 2
#define THREAD_PRIO_CAMERA 6
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
static OSHeapHandle InitializeAllocateSystem(void);
static void VBlankIntr(void);
/*---------------------------------------------------------------------------*
Name: TwlSpMain
Description: Initialize and do main
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void TwlSpMain(void)
{
OSHeapHandle heapHandle;
// OS初期化
OS_Init();
OS_InitThread();
// PXI初期化、ARM9と同期
PXI_Init();
// ヒープ領域設定
heapHandle = InitializeAllocateSystem();
// カメラ初期化
CAMERA_Init(THREAD_PRIO_CAMERA);
// ボタン入力サーチ初期化
(void)PAD_InitXYButton();
// 割込み許可
(void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)GX_VBlankIntr(TRUE);
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
// SPI初期化
// SPI_Init(THREAD_PRIO_SPI);
while (TRUE)
{
OS_Halt();
//---- check reset
if (OS_IsResetOccurred())
{
OS_ResetSystem();
}
}
}
/*---------------------------------------------------------------------------*
Name: InitializeAllocateSystem
Description:
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
static OSHeapHandle InitializeAllocateSystem(void)
{
void *tempLo;
OSHeapHandle hh;
OS_TPrintf("OS_GetWramSubPrivArenaLo() = %p\n", OS_GetWramSubPrivArenaLo());
OS_TPrintf("OS_GetWramSubPrivArenaHi() = %p\n", OS_GetWramSubPrivArenaHi());
OS_TPrintf("OS_GetWramSubArenaLo() = %p\n", OS_GetWramSubArenaLo());
OS_TPrintf("OS_GetWramSubArenaHi() = %p\n", OS_GetWramSubArenaHi());
OS_TPrintf("OS_GetSubPrivArenaLo() = %p\n", OS_GetSubPrivArenaLo());
OS_TPrintf("OS_GetSubPrivArenaHi() = %p\n", OS_GetSubPrivArenaHi());
OS_TPrintf("call OS_SetWramSubPrivArenaHi(0x0380f980); to fix arena.\n");
OS_SetWramSubPrivArenaHi((void*)0x0380f980);
// メモリ割当て初期化
tempLo = OS_InitAlloc(OS_ARENA_WRAM_SUBPRIV,
OS_GetWramSubPrivArenaLo(), OS_GetWramSubPrivArenaHi(), 1);
// アリーナを0クリア
MI_CpuClear8(tempLo, (u32)OS_GetWramSubPrivArenaHi() - (u32)tempLo);
// アリーナ下位アドレスを設定
OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, tempLo);
// ヒープ作成
hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV,
OS_GetWramSubPrivArenaLo(), OS_GetWramSubPrivArenaHi());
if (hh < 0)
{
OS_Panic("ARM7: Fail to create heap.\n");
}
// カレントヒープに設定
(void)OS_SetCurrentHeap(OS_ARENA_WRAM_SUBPRIV, hh);
return hh;
}
/*---------------------------------------------------------------------------*
Name: VBlankIntr
Description: VBlank interrupt handler
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
#ifndef SDK_TEG
extern BOOL PMi_Initialized;
void PM_SelfBlinkProc(void);
static void VBlankIntr(void)
{
//---- LED blink system
if (PMi_Initialized)
{
PM_SelfBlinkProc();
}
}
#else
static void VBlankIntr(void)
{
}
#endif
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,41 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - CAMERA - demos - camera-1
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Log: Makefile,v $
# $NoKeywords: $
#----------------------------------------------------------------------------
SUBDIRS =
#----------------------------------------------------------------------------
#TWL_CODEGEN = THUMB
TARGET_BIN = main.axf
SRCS = main.c
#SRCDIR = # using default
#LCFILE = # using default
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -0,0 +1,144 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - SND - demos - capture
File: main.c
Copyright 2005,2006 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: main.c,v $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/camera.h>
#define DMA_NO 5
#define WIDTH 256
#define HEIGHT 192
static void VBlankIntr(void);
static void CameraIntr(void);
/*---------------------------------------------------------------------------*
Name: TwlMain
Description: main
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void TwlMain()
{
// 初期化
OS_Init();
GX_Init();
OS_InitTick();
// Vブランク割り込み設定
OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
(void)OS_EnableIrqMask(OS_IE_V_BLANK);
(void)OS_EnableIrq();
(void)GX_VBlankIntr(TRUE);
{
u16 bg_color = GX_RGB(31, 0, 0);
GX_LoadBGPltt(&bg_color, 0, sizeof(u16));
}
// VRAM表示モード
GX_SetBankForLCDC(GX_VRAM_LCDC_A);
MI_CpuClearFast((void *)HW_LCDC_VRAM_A, WIDTH*HEIGHT*2);
GX_SetGraphicsMode(GX_DISPMODE_VRAM_A, GX_BGMODE_0, GX_BG0_AS_2D);
GX_SetDispSelect(GX_DISP_SELECT_SUB_MAIN);
OS_WaitVBlankIntr();
GX_DispOn();
// カメラ初期化
CAMERA_Init();
CAMERA_SelectCamera(CAMERA_SELECT_FIRST);
CAMERA_PowerOn();
CAMERA_I2CInit();
CAMERA_I2CPreset(CAMERA_PRESET_QVGA_30SD);
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_NEGATIVE_EDGE);
CAMERA_SetBufferErrorIntrrupt(TRUE);
CAMERA_SetMasterIntrrupt(TRUE);
OS_SetIrqFunction(OS_IE_CAM, CameraIntr);
(void)OS_EnableIrqMask(OS_IE_CAM);
// カメラスタート
CAMERA_ClearBuffer();
// DMA will be started by CameraIntr()
CAMERA_Start();
while (1)
{
OS_WaitVBlankIntr();
}
}
//--------------------------------------------------------------------------------
// Vブランク割り込み処理
//
void VBlankIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt
}
#define PRINT_RATE 32
void CameraIntr(void)
{
if (CAMERA_GetErrorStatus())
{
OS_TPrintf("Error was occurred.\n");
CAMERA_Stop();
MIi_StopExDma(DMA_NO);
while (CAMERA_IsBusy())
{
}
CAMERA_ClearBuffer();
CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, CAMERA_GET_LINE_BYTES(WIDTH) * CAMERA_GET_MAX_LINES(WIDTH), CAMERA_GET_LINE_BYTES(WIDTH) * HEIGHT);
CAMERA_Start();
}
else
{
static int count = 0;
static OSTick prev = 0;
static OSTick save[PRINT_RATE];
OSTick current = OS_GetTick();
if (MIi_IsExDmaBusy(DMA_NO))
{
OS_TPrintf("Why??? %d\n", (int)current);
OS_SetIrqCheckFlag(OS_IE_CAM);
return;
}
CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, CAMERA_GET_LINE_BYTES(WIDTH) * CAMERA_GET_MAX_LINES(WIDTH), CAMERA_GET_LINE_BYTES(WIDTH) * HEIGHT);
if (count == PRINT_RATE)
{
int i;
OSTick uspf = 0;
for (i = 0; i < count; i++)
{
uspf += OS_TicksToMicroSeconds(save[i]);
}
uspf /= count;
OS_TPrintf("%2d.%03d fps\n", (int)(1000000LL / uspf), (int)(1000000000LL / uspf) % 1000);
count = 0;
}
if (prev)
save[count++] = current - prev;
prev = current;
}
OS_SetIrqCheckFlag(OS_IE_CAM); // checking camera interrupt
}

View File

@ -0,0 +1,32 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - build
# File: Makefile
#
# Copyright 2007 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Log: $
# $NoKeywords: $
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = \
ARM7 \
ARM9 \
#----------------------------------------------------------------------------
include $(TWLSDK_ROOT)/build/buildtools/modulerules
#===== End of Makefile =====

View File

@ -112,6 +112,7 @@ typedef enum
PXI_FIFO_TAG_CTRDG_Ex, // Cartridge Ex
PXI_FIFO_TAG_CTRDG_PHI, // Cartridge PHI
PXI_FIFO_TAG_AES, // AES
PXI_FIFO_TAG_CAMERA, // Camera
PXI_MAX_FIFO_TAG = 32 // MAX FIFO TAG
}

37
include/twl/camera.h Normal file
View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - CAMERA - include
File: camera.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_H_
#define TWL_CAMERA_H_
#include <twl/camera/common/fifo.h>
#include <twl/camera/common/types.h>
#ifdef SDK_ARM7
#include <twl/camera/ARM7/i2c.h>
#include <twl/camera/ARM7/control.h>
#else
#include <twl/camera/ARM9/camera.h>
#include <twl/camera/ARM9/camera_api.h>
#include <twl/camera/ARM9/transfer.h>
#endif
/* TWL_LCDC_H_ */
#endif

View File

@ -0,0 +1,70 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - library - camera
File: control.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_CONTROL_H_
#define TWL_CAMERA_CONTROL_H_
#include <twl/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
#define CAMERA_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ
#define CAMERA_THREAD_STACK_SIZE 256 // スレッドのスタックサイズ
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
// CAMERAライブラリ用ワーク構造体
typedef struct CAMERAWork
{
OSMessageQueue msgQ; // スレッド同期用メッセージキュー
OSMessage msgArray[CAMERA_MESSAGE_ARRAY_MAX];
// メッセージを格納するバッファ
OSThread thread; // CAMERA用スレッド
u64 stack[CAMERA_THREAD_STACK_SIZE / sizeof(u64)];
// CAMERA用スレッドのスタック
CAMERAPxiCommand command; // コマンド種別
u8 current; // 受信済みデータ個数 (バイト単位)
u8 total; // 最終データ個数 (1 + 後続コマンド*3)
u8 data[CAMERA_PXI_DATA_SIZE_MAX];
// ARM9からのデータ保存用
}
CAMERAWork;
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
void CAMERA_Init(u32 priority); // 初期化、及びスレッドを開始
void CAMERA_Lock(void); // ARM7側で使うためにロックする
BOOL CAMERA_TryLock(void); // ARM7側で使うためにロックを試みる
void CAMERA_Unlock(void); // ARM7側のロックを解除する
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* TWL_CAMERA_CONTROL_H_ */

View File

@ -0,0 +1,381 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - camera
File: camera_i2c.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_CAMERA_I2CH_
#define TWL_CAMERA_CAMERA_I2CH_
#include <twl/types.h>
#include <twl/i2c/ARM7/i2c.h>
#include <twl/camera/common/types.h>
#define CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
#ifdef _cplusplus
extern "C" {
#endif
//================================================================================
// I2C_ ACCESS
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegister
Description: set value to decive register through I2C_.
Arguments: reg : decive register
data : value to be written
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_WriteRegister( u8 reg, u8 data )
{
return I2Ci_WriteRegister( I2C_SLAVE_CAMERA, reg, data );
}
static inline BOOL CAMERA_WriteRegister( u8 reg, u8 data )
{
return I2C_WriteRegister( I2C_SLAVE_CAMERA, reg, data );
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegister
Description: get value from decive register through I2C_.
Arguments: reg : decive register
Returns: value which is read from specified decive register
*---------------------------------------------------------------------------*/
static inline u8 CAMERAi_ReadRegister( u8 reg )
{
return I2Ci_ReadRegisterSC( I2C_SLAVE_CAMERA, reg );
}
static inline u8 CAMERA_ReadRegister( u8 reg )
{
return I2C_ReadRegisterSC( I2C_SLAVE_CAMERA, reg );
}
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegisters
Description: set value to decive registers through I2C_.
Arguments: reg : decive register
data : value to be written
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_WriteRegisters( u8 reg, const u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
return (size == 0 ? TRUE : FALSE);
#else
return I2Ci_WriteRegisters( I2C_SLAVE_CAMERA, reg, bufp, size );
#endif
}
static inline BOOL CAMERA_WriteRegisters( u8 reg, const u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
return (size == 0 ? TRUE : FALSE);
#else
return I2C_WriteRegisters( I2C_SLAVE_CAMERA, reg, bufp, size );
#endif
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegisters
Description: get value from decive registers through I2C_.
Arguments: reg : decive register
Returns: value which is read from specified decive register
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_ReadRegisters( u8 reg, u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
return (size == 0 ? TRUE : FALSE);
#else
return I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA, reg, bufp, size );
#endif
}
static inline BOOL CAMERA_ReadRegisters( u8 reg, u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
return (size == 0 ? TRUE : FALSE);
#else
return I2C_ReadRegistersSC( I2C_SLAVE_CAMERA, reg, bufp, size );
#endif
}
//================================================================================
// I2C_ BIT CONTROL
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_SetParams
Description: set control bit to device register
Arguments: reg : device register
setBits : bits to set
maskBits : bits to mask
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_SetParams( u8 reg, u8 setBits, u8 maskBits )
{
return I2Ci_SetParams( I2C_SLAVE_CAMERA, reg, setBits, maskBits );
}
static inline BOOL CAMERA_SetParams( u8 reg, u8 setBits, u8 maskBits )
{
return I2C_SetParams( I2C_SLAVE_CAMERA, reg, setBits, maskBits );
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetFlags
Description: set control bit to device register
Arguments: reg : device register
setBits : bits to set
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_SetFlags( u8 reg, u8 setBits )
{
return CAMERAi_SetParams( reg, setBits, setBits );
}
static inline BOOL CAMERA_SetFlags( u8 reg, u8 setBits )
{
return CAMERA_SetParams( reg, setBits, setBits );
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearFlags
Description: clear control bit to device register
Arguments: reg : device register
clrBits : bits to clear
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_ClearFlags( u8 reg, u8 clrBits )
{
return CAMERAi_SetParams( reg, 0, clrBits );
}
static inline BOOL CAMERA_ClearFlags( u8 reg, u8 clrBits )
{
return CAMERA_SetParams( reg, 0, clrBits );
}
//================================================================================
// I2C_ API
//================================================================================
#define CAMERA_I2CSetCropping(x, y, w, h) CAMERA_I2CSetCroppingParams(w, h)
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CSetFlipMode
Description: set CAMERA's flip mode
Arguments: mode one of CameraFlipMode to apply
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CSetFlipMode(CameraFlipMode mode);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CSetSpecialMode
Description: set CAMERA's special mode
Arguments: mode one of CameraSpecialMode to apply
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CSetSpecialMode(CameraSpecialMode mode);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CSetCroppingParams
Description: set CAMERA_ cropping parameters.
Arguments: width width of image (up to 640)
height height of image (up to 480)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CSetCroppingParams(u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CGetCroppingParams
Description: get current CAMERA_ cropping parameters.
Arguments: pWidth address to store the width
pHeight address to store the height
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CGetCroppingParams(u16 *pWidth, u16 *pHeight);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPause
Description: pause to send frame
Arguments: None
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CPause(void)
{
BOOL result;
(void)I2C_Lock();
result = CAMERAi_WriteRegister( 0xef, 0x00 ) &&
CAMERAi_ClearFlags( 0xde, 0x04 );
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CResume
Description: resume from pause state
Arguments: None
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CResume(void)
{
BOOL result;
(void)I2C_Lock();
result = CAMERAi_WriteRegister( 0xef, 0x00 ) &&
CAMERAi_SetFlags( 0xde, 0x04 );
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreSleep
Description: pre-sleep
Arguments: None
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CPreSleep(void)
{
BOOL result;
(void)I2C_Lock();
// not impremented yet
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPostSleep
Description: post-sleep
Arguments: None
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CPostSleep(void)
{
BOOL result;
(void)I2C_Lock();
// not impremented yet
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreset
Description: preset CAMERA registers
Arguments: preset one of CameraPreset
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CPreset(CameraPreset preset);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInit
Description: initialize CAMERA
Arguments: None
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CInit(void)
{
if (CAMERA_I2CPreset(CAMERA_PRESET_DEFAULT) == FALSE) {
return FALSE;
}
if (CAMERA_I2CSetFlipMode(CAMERA_FLIPMODE_DEFAULT) == FALSE) {
return FALSE;
}
return TRUE;
}
#ifdef _cplusplus
} /* extern "C" */
#endif
/* TWL_CAMERA_CAMERA_I2CH_ */
#endif

View File

@ -0,0 +1,298 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - camera
File: camera.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_CAMERA_H_
#define TWL_CAMERA_CAMERA_H_
#include <twl/misc.h>
#include <twl/types.h>
#include <nitro/hw/ARM9/ioreg.h>
#include <twl/camera/ARM9/camera_api.h>
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#define CAMERA_GET_MAX_LINES(width) MIN((1024 / width), 16)
#define CAMERA_GET_LINE_BYTES(width) (width << 1)
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
CAMERA_SELECT_FIRST,
CAMERA_SELECT_SECOND
} CameraSelect;
typedef enum {
CAMERA_OUTPUT_YUV,
CAMERA_OUTPUT_RGB
} CameraOutput;
typedef enum {
CAMERA_INTR_VSYNC_NONE = (0 << REG_CAM_CAM_CNT_IREQ_VS_SHIFT),
CAMERA_INTR_VSYNC_NEGATIVE_EDGE = (2 << REG_CAM_CAM_CNT_IREQ_VS_SHIFT),
CAMERA_INTR_VSYNC_POSITIVE_EDGE = (3 << REG_CAM_CAM_CNT_IREQ_VS_SHIFT)
} CameraIntrVsync;
/*---------------------------------------------------------------------------*
Name: CAMERA_SelectCamera
Description: set stbyn
Arguments: camera one of CameraSelect
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SelectCamera( CameraSelect camera );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetStbyn
Description: set stbyn
Arguments: BOOL High/Low
Returns: BOOL last state
*---------------------------------------------------------------------------*/
BOOL CAMERA_SetStbyn( BOOL high );
/*---------------------------------------------------------------------------*
Name: CAMERA_PowerOn
Description: power camera on
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_PowerOn( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_PowerOff
Description: power camera off
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_PowerOff( void );
/*---------------------------------------------------------------------------*
Name: cameraPreSleep
Description: pre-sleep process for CAMERA without power off
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_PreSleep( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_PostSleep
Description: pre-sleep process for CAMERA without power off
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_PostSleep( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_IsBusy
Description: whether camera is busy
Arguments: None
Returns: TRUE if camera is busy
*---------------------------------------------------------------------------*/
BOOL CAMERA_IsBusy( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_Start
Description: start to receive camera data
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Start( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_Stop
Description: stop to receive camera data
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_Stop( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetSyncLowActive
Description: set CAMERA sync polarity
Arguments: isLowActive if low active, set TRUE
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetSyncLowActive( BOOL isLowActive );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetRclkNegativeEdge
Description: set CAMERA rclk edge.
Should call while master clock is stopping.
Arguments: isNegativeEdge if negative edge, set TRUE
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetRclkNegativeEdge( BOOL isNegativeEdge );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimmingParamsCenter
Description: set camera trimming parameters by centering
expecting original image size is VGA.
NOTE: should call CAMERA_SetTrimming to enable trimming
Arguments: destWidth width of image to output
destHeight height of image to output
srcWidth original width of image
srcHeight original height of image
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTrimmingParamsCenter(u16 destWidth, u16 destHeight, u16 srcWidth, u16 srcHeight);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimmingParams
Description: set camera trimming parameters
NOTE: widht = x2 - x1; height = y2 - y1;
NOTE: should call CAMERA_SetTrimming to enable trimming
Arguments: x1 X of top-left trimming point (multiple of 2)
y1 Y of top-left trimming point
x2 X of bottom-right trimming point (multiple of 2)
y2 Y of bottom-right trimming point
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTrimmingParams(u16 x1, u16 y1, u16 x2, u16 y2);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimming
Description: set trimming enable/disable
Arguments: enabled TRUE if set trimming will be enabled
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTrimming( BOOL enabled );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetOutputFormat
Description: set CAMERA output format.
Arguments: output one of CameraOutput to set.
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetOutputFormat( CameraOutput output );
/*---------------------------------------------------------------------------*
Name: CAMERA_GetErrorStatus
Description: whether line buffer has occurred some errors or not
Arguments: None
Returns: TRUE if error has occurred
*---------------------------------------------------------------------------*/
BOOL CAMERA_GetErrorStatus( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearBuffer
Description: clear line buffer and error status
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_ClearBuffer( void );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetMasterIntrrupt
Description: set interrupt mode
Arguments: enabled TRUE if set master interrupt will be enabled
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetMasterIntrrupt( BOOL enabled );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetVsyncIntrrupt
Description: set vsync interrupt mode
Arguments: type one of CameraIntrVsync to set
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetVsyncIntrrupt( CameraIntrVsync type );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetBufferErrorIntrrupt
Description: set buffer error interrupt mode
Arguments: enabled TRUE if set buffer error interrupt will be enabled
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetBufferErrorIntrrupt( BOOL enabled );
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTransferLines
Description: set number of lines to store the buffer at once.
Arguments: lines number of lines
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_SetTransferLines( int lines );
#ifdef __cplusplus
} /* extern "C" */
#endif
/* TWL_CAMERA_CAMERA_H_ */
#endif

View File

@ -0,0 +1,408 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - library - camera
File: camera_api.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_CAMERA_API_H_
#define TWL_CAMERA_CAMERA_API_H_
#include <twl/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
// 処理結果定義
typedef enum CAMERAResult
{
CAMERA_RESULT_SUCCESS = 0,
CAMERA_RESULT_SUCCESS_TRUE,
CAMERA_RESULT_SUCCESS_FALSE,
CAMERA_RESULT_BUSY,
CAMERA_RESULT_ILLEGAL_PARAMETER,
CAMERA_RESULT_SEND_ERROR,
CAMERA_RESULT_INVALID_COMMAND,
CAMERA_RESULT_ILLEGAL_STATUS,
CAMERA_RESULT_FATAL_ERROR,
CAMERA_RESULT_MAX
}
CAMERAResult;
// コールバック
typedef void (*CAMERACallback)(CAMERAResult result, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_Init
Description: CAMERAライブラリを初期化する
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void CAMERA_Init(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetStbyn2Async
Description: select STBYN for 2nd CAMERA
async version
Arguments: state - High/Low
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetStbyn2Async(BOOL state, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetStbyn2
Description: select STBYN for 2nd CAMERA
sync version.
Arguments: state - High/Low
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetStbyn2(BOOL state);
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegistersAsync
Description: write CAMERA registers via I2C.
async version.
Arguments: addr - start address
bufp - buffer to write
length - length of bufp
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_WriteRegistersAsync(u8 addr, const u8* bufp, size_t length, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegisters
Description: write CAMERA registers via I2C.
sync version.
Arguments: addr - start address
bufp - buffer to write
length - length of bufp
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_WriteRegisters(u8 addr, const u8* bufp, size_t length);
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegistersAsync
Description: read CAMERA registers via I2C.
Arguments: addr - start address
bufp - buffer to read
length - length of bufp
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ReadRegistersAsync(u8 addr, u8* bufp, size_t length, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegisters
Description: set CAMERA key normally
sync version.
Arguments: pKey - pointer to key data
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ReadRegisters(u8 addr, u8* bufp, size_t length);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetParamsAsync
Description: set register as reg = (reg & ~mask) | (bits & mask);
Arguments: addr - address to access
bits - bits to set
mask - mask to touch
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetParamsAsync(u8 addr, u8 bits, u8 mask, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetParams
Description: set register as reg = (reg & ~mask) | (bits & mask);
Arguments: addr - address to access
bits - bits to set
mask - mask to touch
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetParams(u8 addr, u8 bits, u8 mask);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetFlagsAsync
Description: set register as reg |= bits;
Arguments: addr - address to access
bits - bits to set
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetFlagsAsync(u8 addr, u8 bits, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetFlags
Description: set register as reg |= bits;
Arguments: addr - address to access
bits - bits to set
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetFlags(u8 addr, u8 bits);
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearFlagsAsync
Description: set register as reg &= ~bits;
Arguments: addr - address to access
bits - bits to clear
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ClearFlagsAsync(u8 addr, u8 bits, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearFlags
Description: set register as reg &= ~bits;
Arguments: addr - address to access
bits - bits to set
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ClearFlags(u8 addr, u8 bits);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInitAsync
Description: initialize camera registers via I2C
async version.
Arguments: callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CInitAsync(CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInit
Description: initialize camera registers via I2C
sync version.
Arguments: None.
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CInit(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPresetAsync
Description: set camera registers with specified preset via I2C
async version
Arguments: preset - preset type
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPresetAsync(CameraPreset preset, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreset
Description: set camera registers with specified preset via I2C
sync version.
Arguments: preset - preset type
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPreset(CameraPreset preset);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreSleepAsync
Description: pre-sleep process in camera registers via I2C
async version.
Arguments: callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPreSleepAsync(CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreSleep
Description: pre-sleep process in camera registers via I2C
sync version.
Arguments: None.
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPreSleep(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPostSleepAsync
Description: post-sleep process in camera registers via I2C
async version.
Arguments: callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPostSleepAsync(CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPostSleep
Description: post-sleep process in camera registers via I2C
sync version.
Arguments: None.
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPostSleep(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetCroppingAsync
Description: set offset and size
Arguments: x_off - x offset to start capturing
y_off - y offset to start capturing
width - width of image
height - height of image
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetCroppingAsync(u16 x_off, u16 y_off, u16 width, u16 height, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetCropping
Description: set offset and size
Arguments: x_off - x offset to start capturing
y_off - y offset to start capturing
width - width of image
height - height of image
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetCropping(u16 x_off, u16 y_off, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_PauseAsync
Description: pause camera via I2C
async version.
Arguments: callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_PauseAsync(CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_Pause
Description: pause camera via I2C
sync version.
Arguments: None.
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Pause(void);
/*---------------------------------------------------------------------------*
Name: CAMERA_ResumeAsync
Description: resume camera from pausing via I2C
async version.
Arguments: callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ResumeAsync(CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_Resume
Description: resume camera from pausing via I2C
sync version.
Arguments: None.
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Resume(void);
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* TWL_CAMERA_CAMERA_API_H_ */

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - library - camera
File: camera_transfer.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_TRANSFER_H_
#define TWL_CAMERA_TRANSFER_H_
#include <twl/types.h>
#include <twl/mi/exDma.h>
#define CAMERA_DMA_BLOCK_SIZE MI_EXDMA_BLOCK_64B
#define CAMERA_DMA_INTERVAL 8
#define CAMERA_DMA_PRESCALER MI_EXDMA_PRESCALER_1
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
/*---------------------------------------------------------------------------*
Name: CAMERA_DmaRecv
Description: receiving a frame data from CAMERA buffer.
Sync version.
Arguments: dmaNo : DMA channel No. (4 - 7)
dest : destination address
unit : transfer length at once (byte)(width * lines at once)
length : transfer length (byte) (frame size)
Returns: None
*---------------------------------------------------------------------------*/
static inline void CAMERA_DmaRecv(u32 dmaNo, void *dest, u32 unit, u32 length)
{
MIi_ExDmaRecvCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, length, unit,
CAMERA_DMA_BLOCK_SIZE, CAMERA_DMA_INTERVAL, CAMERA_DMA_PRESCALER,
MI_EXDMA_CONTINUOUS_OFF, MI_EXDMA_SRC_RLD_OFF, MI_EXDMA_DEST_RLD_OFF,
MI_EXDMA_TIMING_CAMERA );
}
/*---------------------------------------------------------------------------*
Name: CAMERA_DmaRecvAsync
Description: receiving a frame data from CAMERA buffer.
Async version.
Arguments: dmaNo : DMA channel No. (4 - 7)
dest : destination address
unit : transfer length at once (byte)(width * lines at once)
length : transfer length (byte) (frame size)
Returns: None
*---------------------------------------------------------------------------*/
static inline void CAMERA_DmaRecvAsync(u32 dmaNo, void *dest, u32 unit, u32 length)
{
MIi_ExDmaRecvAsyncCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, length, unit,
CAMERA_DMA_BLOCK_SIZE, CAMERA_DMA_INTERVAL, CAMERA_DMA_PRESCALER,
MI_EXDMA_CONTINUOUS_OFF, MI_EXDMA_SRC_RLD_OFF, MI_EXDMA_DEST_RLD_OFF,
MI_EXDMA_TIMING_CAMERA );
}
/*---------------------------------------------------------------------------*
Name: CAMERA_DmaRecvInfinity
Description: receiving data from CAMERA buffer.
Once starting DMA, it will transfer every frame automatically.
You should call MIi_StopExDma(dmaNo) to stop
Arguments: dmaNo : DMA channel No. (4 - 7)
dest : destination address
unit : transfer length at once (byte)(width * lines at once)
length : transfer length (byte) (frame size)
Returns: None
*---------------------------------------------------------------------------*/
static inline void CAMERA_DmaRecvInfinity(u32 dmaNo, void *dest, u32 unit, u32 length)
{
MIi_ExDmaRecvAsyncCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, length, unit,
CAMERA_DMA_BLOCK_SIZE, CAMERA_DMA_INTERVAL, CAMERA_DMA_PRESCALER,
MI_EXDMA_CONTINUOUS_ON, MI_EXDMA_SRC_RLD_OFF, MI_EXDMA_DEST_RLD_ON,
MI_EXDMA_TIMING_CAMERA );
}
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* TWL_CAMERA_TRANSFER_H_ */

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - camera - include
File: fifo.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_FIFO_H_
#define TWL_CAMERA_FIFO_H_
/*---------------------------------------------------------------------------*
*---------------------------------------------------------------------------*/
// プロトコル関連定義
#define CAMERA_PXI_CONTINUOUS_PACKET_MAX 4 // 連続パケットの最大連続回数
#define CAMERA_PXI_DATA_SIZE_MAX ((CAMERA_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // 最大データ数
#define CAMERA_PXI_START_BIT 0x02000000 // 先頭パケットを意味する
#define CAMERA_PXI_RESULT_BIT 0x00008000 // PXIの応答を示す
/* 先頭パケットのみの規則 */
#define CAMERA_PXI_DATA_NUMS_MASK 0x00ff0000 // データ数領域
#define CAMERA_PXI_DATA_NUMS_SHIFT 16 // データ数位置
#define CAMERA_PXI_COMMAND_MASK 0x00007f00 // コマンド格納部分のマスク
#define CAMERA_PXI_COMMAND_SHIFT 8 // コマンド格納部分の位置
#define CAMERA_PXI_1ST_DATA_MASK 0x000000ff // 先頭パケットのデータ領域
#define CAMERA_PXI_1ST_DATA_SHIFT 0 // 先頭パケットのデータ位置
/* 後続パケットのみの規則 */
#define CAMERA_PXI_DATA_MASK 0x00ffffff // データ領域
#define CAMERA_PXI_DATA_SHIFT 0 // データ位置
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
// PXIコマンド定義
typedef enum CAMERAPxiCommand
{
CAMERA_PXI_COMMAND_SET_STBYN = 0x00, // STBYN操作
// I2C基本操作
CAMERA_PXI_COMMAND_WRITE_REGISTERS = 0x10,
CAMERA_PXI_COMMAND_READ_REGISTERS = 0x11,
CAMERA_PXI_COMMAND_SET_PARAMS = 0x12,
CAMERA_PXI_COMMAND_SET_FLAGS = 0x13,
CAMERA_PXI_COMMAND_CLEAR_FLAGS = 0x14,
// I2C応用操作
CAMERA_PXI_COMMAND_I2C_INIT = 0x20, // 汎用初期化
CAMERA_PXI_COMMAND_I2C_PRESET = 0x21, // 各種プリセット
CAMERA_PXI_COMMAND_I2C_PRE_SLEEP = 0x28, // スリープ前処理
CAMERA_PXI_COMMAND_I2C_POST_SLEEP = 0x29, // スリープ後処理
CAMERA_PXI_COMMAND_I2C_SET_CROPPING = 0x30, // 位置とサイズ設定
CAMERA_PXI_COMMAND_I2C_PAUSE = 0x38, // 一時停止
CAMERA_PXI_COMMAND_I2C_RESUME = 0x39 // 復帰
}
CAMERAPxiCommand;
// PXIコマンドサイズ定義
typedef enum CAMERAPxiSize
{
CAMERA_PXI_SIZE_SET_STBYN = 1, // BOOL
// I2C基本操作
CAMERA_PXI_SIZE_WRITE_REGISTERS = 3, // addr, size, data...
CAMERA_PXI_SIZE_READ_REGISTERS = 2, // addr, size
CAMERA_PXI_SIZE_SET_PARAMS = 3, // addr, bits, mask
CAMERA_PXI_SIZE_SET_FLAGS = 2, // addr, bits
CAMERA_PXI_SIZE_CLEAR_FLAGS = 2, // addr, bits
// I2C応用操作
CAMERA_PXI_SIZE_I2C_INIT = 0,
CAMERA_PXI_SIZE_I2C_PRESET = 1, // preset
CAMERA_PXI_SIZE_I2C_PRE_SLEEP = 0,
CAMERA_PXI_SIZE_I2C_POST_SLEEP = 0,
CAMERA_PXI_SIZE_I2C_SET_CROPPING = 8, // (u16)x_offset, (u16)y_offset, (u16)width, (u16)height
CAMERA_PXI_SIZE_I2C_PAUSE = 0,
CAMERA_PXI_SIZE_I2C_RESUME = 0
}
CAMERAPxiSize;
// 応答定義
typedef enum CAMERAPxiResult
{
CAMERA_PXI_RESULT_SUCCESS = 0, // 処理成功 (void/void*型) // 場合により後続パケットあり
CAMERA_PXI_RESULT_SUCCESS_TRUE, // 処理成功 (BOOL型)
CAMERA_PXI_RESULT_SUCCESS_FALSE, // 処理成功 (BOOL型)
CAMERA_PXI_RESULT_INVALID_COMMAND, // 不正なPXIコマンド
CAMERA_PXI_RESULT_INVALID_PARAMETER, // 不正なパラメータ
CAMERA_PXI_RESULT_ILLEGAL_STATUS, // RTCの状態により処理を実行不能
CAMERA_PXI_RESULT_BUSY, // 他のリクエストを実行中
CAMERA_PXI_RESULT_FATAL_ERROR, // その他何らかの原因で処理に失敗
CAMERA_PXI_RESULT_MAX
}
CAMERAPxiResult;
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* TWL_CAMERA_FIFO_H_ */
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - camera - include
File: types.h
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#ifndef TWL_CAMERA_TYPES_H_
#define TWL_CAMERA_TYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*/
typedef enum {
CAMERA_FLIPMODE_NONE,
CAMERA_FLIPMODE_HORIZONTAL,
CAMERA_FLIPMODE_VERTICAL,
CAMERA_FLIPMODE_HORIZONTAL_VERTICAL,
CAMERA_FLIPMODE_MAX,
CAMERA_FLIPMODE_DEFAULT = CAMERA_FLIPMODE_HORIZONTAL
} CameraFlipMode;
typedef enum {
CAMERA_SPECIALMODE_NONE,
CAMERA_SPECIALMODE_NEVATIVE,
CAMERA_SPECIALMODE_SEPIA,
CAMERA_SPECIALMODE_BLUISH,
CAMERA_SPECIALMODE_REDDISH,
CAMERA_SPECIALMODE_GREENISH,
CAMERA_SPECIALMODE_MAX,
CAMERA_SPECIALMODE_AQUA = CAMERA_SPECIALMODE_BLUISH,
CAMERA_SPECIALMODE_DEFAULT = CAMERA_SPECIALMODE_NONE
} CameraSpecialMode;
typedef enum {
CAMERA_PRESET_HVGA_20,
CAMERA_PRESET_DS_30,
CAMERA_PRESET_VGA_20,
CAMERA_PRESET_QVGA_20,
CAMERA_PRESET_QVGA_30,
CAMERA_PRESET_QVGA_30SD,
CAMERA_PRESET_QVGA_30SS,
CAMERA_PRESET_MAX,
CAMERA_PRESET_DEFAULT = CAMERA_PRESET_HVGA_20
} CameraPreset;
/*===========================================================================*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* TWL_CAMERA_TYPES_H_ */
/*---------------------------------------------------------------------------*
End of file
*---------------------------------------------------------------------------*/