add sharp/micron code and remove samsung at all

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@194 4ee2a332-4b2b-5046-8439-1ba90f034370
This commit is contained in:
yutaka 2007-07-19 03:49:48 +00:00
parent 073c4fab82
commit d9fbb9af01
44 changed files with 4926 additions and 6507 deletions

View File

@ -1,31 +0,0 @@
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

@ -1,28 +0,0 @@
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,224 @@
#VGA
#I2C
# E0
#I2CS
# 7F
#ImageSize
# 640
# 480
# 0
03 01
#04 A0
09 D2 #PLL
0A 03 #PLL1
0B 00 #PLL2
04 10
04 90
C9 B0 #frame height 15fps
C8 04 #1200
E0 07 #frame width
E1 D0 #1600
03 02
11 04 #mid fh
12 B0
13 04 # 0E #max fh
14 B0 # 10
16 70 #mid ex
17 80
19 70 #max ex
1A 80
1E 04 #exp fh
1F B0
#flicker setting
03 01
B9 3E
BA 7F
BB 0E
BC 56
C1 3E
C2 7F
C3 25
C4 80
#black
FF 0B
4A 42
4B 00 #11Jul07 .Kim
51 24
52 24
53 00
54 20
55 00
56 06
57 0C
58 16
59 20
5A 36
5B 48
5C 68
5D 84
5E A6
5F C2
60 D6
61 E8
62 F4
63 FF
#6E 0D #Lengs_Gain_G1(R)
#6F 02 #Lengs_Gain_G2(B)
#7E 51 #Lengs_G1_E(R)
#6D 0D #3200 DNP R:43 B:5A
#6E 06 #Lengs_Gain_G1(R)
#6F 06 #Lengs_Gain_G2(B)
#70 03
6D 0D #5200 DNP R:55, B:49
6E 08 #Lengs_Gain_G1(R)
6F 08 #Lengs_Gain_G2(B)
70 03
7A 4A #Red_E
7B 38 #Red_W
7C 40 #Red_N
7D 50 #Red_S
7E 10 #G1_E
7F 28 #G1_W
80 20 #G1_N
81 40 #G1_S
82 10 #G2_E
83 28 #G2_W
84 20 #G2_N
85 40 #G2_S
86 10 #B_E
87 60 #B_W
88 20 #B_N
89 50 #B_S
#7A 48
#7B 30
#7E 41 #Lengs_G1_E(R)
#87 50
#88 50
#03 02
#C1 0D
#C2 06
#C3 06
#C4 03
#C5 0D #R:55
#C6 08
#C7 08
#C8 03
#C9 43
#CA 55
#05 4D #enable R/B
#03 01
B2 44 #Rgain min 11Jul07 .KIM
B3 80 #Rgain max
B4 44 #Bgain min 11Jul07 .KIM
B5 80 #Bgain max
0F 98
03 02
94 82 # 11Jul07 .KIM
95 80 # 11Jul07 .KIM
AA 4E # Matrix1 of Color
AB A9 # Matrix2 of Color
AC 84 # Matrix3 of Color
AD 87 # Matrix4 of Color
AE 3A # Matrix5 of Color
AF 92 # Matrix6 of Color
B0 8B # Matrix7 of Color
B1 A0 # Matrix8 of Color
B2 4C # Matrix9 of Color
B3 24 # MatrixNo2 of Color
B4 00 # MatrixNo2 of Color
B5 00 # MatrixNo2 of Color
B6 24 # MatrixNo2 of Color
#AA 40 # Matrix1 of Color
#AB 00 # Matrix2 of Color
#AC 00 # Matrix3 of Color
#AD 00 # Matrix4 of Color
#AE 40 # Matrix5 of Color
#AF 00 # Matrix6 of Color
#B0 00 # Matrix7 of Color
#B1 00 # Matrix8 of Color
#B2 40 # Matrix9 of Color
#B3 40 # MatrixNo2 of Color 11Jul07 .KIM
#B4 08 # MatrixNo2 of Color
#B5 00 # MatrixNo2 of Color
#B6 40 # MatrixNo2 of Color 11Jul07 .KIM
69 04 #LPF
6A 04
6B 04
6C 10
6D 10
6E 0A
6F 00 #Gamma
70 00
71 00
72 10
73 10
74 1F
75 00 #DPC
76 00
77 10
78 1F
79 1F
7A 1F
7B 00 #color
7C 00
7D 00
7E 08
7F 08
80 08
81 00 #Lens
82 04
83 08
84 10
85 1F
86 1F
87 00 #Edge
88 00
89 00
8A 28
8B 28
8C 3F
#Bank C
03 02
2E 88 #max_yt1
30 78 #min_yt1
34 80 #Ytarget
36 80 #UsrYtarget
37 80 #FstYtarget
#Bank A
03 00
95 40
03 01

View File

@ -0,0 +1,234 @@
#VGA
#I2C
# E0
#I2CS
# 7F
#ImageSize
# 640
# 480
# 0
03 01
#04 A0
09 D2 #PLL
0A 03 #PLL1
0B 00 #PLL2
04 10
04 90
C9 B0 #frame height 15fps
C8 04 #1200
E0 07 #frame width
E1 D0 #1600
03 02
11 04 #mid fh
12 B0
13 0E #max fh
14 10
16 70 #mid ex
17 80
19 70 #max ex
1A 80
1E 04 #exp fh
1F B0
#flicker setting
03 01
B9 3E
BA 7F
BB 0E
BC 56
C1 3E
C2 7F
C3 25
C4 80
#black
FF 0B
4A 42
4B 00 #11Jul07 .Kim
51 24
52 24
53 00
54 20
55 00
56 06
57 0C
58 16
59 20
5A 36
5B 48
5C 68
5D 84
5E A6
5F C2
60 D6
61 E8
62 F4
63 FF
#6E 0D #Lengs_Gain_G1(R)
#6F 02 #Lengs_Gain_G2(B)
#7E 51 #Lengs_G1_E(R)
#6D 0D #3200 DNP R:43 B:5A
#6E 06 #Lengs_Gain_G1(R)
#6F 06 #Lengs_Gain_G2(B)
#70 03
6D 0D #5200 DNP R:55, B:49
6E 08 #Lengs_Gain_G1(R)
6F 08 #Lengs_Gain_G2(B)
70 03
7A 4A #Red_E
7B 38 #Red_W
7C 40 #Red_N
7D 50 #Red_S
7E 10 #G1_E
7F 28 #G1_W
80 20 #G1_N
81 40 #G1_S
82 10 #G2_E
83 28 #G2_W
84 20 #G2_N
85 40 #G2_S
86 10 #B_E
87 60 #B_W
88 20 #B_N
89 50 #B_S
#7A 48
#7B 30
#7E 41 #Lengs_G1_E(R)
#87 50
#88 50
#03 02
#C1 0D
#C2 06
#C3 06
#C4 03
#C5 0D #R:55
#C6 08
#C7 08
#C8 03
#C9 43
#CA 55
#05 4D #enable R/B
#03 01
B2 44 #Rgain min 11Jul07 .KIM
B3 80 #Rgain max
B4 44 #Bgain min 11Jul07 .KIM
B5 80 #Bgain max
0F 98
03 02
94 82 # 11Jul07 .KIM
95 80 # 11Jul07 .KIM
AA 4E # Matrix1 of Color
AB A9 # Matrix2 of Color
AC 84 # Matrix3 of Color
AD 87 # Matrix4 of Color
AE 3A # Matrix5 of Color
AF 92 # Matrix6 of Color
B0 8B # Matrix7 of Color
B1 A0 # Matrix8 of Color
B2 4C # Matrix9 of Color
B3 24 # MatrixNo2 of Color
B4 00 # MatrixNo2 of Color
B5 00 # MatrixNo2 of Color
B6 24 # MatrixNo2 of Color
#AA 40 # Matrix1 of Color
#AB 00 # Matrix2 of Color
#AC 00 # Matrix3 of Color
#AD 00 # Matrix4 of Color
#AE 40 # Matrix5 of Color
#AF 00 # Matrix6 of Color
#B0 00 # Matrix7 of Color
#B1 00 # Matrix8 of Color
#B2 40 # Matrix9 of Color
#B3 40 # MatrixNo2 of Color 11Jul07 .KIM
#B4 08 # MatrixNo2 of Color
#B5 00 # MatrixNo2 of Color
#B6 40 # MatrixNo2 of Color 11Jul07 .KIM
69 04 #LPF
6A 04
6B 04
6C 10
6D 10
6E 0A
6F 00 #Gamma
70 00
71 00
72 10
73 10
74 1F
75 00 #DPC
76 00
77 10
78 1F
79 1F
7A 1F
7B 00 #color
7C 00
7D 00
7E 08
7F 08
80 08
81 00 #Lens
82 04
83 08
84 10
85 1F
86 1F
87 00 #Edge
88 00
89 00
8A 28
8B 28
8C 3F
#Bank C
03 02
2E 88 #max_yt1
30 78 #min_yt1
34 80 #Ytarget
36 80 #UsrYtarget
37 80 #FstYtarget
#Bank A
03 00
95 40
03 01
#Bank B
03 01
D4 08 # 01D4 referense gain1
09 D2 #PLL
0A 02 #03 #pre PLL1
0B 03 #00 #post PLL2

View File

@ -1,708 +0,0 @@
// 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

@ -1,512 +0,0 @@
// 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

@ -1,715 +0,0 @@
// 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

@ -1,649 +0,0 @@
//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

@ -1,655 +0,0 @@
// 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)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,29 +29,27 @@ TWL_PROC = ARM7
SRCDIR = ../common .
SRCS = \
camera_i2c_common.c \
camera_i2c.c \
camera_i2c_micron.c \
camera_i2c_sharp.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 \
MICRON_INI_FILE := \
MT9V113-MTM9-2.ini \
MT9V113-MTM10.ini \
MT9V113-nin00.ini \
L_INI_FILE := MT9V113-MTM9-2.ini
MICRON_CONVERT_EXE := convert_micron.pl
L_SET_CONVERT_EXE := convert_samsung.pl
L_INI_CONVERT_EXE := convert_micron.pl
MICRON_INIC_FILE := $(MICRON_INI_FILE:%.ini=%.autogen.c)
L_SETC_FILE := $(L_SET_FILE:%.set=%.autogen.c)
#SRCS += $(L_SETC_FILE)
SHARP_DAT_FILE := \
5030_15fpsFIX_x8_CC_FilterKIM_MatrixOn3_PLL.dat \
5030_15fps_5fps_adjust2_x8_CC_FilterKIM_MatrixOn3_PLL_1676MHz-1676MHz.dat \
L_INIC_FILE := $(L_INI_FILE:%.ini=%.autogen.c)
SRCS += $(L_INIC_FILE)
SHARP_CONVERT_EXE := convert_sharp.pl
SHARP_DATC_FILE := $(SHARP_DAT_FILE:%.dat=%.autogen.c)
TARGET_LIB = libcamera_sp$(TWL_LIBSUFFIX).a
@ -77,10 +75,13 @@ do-build: $(TARGETS)
include $(TWLSDK_ROOT)/build/buildtools/modulerules
%.autogen.c: %.ini $(MICRON_CONVERT_EXE)
perl $(MICRON_CONVERT_EXE) $< $@
%.autogen.c: %.ini $(L_INI_CONVERT_EXE)
perl $(L_INI_CONVERT_EXE) $< > $@
%.autogen.c: %.dat $(SHARP_CONVERT_EXE)
perl $(SHARP_CONVERT_EXE) $< $@
$(OBJDIR)/camera_i2c_micron.o: $(MICRON_INIC_FILE)
$(OBJDIR)/camera_i2c_sharp.o: $(SHARP_DATC_FILE)
%.autogen.c: %.set $(L_SET_CONVERT_EXE)
perl $(L_INI_CONVERT_EXE) $< > $@
#===== End of Makefile =====

View File

@ -132,23 +132,12 @@ static void CameraPxiCallback(PXIFifoTag tag, u32 data, BOOL err)
switch (cameraWork.command)
{
// 既知のコマンド群
case CAMERA_PXI_COMMAND_SELECT:
// 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:
case CAMERA_PXI_COMMAND_INIT:
case CAMERA_PXI_COMMAND_ACTIVATE:
case CAMERA_PXI_COMMAND_RESIZE:
case CAMERA_PXI_COMMAND_FRAME_RATE:
case CAMERA_PXI_COMMAND_EFFECT:
case CAMERA_PXI_COMMAND_FLIP:
// スレッドを再開
if (!OS_SendMessage(&cameraWork.msgQ, NULL, OS_MESSAGE_NOBLOCK))
{
@ -230,13 +219,8 @@ static void CameraThread(void *arg)
OSMessage msg;
BOOL result;
#if 0
u16 data16a;
u16 data16b;
u16 data16c;
u16 data16d;
u8 dataArray[CAMERA_PXI_DATA_SIZE_MAX]; // 不定長データ格納用
#endif
while (TRUE)
{
@ -246,8 +230,14 @@ static void CameraThread(void *arg)
// コマンドに従って各種処理を実行
switch (cameraWork.command)
{
case CAMERA_PXI_COMMAND_SELECT:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_SELECT);
case CAMERA_PXI_COMMAND_INIT:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_INIT);
result = CAMERA_I2CInit((CameraSelect)cameraWork.data[0]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_ACTIVATE:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_ACTIVATE);
if (cameraWork.camera != cameraWork.data[0])
{
if (cameraWork.camera != CAMERA_SELECT_NONE)
@ -260,103 +250,40 @@ static void CameraThread(void *arg)
cameraWork.camera = (CameraSelect)cameraWork.data[0];
if (cameraWork.camera != CAMERA_SELECT_NONE)
{
if (FALSE == CAMERA_I2CStandby(cameraWork.camera, FALSE)) // set ?XXXXXXXXX
if (FALSE == CAMERA_I2CStandby(cameraWork.camera, FALSE))
{
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の失敗を通達
}
}
}
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS); // ARM9に処理の成功を通達
break;
#if 0
// I2C基本操作
case CAMERA_PXI_COMMAND_WRITE_REGISTERS: // IN: camera, addr, data... OUT: TRUE/FALSE
if (cameraWork.total <= 2)
{
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_PARAMETER);
break;
}
result = CAMERA_WriteRegisters((CameraSelect)cameraWork.data[0], cameraWork.data[1], &cameraWork.data[2], (size_t)(cameraWork.total-2));
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_TRUE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_READ_REGISTERS: // IN: camera, addr, size OUT: TRUE/FALSE, data...
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_READ_REGISTERS);
result = CAMERA_ReadRegisters((CameraSelect)cameraWork.data[0], cameraWork.data[1], dataArray, cameraWork.data[2]);
if (result)
{
CameraReturnResultEx(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_TRUE, cameraWork.data[2], 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((CameraSelect)cameraWork.data[0], cameraWork.data[1], cameraWork.data[2], cameraWork.data[3]);
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((CameraSelect)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_CLEAR_FLAGS:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_CLEAR_FLAGS);
result = CAMERA_ClearFlags((CameraSelect)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;
#endif
case CAMERA_PXI_COMMAND_I2C_INIT:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_INIT);
result = CAMERA_I2CInit((CameraSelect)cameraWork.data[0]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
#if 0
case CAMERA_PXI_COMMAND_I2C_PRESET:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PRESET);
result = CAMERA_I2CPreset((CameraSelect)cameraWork.data[0], (CameraPreset)cameraWork.data[1]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
#endif
case CAMERA_PXI_COMMAND_I2C_PRE_SLEEP:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PRE_SLEEP);
result = CAMERA_I2CPreSleep(cameraWork.camera);
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(cameraWork.camera);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
#if 0
case CAMERA_PXI_COMMAND_I2C_SET_CROPPING:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_SET_CROPPING);
case CAMERA_PXI_COMMAND_RESIZE:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_RESIZE);
CAMERA_UNPACK_U16(&data16a, &cameraWork.data[1]);
CAMERA_UNPACK_U16(&data16b, &cameraWork.data[3]);
CAMERA_UNPACK_U16(&data16c, &cameraWork.data[5]);
CAMERA_UNPACK_U16(&data16d, &cameraWork.data[7]);
result = CAMERA_I2CSetCropping((CameraSelect)cameraWork.data[0], data16a, data16b, data16c, data16d);
result = CAMERA_I2CResize((CameraSelect)cameraWork.data[0], data16a, data16b);
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(cameraWork.camera);
case CAMERA_PXI_COMMAND_FRAME_RATE:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_FRAME_RATE);
result = CAMERA_I2CFrameRate((CameraSelect)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_RESUME:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_RESUME);
result = CAMERA_I2CResume(cameraWork.camera);
case CAMERA_PXI_COMMAND_EFFECT:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_EFFECT);
result = CAMERA_I2CEffect((CameraSelect)cameraWork.data[0], (CameraEffect)cameraWork.data[1]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
case CAMERA_PXI_COMMAND_FLIP:
CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_FLIP);
result = CAMERA_I2CFlip((CameraSelect)cameraWork.data[0], (CameraFlip)cameraWork.data[1]);
CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9に処理の成功を通達
break;
#endif
// サポートしないコマンド
default:

View File

@ -1,8 +1,8 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - libraties - camera
File: camera_i2c_common.c
File: camera_i2c.c
Copyright 2006 Nintendo. All rights reserved.
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
@ -14,7 +14,8 @@
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/camera.h>
#include <twl/camera/ARM7/i2c_micron.h>
#include <twl/camera/ARM7/i2c_sharp.h>
typedef enum
{
@ -25,7 +26,7 @@ typedef enum
}
CAMERAType;
static CAMERAType cameraType = CAMERA_TYPE_MICRON;
static CAMERAType cameraType = CAMERA_TYPE_SHARP;
#if 0
CAMERA_I2CInit()
@ -46,19 +47,19 @@ BOOL CAMERA_I2CInit(CameraSelect camera)
(void)I2C_Lock();
if (cameraType == CAMERA_TYPE_MICRON)
{
result = CAMERA_M_I2CInit(camera);
result = CAMERAi_M_I2CInit(camera);
if (result == FALSE)
{
cameraType = CAMERA_TYPE_SHARP;
}
}
if (cameraType == CAMERA_TYPE_SHARP)
{
result = CAMERA_S_I2CInit(camera);
result = CAMERAi_S_I2CInit(camera);
if (result == FALSE)
{
cameraType = CAMERA_TYPE_MICRON; //rotation CAMERA_TYPE_UNKNOWN;
cameraType = CAMERA_TYPE_MICRON; // rotate for next try
//cameraType = CAMERA_TYPE_UNKNOWN; // annihilate camera I2C
}
}
(void)I2C_Unlock();
@ -79,13 +80,13 @@ BOOL CAMERA_I2CStandby(CameraSelect camera, BOOL standby)
{
BOOL result = FALSE;
(void)I2C_Lock();
switch (camera)
switch (cameraType)
{
case CAMERA_TYPE_MICRON:
CAMERA_M_I2CStandby(camera, standby);
result = CAMERAi_M_I2CStandby(camera, standby);
break;
case CAMERA_TYPE_SHARP:
CAMERA_S_I2CStandby(camera, standby);
result = CAMERAi_S_I2CStandby(camera, standby);
break;
}
(void)I2C_Unlock();
@ -107,13 +108,41 @@ BOOL CAMERA_I2CResize(CameraSelect camera, u16 width, u16 height)
{
BOOL result = FALSE;
(void)I2C_Lock();
switch (camera)
switch (cameraType)
{
case CAMERA_TYPE_MICRON:
CAMERA_M_I2CResize(camera, width, height);
result = CAMERAi_M_I2CResize(camera, width, height);
break;
case CAMERA_TYPE_SHARP:
CAMERA_S_I2CResize(camera, width, height);
result = CAMERAi_S_I2CResize(camera, width, height);
break;
}
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CFrameRate
Description: set CAMERA frame rate
Arguments: camera : one of CameraSelect
rate : fps (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CFrameRate(CameraSelect camera, int rate)
{
BOOL result = FALSE;
(void)I2C_Lock();
switch (cameraType)
{
case CAMERA_TYPE_MICRON:
result = CAMERAi_M_I2CFrameRate(camera, rate);
break;
case CAMERA_TYPE_SHARP:
result = CAMERAi_S_I2CFrameRate(camera, rate);
break;
}
(void)I2C_Unlock();
@ -121,25 +150,26 @@ BOOL CAMERA_I2CResize(CameraSelect camera, u16 width, u16 height)
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreSleep
Name: CAMERA_I2CEffect
Description: preset CAMERA registers
Description: set CAMERA effect
Arguments: camera : one of CameraSelect
effect : one of CameraEffect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CPreSleep(CameraSelect camera)
BOOL CAMERA_I2CEffect(CameraSelect camera, CameraEffect effect)
{
BOOL result = FALSE;
(void)I2C_Lock();
switch (camera)
switch (cameraType)
{
case CAMERA_TYPE_MICRON:
CAMERA_M_I2CPreSleep(camera);
result = CAMERAi_M_I2CEffect(camera, effect);
break;
case CAMERA_TYPE_SHARP:
CAMERA_M_I2CPreSleep(camera);
result = CAMERAi_S_I2CEffect(camera, effect);
break;
}
(void)I2C_Unlock();
@ -147,30 +177,29 @@ BOOL CAMERA_I2CPreSleep(CameraSelect camera)
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPostSleep
Name: CAMERA_I2CFlip
Description: preset CAMERA registers
Description: set CAMERA flip/mirror
Arguments: camera : one of CameraSelect
flip : one of CameraFlip
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CPostSleep(CameraSelect camera)
BOOL CAMERA_I2CFlip(CameraSelect camera, CameraFlip flip)
{
BOOL result = FALSE;
(void)I2C_Lock();
switch (camera)
switch (cameraType)
{
case CAMERA_TYPE_MICRON:
CAMERA_M_I2CPostSleep(camera);
result = CAMERAi_M_I2CFlip(camera, flip);
break;
case CAMERA_TYPE_SHARP:
CAMERA_M_I2CPostSleep(camera);
result = CAMERAi_S_I2CFlip(camera, flip);
break;
}
(void)I2C_Unlock();
return result;
}

View File

@ -2,7 +2,7 @@
Project: TwlSDK - libraties - camera
File: camera_i2c_micron.c
Copyright 2006 Nintendo. All rights reserved.
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
@ -14,47 +14,15 @@
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/camera.h>
#include <twl/camera/ARM7/i2c_micron.h>
//#define USE_MULTIPLE_IO // use [Read|Write]Registers();
// for micron
BOOL CAMERAi_M_Default_Registers( CameraSelect camera );
BOOL CAMERAi_M_Initialize_Camera( CameraSelect camera );
BOOL CAMERAi_M_Image_Setting_ExtClk_6_75MHz_Op_Pix_27_5MHz_15fps( CameraSelect camera );
BOOL CAMERAi_M_Image_Setting_ExtClk_16_76MHz_Op_Pix_27_5MHz_15fps( CameraSelect camera );
BOOL CAMERAi_M_Viewfinder_ON( CameraSelect camera );
BOOL CAMERAi_M_Viewfinder_OFF( CameraSelect camera );
BOOL CAMERAi_M_Video_Capture_ON( CameraSelect camera );
BOOL CAMERAi_M_Video_Capture_OFF( CameraSelect camera );
BOOL CAMERAi_M_Lens_Calibration_Setup( CameraSelect camera );
BOOL CAMERAi_M_Lens_Calibration_Exit( CameraSelect camera );
BOOL CAMERAi_M_Fixed_15fps( CameraSelect camera );
BOOL CAMERAi_M_Refresh( CameraSelect camera );
BOOL CAMERAi_M_Auto_Exposure( CameraSelect camera );
BOOL CAMERAi_M_Gamma_Correction( CameraSelect camera );
BOOL CAMERAi_M_Auto_White_Balance( CameraSelect camera );
BOOL CAMERAi_M_Lens_Correction( CameraSelect camera );
BOOL CAMERAi_M_Image_Size_VGA( CameraSelect camera );
BOOL CAMERAi_M_Image_Size_QVGA( CameraSelect camera );
BOOL CAMERAi_M_Image_Size_CIF( CameraSelect camera );
BOOL CAMERAi_M_Image_Size_QCIF( CameraSelect camera );
BOOL CAMERAi_M_Effect_Off( CameraSelect camera );
BOOL CAMERAi_M_Effect_Mono( CameraSelect camera );
BOOL CAMERAi_M_Effect_Sepia( CameraSelect camera );
BOOL CAMERAi_M_Manual_WB_To_Auto_WB( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P1( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P2( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P3( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P4( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P5( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P6( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P7( CameraSelect camera );
BOOL CAMERAi_M_Manual_White_Balance_P8( CameraSelect camera );
BOOL CAMERAi_M_Sharpness_0( CameraSelect camera );
// insert auto-generated code
#include "MT9V113-MTM10.autogen.c"
//#include "MT9V113-MTM9-2.autogen.c"
//#include "MT9V113-nin00.autogen.c"
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CInit
Name: CAMERAi_M_I2CInit
Description: initialize CAMERA
@ -62,13 +30,26 @@ BOOL CAMERAi_M_Sharpness_0( CameraSelect camera );
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CInit(CameraSelect camera)
BOOL CAMERAi_M_I2CInit(CameraSelect camera)
{
return CAMERAi_M_Default_Registers(camera);
BOOL rIn = TRUE;
BOOL rOut = TRUE;
// should not send init command same time
if (camera & CAMERA_SELECT_IN)
{
rIn = CAMERAi_M_Default_Registers(CAMERA_SELECT_IN)
&& CAMERAi_M_I2CStandby(CAMERA_SELECT_IN, TRUE);
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = CAMERAi_M_Default_Registers(CAMERA_SELECT_OUT)
&& CAMERAi_M_I2CStandby(CAMERA_SELECT_OUT, TRUE);
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CStandby
Name: CAMERAi_M_I2CStandby
Description: standby or resume CAMERA
@ -77,20 +58,22 @@ BOOL CAMERA_M_I2CInit(CameraSelect camera)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CStandby(CameraSelect camera, BOOL standby)
BOOL CAMERAi_M_I2CStandby(CameraSelect camera, BOOL standby)
{
if (standby)
{
return CAMERAi_M_ClearFlags(camera, 0x001A, 0x0200) // stop to output
&& CAMERAi_M_SetFlags(camera, 0x0018, 0x0001); // go to standby
}
else
{
return CAMERAi_M_ClearFlags(camera, 0x0018, 0x0001) // leave standby
&& CAMERAi_M_SetFlags(camera, 0x001A, 0x0200); // start to output
}
(void)camera;
return TRUE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CResize
Name: CAMERAi_M_I2CResize
Description: resize CAMERA
@ -100,45 +83,155 @@ BOOL CAMERA_M_I2CStandby(CameraSelect camera, BOOL standby)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CResize(CameraSelect camera, u16 width, u16 height)
BOOL CAMERAi_M_I2CResize(CameraSelect camera, u16 width, u16 height)
{
return CAMERAi_M_WriteRegister(camera, 0x98c, 0x2703) // width (A)
&& CAMERAi_M_WriteRegister(camera, 0x990, width)
&& CAMERAi_M_WriteRegister(camera, 0x98c, 0x2705) // height (A)
&& CAMERAi_M_WriteRegister(camera, 0x990, height)
&& CAMERAi_M_WriteRegister(camera, 0x98c, 0x2707) // width (B)
&& CAMERAi_M_WriteRegister(camera, 0x990, width)
&& CAMERAi_M_WriteRegister(camera, 0x98c, 0x2709) // height (B)
&& CAMERAi_M_WriteRegister(camera, 0x990, height);
// anyone else???
return CAMERAi_M_WriteMCU(camera, 0x2703, width) // width (A)
&& CAMERAi_M_WriteMCU(camera, 0x2705, height) // height (A)
// && CAMERAi_M_WriteMCU(camera, 0x2707, width) // width (B)
// && CAMERAi_M_WriteMCU(camera, 0x2709, height) // height (B)
&& CAMERAi_M_Refresh(camera);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CPreSleep
Name: CAMERAi_M_I2CFrameRate
Description: preset CAMERA registers
Description: set CAMERA frame rate
Arguments: camera : one of CameraSelect
rate : fps (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CPreSleep(CameraSelect camera)
BOOL CAMERAi_M_I2CFrameRate(CameraSelect camera, int rate)
{
(void)camera;
if (rate == 0)
{
}
else if (rate > 0 && rate <= 30)
{
}
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CPostSleep
Name: CAMERAi_M_I2CEffect
Description: preset CAMERA registers
Description: set CAMERA effect
Arguments: camera : one of CameraSelect
effect : one of CameraEffect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CPostSleep(CameraSelect camera)
BOOL CAMERAi_M_I2CEffect(CameraSelect camera, CameraEffect effect)
{
(void)camera;
#if 0
SEPIAでガンマコレクションを変更しているので
SEPIAかどうかを覚えておく(IN/OUT別)Readするか
(B)
#endif
switch (effect)
{
case CAMERA_EFFECT_NONE:
return CAMERAi_M_Effect_Off(camera);
case CAMERA_EFFECT_MONO:
return CAMERAi_M_Effect_Mono(camera);
case CAMERA_EFFECT_SEPIA:
return CAMERAi_M_Effect_Sepia(camera);
case CAMERA_EFFECT_NEGATIVE:
return CAMERAi_M_WriteMCU(camera, 0x2759, 0x6443) //NEVATIVE_SPEC_EFFECTS_A
&& CAMERAi_M_WriteMCU(camera, 0x275B, 0x6443) //NEVATIVE_SPEC_EFFECTS_B
&& CAMERAi_M_Refresh(camera);
}
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERAi_M_I2CFlip
Description: set CAMERA flip/mirror
Arguments: camera : one of CameraSelect
flip : one of CameraFlip
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_M_I2CFlip(CameraSelect camera, CameraFlip flip)
{
(void)camera;
switch (flip)
{
case CAMERA_FLIP_NONE: // normal
case CAMERA_FLIP_VERTICAL: // vertical flip
case CAMERA_FLIP_HORIZONTAL:// horizontal mirror
case CAMERA_FLIP_REVERSE: // turn over
return FALSE;
}
return FALSE;
}
#if 0
/*---------------------------------------------------------------------------*
Name: CAMERAi_M_I2CWhiteBalance
Description: set CAMERA white balance
Arguments: camera : one of CameraSelect
type : preset number (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_M_I2CWhiteBalance(CameraSelect camera, int type)
{
switch (type)
{
case 0:
return CAMERAi_M_Manual_WB_To_Auto_WB(camera);
case 1:
return CAMERAi_M_Manual_White_Balance_P1(camera);
case 2:
return CAMERAi_M_Manual_White_Balance_P2(camera);
case 3:
return CAMERAi_M_Manual_White_Balance_P3(camera);
case 4:
return CAMERAi_M_Manual_White_Balance_P4(camera);
case 5:
return CAMERAi_M_Manual_White_Balance_P5(camera);
case 6:
return CAMERAi_M_Manual_White_Balance_P6(camera);
case 7:
return CAMERAi_M_Manual_White_Balance_P7(camera);
case 8:
return CAMERAi_M_Manual_White_Balance_P8(camera);
}
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERAi_M_I2CExposure
Description: set CAMERA exposure
Arguments: camera : one of CameraSelect
type : preset number (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_M_I2CExposure(CameraSelect camera, int type)
{
switch (type)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
return TRUE;
}
return FALSE;
}
#endif

View File

@ -1,264 +0,0 @@
/*---------------------------------------------------------------------------*
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( CameraSelect camera );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_30fps_16M_QVGA( CameraSelect camera );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M( CameraSelect camera );
extern BOOL CAMERAi_I2CPreset_320x240_noPLL_20fps( CameraSelect camera );
extern BOOL CAMERAi_I2CPreset_320x240_PLL_30fps( CameraSelect camera );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Scaledown_16_7M_50Hz( CameraSelect camera );
extern BOOL CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Subsampling_16_7M_50Hz( CameraSelect camera );
typedef BOOL (*CameraI2CPresetFunc)( CameraSelect camera );
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(CameraSelect camera, CameraPreset preset)
{
BOOL result = FALSE;
if (preset >= CAMERA_PRESET_MAX) {
return result;
}
if (gs_preset[preset] == NULL) {
return result;
}
(void)I2C_Lock();
result = gs_preset[preset](camera);
(void)I2C_Unlock();
return result;
}
#define PAGE_ADDR 0xef
#define MIRROR_MODE 0x02 //[6:7] only?
#define WRP_DOWN 0x04
#define WCP_DOWN 0x06
BOOL CAMERA_I2CSetFlipMode(CameraSelect camera, CameraFlipMode mode)
{
(void)I2C_Lock();
switch (mode)
{
case CAMERA_FLIPMODE_NONE:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(camera, MIRROR_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, WRP_DOWN, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, WCP_DOWN, 0x00) == FALSE) {
goto error;
}
break;
case CAMERA_FLIPMODE_HORIZONTAL:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(camera, MIRROR_MODE, 0x40) == FALSE ||
CAMERAi_WriteRegister(camera, WRP_DOWN, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, WCP_DOWN, 0x01) == FALSE) {
goto error;
}
break;
case CAMERA_FLIPMODE_VERTICAL:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(camera, MIRROR_MODE, 0x80) == FALSE ||
CAMERAi_WriteRegister(camera, WRP_DOWN, 0x01) == FALSE ||
CAMERAi_WriteRegister(camera, WCP_DOWN, 0x00) == FALSE) {
goto error;
}
break;
case CAMERA_FLIPMODE_HORIZONTAL_VERTICAL:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x02) == FALSE ||
CAMERAi_WriteRegister(camera, MIRROR_MODE, 0xC0) == FALSE ||
CAMERAi_WriteRegister(camera, WRP_DOWN, 0x01) == FALSE ||
CAMERAi_WriteRegister(camera, 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(CameraSelect camera, CameraSpecialMode mode)
{
(void)I2C_Lock();
switch (mode)
{
case CAMERA_SPECIALMODE_NONE:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CB, 0x2C) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_NEVATIVE:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, NEVAGIVE_EFFECT_MODE, 0x01) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CB, 0x2C) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_SEPIA:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CB, 0x2C) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
//case CAMERA_SPECIALMODE_AQUA:
case CAMERA_SPECIALMODE_BLUISH:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CB, 0xAC) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CR, 0x81) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_REDDISH:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CB, 0xAC) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CR, 0xC1) == FALSE) {
goto error;
}
break;
case CAMERA_SPECIALMODE_GREENISH:
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, NEVAGIVE_EFFECT_MODE, 0x00) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_MODE, 0x03) == FALSE ||
CAMERAi_WriteRegister(camera, SEPIA_EFFECT_CB, 0xAC) == FALSE ||
CAMERAi_WriteRegister(camera, 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(CameraSelect camera, 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(camera, 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(camera, DEST_ADDR, data, 4) == FALSE) {
#else
if (CAMERAi_WriteRegister(camera, DEST_ADDR, (u8)((height + 0x10) >> 8)) == FALSE ||
CAMERAi_WriteRegister(camera, DEST_ADDR+1, (u8)((height + 0x10) & 0xFF)) ==FALSE ||
CAMERAi_WriteRegister(camera, DEST_ADDR+2, (u8)((width + 0x10) >> 8)) == FALSE ||
CAMERAi_WriteRegister(camera, 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(camera, CAPT_ADDR, data, 4) == FALSE) {
#else
if (CAMERAi_WriteRegister(camera, CAPT_ADDR, (u8)(height >> 8)) == FALSE ||
CAMERAi_WriteRegister(camera, CAPT_ADDR+1, (u8)(height & 0xFF)) ==FALSE ||
CAMERAi_WriteRegister(camera, CAPT_ADDR+2, (u8)(width >> 8)) == FALSE ||
CAMERAi_WriteRegister(camera, CAPT_ADDR+3, (u8)(width & 0xFF)) == FALSE) {
#endif
(void)I2C_Unlock();
return FALSE;
}
(void)I2C_Unlock();
return TRUE;
}
BOOL CAMERA_I2CGetCroppingParams(CameraSelect camera, u16 *pWidth, u16 *pHeight)
{
u8 data[4];
(void)I2C_Lock();
if (CAMERAi_WriteRegister(camera, PAGE_ADDR, 0x00) == FALSE) {
(void)I2C_Unlock();
return FALSE;
}
data[0] = CAMERAi_ReadRegister(camera, CAPT_ADDR);
data[1] = CAMERAi_ReadRegister(camera, CAPT_ADDR+1);
data[2] = CAMERAi_ReadRegister(camera, CAPT_ADDR+2);
data[3] = CAMERAi_ReadRegister(camera, 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

@ -2,7 +2,7 @@
Project: TwlSDK - libraties - camera
File: camera_i2c_sharp.c
Copyright 2006 Nintendo. All rights reserved.
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
@ -14,14 +14,24 @@
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <twl/camera.h>
#include <twl/camera/ARM7/i2c_sharp.h>
//#define USE_MULTIPLE_IO // use [Read|Write]Registers();
// insert auto-generated code
//#include "5030_15fpsFIX_x8_CC_FilterKIM_MatrixOn3_PLL.autogen.c"
#include "5030_15fps_5fps_adjust2_x8_CC_FilterKIM_MatrixOn3_PLL_1676MHz-1676MHz.autogen.c"
// for sharp
#define BANK_ADDR 0x03
typedef enum
{
BANK_GROUP_A = 0x00,
BANK_GROUP_B = 0x01,
BANK_GROUP_C = 0x02
}
BankGroup;
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CInit
Name: CAMERAi_S_I2CInit
Description: initialize CAMERA
@ -29,14 +39,28 @@
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CInit(CameraSelect camera)
BOOL CAMERAi_S_I2CInit(CameraSelect camera)
{
(void)camera;
return FALSE;
BOOL rIn = TRUE;
BOOL rOut = TRUE;
// should not send init command same time
if (camera & CAMERA_SELECT_IN)
{
rIn = CAMERAi_S_Initialize(CAMERA_SELECT_IN)
&& CAMERAi_S_WriteRegister(CAMERA_SELECT_IN, 0x18, 0x02) // force to order YUYV
&& CAMERAi_S_I2CStandby(CAMERA_SELECT_IN, TRUE);
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = CAMERAi_S_Initialize(CAMERA_SELECT_OUT)
&& CAMERAi_S_WriteRegister(CAMERA_SELECT_OUT, 0x18, 0x02) // force to order YUYV
&& CAMERAi_S_I2CStandby(CAMERA_SELECT_OUT, TRUE);
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CStandby
Name: CAMERAi_S_I2CStandby
Description: standby or resume CAMERA
@ -45,20 +69,22 @@ BOOL CAMERA_S_I2CInit(CameraSelect camera)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CStandby(CameraSelect camera, BOOL standby)
BOOL CAMERAi_S_I2CStandby(CameraSelect camera, BOOL standby)
{
if (standby)
{
return CAMERAi_S_WriteRegister(camera, BANK_ADDR, BANK_GROUP_B)
&& CAMERAi_S_ClearFlags(camera, 0x04, 0x80);
}
else
{
return CAMERAi_S_WriteRegister(camera, BANK_ADDR, BANK_GROUP_B)
&& CAMERAi_S_SetFlags(camera, 0x04, 0x80);
}
(void)camera;
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CResize
Name: CAMERAi_S_I2CResize
Description: resize CAMERA
@ -68,40 +94,76 @@ BOOL CAMERA_S_I2CStandby(CameraSelect camera, BOOL standby)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CResize(CameraSelect camera, u16 width, u16 height)
BOOL CAMERAi_S_I2CResize(CameraSelect camera, u16 width, u16 height)
{
(void)height;
(void)width;
u8 data[2] = { 0, 0 };
switch (width)
{
case 640: data[0] = 32; break;
case 320: data[0] = 64; break;
case 160: data[0] = 128; break;
}
switch (height)
{
case 480: data[1] = 32; break;
case 240: data[1] = 64; break;
case 120: data[1] = 128; break;
}
if (data[0] && data[1])
{
return CAMERAi_S_WriteRegister(camera, BANK_ADDR, BANK_GROUP_B)
&& CAMERAi_S_WriteRegisters(camera, 0x3D, data, 2);
}
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERAi_S_I2CFrameRate
Description: set CAMERA frame rate
Arguments: camera : one of CameraSelect
rate : fps (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_S_I2CFrameRate(CameraSelect camera, int rate)
{
(void)rate;
(void)camera;
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CPreSleep
Name: CAMERAi_S_I2CEffect
Description: preset CAMERA registers
Description: set CAMERA effect
Arguments: camera : one of CameraSelect
effect : one of CameraEffect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CPreSleep(CameraSelect camera)
BOOL CAMERAi_S_I2CEffect(CameraSelect camera, CameraEffect effect)
{
(void)effect;
(void)camera;
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CPostSleep
Name: CAMERAi_S_I2CFlip
Description: preset CAMERA registers
Description: set CAMERA flip/mirror
Arguments: camera : one of CameraSelect
flip : one of CameraFlip
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CPostSleep(CameraSelect camera)
BOOL CAMERAi_S_I2CFlip(CameraSelect camera, CameraFlip flip)
{
(void)flip;
(void)camera;
return FALSE;
}

View File

@ -2,9 +2,13 @@
use strict;
# 定義ファイル
my $register_sdat = "MT9V113-REV1.sdat";
# 固定フォーマット
my $file_head_format =<<'EOF';
/*---------------------------------------------------------------------------*
Project: TwlSDK - libraties - camera
Project: TwlSDK - libralies - camera
File: %1$s
Copyright 2007 Nintendo. All rights reserved.
@ -18,8 +22,6 @@ my $file_head_format =<<'EOF';
$Log: $
$NoKeywords: $
*---------------------------------------------------------------------------*/
#include <nitro/os/common/thread.h>
#include <twl/camera/ARM7/i2c_micron.h>
//#define PRINT_DEBUG
@ -28,20 +30,30 @@ my $file_head_format =<<'EOF';
#define DBG_PRINTF OS_TPrintf
#else
#define DBG_PRINTF( ... ) ((void)0)
#define DBG_CHAR( c ) ((void)0)
#endif
static inline BOOL CAMERAi_M_WriteMCU( CameraSelect camera, u16 addr, u16 value )
{
return CAMERAi_M_WriteRegister(camera, 0x98C, addr)
&& CAMERAi_M_WriteRegister(camera, 0x990, value);
}
static inline BOOL CAMERAi_M_ReadMCU( CameraSelect camera, u16 addr, u16 *pValue )
{
return CAMERAi_M_WriteRegister(camera, 0x98C, addr)
&& CAMERAi_M_ReadRegisters(camera, 0x990, pValue, 1);
}
EOF
my $file_foot_format =<<'EOF';
EOF
my $declare_format =<<'EOF';
BOOL CAMERAi_M_%s( CameraSelect camera );
static BOOL CAMERAi_M_%s( CameraSelect camera );
EOF
my $func_head_format =<<'EOF';
BOOL CAMERAi_M_%s( CameraSelect camera )
static BOOL CAMERAi_M_%s( CameraSelect camera )
{
EOF
@ -51,49 +63,54 @@ my $func_foot_format =<<'EOF';
EOF
my $call_format =<<'EOF';
if (CAMERAi_M_%1$s(camera) == FALSE) {%2$s
if (CAMERAi_M_%1$s(camera) == FALSE)%2$s
{
DBG_PRINTF("Failed to call CAMERAi_M_%1$s! (%%d)\n", __LINE__);
return FALSE;
}
EOF
my $reg_format =<<'EOF';
if (CAMERAi_M_WriteRegister(camera, %s, %s) == FALSE) {%s
if (CAMERAi_M_WriteRegister(camera, %s, %s) == FALSE)%s
{
DBG_PRINTF("Failed to write a register! (%%d)\n", __LINE__);
return FALSE;
}
EOF
my $set_format =<<'EOF';
if (CAMERAi_M_SetFlags(camera, %s, %s) == FALSE) {%s
if (CAMERAi_M_SetFlags(camera, %s, %s) == FALSE)%s
{
DBG_PRINTF("Failed to set a register! (%%d)\n", __LINE__);
return FALSE;
}
EOF
my $clear_format =<<'EOF';
if (CAMERAi_M_ClearFlags(camera, %s, %s) == FALSE) {%s
if (CAMERAi_M_ClearFlags(camera, %s, %s) == FALSE)%s
{
DBG_PRINTF("Failed to clear a register! (%%d)\n", __LINE__);
return FALSE;
}
EOF
my $sleep_format =<<'EOF';
my $delay_format =<<'EOF';
OS_Sleep(%s);%s
EOF
my $poolreg_format =<<'EOF';
i = %5$s;%6$s
my $pollreg_format =<<'EOF';
timeout = %5$s;%6$s
while (1)
{
u16 data;
if (CAMERAi_M_ReadRegisters(camera, %1$s, &data, 1) == FALSE) {
u16 data;
if (CAMERAi_M_ReadRegisters(camera, %1$s, &data, 1) == FALSE)
{
DBG_PRINTF("Failed to read a register! (%%d)\n", __LINE__);
return FALSE;
}
if ((data & %2$s) %3$s)
{
if (--i)
if (--timeout)
{
OS_Sleep(%4$s);
continue;
@ -105,8 +122,130 @@ my $poolreg_format =<<'EOF';
}
EOF
my @functions = ({name => "", data => "", declare => ""}); # API
my $mcu_format =<<'EOF';
if (CAMERAi_M_WriteMCU(camera, %s, %s) == FALSE)%s
{
DBG_PRINTF("Failed to write a MCU! (%%d)\n", __LINE__);
return FALSE;
}
EOF
my $fieldset_format =<<'EOF';
{%3$s
u16 data;
if (CAMERAi_M_ReadMCU(camera, %1$s, &data) == FALSE)
{
DBG_PRINTF("Failed to read a MCU! (%%d)\n", __LINE__);
return FALSE;
}
if (CAMERAi_M_WriteMCU(camera, %1$s, (u16)(data | %2$s)) == FALSE)
{
DBG_PRINTF("Failed to write a MCU! (%%d)\n", __LINE__);
return FALSE;
}
}
EOF
my $fieldclear_format =<<'EOF';
{%3$s
u16 data;
if (CAMERAi_M_ReadMCU(camera, %1$s, &data) == FALSE)
{
DBG_PRINTF("Failed to read a MCU! (%%d)\n", __LINE__);
return FALSE;
}
if (CAMERAi_M_WriteMCU(camera, %1$s, (u16)(data & ~%2$s)) == FALSE)
{
DBG_PRINTF("Failed to write a MCU! (%%d)\n", __LINE__);
return FALSE;
}
}
EOF
my $pollfield_format =<<'EOF';
timeout = %4$s;%5$s
while (1)
{
u16 data;
if (CAMERAi_M_ReadMCU(camera, %1$s, &data) == FALSE)
{
DBG_PRINTF("Failed to read a MCU! (%%d)\n", __LINE__);
return FALSE;
}
if (data %2$s)
{
if (--timeout)
{
OS_Sleep(%3$s);
continue;
}
DBG_PRINTF("Failed to poll a register! (%%d)\n", __LINE__);
return FALSE;
}
break;
}
EOF
my $comp_target =<<'EOF';
if \(CAMERAi_M_WriteRegister\(camera\, 0[xX]0?98[cC]\, ([\w\d]+)\) == FALSE\)([^\r\n]+)
\{
DBG_PRINTF\(\"Failed to write a register\! \(\%d\)\\n\"\, __LINE__\)\;
return FALSE\;
\}
if \(CAMERAi_M_WriteRegister\(camera\, 0[xX]0?990\, ([\w\d]+)\) == FALSE\)(?:\s*//([^\r\n]+))?
\{
DBG_PRINTF\(\"Failed to write a register\! \(\%d\)\\n\"\, __LINE__\)\;
return FALSE\;
\}
EOF
# API別データベース
# name: API名 (最初のAPIより手前は無名)
# data: API本体 (文字列の結合形式)
# comment: コメント行のテンポラリ (APIの最後に位置するコメントをAPI外に出すためのもの)
# declare: API本体の先頭に挿入するデータ (1つのみ)
#
my @functions = ({name => "", data => "", comment => "", declare => ""});
# 定義ファイルデータベース
my %regmap; # map register/regmap name to the address/mask
# 定義ファイルデータベースの生成
sub regmap_init {
my %mcu;
open IN, $_[0] or die;
# search space
while(<IN>) {
if (/^\[ADDR_SPACE\]/) {
while (<IN>) {
last if (/^\[END\]/);
if (/^([\w\d]+)\s*=\s*\{MCU, (\d+),/) { # only MCU is supported
$mcu{$1} = $2;
}
}
}
if (/^\[REGISTERS\]/) {
my $lastreg = "";
while (<IN>) {
last if (/\[END\]/);
if (/(^[\w\d]+)\s*=\s*\{(\w+?),\s*([\w\d]+?),/) { # address entry
if ($mcu{$3}) { # MCU
$regmap{$1}{0} = sprintf("0xA%1X%02X", $mcu{$3}, hex($2));
}
$lastreg = $1;
}
elsif (/^\s*\{([\w\d]+?),\s*(\w+?),/) { # bitfield entry
$regmap{$lastreg}{$1} = $2;
}
}
}
}
close IN;
# use Data::Dumper;
# print Dumper(\%mcu, \%regmap);
}
# API名の整形
sub name_conv {
$_ = $_[0];
s/\>/To/g;
@ -114,97 +253,131 @@ sub name_conv {
return $_;
}
# 各種コマンドのC言語への変換
sub func_conv {
my($key, $value, $comment) = @_;
$comment = " " . $comment; # insert spaces
my @v = split /\s*\,\s*/, $value; # split value
$comment = " " . $comment if ($comment); # insert spaces
if ($key eq "LOAD") {
return sprintf($call_format, name_conv($value), $comment);
}
elsif ($key eq "REG") {
my($reg, $val) = split /\s*\,\s*/, $value;
return sprintf($reg_format, $reg, $val, $comment);
elsif ($key eq "REG") { # address, value
return sprintf($reg_format, $v[0], $v[1], $comment);
}
elsif ($key eq "BITFIELD") {
my($reg, $mask, $which) = split /\s*\,\s*/, $value;
if ($which) {
return sprintf($set_format, $reg, $mask, $comment);
elsif ($key eq "BITFIELD") { # address, mask, set/clear
if ($v[2]) {
return sprintf($set_format, $v[0], $v[1], $comment);
} else {
return sprintf($clear_format, $reg, $mask, $comment);
return sprintf($clear_format, $v[0], $v[1], $comment);
}
}
elsif ($key eq "DELAY") {
return sprintf($sleep_format, $value, $comment);
elsif ($key eq "DELAY") { # msec
return sprintf($delay_format, $v[0], $comment);
}
elsif ($key eq "POLL_REG") {
my($reg, $mask, $cond, $delay, $timeout) = split /\s*\,\s*/, $value;
$delay =~ s/DELAY\s*=\s*//;
$timeout =~ s/TIMEOUT\s*=\s*//;
${$functions[$#functions]}{declare} = " int i;\r\n";
return sprintf($poolreg_format, $reg, $mask, $cond, $delay, $timeout, $comment);
elsif ($key eq "POLL_REG") { # address, mask, condition, delay, timeout
$v[3] =~ s/DELAY\s*=\s*//;
$v[4] =~ s/TIMEOUT\s*=\s*//;
${$functions[$#functions]}{declare} = " int timeout;\r\n";
return sprintf($pollreg_format, $v[0], @v[1..4], $comment);
}
return " // " . $key . "=" . $value . $comment . "\r\n";
elsif ($key eq "VAR8") { # page, address, value
return sprintf($mcu_format, sprintf("0xA%1X%02X", $v[0], hex($v[1])), $v[2], $comment);
}
elsif ($key eq "VAR") { # page, address, value
return sprintf($mcu_format, sprintf("0x2%1X%02X", $v[0], hex($v[1])), $v[2], $comment);
}
elsif ($key eq "FIELD_WR") { # name, value OR name, mask, set/clear
if ($v[2] eq "") {
return sprintf($mcu_format, $regmap{$v[0]}{0}, $v[1], $comment);
}
if ($v[2]) {
return sprintf($fieldset_format, $regmap{$v[0]}{0}, $regmap{$v[0]}{$v[1]}, $comment);
} else {
return sprintf($fieldclear_format, $regmap{$v[0]}{0}, $regmap{$v[0]}{$v[1]}, $comment);
}
}
elsif ($key eq "POLL_FIELD") { # name, condition, delay, timeout
$v[2] =~ s/DELAY\s*=\s*//;
$v[3] =~ s/TIMEOUT\s*=\s*//;
${$functions[$#functions]}{declare} = " int timeout;\r\n";
return sprintf($pollfield_format, $regmap{$v[0]}{0}, @v[1..3], $comment);
}
return "// IGNORED: " . $key . "=" . $value . $comment . "\r\n"; # 未対応コマンド
}
die "USAGE: convert.pl [INFILE] > [OUTFILE]\n" if ($#ARGV != 0);
# 後処理 (上位API化処理)
sub comp_func {
$_[0] =~ s/$comp_target/sprintf($mcu_format, $1, $3, $2 . $4)/eg;
return $_[0];
}
#ここからメイン
# 引数チェック
die "USAGE: $0 INFILE [OUTFILE]\n" if ($#ARGV != 1 and $#ARGV != 0);
# 各種初期化
regmap_init($register_sdat);
my $infile = $ARGV[0];
(my $outfile = $infile) =~ s/\.ini$/.autogen.c/;
my $outfile = $ARGV[1];
($outfile = $infile) =~ s/\.ini$/.autogen.c/ unless ($outfile);
open IN, $infile or die "Cannot open the file!\n";
my @packets; # パケットヘッダ+パケットの中身の集まり
my @data; # データ群
my $first = -1; # 先頭アドレス
my $current = -1; # 期待アドレス
# 入出力ファイルのオープン (両方オープンしておく)
open IN, $infile or die "Cannot open the input file!\n";
open OUT, ">", $outfile or die "Cannot open the output file!\n";
# 入力処理
while (<IN>) {
my $comment = "";
s/[\r\n]+$//; # delete \r and/or \n
s|\;|//|; # replace first ; to //
if (s|(//.*)||) {
$comment = $1;
if (s/(\;|\/\/)(.*)//) { # コメント抽出
$comment = $1 . $2;
}
if (/\s*\[(.+)\]/) {
push @functions, {name => name_conv($1), data => "", declare => ""};
if (/\s*\[(.+)\]/) { # API検出
push @functions, {name => name_conv($1), data => "", comment => "", declare => ""};
}
elsif (/\s*(.+?)\s*\=\s*(.+?)\s*$/) {
elsif (/\s*(.+?)\s*\=\s*(.+?)\s*$/) { # コマンド検出
# コマンドの手前にコメントがあった場合は、dataに移動させる
${$functions[$#functions]}{data} .= ${$functions[$#functions]}{comment};
${$functions[$#functions]}{comment} = "";
# コマンドをC言語に変換してdataに追加
${$functions[$#functions]}{data} .= func_conv($1, $2, $comment);
}
elsif (/\S+/) {
print "UNKNOWN STATEMENT: <<", $_, ">>\n";
${$functions[$#functions]}{data} .= $_ . $comment . "\r\n";
elsif (/\S+/) { # 未知入力行検出 (コメント扱い (エラーにすべきかも))
warn "UNKNOWN STATEMENT: <<", $_, ">>\n";
${$functions[$#functions]}{comment} .= "// " . $_ . $comment . "\r\n";
}
elsif ($comment) {
${$functions[$#functions]}{data} .= $comment . "\r\n";
elsif ($comment) { # コメントのみ
${$functions[$#functions]}{comment} .= "// " . $comment . "\r\n";
}
}
close(IN);
# 入力処理終了
close IN;
#use Data::Dumper;
#print Dumper(\@functions);
#exit(1);
# output
printf $file_head_format, $outfile;
foreach my $func ( @functions ) {
if ($$func{name}) {
if ($$func{data} !~ /camera/) {
$$func{declare} = "#pragma unused(camera)\r\n";
}
printf $declare_format, $$func{name};
}
# 出力処理
$outfile =~ s/^.*[\\\/]//; # get basename to print
printf OUT $file_head_format, $outfile; # ファイルヘッダ出力
foreach my $func ( @functions ) { # 検出済みAPIの宣言
printf OUT $declare_format, $$func{name} if ($$func{name});
}
printf "\r\n";
foreach my $func ( @functions ) {
if ($$func{name}) {
printf $func_head_format, $$func{name};
print $$func{declare}, "\r\n" if ($$func{declare});
printf OUT "\r\n";
foreach my $func ( @functions ) { # API本体の出力
if ($$func{name}) { # 最初のAPIより前の場合を除く
printf OUT $func_head_format, $$func{name}; # API名開き括弧の出力
print OUT "#pragma unused(camera)\r\n" unless ($$func{data} =~ /camera/); # warning防止
print OUT $$func{declare}, "\r\n" if ($$func{declare}); # 変数宣言 (if any)
}
print $$func{data};
if ($$func{name}) {
printf $func_foot_format;
print OUT comp_func($$func{data}); # 本体の後処理+出力
if ($$func{name}) { # 最初のAPIより前の場合を除く
printf OUT $func_foot_format ; # 閉じ括弧出力
}
print OUT $$func{comment}; # 最後のコメントの出力 (たいてい次のAPIのためのもの)
}
printf $file_foot_format;
printf OUT $file_foot_format; # ファイルフッタ出力
# 出力処理終了
close OUT;

View File

@ -1,145 +0,0 @@
#!/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_samsung.h>
//#define PRINT_DEBUG
#ifdef PRINT_DEBUG
#include <nitro/os/common/printf.h>
#define DBG_PRINTF OS_TPrintf
#else
#define DBG_PRINTF( ... ) ((void)0)
#define DBG_CHAR( c ) ((void)0)
#endif
BOOL %2$s( CameraSelect camera );
BOOL %2$s( CameraSelect camera )
{
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(camera, 0x%s, data, %d) == FALSE) {
DBG_PRINTF("Failed to initialize! (%%d)\n", __LINE__);
return FALSE;
}
}
EOF
my $packet_single_format =<<'EOF';
if (CAMERAi_WriteRegister(camera, 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,168 @@
#!/usr/bin/perl --
use strict;
# 固定フォーマット
my $file_head_format =<<'EOF';
/*---------------------------------------------------------------------------*
Project: TwlSDK - libralies - 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: $
*---------------------------------------------------------------------------*/
//#define PRINT_DEBUG
#ifdef PRINT_DEBUG
#include <nitro/os/common/printf.h>
#define DBG_PRINTF OS_TPrintf
#else
#define DBG_PRINTF( ... ) ((void)0)
#endif
static BOOL CAMERAi_S_Initialize( CameraSelect camera )
{
EOF
my $file_foot_format =<<'EOF';
return TRUE;
}
EOF
my $single_format =<<'EOF';
if (CAMERAi_S_WriteRegister(camera, 0x%02X, 0x%02X) == FALSE)
{
DBG_PRINTF("Failed to write a register! (%%d)\n", __LINE__);
return FALSE;
}
EOF
my $multi_head_format =<<'EOF';
{
const u8 data[] =
{
EOF
my $multi_foot_format =<<'EOF';
};
if (CAMERAi_S_WriteRegisters(camera, 0x%02X, data, %d) == FALSE)
{
DBG_PRINTF("Failed to write registers! (%%d)\n", __LINE__);
return FALSE;
}
}
EOF
sub print_data {
my $result = "";
for (my $i = 0; $i < @_; $i++)
{
if (($i % 16) == 0) {
$result .= " " ;
} else {
$result .= " " ;
}
$result .= sprintf("0x%02X,", $_[$i]);
if (($i % 16) == 15) {
$result .= "\r\n";
}
}
if ((@_ % 16) != 0) {
$result .= "\r\n";
}
return $result;
}
sub print_command {
my($addr, @value) = @_;
if (@value == 1) {
return sprintf($single_format, $addr, $value[0]);
}
my $result = $multi_head_format;
for (my $i = 0; $i < @value; $i++)
{
if (($i % 16) == 0) {
$result .= " " ;
} else {
$result .= " " ;
}
$result .= sprintf("0x%02X,", $value[$i]);
if (($i % 16) == 15) {
$result .= "\r\n";
}
}
if ((@value % 16) != 0) {
$result .= "\r\n";
}
$result .= sprintf($multi_foot_format, $addr, scalar(@value));
return $result;
}
#
# データはいったんキャッシュして、連続アドレスをバーストライトに書き換える
#
my @cache; # キャッシュデータ
my $start = -1; # キャッシュの先頭アドレス
my @output; # 出力データ
my $comment = ""; # コメント
#ここからメイン
# 引数チェック
die "USAGE: $0 INFILE [OUTFILE]\n" if ($#ARGV != 1 and $#ARGV != 0);
# 各種初期化
my $infile = $ARGV[0];
my $outfile = $ARGV[1];
($outfile = $infile) =~ s/\.ini$/.autogen.c/ unless ($outfile);
# 入出力ファイルのオープン (両方オープンしておく)
open IN, $infile or die "Cannot open the input file!\n";
open OUT, ">", $outfile or die "Cannot open the output file!\n";
# 入力処理
while (<IN>) {
s/[\r\n]+$//; # delete \r and/or \n
s|\#|// |g; # change comment sign
if (s|(//.*)||) { # コメント抽出
$comment .= " $1\r\n";
}
if (/\s*([\w\d]{2})\s+([\w\d]{2})/) { # データ抽出
my ($addr, $value) = (hex($1), hex($2));
if ($addr != $start + @cache)
{
push @output, print_command($start, @cache) if (@cache);
@cache = ($value);
$start = $addr;
} else {
push @cache, $value;
}
push @output, $comment; # コメント出力
$comment = "";
}
elsif (/\S+/) { # 未知入力行検出 (コメント扱い (エラーにすべきかも))
warn "UNKNOWN STATEMENT: <<", $_, ">>\n";
}
}
# 最終行処理
push @output, print_command($start, @cache);
# 入力処理終了
close IN;
# 出力処理
$outfile =~ s/^.*[\\\/]//; # get basename to print
printf OUT $file_head_format, $outfile; # ファイルヘッダ出力
print OUT @output;
printf OUT $file_foot_format; # ファイルフッタ出力
# 出力処理終了
close OUT;

View File

@ -19,6 +19,8 @@
/*---------------------------------------------------------------------------*
è<EFBFBD>è`
*---------------------------------------------------------------------------*/
#define SYNC_TYPE (0 << REG_CAM_CAM_MCNT_SYNC_SHIFT) // 1 if low active
#define RCLK_TYPE (1 << REG_CAM_CAM_MCNT_IRCLK_SHIFT) // 1 if negative edge
/*---------------------------------------------------------------------------*
Œ^è`
@ -27,33 +29,13 @@
/*---------------------------------------------------------------------------*
<EFBFBD>ÃIÏ<EFBFBD>è`
*---------------------------------------------------------------------------*/
static CameraSelect currentCamera;
static BOOL cameraPreSleepState;
/*---------------------------------------------------------------------------*
àŠÖ<EFBFBD>è`
*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: CAMERA_Select
Description: select camera to activate
Arguments: camera one of CameraSelect
Returns: None
*---------------------------------------------------------------------------*/
BOOL CAMERA_Select( CameraSelect camera )
static inline void CAMERAi_Wait(u32 clocks)
{
if (currentCamera == camera || CAMERA_SELECT_BOTH == camera)
{
return FALSE;
}
if (CAMERA_I2CSelect(camera) != CAMERA_RESULT_SUCCESS)
{
return FALSE;
}
currentCamera = camera;
return TRUE;
OS_SpinWaitSysCycles(clocks << 1);
}
/*---------------------------------------------------------------------------*
@ -68,13 +50,16 @@ BOOL CAMERA_Select( CameraSelect camera )
void CAMERA_PowerOn( void )
{
reg_CFG_CLK |= REG_CFG_CLK_CAM_MASK;
if ((reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) == 0) {
if ((reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) == 0)
{
reg_CAM_CAM_MCNT |= (SYNC_TYPE | RCLK_TYPE); // set polarities
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_V28_MASK; // VDD2.8 POWER ON
OS_SpinWaitSysCycles( 30 ); // wait for over 15 MCLK (10-20)
CAMERAi_Wait( 10 ); // wait for over 10 MCLKs (M:10-20)(S:10ns?)
reg_CFG_CLK |= REG_CFG_CLK_CAM_CKI_MASK; // MCLK on
OS_SpinWaitSysCycles( 30 ); // wait for over 15 MCLKs (20-10)
CAMERAi_Wait( 32 ); // wait for over 32 MCLKs (M:20-10)(S:32)
reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_RSTN_MASK; // RSTN => Hi
OS_SpinWaitSysCycles( 12000 ); // wait for over 6000 MCLKs
CAMERAi_Wait( 6000 ); // wait for over 6000 MCLKs
reg_CAM_CAM_CNT = REG_CAM_CAM_CNT_CL_MASK; // full reset CNT
}
@ -91,54 +76,19 @@ void CAMERA_PowerOn( void )
*---------------------------------------------------------------------------*/
void CAMERA_PowerOff( void )
{
if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) {
if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK)
{
reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_E_MASK; // stop cmaera output
reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_RSTN_MASK;// RSTN => Lo
OS_SpinWaitSysCycles( 10 ); // wait for over 5 MCLK
CAMERAi_Wait( 10 ); // wait for over 10 MCLKs (M:10)(S:10ns?)
reg_CFG_CLK &= ~REG_CFG_CLK_CAM_CKI_MASK; // MCLK off
CAMERAi_Wait( 20 ); // wait for over 20 MCLKs (M:20)(S:0?)
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; /* •K—v é<E2809A>H */
}
/*---------------------------------------------------------------------------*
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) {
cameraPreSleepState = TRUE;
CAMERA_I2CPreSleep();
CAMERA_PowerOff();
}
}
/*---------------------------------------------------------------------------*
Name: CAMERA_PostSleep
Description: pre-sleep process for CAMERA without power off
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void CAMERA_PostSleep( void )
{
if (cameraPreSleepState == TRUE) {
cameraPreSleepState = FALSE;
CAMERA_PowerOn();
CAMERA_I2CPostSleep();
}
reg_CFG_CLK &= ~REG_CFG_CLK_CAM_MASK;
}
/*---------------------------------------------------------------------------*
@ -152,7 +102,7 @@ void CAMERA_PostSleep( void )
*---------------------------------------------------------------------------*/
BOOL CAMERA_IsBusy( void )
{
return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_E_MASK) ? TRUE : FALSE;
return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_E_MASK) >> REG_CAM_CAM_CNT_E_SHIFT;
}
/*---------------------------------------------------------------------------*
@ -183,50 +133,11 @@ 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.
Description: set camera trimming parameters by centering
NOTE: should call CAMERA_SetTrimming to enable trimming
Arguments: destWidth width of image to output
destHeight height of image to output
@ -248,8 +159,9 @@ void CAMERA_SetTrimmingParamsCenter(u16 destWidth, u16 destHeight, u16 srcWidth,
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimmingParams
Description: set camera trimming
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
@ -269,7 +181,7 @@ void CAMERA_SetTrimmingParams(u16 x1, u16 y1, u16 x2, u16 y2)
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimming
Description: set trimming enable/disable
Description: set trimming to be enabled/disabled
Arguments: enabled TRUE if set trimming will be enabled
@ -277,11 +189,9 @@ void CAMERA_SetTrimmingParams(u16 x1, u16 y1, u16 x2, u16 y2)
*---------------------------------------------------------------------------*/
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;
}
u16 value = reg_CAM_CAM_CNT;
reg_CAM_CAM_CNT = enabled ? (u16)(value | REG_CAM_CAM_CNT_T_MASK)
: (u16)(value & ~REG_CAM_CAM_CNT_T_MASK);
}
/*---------------------------------------------------------------------------*
@ -295,14 +205,14 @@ void CAMERA_SetTrimming( BOOL enabled )
*---------------------------------------------------------------------------*/
void CAMERA_SetOutputFormat( CameraOutput output )
{
switch (output) {
u16 value = reg_CAM_CAM_CNT;
switch (output)
{
case CAMERA_OUTPUT_YUV:
reg_CAM_CAM_CNT &= ~(1 << REG_CAM_CAM_CNT_F_SHIFT);
reg_CAM_CAM_CNT = (u16)(value & ~REG_CAM_CAM_CNT_F_MASK);
break;
case CAMERA_OUTPUT_RGB:
reg_CAM_CAM_CNT |= (1 << REG_CAM_CAM_CNT_F_SHIFT);
break;
default:
reg_CAM_CAM_CNT = (u16)(value | REG_CAM_CAM_CNT_F_MASK);
break;
}
}
@ -318,7 +228,7 @@ void CAMERA_SetOutputFormat( CameraOutput output )
*---------------------------------------------------------------------------*/
BOOL CAMERA_GetErrorStatus( void )
{
return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_ERR_MASK) ? TRUE : FALSE;
return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_ERR_MASK) >> REG_CAM_CAM_CNT_ERR_SHIFT;
}
/*---------------------------------------------------------------------------*
@ -346,11 +256,9 @@ void CAMERA_ClearBuffer( void )
*---------------------------------------------------------------------------*/
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;
}
u16 value = reg_CAM_CAM_CNT;
reg_CAM_CAM_CNT = enabled ? (u16)(value | REG_CAM_CAM_CNT_IREQ_I_MASK)
: (u16)(value & ~REG_CAM_CAM_CNT_IREQ_I_MASK);
}
/*---------------------------------------------------------------------------*
@ -378,11 +286,9 @@ void CAMERA_SetVsyncIntrrupt( CameraIntrVsync type )
*---------------------------------------------------------------------------*/
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;
}
u16 value = reg_CAM_CAM_CNT;
reg_CAM_CAM_CNT = enabled ? (u16)(value | REG_CAM_CAM_CNT_IREQ_BE_MASK)
: (u16)(value & ~REG_CAM_CAM_CNT_IREQ_BE_MASK);
}
/*---------------------------------------------------------------------------*

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - libraties - I2C_
File: I2C__instruction.c
Project: TwlSDK - libraties - i2c
File: i2c_instruction.c
Copyright 2006-2007 Nintendo. All rights reserved.
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
@ -16,6 +16,25 @@
#include <twl.h>
#include <twl/i2c/ARM7/i2c.h>
//#define PRINT_DEBUG
//#define PRINT_DEBUG_MINI // rough version
#ifdef PRINT_DEBUG
#include <nitro/os/common/printf.h>
#define DBG_PRINTF OS_TPrintf
#undef PRINT_DEBUG_MINI // because of the alternative option
#else
#define DBG_PRINTF( ... ) ((void)0)
#endif
#ifdef PRINT_DEBUG_MINI
#include <nitro/os/common/printf.h>
#define DBG_PRINT_FUNC() OS_TPrintf("%s(0x%02X, 0x%02X, ...);\n", __func__, I2C_DeviceAddrTable[id], reg)
#define DBG_PRINT_ERR() OS_TPrintf(" Failed(%d) @ %d\n", error, r)
#else
#define DBG_PRINT_FUNC() ((void)0)
#define DBG_PRINT_ERR() ((void)0)
#endif
#define RETRY_COUNT 8
static u8 I2C_DeviceAddrTable[I2C_SLAVE_NUM] = {
@ -73,23 +92,27 @@ static inline void I2Ci_StopPhase2( void )
static inline void I2Ci_SetData( u8 data )
{
DBG_PRINTF(">%02X", data);
reg_EXI_I2CD = data;
}
static inline u8 I2Ci_GetData( void )
{
DBG_PRINTF("<%02X", reg_EXI_I2CD);
return reg_EXI_I2CD;
}
static inline BOOL I2Ci_GetResult( void )
{
I2Ci_Wait();
DBG_PRINTF("%c", (reg_EXI_I2CCNT & REG_EXI_I2CCNT_ACK_MASK) ? '.' : '*');
return (BOOL)((reg_EXI_I2CCNT & REG_EXI_I2CCNT_ACK_MASK) >> REG_EXI_I2CCNT_ACK_SHIFT);
}
static inline BOOL I2Ci_SendStart( I2CSlave id )
{
DBG_PRINTF("\n");
I2Ci_Wait();
I2Ci_SetData( (u8)(I2C_DeviceAddrTable[id] | (u8)I2C_WRITE) );
I2Ci_Start();
@ -150,14 +173,16 @@ static inline u8 I2Ci_WaitReceiveLast( void )
static inline BOOL I2Ci_SendMiddle16( u16 data )
{
return I2Ci_SendMiddle( (u8)(data >> 8) )
&& I2Ci_SendMiddle( (u8)(data && 0xFF) );
BOOL rHi = I2Ci_SendMiddle( (u8)(data >> 8) );
BOOL rLo = I2Ci_SendMiddle( (u8)(data & 0xFF) );
return (rHi && rLo);
}
static inline BOOL I2Ci_SendLast16( u16 data )
{
return I2Ci_SendMiddle( (u8)(data >> 8) )
&& I2Ci_SendLast( (u8)(data && 0xFF) );
BOOL rHi = I2Ci_SendMiddle( (u8)(data >> 8) );
BOOL rLo = I2Ci_SendLast( (u8)(data & 0xFF) );
return (rHi && rLo);
}
static inline u16 I2Ci_WaitReceiveMiddle16( void )
@ -399,6 +424,7 @@ BOOL I2Ci_WriteRegister( I2CSlave id, u8 reg, u8 data )
{
int r;
int error;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -406,6 +432,7 @@ BOOL I2Ci_WriteRegister( I2CSlave id, u8 reg, u8 data )
if (I2Ci_SendMiddle( reg ) == FALSE) error++;
if (I2Ci_SendLast( data ) == FALSE) error++;
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : TRUE;
}
@ -423,6 +450,7 @@ BOOL I2Ci_WriteRegister16( I2CSlave id, u16 reg, u16 data )
{
int r;
int error;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -430,7 +458,8 @@ BOOL I2Ci_WriteRegister16( I2CSlave id, u16 reg, u16 data )
if (I2Ci_SendMiddle16( reg ) == FALSE) error++;
if (I2Ci_SendLast16( data ) == FALSE) error++;
if (error == 0) break;
}OS_TPrintf("%s(%d<%d>, %d, %d); => error = %d, r = %d\n", __func__, id, I2C_DeviceAddrTable[id], reg, data, error, r);
DBG_PRINT_ERR();
}
return error ? FALSE : TRUE;
}
@ -448,6 +477,7 @@ u8 I2Ci_ReadRegister( I2CSlave id, u8 reg )
int r;
u8 data;
int error;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -456,6 +486,7 @@ u8 I2Ci_ReadRegister( I2CSlave id, u8 reg )
if (I2Ci_ReceiveStart( id ) == FALSE) error++;
data = I2Ci_WaitReceiveLast();
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? (u8)0xee : data;
}
@ -473,6 +504,7 @@ u8 I2Ci_ReadRegisterSC( I2CSlave id, u8 reg )
int r;
u8 data;
int error;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -481,6 +513,7 @@ u8 I2Ci_ReadRegisterSC( I2CSlave id, u8 reg )
if (I2Ci_ReceiveStart( id ) == FALSE) error++;
data = I2Ci_WaitReceiveLast();
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? (u8)0xee : data;
}
@ -498,6 +531,7 @@ u16 I2Ci_ReadRegister16( I2CSlave id, u16 reg )
int r;
u16 data;
int error;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -506,6 +540,7 @@ u16 I2Ci_ReadRegister16( I2CSlave id, u16 reg )
if (I2Ci_ReceiveStart( id ) == FALSE) error++;
data = I2Ci_WaitReceiveLast16();
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? (u16)0xeeee : data;
}
@ -524,6 +559,7 @@ BOOL I2Ci_VerifyRegister( I2CSlave id, u8 reg, u8 data )
int r;
int error;
BOOL result;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -536,6 +572,7 @@ BOOL I2Ci_VerifyRegister( I2CSlave id, u8 reg, u8 data )
result = FALSE;
}
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : (result ? TRUE : FALSE);
}
@ -553,6 +590,7 @@ BOOL I2Ci_VerifyRegisterSC( I2CSlave id, u8 reg, u8 data )
int r;
int error;
BOOL result;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -565,6 +603,7 @@ BOOL I2Ci_VerifyRegisterSC( I2CSlave id, u8 reg, u8 data )
result = FALSE;
}
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : (result ? TRUE : FALSE);
}
@ -582,6 +621,7 @@ BOOL I2Ci_VerifyRegister16( I2CSlave id, u16 reg, u16 data )
int r;
int error;
BOOL result;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -594,6 +634,7 @@ BOOL I2Ci_VerifyRegister16( I2CSlave id, u16 reg, u16 data )
result = FALSE;
}
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : (result ? TRUE : FALSE);
}
@ -614,6 +655,7 @@ BOOL I2Ci_WriteRegisters( I2CSlave id, u8 reg, const u8 *bufp, size_t size )
int r;
int error;
const u8 *ptr;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -626,6 +668,7 @@ BOOL I2Ci_WriteRegisters( I2CSlave id, u8 reg, const u8 *bufp, size_t size )
}
if (I2Ci_SendLast( *ptr++ ) == FALSE) error++;
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : TRUE;
}
@ -645,6 +688,7 @@ BOOL I2Ci_WriteRegisters16( I2CSlave id, u16 reg, const u16 *bufp, size_t size )
int r;
int error;
const u16 *ptr;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -657,6 +701,7 @@ BOOL I2Ci_WriteRegisters16( I2CSlave id, u16 reg, const u16 *bufp, size_t size )
}
if (I2Ci_SendLast16( *ptr++ ) == FALSE) error++;
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : TRUE;
}
@ -676,6 +721,7 @@ BOOL I2Ci_ReadRegisters( I2CSlave id, u8 reg, u8 *bufp, size_t size )
int r;
int error;
u8 *ptr;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -696,6 +742,7 @@ BOOL I2Ci_ReadRegisters( I2CSlave id, u8 reg, u8 *bufp, size_t size )
{
(void)I2Ci_WaitReceiveLast();
}
DBG_PRINT_ERR();
}
return error ? FALSE : TRUE;
}
@ -714,6 +761,7 @@ BOOL I2Ci_ReadRegistersSC( I2CSlave id, u8 reg, u8 *bufp, size_t size )
int r;
int error;
u8 *ptr;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -734,6 +782,7 @@ BOOL I2Ci_ReadRegistersSC( I2CSlave id, u8 reg, u8 *bufp, size_t size )
{
(void)I2Ci_WaitReceiveLast();
}
DBG_PRINT_ERR();
}
return error ? FALSE : TRUE;
}
@ -752,6 +801,7 @@ BOOL I2Ci_ReadRegisters16( I2CSlave id, u16 reg, u16 *bufp, size_t size )
int r;
int error;
u16 *ptr;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -772,6 +822,7 @@ BOOL I2Ci_ReadRegisters16( I2CSlave id, u16 reg, u16 *bufp, size_t size )
{
(void)I2Ci_WaitReceiveLast16();
}
DBG_PRINT_ERR();
}
return error ? FALSE : TRUE;
}
@ -792,6 +843,7 @@ BOOL I2Ci_VerifyRegisters( I2CSlave id, u8 reg, const u8 *bufp, size_t size )
int error;
const u8 *ptr;
BOOL result;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -811,6 +863,7 @@ BOOL I2Ci_VerifyRegisters( I2CSlave id, u8 reg, const u8 *bufp, size_t size )
result = FALSE;
}
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : (result ? TRUE : FALSE);
}
@ -830,6 +883,7 @@ BOOL I2Ci_VerifyRegistersSC( I2CSlave id, u8 reg, const u8 *bufp, size_t size )
int error;
const u8 *ptr;
BOOL result;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -849,6 +903,7 @@ BOOL I2Ci_VerifyRegistersSC( I2CSlave id, u8 reg, const u8 *bufp, size_t size )
result = FALSE;
}
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : (result ? TRUE : FALSE);
}
@ -868,6 +923,7 @@ BOOL I2Ci_VerifyRegisters16( I2CSlave id, u16 reg, const u16 *bufp, size_t size
int error;
const u16 *ptr;
BOOL result;
DBG_PRINT_FUNC();
for (r = 0; r < RETRY_COUNT; r++)
{
error = 0;
@ -887,40 +943,7 @@ BOOL I2Ci_VerifyRegisters16( I2CSlave id, u16 reg, const u16 *bufp, size_t size
result = FALSE;
}
if (error == 0) break;
DBG_PRINT_ERR();
}
return error ? FALSE : (result ? TRUE : FALSE);
}
#if 0
//================================================================================
// INTERRUPT
//================================================================================
/*---------------------------------------------------------------------------*
Name: I2Ci_EnableInterrupt
Description: enable I2C interrupt for each device.
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void I2Ci_EnableInterrupt( void )
{
OS_EnableIrqMask( OS_IE_I2C );
}
/*---------------------------------------------------------------------------*
Name: I2Ci_DisableInterrupt
Description: disable I2C interrupt for each device.
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void I2Ci_DisableInterrupt( void )
{
OS_DisableIrqMask( OS_IE_I2C );
}
#endif

View File

@ -20,8 +20,8 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs
#----------------------------------------------------------------------------
SUBDIRS = camera-1
SUBDIRS = camera-1 \
camera-2 \
#----------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - tests - snd - channel
Project: TwlSDK - tests - camera
File: main.c
Copyright 2007 Nintendo. All rights reserved.
@ -61,14 +61,14 @@ void TwlSpMain(void)
(void)OS_EnableIrq();
(void)OS_EnableInterrupts();
// カメラ初期化
CAMERA_Init(THREAD_PRIO_CAMERA);
// ボタン入力サーチ初期化
(void)PAD_InitXYButton();
// SPI初期化
// SPI_Init(THREAD_PRIO_SPI);
SPI_Init(THREAD_PRIO_SPI);
// カメラ初期化
CAMERA_Init(THREAD_PRIO_CAMERA);
while (TRUE)
{

View File

@ -1,8 +1,8 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - SND - demos - capture
Project: TwlSDK - tests - camera
File: main.c
Copyright 2005,2006 Nintendo. All rights reserved.
Copyright 2007 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
@ -17,9 +17,13 @@
#include <twl.h>
#include <twl/camera.h>
#define DMA_NO 5
#define WIDTH 256
#define HEIGHT 192
#define DMA_NO 5 // 使用するDMA番号(4-7)
#define WIDTH 256 // イメージの幅
#define HEIGHT 192 // イメージの高さ
#define NUMS 1 // バッファ数
#define LINES_AT_ONCE CAMERA_GET_MAX_LINES(WIDTH) // 一回の転送ライン数
#define BYTES_PER_LINE CAMERA_GET_LINE_BYTES(WIDTH) // 一ラインの転送バイト数
static void VBlankIntr(void);
static void CameraIntr(void);
@ -48,55 +52,151 @@ void TwlMain()
(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));
}
(void)OS_EnableInterrupts();
// 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);
//GX_SetDispSelect(GX_DISP_SELECT_SUB_MAIN);
OS_WaitVBlankIntr();
GX_DispOn();
// カメラ初期化
CAMERA_Init();
CAMERA_PowerOn();
CAMERA_Init(); // create camera thread
CAMERA_PowerOn(); // wakeup camera module
result = CAMERA_I2CInit(CAMERA_SELECT_BOTH);
result = CAMERA_I2CInit(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CInit was failed. (%d)\n", result);
}
else
{
OS_TPrintf("CAMERA_I2CInit was done.\n");
CAMERA_PowerOff();
OS_Terminate();
}
OS_TPrintf("CAMERA_I2CInit was done successfully.\n");
CAMERA_SetTrimmingParamsCenter(WIDTH, HEIGHT, 640, 480); // clipped by camera i/f
result = CAMERA_I2CActivate(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CActivate was failed. (%d)\n", result);
}
#if 0
result = CAMERA_I2CResize(CAMERA_SELECT_IN, 320, 240);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CResize was failed. (%d)\n", result);
}
#endif
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_SetVsyncIntrrupt(CAMERA_INTR_VSYNC_POSITIVE_EDGE); // almost end of vblank
CAMERA_SetVsyncIntrrupt(CAMERA_INTR_VSYNC_NEGATIVE_EDGE); // almost begin of vblank
CAMERA_SetBufferErrorIntrrupt(TRUE);
CAMERA_SetMasterIntrrupt(TRUE);
OS_SetIrqFunction(OS_IE_CAM, CameraIntr);
(void)OS_EnableIrqMask(OS_IE_CAM);
// ƒJƒ<4A>ƒ‰ƒXƒ^<5E>[ƒg
// カメラスタート (DMAはここで開始してもしなくても良い)
CAMERA_ClearBuffer();
// DMA will be started by CameraIntr()
CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, BYTES_PER_LINE * LINES_AT_ONCE, BYTES_PER_LINE * HEIGHT);
CAMERA_Start();
OS_TPrintf("Camera is shooting a movie...\n");
while (1)
{
u16 pad;
u16 trg;
static u16 old = 0xffff; // ignore the trigger by first data
OS_WaitVBlankIntr();
pad = PAD_Read();
trg = (u16)(pad & ~old);
old = pad;
if (trg & PAD_BUTTON_A)
{
OS_TPrintf("call CAMERA_I2CActivate(CAMERA_SELECT_IN)... ");
result = CAMERA_I2CActivate(CAMERA_SELECT_IN);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
}
if (trg & PAD_BUTTON_B)
{
OS_TPrintf("call CAMERA_I2CActivate(CAMERA_SELECT_OUT)... ");
result = CAMERA_I2CActivate(CAMERA_SELECT_OUT);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
}
if (trg & PAD_BUTTON_R)
{
OS_TPrintf("call CAMERA_I2CActivate(CAMERA_SELECT_NONE)... ");
result = CAMERA_I2CActivate(CAMERA_SELECT_NONE);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
}
if (trg & PAD_BUTTON_START) // start/stop to capture
{
if (OS_GetIrqMask() & OS_IE_CAM)
{
// clear the handler
(void)OS_DisableIrqMask(OS_IE_CAM);
OS_TPrintf("call CAMERA_Stop()... ");
CAMERA_Stop();
while (CAMERA_IsBusy())
{
}
OS_TPrintf("Camera was stopped.\n");
}
else
{
// set the handler
OS_SetIrqFunction(OS_IE_CAM, CameraIntr);
(void)OS_EnableIrqMask(OS_IE_CAM);
CAMERA_ClearBuffer();
CAMERA_Start();
OS_TPrintf("Camera is shooting a movie...\n");
}
}
if (trg & PAD_BUTTON_SELECT) // power on/off
{
if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK)
{
OS_TPrintf("call CAMERA_I2CActivate(CAMERA_SELECT_NONE)... ");
result = CAMERA_I2CActivate(CAMERA_SELECT_NONE);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
OS_TPrintf("call CAMERA_PowerOff()... ");
CAMERA_PowerOff();
OS_TPrintf("Done.\n");
}
else
{
OS_TPrintf("call CAMERA_PowerOn()... ");
CAMERA_PowerOn();
OS_TPrintf("Done.\n");
OS_TPrintf("call CAMERA_I2CInit(CAMERA_SELECT_IN)... ");
result = CAMERA_I2CInit(CAMERA_SELECT_IN);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
// resize
OS_TPrintf("call CAMERA_I2CResize(CAMERA_SELECT_IN)... ");
result = CAMERA_I2CResize(CAMERA_SELECT_IN, 320, 240);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
// activate inside camera first
OS_TPrintf("call CAMERA_I2CActivate(CAMERA_SELECT_IN)... ");
result = CAMERA_I2CActivate(CAMERA_SELECT_IN);
OS_TPrintf("%s\n", result == CAMERA_RESULT_SUCCESS_TRUE ? "SUCCESS" : "FAILED");
// set misc registers
CAMERA_SetTrimmingParamsCenter(WIDTH, HEIGHT, 320, 240); // clipped by camera i/f
CAMERA_SetTrimming(TRUE);
CAMERA_SetOutputFormat(CAMERA_OUTPUT_RGB);
CAMERA_SetTransferLines(CAMERA_GET_MAX_LINES(WIDTH));
CAMERA_SetVsyncIntrrupt(CAMERA_INTR_VSYNC_POSITIVE_EDGE); // almost end of vblank
CAMERA_SetBufferErrorIntrrupt(TRUE);
CAMERA_SetMasterIntrrupt(TRUE);
}
}
}
}
@ -107,49 +207,68 @@ void VBlankIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt
}
//--------------------------------------------------------------------------------
// カメラ割り込み処理 (エラー時とVsync時の両方で発生)
//
#if 0
Start時にDMAを開始しない場合Startのタイミングによっては
Start時にDMAを開始している場合StartのタイミングによってはDMAが停止していないから始まる
DMA周りの管理をカメラのVsyncからDMA割り込みに変えても良いかも
#endif
#define PRINT_RATE 32
void CameraIntr(void)
{
if (CAMERA_GetErrorStatus())
OS_TPrintf(".");
OS_SetIrqCheckFlag(OS_IE_CAM); // checking camera interrupt
if (CAMERA_GetErrorStatus()) // error?
{
OS_TPrintf("Error was occurred.\n");
CAMERA_Stop();
MIi_StopExDma(DMA_NO);
while (CAMERA_IsBusy())
// 停止処理
CAMERA_Stop(); // カメラ停止
MIi_StopExDma(DMA_NO); // DMA停止
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();
return; // waiting next frame (skip current frame)
}
// 以降はVsync時の処理
if (MIi_IsExDmaBusy(DMA_NO)) // NOT done to capture last frame?
{
OS_TPrintf("DMA was not done until VBlank.\n");
return; // waiting next frame (skip current frame)
}
if (CAMERA_IsBusy() == FALSE) // done to execute stop command?
{
OS_TPrintf("Finished receiving final frame.\n");
// disable this handler?
}
else
{
// start to capture for next frame
CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, BYTES_PER_LINE * LINES_AT_ONCE, BYTES_PER_LINE * HEIGHT);
}
// debug print
{
static OSTick begin = 0;
static int count = 0;
static OSTick prev = 0;
static OSTick save[PRINT_RATE];
OSTick current = OS_GetTick();
if (MIi_IsExDmaBusy(DMA_NO))
if (begin == 0) // first time
{
OS_TPrintf("DMA was not done until VBlank.\n");
OS_SetIrqCheckFlag(OS_IE_CAM);
return;
begin = OS_GetTick();
}
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)
else if (++count == PRINT_RATE)
{
int i;
OSTick uspf = 0;
for (i = 0; i < count; i++)
{
uspf += OS_TicksToMicroSeconds(save[i]);
}
uspf /= count;
OSTick uspf = OS_TicksToMicroSeconds(OS_GetTick() - begin) / count;
OS_TPrintf("%2d.%03d fps\n", (int)(1000000LL / uspf), (int)(1000000000LL / uspf) % 1000);
count = 0;
begin = OS_GetTick();
}
if (prev)
save[count++] = current - prev;
prev = current;
}
OS_SetIrqCheckFlag(OS_IE_CAM); // checking camera interrupt
}

View File

@ -0,0 +1,44 @@
#! make -f
#----------------------------------------------------------------------------
# Project: TwlSDK - CAMERA - demos - camera-2
# 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 - camera
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();
// 割込み許可
(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();
// ボタン入力サーチ初期化
(void)PAD_InitXYButton();
// SPI初期化
SPI_Init(THREAD_PRIO_SPI);
// カメラ初期化
CAMERA_Init(THREAD_PRIO_CAMERA);
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-2
# 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,232 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - tests - camera
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.h>
#include <twl/camera.h>
#define DMA_NO 5 // 使用するDMA番号(4-7)
#define DMA_IE OS_IE_DMA5 // 対応する割り込み
#define WIDTH 256 // イメージの幅
#define HEIGHT 192 // イメージの高さ
#define LINES_AT_ONCE CAMERA_GET_MAX_LINES(WIDTH) // 一回の転送ライン数
#define BYTES_PER_LINE CAMERA_GET_LINE_BYTES(WIDTH) // 一ラインの転送バイト数
#if 0
CAMERA_DmaRecvInfinity()
(DMAなしで安全にカメラからのデータを取得する手段がないことに注意)
#endif
static void VBlankIntr(void);
static void CameraDmaIntr(void);
static void CameraErrIntr(void);
#include <nitro/dtcm_begin.h>
volatile int lineNumber = 0;
#include <nitro/dtcm_end.h>
static BOOL effect = FALSE;
static u16 pipeBuffer[BYTES_PER_LINE * LINES_AT_ONCE / sizeof(u16)] ATTRIBUTE_ALIGN(4);
/*---------------------------------------------------------------------------*
Name: TwlMain
Description: main
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void TwlMain()
{
CAMERAResult result;
// 初期化
OS_Init();
OS_InitThread();
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);
(void)OS_EnableInterrupts();
// 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(); // create camera thread
CAMERA_PowerOn(); // wakeup camera module
result = CAMERA_I2CInit(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CInit was failed. (%d)\n", result);
CAMERA_PowerOff();
OS_Terminate();
}
OS_TPrintf("CAMERA_I2CInit was done successfully.\n");
result = CAMERA_I2CActivate(CAMERA_SELECT_IN);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CActivate was failed. (%d)\n", result);
}
#if 0
result = CAMERA_I2CResize(CAMERA_SELECT_IN, 320, 240);
if (result != CAMERA_RESULT_SUCCESS_TRUE)
{
OS_TPrintf("CAMERA_I2CResize was failed. (%d)\n", result);
}
#endif
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));
// DMA割り込み設定
OS_SetIrqFunction(DMA_IE, CameraDmaIntr);
(void)OS_EnableIrqMask(DMA_IE);
// DMAスタート (明示的に止めない限り永遠に有効)
MIi_StopExDma(DMA_NO);
CAMERA_DmaPipeInfinity(DMA_NO, pipeBuffer, BYTES_PER_LINE * LINES_AT_ONCE);
// カメラ割り込み設定
CAMERA_SetBufferErrorIntrrupt(TRUE);
CAMERA_SetMasterIntrrupt(TRUE);
OS_SetIrqFunction(OS_IE_CAM, CameraErrIntr);
(void)OS_EnableIrqMask(OS_IE_CAM);
// カメラスタート
lineNumber = 0;
CAMERA_ClearBuffer();
CAMERA_Start();
OS_TPrintf("Camera is shooting a movie...\n");
while (1)
{
u16 pad;
u16 trg;
static u16 old = 0;//0xffff; // ignore the trigger by first data
OS_WaitVBlankIntr();
pad = PAD_Read();
trg = (u16)(pad & ~old);
old = pad;
if (trg & PAD_BUTTON_A)
{
effect ^= 1;
DC_StoreRange(&effect, sizeof(effect));
OS_TPrintf("Effect %s\n", effect ? "ON" : "OFF");
}
}
}
//--------------------------------------------------------------------------------
// Vブランク割り込み処理
//
void VBlankIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt
}
//--------------------------------------------------------------------------------
// DMA割り込み処理 (重すぎ?)
//
#define PRINT_RATE 32
void CameraDmaIntr(void)
{
int line = lineNumber;
OS_SetIrqCheckFlag(DMA_IE); // checking dma interrupt
// 必要な処理をしてフレームバッファにコピーする
if (effect)
{
int i;
u32 *src = (u32*)pipeBuffer;
u32 *dest = (u32*)HW_LCDC_VRAM_A + line * WIDTH / 2;
for (i = 0; i < WIDTH * LINES_AT_ONCE / 2; i++) // pack 2 pixel data
{
dest[i] = ~src[i]; // reverse (if using RGBA format, set bitOR with 0x10001000)
}
}
else
{
MI_CpuCopy8(pipeBuffer, (u16*)HW_LCDC_VRAM_A + line * WIDTH, sizeof(pipeBuffer));
}
DC_InvalidateRange(pipeBuffer, sizeof(pipeBuffer));
line += LINES_AT_ONCE;
if (line >= HEIGHT)
{
static OSTick begin = 0;
static int count = 0;
// 必要ならdestFrameのスワップなど
// debug print
OS_TPrintf(".");
if (begin == 0) // first time
{
begin = OS_GetTick();
}
else if (++count == PRINT_RATE)
{
OSTick uspf = OS_TicksToMicroSeconds(OS_GetTick() - begin) / count;
OS_TPrintf("%2d.%03d fps\n", (int)(1000000LL / uspf), (int)(1000000000LL / uspf) % 1000);
count = 0;
begin = OS_GetTick();
}
DC_StoreRange(&begin, sizeof(begin));
DC_StoreRange(&count, sizeof(count));
lineNumber = 0;
}
else
{
lineNumber = line;
}
}
//--------------------------------------------------------------------------------
// カメラ割り込み処理 (エラー時しか発生しないはず)
//
#if 0
DMAは放置プレイで良い
#endif
void CameraErrIntr(void)
{
OS_SetIrqCheckFlag(OS_IE_CAM); // checking camera interrupt
OS_TPrintf("Error was occurred.\n");
// カメラ停止
CAMERA_Stop();
lineNumber = 0;
// カメラ再開
CAMERA_ClearBuffer();
CAMERA_Start();
}

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

@ -22,7 +22,7 @@
#ifdef SDK_ARM7
#include <twl/camera/ARM7/i2c_common.h>
#include <twl/camera/ARM7/i2c.h>
#include <twl/camera/ARM7/control.h>
#else

View File

@ -29,7 +29,7 @@ extern "C" {
*---------------------------------------------------------------------------*/
#define CAMERA_MESSAGE_ARRAY_MAX 4 // スレッド同期用メッセージキューのサイズ
#define CAMERA_THREAD_STACK_SIZE 256 // スレッドのスタックサイズ
#define CAMERA_THREAD_STACK_SIZE 512 // スレッドのスタックサイズ
/*---------------------------------------------------------------------------*

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - camera
File: 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_I2C_COMMON_H_
#define TWL_CAMERA_I2C_COMMON_H_
#include <twl/types.h>
#include <twl/camera/common/types.h>
#ifdef _cplusplus
extern "C" {
#endif
//================================================================================
// I2C API
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInit
Description: initialize CAMERA
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CInit(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CStandby
Description: standby or resume CAMERA
Arguments: camera : one of CameraSelect
standby : TRUE if goto standby mode
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CStandby(CameraSelect camera, BOOL standby);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CResize
Description: resize CAMERA
Arguments: camera : one of CameraSelect
width : width of output image
height : height of output image
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CResize(CameraSelect camera, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CFrameRate
Description: set CAMERA frame rate
Arguments: camera : one of CameraSelect
rate : fps (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CFrameRate(CameraSelect camera, int rate);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CEffect
Description: set CAMERA effect
Arguments: camera : one of CameraSelect
effect : one of CameraEffect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CEffect(CameraSelect camera, CameraEffect effect);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CFlip
Description: set CAMERA flip/mirror
Arguments: camera : one of CameraSelect
flip : one of CameraFlip
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CFlip(CameraSelect camera, CameraFlip flip);
#ifdef _cplusplus
} /* extern "C" */
#endif
/* TWL_CAMERA_I2C_COMMON_H_ */
#endif

View File

@ -1,262 +0,0 @@
/*---------------------------------------------------------------------------*
Project: TwlSDK - camera
File: i2c_common.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_I2C_COMMON_H_
#define TWL_CAMERA_I2C_COMMON_H_
#include <twl/types.h>
#include <twl/i2c/ARM7/i2c.h>
#include <twl/camera/common/types.h>
#include <twl/camera/ARM7/i2c_micron.h>
#include <twl/camera/ARM7/i2c_sharp.h>
#ifdef _cplusplus
extern "C" {
#endif
#if 0
//================================================================================
// I2C_ ACCESS
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegister
Description: set value to decive register through I2C_.
Arguments: camera : one of CameraSelect
reg : decive register
data : value to be written
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_WriteRegister( CameraSelect camera, u16 reg, u16 data )
{
return cameraType ? CAMERAi_S_WriteRegister(camera, reg, data)
: CAMERAi_M_WriteRegister(camera, reg, data);
}
static inline BOOL CAMERA_WriteRegister( CameraSelect camera, u16 reg, u16 data )
{
return cameraType ? CAMERA_S_WriteRegister(camera, reg, data)
: CAMERA_M_WriteRegister(camera, reg, data);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegister
Description: get value from decive register through I2C_.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
Returns: value which is read from specified decive register
*---------------------------------------------------------------------------*/
static inline u16 CAMERAi_ReadRegister( CameraSelect camera, u16 reg )
{
return cameraType ? CAMERAi_S_ReadRegister(camera, reg)
: CAMERAi_M_ReadRegister(camera, reg);
}
static inline u16 CAMERA_ReadRegister( CameraSelect camera, u16 reg )
{
return cameraType ? CAMERA_S_ReadRegister(camera, reg)
: CAMERA_M_ReadRegister(camera, reg);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegisters
Description: set value to decive registers through I2C_.
Arguments: camera : one of CameraSelect
reg : decive register
bufp : data array to be written
size : data size
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_WriteRegisters( CameraSelect camera, u16 reg, const u16 *bufp, size_t size )
{
return cameraType ? CAMERAi_S_WriteRegisters(camera, reg, bufp, size)
: CAMERAi_M_WriteRegisters(camera, reg, bufp, size);
}
static inline BOOL CAMERA_WriteRegisters( CameraSelect camera, u16 reg, const u16 *bufp, size_t size )
{
return cameraType ? CAMERA_S_WriteRegisters(camera, reg, bufp, size)
: CAMERA_M_WriteRegisters(camera, reg, bufp, size);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegisters
Description: get value from decive registers through I2C_.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
bufp : data array to be read
size : data size
Returns: value which is read from specified decive register
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_ReadRegisters( CameraSelect camera, u16 reg, u16 *bufp, size_t size )
{
return cameraType ? CAMERAi_S_ReadRegisters(camera, reg, bufp, size)
: CAMERAi_M_ReadRegisters(camera, reg, bufp, size);
}
static inline BOOL CAMERA_ReadRegisters( CameraSelect camera, u16 reg, u16 *bufp, size_t size )
{
return cameraType ? CAMERA_S_ReadRegisters(camera, reg, bufp, size)
: CAMERA_M_ReadRegisters(camera, reg, bufp, size);
}
//================================================================================
// I2C_ BIT CONTROL
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_SetParamsM
Description: set control bit to device register
Arguments: camera : one of CameraSelect
reg : device register
setBits : bits to set
maskBits : bits to mask
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_SetParams( CameraSelect camera, u16 reg, u16 setBits, u16 maskBits )
{
return cameraType ? CAMERAi_S_SetParams(camera, reg, setBits, maskBits)
: CAMERAi_M_SetParams(camera, reg, setBits, maskBits);
}
static inline BOOL CAMERA_SetParams( CameraSelect camera, u16 reg, u16 setBits, u16 maskBits )
{
return cameraType ? CAMERA_S_SetParams(camera, reg, setBits, maskBits)
: CAMERA_M_SetParams(camera, reg, setBits, maskBits);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetFlagsM
Description: set control bit to device register
Arguments: camera : one of CameraSelect
reg : device register
setBits : bits to set
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_SetFlags( CameraSelect camera, u16 reg, u16 setBits )
{
return cameraType ? CAMERAi_S_SetFlags(camera, reg, setBits)
: CAMERAi_M_SetFlags(camera, reg, setBits);
}
static inline BOOL CAMERA_SetFlags( CameraSelect camera, u16 reg, u16 setBits )
{
return cameraType ? CAMERA_S_SetFlags(camera, reg, setBits)
: CAMERA_M_SetFlags(camera, reg, setBits);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearFlagsM
Description: clear control bit to device register
Arguments: camera : one of CameraSelect
reg : device register
clrBits : bits to clear
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_ClearFlags( CameraSelect camera, u16 reg, u16 clrBits )
{
return cameraType ? CAMERAi_S_ClearFlags(camera, reg, clrBits)
: CAMERAi_M_ClearFlags(camera, reg, clrBits);
}
static inline BOOL CAMERA_ClearFlags( CameraSelect camera, u16 reg, u16 clrBits )
{
return cameraType ? CAMERA_S_ClearFlags(camera, reg, clrBits)
: CAMERA_M_ClearFlags(camera, reg, clrBits);
}
#endif
//================================================================================
// I2C_ API
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInit
Description: initialize CAMERA
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CInit(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CStandby
Description: standby or resume CAMERA
Arguments: camera : one of CameraSelect
standby : TRUE if goto standby mode
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CStandby(CameraSelect camera, BOOL standby);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CResize
Description: resize CAMERA
Arguments: camera : one of CameraSelect
width : width of output image
height : height of output image
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CResize(CameraSelect camera, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreSleep
Description: preset CAMERA registers
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CPreSleep(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPostSleep
Description: preset CAMERA registers
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CPostSleep(CameraSelect camera);
#ifdef _cplusplus
} /* extern "C" */
#endif
/* TWL_CAMERA_I2C_COMMON_H_ */
#endif

View File

@ -16,11 +16,7 @@
#ifndef TWL_CAMERA_I2C_MICRON_H_
#define TWL_CAMERA_I2C_MICRON_H_
#include <twl/types.h>
#include <twl/i2c/ARM7/i2c.h>
#include <twl/camera/common/types.h>
#define CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
#if 0
Write時にNONEを指定するとTRUEで返りRead時にNONEを指定するとFALSEで返る
@ -33,12 +29,12 @@ extern "C" {
#endif
//================================================================================
// I2C_ ACCESS
// I2C ACCESS
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_M_WriteRegister
Name: CAMERAi_M_WriteRegister
Description: set value to decive register through I2C_.
Description: set value to decive register through I2C.
Arguments: camera : one of CameraSelect
reg : decive register
@ -76,9 +72,9 @@ static inline BOOL CAMERA_M_WriteRegister( CameraSelect camera, u16 reg, u16 dat
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_ReadRegister
Name: CAMERAi_M_ReadRegister
Description: get value from decive register through I2C_.
Description: get value from decive register through I2C.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
@ -109,9 +105,9 @@ static inline u16 CAMERA_M_ReadRegister( CameraSelect camera, u16 reg )
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_WriteRegisters
Name: CAMERAi_M_WriteRegisters
Description: set value to decive registers through I2C_.
Description: set value to decive registers through I2C.
Arguments: camera : one of CameraSelect
reg : decive register
@ -126,35 +122,11 @@ static inline BOOL CAMERAi_M_WriteRegisters( CameraSelect camera, u16 reg, const
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
rIn = (size == 0 ? TRUE : FALSE);
#else
rIn = I2Ci_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_IN, reg, bufp, size );
#endif
}
if (camera & CAMERA_SELECT_OUT)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
rOut = (size == 0 ? TRUE : FALSE);
#else
rOut = I2Ci_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
#endif
}
return (rIn && rOut);
}
@ -164,47 +136,19 @@ static inline BOOL CAMERA_M_WriteRegisters( CameraSelect camera, u16 reg, const
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
rIn = (size == 0 ? TRUE : FALSE);
#else
rOut = I2C_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_IN, reg, bufp, size );
#endif
}
if (camera & CAMERA_SELECT_OUT)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
rOut = (size == 0 ? TRUE : FALSE);
#else
rOut = I2C_WriteRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
#endif
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_ReadRegisters
Name: CAMERAi_M_ReadRegisters
Description: get value from decive registers through I2C_.
Description: get value from decive registers through I2C.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
@ -215,32 +159,6 @@ static inline BOOL CAMERA_M_WriteRegisters( CameraSelect camera, u16 reg, const
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_M_ReadRegisters( CameraSelect camera, u16 reg, u16 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
switch (camera)
{
case CAMERA_SELECT_IN:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters16( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
case CAMERA_SELECT_OUT:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
}
return (size == 0 ? TRUE : FALSE);
#else
switch (camera)
{
case CAMERA_SELECT_IN:
@ -249,38 +167,9 @@ static inline BOOL CAMERAi_M_ReadRegisters( CameraSelect camera, u16 reg, u16 *b
return I2Ci_ReadRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
}
return FALSE;
#endif
}
static inline BOOL CAMERA_M_ReadRegisters( CameraSelect camera, u16 reg, u16 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
switch (camera)
{
case CAMERA_SELECT_IN:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters16( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
case CAMERA_SELECT_OUT:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
}
(void)I2C_Unlock();
return (size == 0 ? TRUE : FALSE);
#else
switch (camera)
{
case CAMERA_SELECT_IN:
@ -289,14 +178,13 @@ static inline BOOL CAMERA_M_ReadRegisters( CameraSelect camera, u16 reg, u16 *bu
return I2C_ReadRegisters16( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
}
return FALSE;
#endif
}
//================================================================================
// I2C_ BIT CONTROL
// I2C BIT CONTROL
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_M_SetParams
Name: CAMERAi_M_SetParams
Description: set control bit to device register
@ -337,7 +225,7 @@ static inline BOOL CAMERA_M_SetParams( CameraSelect camera, u16 reg, u16 setBits
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_SetFlags
Name: CAMERAi_M_SetFlags
Description: set control bit to device register
@ -357,7 +245,7 @@ static inline BOOL CAMERA_M_SetFlags( CameraSelect camera, u16 reg, u16 setBits
}
/*---------------------------------------------------------------------------*
Name: CAMERA_M_ClearFlags
Name: CAMERAi_M_ClearFlags
Description: clear control bit to device register
@ -378,10 +266,10 @@ static inline BOOL CAMERA_M_ClearFlags( CameraSelect camera, u16 reg, u16 clrBit
//================================================================================
// I2C_ API
// I2C API
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CInit
Name: CAMERAi_M_I2CInit
Description: initialize CAMERA
@ -389,10 +277,10 @@ static inline BOOL CAMERA_M_ClearFlags( CameraSelect camera, u16 reg, u16 clrBit
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CInit(CameraSelect camera);
BOOL CAMERAi_M_I2CInit(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CStandby
Name: CAMERAi_M_I2CStandby
Description: standby or resume CAMERA
@ -401,10 +289,10 @@ BOOL CAMERA_M_I2CInit(CameraSelect camera);
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CStandby(CameraSelect camera, BOOL standby);
BOOL CAMERAi_M_I2CStandby(CameraSelect camera, BOOL standby);
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CResize
Name: CAMERAi_M_I2CResize
Description: resize CAMERA
@ -414,30 +302,69 @@ BOOL CAMERA_M_I2CStandby(CameraSelect camera, BOOL standby);
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CResize(CameraSelect camera, u16 width, u16 height);
BOOL CAMERAi_M_I2CResize(CameraSelect camera, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CPreSleep
Name: CAMERAi_M_I2CFrameRate
Description: preset CAMERA registers
Description: set CAMERA frame rate
Arguments: camera : one of CameraSelect
rate : fps (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CPreSleep(CameraSelect camera);
BOOL CAMERAi_M_I2CFrameRate(CameraSelect camera, int rate);
/*---------------------------------------------------------------------------*
Name: CAMERA_M_I2CPostSleep
Name: CAMERAi_M_I2CEffect
Description: preset CAMERA registers
Description: set CAMERA effect
Arguments: camera : one of CameraSelect
effect : one of CameraEffect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_M_I2CPostSleep(CameraSelect camera);
BOOL CAMERAi_M_I2CEffect(CameraSelect camera, CameraEffect effect);
/*---------------------------------------------------------------------------*
Name: CAMERAi_M_I2CFlip
Description: set CAMERA flip/mirror
Arguments: camera : one of CameraSelect
flip : one of CameraFlip
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_M_I2CFlip(CameraSelect camera, CameraFlip flip);
#if 0
/*---------------------------------------------------------------------------*
Name: CAMERAi_M_I2CWhiteBalance
Description: set CAMERA white balance
Arguments: camera : one of CameraSelect
type : preset number (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_M_I2CWhiteBalance(CameraSelect camera, int type);
/*---------------------------------------------------------------------------*
Name: CAMERAi_M_I2CExposure
Description: set CAMERA exposure
Arguments: camera : one of CameraSelect
type : preset number (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_M_I2CExposure(CameraSelect camera, int type);
#endif
#ifdef _cplusplus
} /* extern "C" */

View File

@ -1,546 +0,0 @@
/*---------------------------------------------------------------------------*
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
#if 0
Write時にNONEを指定するとTRUEで返りRead時にNONEを指定するとFALSEで返る
Write時にBOTHを指定すると両方に書き込みRead時にBOTHを指定するとFALSEで返る
SetParams等はWriteと同じ仕様
#endif
#ifdef _cplusplus
extern "C" {
#endif
//================================================================================
// I2C_ ACCESS
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegister
Description: set value to decive register through I2C_.
Arguments: camera : one of CameraSelect
reg : decive register
data : value to be written
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_WriteRegister( CameraSelect camera, u8 reg, u8 data )
{
BOOL rIn = TRUE;
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2Ci_WriteRegister( I2C_SLAVE_CAMERA_IN, reg, data );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2Ci_WriteRegister( I2C_SLAVE_CAMERA_OUT, reg, data );
}
return (rIn && rOut);
}
static inline BOOL CAMERA_WriteRegister( CameraSelect camera, u8 reg, u8 data )
{
BOOL rIn = TRUE;
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2C_WriteRegister( I2C_SLAVE_CAMERA_IN, reg, data );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2C_WriteRegister( I2C_SLAVE_CAMERA_OUT, reg, data );
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegister
Description: get value from decive register through I2C_.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
Returns: value which is read from specified decive register
*---------------------------------------------------------------------------*/
static inline u8 CAMERAi_ReadRegister( CameraSelect camera, u8 reg )
{
switch (camera)
{
case CAMERA_SELECT_IN:
return I2Ci_ReadRegisterSC( I2C_SLAVE_CAMERA_IN, reg );
case CAMERA_SELECT_OUT:
return I2Ci_ReadRegisterSC( I2C_SLAVE_CAMERA_OUT, reg );
}
return FALSE;
}
static inline u8 CAMERA_ReadRegister( CameraSelect camera, u8 reg )
{
switch (camera)
{
case CAMERA_SELECT_IN:
return I2C_ReadRegisterSC( I2C_SLAVE_CAMERA_IN, reg );
case CAMERA_SELECT_OUT:
return I2C_ReadRegisterSC( I2C_SLAVE_CAMERA_OUT, reg );
}
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegisters
Description: set value to decive registers through I2C_.
Arguments: camera : one of CameraSelect
reg : decive register
bufp : data array to be written
size : data size
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_WriteRegisters( CameraSelect camera, u8 reg, const u8 *bufp, size_t size )
{
BOOL rIn = TRUE;
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
rIn = (size == 0 ? TRUE : FALSE);
#else
rIn = I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_IN, reg, bufp, size );
#endif
}
if (camera & CAMERA_SELECT_OUT)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
rOut = (size == 0 ? TRUE : FALSE);
#else
rOut = I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_OUT, reg, bufp, size );
#endif
}
return (rIn && rOut);
}
static inline BOOL CAMERA_WriteRegisters( CameraSelect camera, u8 reg, const u8 *bufp, size_t size )
{
BOOL rIn = TRUE;
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
rIn = (size == 0 ? TRUE : FALSE);
#else
rOut = I2C_WriteRegisters( I2C_SLAVE_CAMERA_IN, reg, bufp, size );
#endif
}
if (camera & CAMERA_SELECT_OUT)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
rOut = (size == 0 ? TRUE : FALSE);
#else
rOut = I2C_WriteRegisters( I2C_SLAVE_CAMERA_OUT, reg, bufp, size );
#endif
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegisters
Description: get value from decive registers through I2C_.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
bufp : data array to be read
size : data size
Returns: value which is read from specified decive register
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_ReadRegisters( CameraSelect camera, u8 reg, u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
switch (camera)
{
case CAMERA_SELECT_IN:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
case CAMERA_SELECT_OUT:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
}
return (size == 0 ? TRUE : FALSE);
#else
switch (camera)
{
case CAMERA_SELECT_IN:
return I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA_IN, reg, bufp, size );
case CAMERA_SELECT_OUT:
return I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA_OUT, reg, bufp, size );
}
return FALSE;
#endif
}
static inline BOOL CAMERA_ReadRegisters( CameraSelect camera, u8 reg, u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
switch (camera)
{
case CAMERA_SELECT_IN:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
case CAMERA_SELECT_OUT:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
}
(void)I2C_Unlock();
return (size == 0 ? TRUE : FALSE);
#else
switch (camera)
{
case CAMERA_SELECT_IN:
return I2C_ReadRegistersSC( I2C_SLAVE_CAMERA_IN, reg, bufp, size );
case CAMERA_SELECT_OUT:
return I2C_ReadRegistersSC( I2C_SLAVE_CAMERA_OUT, reg, bufp, size );
}
return FALSE;
#endif
}
//================================================================================
// I2C_ BIT CONTROL
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_SetParams
Description: set control bit to device register
Arguments: camera : one of CameraSelect
reg : device register
setBits : bits to set
maskBits : bits to mask
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_SetParams( CameraSelect camera, u8 reg, u8 setBits, u8 maskBits )
{
BOOL rIn = TRUE;
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2Ci_SetParams( I2C_SLAVE_CAMERA_IN, reg, setBits, maskBits );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2Ci_SetParams( I2C_SLAVE_CAMERA_OUT, reg, setBits, maskBits );
}
return (rIn && rOut);
}
static inline BOOL CAMERA_SetParams( CameraSelect camera, u8 reg, u8 setBits, u8 maskBits )
{
BOOL rIn = TRUE;
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2C_SetParams( I2C_SLAVE_CAMERA_IN, reg, setBits, maskBits );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2C_SetParams( I2C_SLAVE_CAMERA_OUT, reg, setBits, maskBits );
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_SetFlags
Description: set control bit to device register
Arguments: camera : one of CameraSelect
reg : device register
setBits : bits to set
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_SetFlags( CameraSelect camera, u8 reg, u8 setBits )
{
return CAMERAi_SetParams( camera, reg, setBits, setBits );
}
static inline BOOL CAMERA_SetFlags( CameraSelect camera, u8 reg, u8 setBits )
{
return CAMERA_SetParams( camera, reg, setBits, setBits );
}
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearFlags
Description: clear control bit to device register
Arguments: camera : one of CameraSelect
reg : device register
clrBits : bits to clear
Returns: None
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_ClearFlags( CameraSelect camera, u8 reg, u8 clrBits )
{
return CAMERAi_SetParams( camera, reg, 0, clrBits );
}
static inline BOOL CAMERA_ClearFlags( CameraSelect camera, u8 reg, u8 clrBits )
{
return CAMERA_SetParams( camera, reg, 0, clrBits );
}
//================================================================================
// I2C_ API
//================================================================================
#define CAMERA_I2CSetCropping(c, x, y, w, h) CAMERA_I2CSetCroppingParams(c, w, h)
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CSetFlipMode
Description: set CAMERA's flip mode
Arguments: camera : one of CameraSelect
mode : one of CameraFlipMode to apply
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CSetFlipMode(CameraSelect camera, CameraFlipMode mode);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CSetSpecialMode
Description: set CAMERA's special mode
Arguments: camera : one of CameraSelect
mode : one of CameraSpecialMode to apply
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CSetSpecialMode(CameraSelect camera, CameraSpecialMode mode);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CSetCroppingParams
Description: set CAMERA_ cropping parameters.
Arguments: camera : one of CameraSelect
width : width of image (up to 640)
height : height of image (up to 480)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CSetCroppingParams(CameraSelect camera, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CGetCroppingParams
Description: get current CAMERA_ cropping parameters.
Arguments: camera : one of CameraSelect
pWidth : address to store the width
pHeight : address to store the height
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CGetCroppingParams(CameraSelect camera, u16 *pWidth, u16 *pHeight);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPause
Description: pause to send frame
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CPause(CameraSelect camera)
{
BOOL result;
(void)I2C_Lock();
result = CAMERAi_WriteRegister( camera, 0xef, 0x00 ) &&
CAMERAi_ClearFlags( camera, 0xde, 0x04 );
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CResume
Description: resume from pause state
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CResume(CameraSelect camera)
{
BOOL result;
(void)I2C_Lock();
result = CAMERAi_WriteRegister( camera, 0xef, 0x00 ) &&
CAMERAi_SetFlags( camera, 0xde, 0x04 );
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreSleep
Description: pre-sleep
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CPreSleep(CameraSelect camera)
{
BOOL result;
(void)I2C_Lock();
(void)camera; // not impremented yet
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPostSleep
Description: post-sleep
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CPostSleep(CameraSelect camera)
{
BOOL result;
(void)I2C_Lock();
(void)camera; // not impremented yet
(void)I2C_Unlock();
return result;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreset
Description: preset CAMERA registers
Arguments: camera : one of CameraSelect
preset : one of CameraPreset
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_I2CPreset(CameraSelect camera, CameraPreset preset);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInit
Description: initialize CAMERA
Arguments: camera : one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
static inline BOOL CAMERA_I2CInit(CameraSelect camera)
{
if (CAMERA_I2CPreset(camera, CAMERA_PRESET_DEFAULT) == FALSE) {
return FALSE;
}
if (CAMERA_I2CSetFlipMode(camera, CAMERA_FLIPMODE_DEFAULT) == FALSE) {
return FALSE;
}
return TRUE;
}
#ifdef _cplusplus
} /* extern "C" */
#endif
/* TWL_CAMERA_CAMERA_I2CH_ */
#endif

View File

@ -16,11 +16,7 @@
#ifndef TWL_CAMERA_I2C_SHARP_H_
#define TWL_CAMERA_I2C_SHARP_H_
#include <twl/types.h>
#include <twl/i2c/ARM7/i2c.h>
#include <twl/camera/common/types.h>
#define CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
#if 0
Write時にNONEを指定するとTRUEで返りRead時にNONEを指定するとFALSEで返る
@ -33,12 +29,12 @@ extern "C" {
#endif
//================================================================================
// I2C_ ACCESS
// I2C ACCESS
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_S_WriteRegister
Name: CAMERAi_S_WriteRegister
Description: set value to decive register through I2C_.
Description: set value to decive register through I2C.
Arguments: camera : one of CameraSelect
reg : decive register
@ -52,11 +48,11 @@ static inline BOOL CAMERAi_S_WriteRegister( CameraSelect camera, u8 reg, u8 data
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2Ci_WriteRegister( I2C_SLAVE_CAMERA_MICRON_IN, reg, data );
rIn = I2Ci_WriteRegister( I2C_SLAVE_CAMERA_SHARP_IN, reg, data );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2Ci_WriteRegister( I2C_SLAVE_CAMERA_MICRON_OUT, reg, data );
rOut = I2Ci_WriteRegister( I2C_SLAVE_CAMERA_SHARP_OUT, reg, data );
}
return (rIn && rOut);
}
@ -66,19 +62,19 @@ static inline BOOL CAMERA_S_WriteRegister( CameraSelect camera, u8 reg, u8 data
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2C_WriteRegister( I2C_SLAVE_CAMERA_MICRON_IN, reg, data );
rIn = I2C_WriteRegister( I2C_SLAVE_CAMERA_SHARP_IN, reg, data );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2C_WriteRegister( I2C_SLAVE_CAMERA_MICRON_OUT, reg, data );
rOut = I2C_WriteRegister( I2C_SLAVE_CAMERA_SHARP_OUT, reg, data );
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_ReadRegister
Name: CAMERAi_S_ReadRegister
Description: get value from decive register through I2C_.
Description: get value from decive register through I2C.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
@ -90,9 +86,9 @@ static inline u8 CAMERAi_S_ReadRegister( CameraSelect camera, u8 reg )
switch (camera)
{
case CAMERA_SELECT_IN:
return I2Ci_ReadRegister( I2C_SLAVE_CAMERA_MICRON_IN, reg );
return I2Ci_ReadRegister( I2C_SLAVE_CAMERA_SHARP_IN, reg );
case CAMERA_SELECT_OUT:
return I2Ci_ReadRegister( I2C_SLAVE_CAMERA_MICRON_OUT, reg );
return I2Ci_ReadRegister( I2C_SLAVE_CAMERA_SHARP_OUT, reg );
}
return FALSE;
}
@ -101,17 +97,17 @@ static inline u8 CAMERA_S_ReadRegister( CameraSelect camera, u8 reg )
switch (camera)
{
case CAMERA_SELECT_IN:
return I2C_ReadRegister( I2C_SLAVE_CAMERA_MICRON_IN, reg );
return I2C_ReadRegister( I2C_SLAVE_CAMERA_SHARP_IN, reg );
case CAMERA_SELECT_OUT:
return I2C_ReadRegister( I2C_SLAVE_CAMERA_MICRON_OUT, reg );
return I2C_ReadRegister( I2C_SLAVE_CAMERA_SHARP_OUT, reg );
}
return FALSE;
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_WriteRegisters
Name: CAMERAi_S_WriteRegisters
Description: set value to decive registers through I2C_.
Description: set value to decive registers through I2C.
Arguments: camera : one of CameraSelect
reg : decive register
@ -126,35 +122,11 @@ static inline BOOL CAMERAi_S_WriteRegisters( CameraSelect camera, u8 reg, const
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
rIn = (size == 0 ? TRUE : FALSE);
#else
rIn = I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg, bufp, size );
#endif
rIn = I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_SHARP_IN, reg, bufp, size );
}
if (camera & CAMERA_SELECT_OUT)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
rOut = (size == 0 ? TRUE : FALSE);
#else
rOut = I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
#endif
rOut = I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_SHARP_OUT, reg, bufp, size );
}
return (rIn && rOut);
}
@ -164,47 +136,19 @@ static inline BOOL CAMERA_S_WriteRegisters( CameraSelect camera, u8 reg, const u
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
rIn = (size == 0 ? TRUE : FALSE);
#else
rOut = I2C_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg, bufp, size );
#endif
rOut = I2C_WriteRegisters( I2C_SLAVE_CAMERA_SHARP_IN, reg, bufp, size );
}
if (camera & CAMERA_SELECT_OUT)
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
while ( size > 0 )
{
if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
(void)I2C_Unlock();
rOut = (size == 0 ? TRUE : FALSE);
#else
rOut = I2C_WriteRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
#endif
rOut = I2C_WriteRegisters( I2C_SLAVE_CAMERA_SHARP_OUT, reg, bufp, size );
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_ReadRegisters
Name: CAMERAi_S_ReadRegisters
Description: get value from decive registers through I2C_.
Description: get value from decive registers through I2C.
Arguments: camera : one of CameraSelect w/o BOTH
reg : decive register
@ -215,88 +159,32 @@ static inline BOOL CAMERA_S_WriteRegisters( CameraSelect camera, u8 reg, const u
*---------------------------------------------------------------------------*/
static inline BOOL CAMERAi_S_ReadRegisters( CameraSelect camera, u8 reg, u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
switch (camera)
{
case CAMERA_SELECT_IN:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
return I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_SHARP_IN, reg, bufp, size );
case CAMERA_SELECT_OUT:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
}
return (size == 0 ? TRUE : FALSE);
#else
switch (camera)
{
case CAMERA_SELECT_IN:
return I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg, bufp, size );
case CAMERA_SELECT_OUT:
return I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
return I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_SHARP_OUT, reg, bufp, size );
}
return FALSE;
#endif
}
static inline BOOL CAMERA_S_ReadRegisters( CameraSelect camera, u8 reg, u8 *bufp, size_t size )
{
#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO
(void)I2C_Lock();
switch (camera)
{
case CAMERA_SELECT_IN:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
return I2C_ReadRegisters( I2C_SLAVE_CAMERA_SHARP_IN, reg, bufp, size );
case CAMERA_SELECT_OUT:
while ( size > 0 )
{
if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg++, bufp++, 1 ) )
{
break;
}
size--;
}
break;
}
(void)I2C_Unlock();
return (size == 0 ? TRUE : FALSE);
#else
switch (camera)
{
case CAMERA_SELECT_IN:
return I2C_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_IN, reg, bufp, size );
case CAMERA_SELECT_OUT:
return I2C_ReadRegisters( I2C_SLAVE_CAMERA_MICRON_OUT, reg, bufp, size );
return I2C_ReadRegisters( I2C_SLAVE_CAMERA_SHARP_OUT, reg, bufp, size );
}
return FALSE;
#endif
}
//================================================================================
// I2C_ BIT CONTROL
// I2C BIT CONTROL
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_S_SetParams
Name: CAMERAi_S_SetParams
Description: set control bit to device register
@ -313,11 +201,11 @@ static inline BOOL CAMERAi_S_SetParams( CameraSelect camera, u8 reg, u8 setBits,
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2Ci_SetParams( I2C_SLAVE_CAMERA_MICRON_IN, reg, setBits, maskBits );
rIn = I2Ci_SetParams( I2C_SLAVE_CAMERA_SHARP_IN, reg, setBits, maskBits );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2Ci_SetParams( I2C_SLAVE_CAMERA_MICRON_OUT, reg, setBits, maskBits );
rOut = I2Ci_SetParams( I2C_SLAVE_CAMERA_SHARP_OUT, reg, setBits, maskBits );
}
return (rIn && rOut);
}
@ -327,17 +215,17 @@ static inline BOOL CAMERA_S_SetParams( CameraSelect camera, u8 reg, u8 setBits,
BOOL rOut = TRUE;
if (camera & CAMERA_SELECT_IN)
{
rIn = I2C_SetParams( I2C_SLAVE_CAMERA_MICRON_IN, reg, setBits, maskBits );
rIn = I2C_SetParams( I2C_SLAVE_CAMERA_SHARP_IN, reg, setBits, maskBits );
}
if (camera & CAMERA_SELECT_OUT)
{
rOut = I2C_SetParams( I2C_SLAVE_CAMERA_MICRON_OUT, reg, setBits, maskBits );
rOut = I2C_SetParams( I2C_SLAVE_CAMERA_SHARP_OUT, reg, setBits, maskBits );
}
return (rIn && rOut);
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_SetFlags
Name: CAMERAi_S_SetFlags
Description: set control bit to device register
@ -357,7 +245,7 @@ static inline BOOL CAMERA_S_SetFlags( CameraSelect camera, u8 reg, u8 setBits )
}
/*---------------------------------------------------------------------------*
Name: CAMERA_S_ClearFlags
Name: CAMERAi_S_ClearFlags
Description: clear control bit to device register
@ -378,10 +266,10 @@ static inline BOOL CAMERA_S_ClearFlags( CameraSelect camera, u8 reg, u8 clrBits
//================================================================================
// I2C_ API
// I2C API
//================================================================================
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CInit
Name: CAMERAi_S_I2CInit
Description: initialize CAMERA
@ -389,10 +277,10 @@ static inline BOOL CAMERA_S_ClearFlags( CameraSelect camera, u8 reg, u8 clrBits
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CInit(CameraSelect camera);
BOOL CAMERAi_S_I2CInit(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CStandby
Name: CAMERAi_S_I2CStandby
Description: standby or resume CAMERA
@ -401,10 +289,10 @@ BOOL CAMERA_S_I2CInit(CameraSelect camera);
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CStandby(CameraSelect camera, BOOL standby);
BOOL CAMERAi_S_I2CStandby(CameraSelect camera, BOOL standby);
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CResize
Name: CAMERAi_S_I2CResize
Description: resize CAMERA
@ -414,30 +302,44 @@ BOOL CAMERA_S_I2CStandby(CameraSelect camera, BOOL standby);
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CResize(CameraSelect camera, u16 width, u16 height);
BOOL CAMERAi_S_I2CResize(CameraSelect camera, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CPreSleep
Name: CAMERAi_S_I2CFrameRate
Description: preset CAMERA registers
Description: set CAMERA frame rate
Arguments: camera : one of CameraSelect
rate : fps (0: auto)
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CPreSleep(CameraSelect camera);
BOOL CAMERAi_S_I2CFrameRate(CameraSelect camera, int rate);
/*---------------------------------------------------------------------------*
Name: CAMERA_S_I2CPostSleep
Name: CAMERAi_S_I2CEffect
Description: preset CAMERA registers
Description: set CAMERA effect
Arguments: camera : one of CameraSelect
effect : one of CameraEffect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_S_I2CPostSleep(CameraSelect camera);
BOOL CAMERAi_S_I2CEffect(CameraSelect camera, CameraEffect effect);
/*---------------------------------------------------------------------------*
Name: CAMERAi_S_I2CFlip
Description: set CAMERA flip/mirror
Arguments: camera : one of CameraSelect
flip : one of CameraFlip
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERAi_S_I2CFlip(CameraSelect camera, CameraFlip flip);
#ifdef _cplusplus
} /* extern "C" */

View File

@ -42,30 +42,6 @@ typedef enum {
CAMERA_INTR_VSYNC_POSITIVE_EDGE = (3 << REG_CAM_CAM_CNT_IREQ_VS_SHIFT)
} CameraIntrVsync;
/*---------------------------------------------------------------------------*
Name: CAMERA_Select
Description: select camera to activate
Arguments: camera one of CameraSelect
Returns: TRUE if success
*---------------------------------------------------------------------------*/
BOOL CAMERA_Select( CameraSelect camera );
#if 0
/*---------------------------------------------------------------------------*
Name: CAMERA_SetStbyn
Description: set stbyn
Arguments: BOOL High/Low
Returns: BOOL last state
*---------------------------------------------------------------------------*/
BOOL CAMERA_SetStbyn( BOOL high );
#endif
/*---------------------------------------------------------------------------*
Name: CAMERA_PowerOn
@ -88,28 +64,6 @@ void CAMERA_PowerOn( void );
*---------------------------------------------------------------------------*/
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
@ -143,34 +97,10 @@ void CAMERA_Start( void );
*---------------------------------------------------------------------------*/
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
@ -201,7 +131,7 @@ void CAMERA_SetTrimmingParams(u16 x1, u16 y1, u16 x2, u16 y2);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetTrimming
Description: set trimming enable/disable
Description: set trimming to be enabled/disabled
Arguments: enabled TRUE if set trimming will be enabled

View File

@ -29,7 +29,7 @@ extern "C" {
typedef enum CAMERAResult
{
CAMERA_RESULT_SUCCESS = 0,
CAMERA_RESULT_SUCCESS_TRUE,
CAMERA_RESULT_SUCCESS_TRUE = 0,
CAMERA_RESULT_SUCCESS_FALSE,
CAMERA_RESULT_BUSY,
CAMERA_RESULT_ILLEGAL_PARAMETER,
@ -55,181 +55,6 @@ typedef void (*CAMERACallback)(CAMERAResult result, void *arg);
*---------------------------------------------------------------------------*/
void CAMERA_Init(void);
/*---------------------------------------------------------------------------*
Name: CAMERAi_I2CSelectAsync
Description: select CAMERA to activate
async version
Arguments: camera - one of CameraSelect
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CSelectAsync(CameraSelect camera, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERAi_I2CSelect
Description: select CAMERA to activate
sync version.
Arguments: camera - one of CameraSelect
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CSelect(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegistersAsync
Description: write CAMERA registers via I2C.
async version.
Arguments: camera - one of CameraSelect
addr - start address
bufp - buffer to write
length - length of bufp
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_WriteRegistersAsync(CameraSelect camera, u8 addr, const u8* bufp, size_t length, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_WriteRegisters
Description: write CAMERA registers via I2C.
sync version.
Arguments: camera - one of CameraSelect
addr - start address
bufp - buffer to write
length - length of bufp
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_WriteRegisters(CameraSelect camera, u8 addr, const u8* bufp, size_t length);
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegistersAsync
Description: read CAMERA registers via I2C.
Arguments: camera - one of CameraSelect
addr - start address
bufp - buffer to read
length - length of bufp
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ReadRegistersAsync(CameraSelect camera, u8 addr, u8* bufp, size_t length, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_ReadRegisters
Description: set CAMERA key normally
sync version.
Arguments: camera - one of CameraSelect
addr - start address
bufp - buffer to read
length - length of bufp
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ReadRegisters(CameraSelect camera, u8 addr, u8* bufp, size_t length);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetParamsAsync
Description: set register as reg = (reg & ~mask) | (bits & mask);
Arguments: camera - one of CameraSelect
addr - address to access
bits - bits to set
mask - mask to touch
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetParamsAsync(CameraSelect camera, u8 addr, u8 bits, u8 mask, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetParams
Description: set register as reg = (reg & ~mask) | (bits & mask);
Arguments: camera - one of CameraSelect
addr - address to access
bits - bits to set
mask - mask to touch
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetParams(CameraSelect camera, u8 addr, u8 bits, u8 mask);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetFlagsAsync
Description: set register as reg |= bits;
Arguments: camera - one of CameraSelect
addr - address to access
bits - bits to set
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetFlagsAsync(CameraSelect camera, u8 addr, u8 bits, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetFlags
Description: set register as reg |= bits;
Arguments: camera - one of CameraSelect
addr - address to access
bits - bits to set
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetFlags(CameraSelect camera, u8 addr, u8 bits);
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearFlagsAsync
Description: set register as reg &= ~bits;
Arguments: camera - one of CameraSelect
addr - address to access
bits - bits to clear
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ClearFlagsAsync(CameraSelect camera, u8 addr, u8 bits, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_ClearFlags
Description: set register as reg &= ~bits;
Arguments: camera - one of CameraSelect
addr - address to access
bits - bits to set
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ClearFlags(CameraSelect camera, u8 addr, u8 bits);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CInitAsync
@ -255,166 +80,146 @@ CAMERAResult CAMERA_I2CInitAsync(CameraSelect camera, CAMERACallback callback, v
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CInit(CameraSelect camera);
#if 0
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPresetAsync
Description: set camera registers with specified preset via I2C
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CActivateAsync
Description: activate specified CAMERA (goto standby if NONE is specified)
async version
Arguments: camera - one of CameraSelect
preset - preset type
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPresetAsync(CameraSelect camera, CameraPreset preset, CAMERACallback callback, void *arg);
CAMERAResult CAMERA_I2CActivateAsync(CameraSelect camera, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreset
Name: CAMERA_I2CActivate
Description: set camera registers with specified preset via I2C
Description: activate specified CAMERA (goto standby if NONE is specified)
sync version.
Arguments: camera - one of CameraSelect
preset - preset type
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CPreset(CameraSelect camera, CameraPreset preset);
#endif
/*---------------------------------------------------------------------------*
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);
CAMERAResult CAMERA_I2CActivate(CameraSelect camera);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CPreSleep
Name: CAMERAi_I2CResizeAsync
Description: pre-sleep process in camera registers via I2C
sync version.
Description: resize CAMERA output image
async 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: camera - one of CameraSelect
x_off - x offset to start capturing
y_off - y offset to start capturing
width - width of image
height - height of image
Arguments: camera - one of CameraResize
width - width of the image
height - height of the image
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_SetCroppingAsync(CameraSelect camera, u16 x_off, u16 y_off, u16 width, u16 height, CAMERACallback callback, void *arg);
CAMERAResult CAMERA_I2CResizeAsync(CameraSelect camera, u16 width, u16 height, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_SetCropping
Name: CAMERAi_I2CResize
Description: set offset and size
Description: resize CAMERA output image
sync version.
Arguments: camera - one of CameraResize
width - width of the image
height - height of the image
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CResize(CameraSelect camera, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CFrameRateAsync
Description: set CAMERA frame rate (0 means automatic)
async version
Arguments: camera - one of CameraSelect
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(CameraSelect camera, u16 x_off, u16 y_off, u16 width, u16 height);
/*---------------------------------------------------------------------------*
Name: CAMERA_PauseAsync
Description: pause camera via I2C
async version.
Arguments: callback -
rate - frame rate (fps)
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_PauseAsync(CAMERACallback callback, void *arg);
CAMERAResult CAMERA_I2CFrameRateAsync(CameraSelect camera, int rate, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_Pause
Name: CAMERA_I2CFrameRate
Description: pause camera via I2C
Description: set CAMERA frame rate (0 means automatic)
sync version.
Arguments: None.
Arguments: camera - one of CameraSelect
rate - frame rate (fps)
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Pause(void);
CAMERAResult CAMERA_I2CFrameRate(CameraSelect camera, int rate);
/*---------------------------------------------------------------------------*
Name: CAMERA_ResumeAsync
Name: CAMERA_I2CEffectAsync
Description: resume camera from pausing via I2C
async version.
Description: set CAMERA frame rate (0 means automatic)
async version
Arguments: callback -
Arguments: camera - one of CameraSelect
effect - one of CameraEffect
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_ResumeAsync(CAMERACallback callback, void *arg);
CAMERAResult CAMERA_I2CEffectAsync(CameraSelect camera, CameraEffect effect, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_Resume
Name: CAMERA_I2CEffect
Description: resume camera from pausing via I2C
Description: set CAMERA frame rate (0 means automatic)
sync version.
Arguments: None.
Arguments: camera - one of CameraSelect
effect - one of CameraEffect
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_Resume(void);
CAMERAResult CAMERA_I2CEffect(CameraSelect camera, CameraEffect effect);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CFlipAsync
Description: set CAMERA frame rate (0 means automatic)
async version
Arguments: camera - one of CameraSelect
flip - one of CameraFlip
callback -
arg -
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CFlipAsync(CameraSelect camera, CameraFlip flip, CAMERACallback callback, void *arg);
/*---------------------------------------------------------------------------*
Name: CAMERA_I2CFlip
Description: set CAMERA frame rate (0 means automatic)
sync version.
Arguments: camera - one of CameraSelect
flip - one of CameraFlip
Returns: CAMERAResult
*---------------------------------------------------------------------------*/
CAMERAResult CAMERA_I2CFlip(CameraSelect camera, CameraFlip flip);
/*===========================================================================*/

View File

@ -21,7 +21,7 @@
#include <twl/mi/exDma.h>
#define CAMERA_DMA_BLOCK_SIZE MI_EXDMA_BLOCK_64B
#define CAMERA_DMA_INTERVAL 8
#define CAMERA_DMA_INTERVAL 2
#define CAMERA_DMA_PRESCALER MI_EXDMA_PRESCALER_1
#ifdef __cplusplus
@ -73,22 +73,22 @@ static inline void CAMERA_DmaRecvAsync(u32 dmaNo, void *dest, u32 unit, u32 leng
}
/*---------------------------------------------------------------------------*
Name: CAMERA_DmaRecvInfinity
Name: CAMERA_DmaPipeInfinity
Description: receiving data from CAMERA buffer.
Once starting DMA, it will transfer every frame automatically.
Once starting DMA, it will transfer every unit data to same
destination address.
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)
static inline void CAMERA_DmaPipeInfinity(u32 dmaNo, void *dest, u32 unit)
{
MIi_ExDmaRecvAsyncCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, length, unit,
MIi_ExDmaRecvAsyncCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, unit, 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 );

View File

@ -47,48 +47,32 @@ extern "C" {
// PXIコマンド定義
typedef enum CAMERAPxiCommand
{
CAMERA_PXI_COMMAND_SELECT = 0x00, // アクティブ選択
// 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_INIT = 0x00, // 初期化
CAMERA_PXI_COMMAND_I2C_PRE_SLEEP = 0x28, // スリープ前処理
CAMERA_PXI_COMMAND_I2C_POST_SLEEP = 0x29, // スリープ後処理
CAMERA_PXI_COMMAND_ACTIVATE = 0x10, // アクティブ選択
CAMERA_PXI_COMMAND_I2C_SET_CROPPING = 0x30, // 位置とサイズ設定
CAMERA_PXI_COMMAND_RESIZE = 0x30, // サイズ設定
CAMERA_PXI_COMMAND_FRAME_RATE = 0x31, // フレームレート設定
CAMERA_PXI_COMMAND_EFFECT = 0x32, // エフェクト設定
CAMERA_PXI_COMMAND_FLIP = 0x33, // 反転設定
CAMERA_PXI_COMMAND_I2C_PAUSE = 0x38, // 一時停止
CAMERA_PXI_COMMAND_I2C_RESUME = 0x39 // 復帰
CAMERA_PXI_COMMAND_UNKNOWN
}
CAMERAPxiCommand;
// PXIコマンドサイズ定義
typedef enum CAMERAPxiSize
{
CAMERA_PXI_SIZE_SELECT = 1, // camera
// I2C基本操作
CAMERA_PXI_SIZE_WRITE_REGISTERS = CAMERA_PXI_DATA_SIZE_MAX, // camera, addr, size, data...
CAMERA_PXI_SIZE_READ_REGISTERS = 3, // camera, addr, size
CAMERA_PXI_SIZE_SET_PARAMS = 4, // camera, addr, bits, mask
CAMERA_PXI_SIZE_SET_FLAGS = 3, // camera, addr, bits
CAMERA_PXI_SIZE_CLEAR_FLAGS = 3, // camera, addr, bits
// I2C応用操作
CAMERA_PXI_SIZE_I2C_INIT = 1, // camera
CAMERA_PXI_SIZE_I2C_PRESET = 2, // camera, preset
CAMERA_PXI_SIZE_INIT = 1, // camera
CAMERA_PXI_SIZE_I2C_PRE_SLEEP = 0,
CAMERA_PXI_SIZE_I2C_POST_SLEEP = 0,
CAMERA_PXI_SIZE_ACTIVATE = 1, // camera
CAMERA_PXI_SIZE_I2C_SET_CROPPING = 9, // camera, (u16)x_offset, (u16)y_offset, (u16)width, (u16)height
CAMERA_PXI_SIZE_RESIZE = 5, // camera, (u16)width, (u16)height
CAMERA_PXI_SIZE_FRAME_RATE = 2, // camera, rate
CAMERA_PXI_SIZE_EFFECT = 2, // camera, effect
CAMERA_PXI_SIZE_FLIP = 2, // camera, flip
CAMERA_PXI_SIZE_I2C_PAUSE = 0,
CAMERA_PXI_SIZE_I2C_RESUME = 0
CAMERA_PXI_SIZE_UNKNOWN
}
CAMERAPxiSize;

View File

@ -22,21 +22,36 @@ extern "C" {
/*===========================================================================*/
typedef enum {
typedef enum
{
CAMERA_SELECT_NONE = 0,
CAMERA_SELECT_IN = (1<<0),
CAMERA_SELECT_OUT = (1<<1),
CAMERA_SELECT_BOTH = (CAMERA_SELECT_IN|CAMERA_SELECT_OUT)
} CameraSelect;
}
CameraSelect;
typedef enum {
CAMERA_FUNC_INIT,
CAMERA_FUNC_STANDBY,
CAMERA_FUNC_RESIZE,
CAMERA_FUNC_PRESLEEP,
CAMERA_FUNC_POSTSLEEP,
CAMERA_FUNC_MAX
} CameraFunct;
typedef enum
{
CAMERA_EFFECT_NONE,
CAMERA_EFFECT_MONO,
CAMERA_EFFECT_SEPIA,
CAMERA_EFFECT_NEGATIVE,
CAMERA_EFFECT_MAX
}
CameraEffect;
typedef enum
{
CAMERA_FLIP_NONE,
CAMERA_FLIP_VERTICAL,
CAMERA_FLIP_HORIZONTAL,
CAMERA_FLIP_REVERSE,
CAMERA_FLIP_MAX
}
CameraFlip;
/*===========================================================================*/

View File

@ -51,8 +51,8 @@ I2CReadWrite;
#define I2C_ADDR_CODEC (0x18 << 1)
#define I2C_ADDR_CAMERA_MICRON_IN 0x78 // MICRON
#define I2C_ADDR_CAMERA_MICRON_OUT 0x7A // MICRON
#define I2C_ADDR_CAMERA_MICRON_IN 0x7A // MICRON
#define I2C_ADDR_CAMERA_MICRON_OUT 0x78 // MICRON
#define I2C_ADDR_CAMERA_SHARP_IN 0xE0 // SHARP
#define I2C_ADDR_CAMERA_SHARP_OUT 0xA0 // SHARP
@ -495,33 +495,6 @@ static inline BOOL I2C_VerifyRegisters16( I2CSlave id, u16 reg, const u16 *bufp,
return result;
}
#if 0
//================================================================================
// INTERRUPT
//================================================================================
/*---------------------------------------------------------------------------*
Name: I2Ci_EnableInterrupt
Description: enable I2C interrupt for each device.
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void I2Ci_EnableInterrupt( void );
/*---------------------------------------------------------------------------*
Name: I2Ci_DisableInterrupt
Description: disable I2C interrupt for each device.
Arguments: None.
Returns: None.
*---------------------------------------------------------------------------*/
void I2Ci_DisableInterrupt( void );
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif