diff --git a/build/buildsetup/ioreg/io_register_list.csv b/build/buildsetup/ioreg/io_register_list.csv index d6e9019..ad6b23c 100644 --- a/build/buildsetup/ioreg/io_register_list.csv +++ b/build/buildsetup/ioreg/io_register_list.csv @@ -459,9 +459,9 @@ 0x1052,,DB_BLDALPHA,16,rw,G2S,volatile,EVB,8,5,EVA,0,5,,,,,,,,,,,,,,,,,,,,,,,, 0x1054,,DB_BLDY,16,rw,G2S,volatile,EVY,0,5,,,,,,,,,,,,,,,,,,,,,,,,,,, #twl p79 ` 84,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -0x4200,,MCNT,16,rw,CAM,volatile,INI,7,1,V28,6,1,VIO,5,1,V18,4,1,IRCLK,3,1,SYNC,2,1,RSTN,1,1,STBYN,0,1,,,,,, -0x4202,,CNT,16,rw,CAM,volatile,E,15,1,T,14,1,F,13,1,IREQ_I,11,1,IREQ_BE,10,1,IREQ_VS1,9,1,IREQ_VS0,8,1,CL,7,1,ERR,6,1,TL,0,4 -0x4204,,DAT,32,r,CAM,volatile,DATA,0,32,,,,,,,,,,,,,,,,,,,,,,,,,,, +0x4200,,CAM_MCNT,16,rw,CAM,volatile,INI,7,1,V28,6,1,VIO,5,1,V18,4,1,IRCLK,3,1,SYNC,2,1,RSTN,1,1,STBYN,0,1,,,,,, +0x4202,,CAM_CNT,16,rw,CAM,volatile,E,15,1,T,14,1,F,13,1,IREQ_I,11,1,IREQ_BE,10,1,IREQ_VS,8,2,CL,5,1,ERR,4,1,TL,0,4 +0x4204,,CAM_DAT,32,r,CAM,volatile,DATA,0,32,,,,,,,,,,,,,,,,,,,,,,,,,,, 0x4210,,SOFS_H,16,rw,CAM,volatile,OFFSET,0,10 0x4212,,SOFS_V,16,rw,CAM,volatile,OFFSET,0,9 0x4214,,EOFS_H,16,rw,CAM,volatile,OFFSET,0,10 diff --git a/build/buildtools/commondefs b/build/buildtools/commondefs index 1f5f19c..6f9d94e 100644 --- a/build/buildtools/commondefs +++ b/build/buildtools/commondefs @@ -159,6 +159,7 @@ TWL_LIBS_BASE ?= \ libvlink \ libctrdg \ libaes \ + libcamera \ ifdef TWL_PROFILE_TYPE TWL_LIBS_BASE += libos.$(TWL_PROFILE_TYPE) @@ -176,6 +177,7 @@ TWL_LIBS_BASE ?= \ libi2c_sp \ libcdc_sp \ libsnd_sp \ + libcamera_sp \ ifdef TWL_PROFILE_TYPE TWL_LIBS_BASE += libos_sp.$(TWL_PROFILE_TYPE) diff --git a/build/libraries/Makefile b/build/libraries/Makefile index 5a971e9..c836c95 100644 --- a/build/libraries/Makefile +++ b/build/libraries/Makefile @@ -32,7 +32,7 @@ SUBDIRS = \ i2c \ cdc \ snd \ - + camera \ #---------------------------------------------------------------------------- export NITRO_BLXCHECKED = yes diff --git a/build/libraries/camera/ARM7/320x240_PLL_30fps_070306.set b/build/libraries/camera/ARM7/320x240_PLL_30fps_070306.set new file mode 100644 index 0000000..ddfd57c --- /dev/null +++ b/build/libraries/camera/ARM7/320x240_PLL_30fps_070306.set @@ -0,0 +1,31 @@ +sef00 +s8000 // for 320x240 +s8101 +sc400 +sc5f0 +sc601 +sc740 + + + +sef02 +s5821 // PLL 33Mhz 30fps +s590c +s5a24 // for 33MHz + +//s5821 // PLL on +//s591A // pll_s=0, pll_p=26, +//s5A1A // pll_m=26 + +//s289B // CFPN on **** Revised at EVT1 + +sef01 +sd189 // 0209 16.7Mhz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000 + + + +sef01 +s7167 // AE Target similar to 20fps noPLL setting +sd915 //AE saturation CHIP_DEBUG + + diff --git a/build/libraries/camera/ARM7/320x240_noPLL_20fps_070306.set b/build/libraries/camera/ARM7/320x240_noPLL_20fps_070306.set new file mode 100644 index 0000000..33147f1 --- /dev/null +++ b/build/libraries/camera/ARM7/320x240_noPLL_20fps_070306.set @@ -0,0 +1,28 @@ +sef00 +s8000 // for 320x240 +s8101 +sc400 +sc5f0 +sc601 +sc740 + + +sef01 +se400 // 0209 for PLL off 20fps // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps) +se525 // 0209 //ea // 24MHz NT VblankL (H.L) + + +// +//s5861 // PLL off +//s594c +//s5a30 // for 48MHz +// +//s289B // CFPN on **** Revised at EVT1 +// +////061011 +//sef01 +//sd189 // 0209 16.7Mhz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000 + + +sef01 +s7173 // AE Target Default (73h) \ No newline at end of file diff --git a/build/libraries/camera/ARM7/A3AFX_EVT2_20fps_16M_070206.set b/build/libraries/camera/ARM7/A3AFX_EVT2_20fps_16M_070206.set new file mode 100644 index 0000000..d9fb6d0 --- /dev/null +++ b/build/libraries/camera/ARM7/A3AFX_EVT2_20fps_16M_070206.set @@ -0,0 +1,708 @@ +// 10.18 X shading, Color correction, RGB shading +// <0. D9> 50->C0 +// <1. E0> 04 -> 07, <0. D1>¼³Á¤°ªÀÌ B2¹Ì¸¸½Ã ¿µ»ó Èê·¯³»¸² °ü·Ã. +// 07·Î º¯°æ½Ã 63ÀÌÇÏ¿¡ ´ëÇØ Èê·¯³»¸² ¹ß»ý. 13MÀÌ»ó¿¡ ´ëÇØ ¸¸Á·ÇÔ. +// <1. B7> 68 -> 58, NL color saturation level +// <2. 23> DB -> D8, Tx width Sel +// <2. 3A> 60 -> 20, double shutter OFF +// <2. 0B> 81 -> 85 Negative (subsampling½Ã) + +//------------------------------------------------------------------ +// Set File +// - S5KA3AFX_xshade_060913.xls generates +// - date : 2007-01-08¿ÀÈÄ 2:45:52 +//------------------------------------------------------------------ + +// Page : 00 +sef00 +s0b39 // B gain +s0d03 +s0e00 +s0f1F +s1000 +s1137 +s1208 +s1342 +s1400 +s1512 +s169E +s1900 +s1707 +s18F2 +s1901 +s1707 +s18F5 +s1902 +s1707 +s18E8 +s1903 +s1707 +s18E6 +s1904 +s1707 +s18E2 +s1905 +s1707 +s18D9 +s1906 +s1707 +s18DB +s1907 +s1700 +s1806 +s1908 +s1707 +s18FF +s1909 +s1707 +s18FF +s190A +s1707 +s18FC +s190B +s1707 +s18F4 +s190C +s1707 +s18F5 +s190D +s1707 +s18ED +s190E +s1700 +s181C +s190F +s1700 +s1811 +s1910 +s1700 +s1812 +s1911 +s1700 +s1813 +s1912 +s1700 +s1808 +s1913 +s1700 +s180A +s1914 +s1700 +s1806 +s1915 +s1700 +s1827 +s1916 +s1700 +s182F +s1917 +s1700 +s1828 +s1918 +s1700 +s181E +s1919 +s1700 +s181A +s191A +s1700 +s1817 +s191B +s1700 +s181B +s191C +s1700 +s1843 +s191D +s1700 +s1838 +s191E +s1700 +s183B +s191F +s1700 +s1835 +s1920 +s1700 +s1835 +s1921 +s1700 +s1830 +s1922 +s1700 +s182E +s1940 + + +////////////////////////////////////////////////////////// +//sef00 +//sca02 //Raw data out + +//sef00 +//scb00 // Normal mode +// +//sef01 +//s7000 // AE/AWB off //Jee hwan: 06.10.27 +// +//sef02 //shutter off //Jee hwan: 06.10.27 +//s0122 + +sef02 // CIS page +//s4b5E // PCLK driving current max +s23d8 // Tx width +s3a20 // double shutter off +s6508 // CIS mode +s0a90 // Display WCW +s0126 // E-shutter enable + +s0378 // S1R END **** Revised at EVT1 +s0500 // S1S end value control +s07E5 // S2 END +s090E // S4 END +s0b81 //85 //81 // Analog offset +s1320 //a0 // R_REF +//s1580 // EC COMP 100'b +s1c57 // global gain **** Revised at EVT1 +s243d // i_cds **** Revised at EVT1 +s2625 // clamp level control **** Revised at EVT1 +s298f // CFPN start frame (16) +s4b5b // IO driving current +s5605 // Line ADLC +s5861 // amp bias current source select (71h : self bias) +s5f06 // aps bias current +s673c // EC_COMP & SAVG_END +s6810 // i_rmp control +s6913 // i_mid + +s5821 // PLL for 30MHz 20fps +s5950 +s5a3c + +//s5821 // PLL on +//s591A // pll_s=0, pll_p=26, +//s5A1A // pll_m=26 + +s289B // CFPN on **** Revised at EVT1 + +//061011 +sef01 +sd18a // for 16.8MHz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000 +//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000 +//sd915 //AE saturation CHIP_DEBUG + +////////// +//page 0 +////////// +sef00 +//s093e //gr gain + +sef00 +s2960 //GrGb + +// AE Window +sef00 +s5500 // AE window +s5800 +s5931 +s5a02 +s5b47 +s5c00 +s5d64 +s5e01 +s5fac +s6000 +s6173 +s6202 +s630c +s6400 +s65ab +s6601 +s677e + +sef01 // AE weight +s7701 +s7801 +//s7903 +//s7a03 +//s7b04 +//s7c04 + +sef00 +s5718 // AE Lux min threshold + +sd9c0 // color edge threshold + +///////////////////////////////////////////////////// +//page 1///////////////////////////////////////////// +///////////////////////////////////////////////////// +sef01 +s837d // R gain max +s8430 // B gain max + +saf00 //L.L Brightness +sb4b0 //a0 // N.L contrast +sb5b0 //a0 // L.L contrast + +sb746 //58 //68 // N.L color saturation +sb830 //52 // L.L color saturation + +s7097 //17 // fix PAL(50Hz) +s715a //68 //70 //6f //4d //60 //78 //AE target +s720c //12 //0a //05 //12 // AE threshold +s7463 //60 //70 //74 //70 // low agc max +s7540 // normal agc max + +sa640 //80 //N.L sharpness H/V Gain +sab24 //18 //60 //N.L NR Edge +sad40 //20 //L.L NR Edge +//sa330 //AWB speed //EVT0Àº °íÁ¤µÇ¾î ÀÖÀ½.(0x03) //EVT1Àº º¯°æ °¡´É. + +scc09 //08 //Flicker threshold 12 +sd522 //32 //Chip_Debug2 + +se008 // NT Max +se208 //07 //18 // Low NT max +se106 // PAL Max +se306 //07 //18 // Low PAL max + +se401 // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps) +se5a9 //ea // 24MHz NT VblankL (H.L) +//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 28~5fps) +//se52a // 13MHz VblankL (H.L) + +se843 //44 //84 //97 // ae speed + +sef00 +//s8c0e //skin color detection +sc80a //YC delay + + +//////////////////////////////////////// +// Color Correction -> Shading -> Gamma -> AWB -> Hue +//////////////////////////////////////// + +// Color Correction + +sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old +s4c40 //95 //95 //81 //8a //50 //62 //56 +s4d92 //c2 //c2 //ba //d2 //af //a9 //8d +s4e0f //92 //92 //87 //07 //1f //07 //89 +s4f9a //9b //9b //98 //9e //9e //a2 //94 +s503b //73 //73 //64 //4c //2e //47 //5c +s511e //98 //98 //8c //12 //30 //1b //8b +s5282 //80 //80 //80 //80 //86 //85 //80 +s53bf //b3 //b3 //ad //cd //eb //f2 //91 +s547f //73 //73 //6d //8e //b2 //b8 //51 + +//////CW +//sef00 +//s4c92 +//s4dcf +//s4e82 +//s4fad +//s506e +//s5180 +//s5287 +//s53eb +//s54b2 +// +////D65 +//sef00 +//s4c8a +//s4dc2 +//s4e88 +//s4f9f +//s5072 +//s5193 +//s5281 +//s53ca +//s548c + +//Default +//sef00 +//s4c56 +//s4d8d +//s4e89 +//s4f96 +//s505d +//s5188 +//s5294 +//s5389 +//s545d + +// Shading2 //// RGB Shading// RGB Shading// RGB Shading + // // //linear//old +sef00 //sef00 //sef00 //00 //00 //00 //00 +s3001 //s3001 //s3001 //01 //01 //01 //01 +s322a //0a //s3200 //s3200 //00 //00 //00 //00 +s360a //s3600 //s3600 //00 //00 //00 //00 +s3a0a //s3a00 //s3a00 //00 //00 //00 //00 +s3300 //s3301 //s3300 //00 //01 //00 //01 +s3400 //s3450 //s3400 //32 //50 //00 //50 +s3700 //s3701 //s3700 //00 //01 //00 //01 +s3800 //s3850 //s3800 //50 //50 //00 //50 +s3b00 //s3b01 //s3b00 //00 //01 //00 //01 +s3c00 //s3c50 //s3c00 //00 //50 //00 //50 +s31b6 //fd //s31df //s3187 //ff //ff //5e //ff +s35df //da //s35b8 //s3569 //d7 //da //54 //da +s39bf //c1 //s39a9 //s395a //be //e6 //4d //e6 +s3f01 //s3f01 //s3f01 //01 //01 //01 //01 +s4036 //4a //s4040 //s4040 //4a //40 //40 //40 +s3d01 //s3d00 //s3d01 //00 //00 //01 //00 +s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0 + +//sef00 +////Gamma(Red) +//s4800 +//s4900 +//s4A08 +//s4BF0 +//s4801 +//s4900 +//s4A10 +//s4BB6 +//s4802 +//s4900 +//s4A20 +//s4B5F +//s4803 +//s4900 +//s4A40 +//s4B4F +//s4804 +//s4900 +//s4A80 +//s4B37 +//s4805 +//s4901 +//s4A00 +//s4B27 +//s4806 +//s4901 +//s4AC0 +//s4B1C +//s4807 +//s4902 +//s4A80 +//s4B14 +//s4808 +//s4903 +//s4A00 +//s4B14 +//s4809 +//s4903 +//s4A80 +//s4B12 +//s480A +//s4903 +//s4AC0 +//s4B10 +//s480D +//s4B14 +////Gamma(Green) +//s4810 +//s4900 +//s4A08 +//s4BF0 +//s4811 +//s4900 +//s4A10 +//s4BB6 +//s4812 +//s4900 +//s4A20 +//s4B5F +//s4813 +//s4900 +//s4A40 +//s4B4F +//s4814 +//s4900 +//s4A80 +//s4B37 +//s4815 +//s4901 +//s4A00 +//s4B27 +//s4816 +//s4901 +//s4AC0 +//s4B1C +//s4817 +//s4902 +//s4A80 +//s4B14 +//s4818 +//s4903 +//s4A00 +//s4B14 +//s4819 +//s4903 +//s4A80 +//s4B12 +//s481A +//s4903 +//s4AC0 +//s4B10 +//s481D +//s4B14 +////Gamma(Blue) +//s4820 +//s4900 +//s4A08 +//s4BF0 +//s4821 +//s4900 +//s4A10 +//s4BB6 +//s4822 +//s4900 +//s4A20 +//s4B5F +//s4823 +//s4900 +//s4A40 +//s4B4F +//s4824 +//s4900 +//s4A80 +//s4B37 +//s4825 +//s4901 +//s4A00 +//s4B27 +//s4826 +//s4901 +//s4AC0 +//s4B1C +//s4827 +//s4902 +//s4A80 +//s4B14 +//s4828 +//s4903 +//s4A00 +//s4B14 +//s4829 +//s4903 +//s4A80 +//s4B12 +//s482A +//s4903 +//s4AC0 +//s4B10 +//s482D +//s4B14 +//s4880 + +//gamma5 +sef00 +//Gamma(Red) +s4800 +s4900 +s4A08 +s4B1B +s4801 +s4900 +s4A10 +s4B4E +s4802 +s4900 +s4A20 +s4B6F +s4803 +s4900 +s4A40 +s4B59 +s4804 +s4900 +s4A80 +s4B33 +s4805 +s4901 +s4A00 +s4B2B +s4806 +s4901 +s4AC0 +s4B20 +s4807 +s4902 +s4A80 +s4B19 +s4808 +s4903 +s4A00 +s4B16 +s4809 +s4903 +s4A80 +s4B13 +s480A +s4903 +s4AC0 +s4B12 +s480B +s4B14 +//Gamma(Green) +s4810 +s4900 +s4A08 +s4B1B +s4811 +s4900 +s4A10 +s4B4E +s4812 +s4900 +s4A20 +s4B6F +s4813 +s4900 +s4A40 +s4B59 +s4814 +s4900 +s4A80 +s4B33 +s4815 +s4901 +s4A00 +s4B2B +s4816 +s4901 +s4AC0 +s4B20 +s4817 +s4902 +s4A80 +s4B19 +s4818 +s4903 +s4A00 +s4B16 +s4819 +s4903 +s4A80 +s4B13 +s481A +s4903 +s4AC0 +s4B12 +s481B +s4B14 +//Gamma(Blue) +s4820 +s4900 +s4A08 +s4B1B +s4821 +s4900 +s4A10 +s4B4E +s4822 +s4900 +s4A20 +s4B6F +s4823 +s4900 +s4A40 +s4B59 +s4824 +s4900 +s4A80 +s4B33 +s4825 +s4901 +s4A00 +s4B2B +s4826 +s4901 +s4AC0 +s4B20 +s4827 +s4902 +s4A80 +s4B19 +s4828 +s4903 +s4A00 +s4B16 +s4829 +s4903 +s4A80 +s4B13 +s482A +s4903 +s4AC0 +s4B12 +s482B +s4B14 +s4880 + +//AWB +//sef00 +//s9301 // AWB map +//sa00f +//s9f0f +//s9300 + +//AWB mode : auto(??) +//sef01 +//s8000 + +// Hue + +sef00 +s8c0c //Skin Color Detection On/Off +s7400 //00 //Hue & Saturation Off=00, On=01 +s7958 //Saturation Gain +s7501 //Hue & Saturation Cosine 1 +s7660 //ff //Hue & Saturation Cosine 2 +s7702 //Hue & Saturation Sine 1 +s7811 //Hue & Saturation Sine 2 +s7295 //b0 //90 //Contrast Gain +//s7389 //Brightness Gain +sd800 //Edge color suppress + +//sef02 +//s0f40 + +//AWB white's count low 0f00 --> 0708 +sef01 +s8507 //0f //07 +s8608 //00 //08 + +//AWB boundary +//sef00 +//sb100 +//sb221 +//sb300 +//sb42c +//sb501 +//sb6e0 +//sb702 +//sb870 + +// Bad Pixel Replacement + +//sef00 +//s1a01 +//s1b00 +//s1e00 +//s1c00 +//s1f00 +//s1d00 +//s2000 + +sef01 +sb930 +sba00 + +seb40 //6f //Low Light Indication AGC +// +//sef02 //shutter on //Jee hwan: 06.10.27 +//s0126 +// +//sef01 // AE/AWB on //Jee hwan: 06.10.27 +//s7017 diff --git a/build/libraries/camera/ARM7/A3AFX_EVT2_20fps_16M_PLLoff_hVGA_070209.set b/build/libraries/camera/ARM7/A3AFX_EVT2_20fps_16M_PLLoff_hVGA_070209.set new file mode 100644 index 0000000..1c394c9 --- /dev/null +++ b/build/libraries/camera/ARM7/A3AFX_EVT2_20fps_16M_PLLoff_hVGA_070209.set @@ -0,0 +1,512 @@ +// 10.18 X shading, Color correction, RGB shading +// <0. D9> 50->C0 +// <1. E0> 04 -> 07, <0. D1>¼³Á¤°ªÀÌ B2¹Ì¸¸½Ã ¿µ»ó Èê·¯³»¸² °ü·Ã. +// 07·Î º¯°æ½Ã 63ÀÌÇÏ¿¡ ´ëÇØ Èê·¯³»¸² ¹ß»ý. 13MÀÌ»ó¿¡ ´ëÇØ ¸¸Á·ÇÔ. +// <1. B7> 68 -> 58, NL color saturation level +// <2. 23> DB -> D8, Tx width Sel +// <2. 3A> 60 -> 20, double shutter OFF +// <2. 0B> 81 -> 85 Negative (subsampling½Ã) + +//------------------------------------------------------------------ +// Set File +// - S5KA3AFX_xshade_060913.xls generates +// - date : 2007-01-08¿ÀÈÄ 2:45:52 +//------------------------------------------------------------------ + +// Page : 00 +sef00 + +sc3a0 // 320x480 +sc601 +sc740 + +s0d03 +s0e00 +s0f1F +s1000 +s1137 +s1208 +s1342 +s1400 +s1512 +s169E +s1900 +s1707 +s18F2 +s1901 +s1707 +s18F5 +s1902 +s1707 +s18E8 +s1903 +s1707 +s18E6 +s1904 +s1707 +s18E2 +s1905 +s1707 +s18D9 +s1906 +s1707 +s18DB +s1907 +s1700 +s1806 +s1908 +s1707 +s18FF +s1909 +s1707 +s18FF +s190A +s1707 +s18FC +s190B +s1707 +s18F4 +s190C +s1707 +s18F5 +s190D +s1707 +s18ED +s190E +s1700 +s181C +s190F +s1700 +s1811 +s1910 +s1700 +s1812 +s1911 +s1700 +s1813 +s1912 +s1700 +s1808 +s1913 +s1700 +s180A +s1914 +s1700 +s1806 +s1915 +s1700 +s1827 +s1916 +s1700 +s182F +s1917 +s1700 +s1828 +s1918 +s1700 +s181E +s1919 +s1700 +s181A +s191A +s1700 +s1817 +s191B +s1700 +s181B +s191C +s1700 +s1843 +s191D +s1700 +s1838 +s191E +s1700 +s183B +s191F +s1700 +s1835 +s1920 +s1700 +s1835 +s1921 +s1700 +s1830 +s1922 +s1700 +s182E +s1940 + + +////////////////////////////////////////////////////////// +//sef00 +//sca02 //Raw data out + +//sef00 +//scb00 // Normal mode +// +//sef01 +//s7000 // AE/AWB off //Jee hwan: 06.10.27 +// +//sef02 //shutter off //Jee hwan: 06.10.27 +//s0122 + +sef02 // CIS page +//s4b5E // PCLK driving current max +s23d8 // Tx width +s3a20 // double shutter off +s6508 // CIS mode +s0a90 // Display WCW +s0126 // E-shutter enable + +s0378 // S1R END **** Revised at EVT1 +s0500 // S1S end value control +s07E5 // S2 END +s090E // S4 END +s0b81 //85 //81 // Analog offset +s1320 //a0 // R_REF +//s1580 // EC COMP 100'b +s1c57 // global gain **** Revised at EVT1 +s243d // i_cds **** Revised at EVT1 +s2625 // clamp level control **** Revised at EVT1 +s298f // CFPN start frame (16) +s4b5b // IO driving current +s5605 // Line ADLC +s5861 // amp bias current source select (71h : self bias) +s5f06 // aps bias current +s673c // EC_COMP & SAVG_END +s6810 // i_rmp control +s6913 // i_mid + +s5861 // PLL off +s594c +s5a30 // for 48MHz + +s289B // CFPN on **** Revised at EVT1 + +//061011 +sef01 +sd189 // 0209 16.7Mhz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000 + +////////// +//page 0 +////////// +sef00 +//s093e //gr gain +s093d // 0208 +s0a3d // 0208 + +sef00 +s2960 //GrGb + +// AE Window +sef00 +s5500 // AE window +s5800 +s5931 +s5a02 +s5b47 +s5c00 +s5d64 +s5e01 +s5fac +s6000 +s6173 +s6202 +s630c +s6400 +s65ab +s6601 +s677e + +sef01 // AE weight +s7701 +s7801 +//s7903 +//s7a03 +//s7b04 +//s7c04 + +sef00 +s5718 // AE Lux min threshold + +sd9c0 // color edge threshold + +///////////////////////////////////////////////////// +//page 1///////////////////////////////////////////// +///////////////////////////////////////////////////// +sef01 +s837d // R gain max +s8430 // B gain max + +saf00 //L.L Brightness +sb4b0 //a0 // N.L contrast +sb5b0 //a0 // L.L contrast + +sb746 //58 //68 // N.L color saturation +sb830 //52 // L.L color saturation + +s7097 //17 // fix PAL(50Hz) +s715a //68 //70 //6f //4d //60 //78 //AE target +s720c //12 //0a //05 //12 // AE threshold +s746a //60 //70 //74 //70 // low agc max +s7540 // normal agc max + +sa640 //80 //N.L sharpness H/V Gain +sab24 //18 //60 //N.L NR Edge +sad40 //20 //L.L NR Edge +//sa330 //AWB speed //EVT0Àº °íÁ¤µÇ¾î ÀÖÀ½.(0x03) //EVT1Àº º¯°æ °¡´É. + +scc09 //08 //Flicker threshold 12 +sd522 //32 //Chip_Debug2 + +se008 // NT Max +se208 //07 //18 // Low NT max +se106 // PAL Max +se306 //07 //18 // Low PAL max + +se400 // 0209 for PLL off 20fps // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps) +se525 // 0209 //ea // 24MHz NT VblankL (H.L) + +se843 //44 //84 //97 // ae speed + +sef00 +//s8c0e //skin color detection +sc80a //YC delay + + +//////////////////////////////////////// +// Color Correction -> Shading -> Gamma -> AWB -> Hue +//////////////////////////////////////// + +// Color Correction + +sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old +s4c40 //95 //95 //81 //8a //50 //62 //56 +s4d92 //c2 //c2 //ba //d2 //af //a9 //8d +s4e0f //92 //92 //87 //07 //1f //07 //89 +s4f9a //9b //9b //98 //9e //9e //a2 //94 +s503b //73 //73 //64 //4c //2e //47 //5c +s511e //98 //98 //8c //12 //30 //1b //8b +s5282 //80 //80 //80 //80 //86 //85 //80 +s53bf //b3 //b3 //ad //cd //eb //f2 //91 +s547f //73 //73 //6d //8e //b2 //b8 //51 + +// Shading2 //// RGB Shading// RGB Shading// RGB Shading + // // //linear//old +sef00 //sef00 //sef00 //00 //00 //00 //00 +s3001 //s3001 //s3001 //01 //01 //01 //01 +s322a //0a //s3200 //s3200 //00 //00 //00 //00 +s360a //s3600 //s3600 //00 //00 //00 //00 +s3a0a //s3a00 //s3a00 //00 //00 //00 //00 +s3300 //s3301 //s3300 //00 //01 //00 //01 +s3400 //s3450 //s3400 //32 //50 //00 //50 +s3700 //s3701 //s3700 //00 //01 //00 //01 +s3800 //s3850 //s3800 //50 //50 //00 //50 +s3b00 //s3b01 //s3b00 //00 //01 //00 //01 +s3c00 //s3c50 //s3c00 //00 //50 //00 //50 +s31b6 //fd //s31df //s3187 //ff //ff //5e //ff +s35df //da //s35b8 //s3569 //d7 //da //54 //da +s39bf //c1 //s39a9 //s395a //be //e6 //4d //e6 +s3f01 //s3f01 //s3f01 //01 //01 //01 //01 +s4036 //4a //s4040 //s4040 //4a //40 //40 //40 +s3d01 //s3d00 //s3d01 //00 //00 //01 //00 +s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0 + +//gamma5 +sef00 +//Gamma(Red) +s4800 +s4900 +s4A08 +s4B1B +s4801 +s4900 +s4A10 +s4B4E +s4802 +s4900 +s4A20 +s4B6F +s4803 +s4900 +s4A40 +s4B59 +s4804 +s4900 +s4A80 +s4B33 +s4805 +s4901 +s4A00 +s4B2B +s4806 +s4901 +s4AC0 +s4B20 +s4807 +s4902 +s4A80 +s4B19 +s4808 +s4903 +s4A00 +s4B16 +s4809 +s4903 +s4A80 +s4B13 +s480A +s4903 +s4AC0 +s4B12 +s480B +s4B14 +//Gamma(Green) +s4810 +s4900 +s4A08 +s4B1B +s4811 +s4900 +s4A10 +s4B4E +s4812 +s4900 +s4A20 +s4B6F +s4813 +s4900 +s4A40 +s4B59 +s4814 +s4900 +s4A80 +s4B33 +s4815 +s4901 +s4A00 +s4B2B +s4816 +s4901 +s4AC0 +s4B20 +s4817 +s4902 +s4A80 +s4B19 +s4818 +s4903 +s4A00 +s4B16 +s4819 +s4903 +s4A80 +s4B13 +s481A +s4903 +s4AC0 +s4B12 +s481B +s4B14 +//Gamma(Blue) +s4820 +s4900 +s4A08 +s4B1B +s4821 +s4900 +s4A10 +s4B4E +s4822 +s4900 +s4A20 +s4B6F +s4823 +s4900 +s4A40 +s4B59 +s4824 +s4900 +s4A80 +s4B33 +s4825 +s4901 +s4A00 +s4B2B +s4826 +s4901 +s4AC0 +s4B20 +s4827 +s4902 +s4A80 +s4B19 +s4828 +s4903 +s4A00 +s4B16 +s4829 +s4903 +s4A80 +s4B13 +s482A +s4903 +s4AC0 +s4B12 +s482B +s4B14 +s4880 + +// Hue + +sef00 +s8c0c //Skin Color Detection On/Off +s7400 //00 //Hue & Saturation Off=00, On=01 +s7958 //Saturation Gain +s7501 //Hue & Saturation Cosine 1 +s7660 //ff //Hue & Saturation Cosine 2 +s7702 //Hue & Saturation Sine 1 +s7811 //Hue & Saturation Sine 2 +s72a5 //95 //b0 //90 //Contrast Gain 0208 +//s7389 //Brightness Gain +sd800 //Edge color suppress + +//sef02 +//s0f40 + +//AWB white's count low 0f00 --> 0708 +sef01 +s8507 //0f //07 +s8608 //00 //08 + +// Bad Pixel Replacement + +sef00 // 0208 +s1a01 +s1b20 +s1e20 +s1c20 +s1f20 +s1d20 +s2020 + +s2b01 // 0208 NR +s2d15 + +sef01 +sb930 +sba00 + +seb40 //6f //Low Light Indication AGC + +sef00 // 0209 sharpness +sb902 +sbe80 +sbf30 +sc080 +sc130 + +sef01 +sa680 + diff --git a/build/libraries/camera/ARM7/A3AFX_EVT2_30fps_16M_QVGA_070206.set b/build/libraries/camera/ARM7/A3AFX_EVT2_30fps_16M_QVGA_070206.set new file mode 100644 index 0000000..e3234f6 --- /dev/null +++ b/build/libraries/camera/ARM7/A3AFX_EVT2_30fps_16M_QVGA_070206.set @@ -0,0 +1,715 @@ +// 10.18 X shading, Color correction, RGB shading +// <0. D9> 50->C0 +// <1. E0> 04 -> 07, <0. D1>¼³Á¤°ªÀÌ B2¹Ì¸¸½Ã ¿µ»ó Èê·¯³»¸² °ü·Ã. +// 07·Î º¯°æ½Ã 63ÀÌÇÏ¿¡ ´ëÇØ Èê·¯³»¸² ¹ß»ý. 13MÀÌ»ó¿¡ ´ëÇØ ¸¸Á·ÇÔ. +// <1. B7> 68 -> 58, NL color saturation level +// <2. 23> DB -> D8, Tx width Sel +// <2. 3A> 60 -> 20, double shutter OFF +// <2. 0B> 81 -> 85 Negative (subsampling½Ã) + +//------------------------------------------------------------------ +// Set File +// - S5KA3AFX_xshade_060913.xls generates +// - date : 2007-01-08¿ÀÈÄ 2:45:52 +//------------------------------------------------------------------ + +// Page : 00 +sef00 + +s8000 // for 256x192 +s8101 +sc400 +sc5c0 +sc601 +sc700 + +s0d03 +s0e00 +s0f1F +s1000 +s1137 +s1208 +s1342 +s1400 +s1512 +s169E +s1900 +s1707 +s18F2 +s1901 +s1707 +s18F5 +s1902 +s1707 +s18E8 +s1903 +s1707 +s18E6 +s1904 +s1707 +s18E2 +s1905 +s1707 +s18D9 +s1906 +s1707 +s18DB +s1907 +s1700 +s1806 +s1908 +s1707 +s18FF +s1909 +s1707 +s18FF +s190A +s1707 +s18FC +s190B +s1707 +s18F4 +s190C +s1707 +s18F5 +s190D +s1707 +s18ED +s190E +s1700 +s181C +s190F +s1700 +s1811 +s1910 +s1700 +s1812 +s1911 +s1700 +s1813 +s1912 +s1700 +s1808 +s1913 +s1700 +s180A +s1914 +s1700 +s1806 +s1915 +s1700 +s1827 +s1916 +s1700 +s182F +s1917 +s1700 +s1828 +s1918 +s1700 +s181E +s1919 +s1700 +s181A +s191A +s1700 +s1817 +s191B +s1700 +s181B +s191C +s1700 +s1843 +s191D +s1700 +s1838 +s191E +s1700 +s183B +s191F +s1700 +s1835 +s1920 +s1700 +s1835 +s1921 +s1700 +s1830 +s1922 +s1700 +s182E +s1940 + + +////////////////////////////////////////////////////////// +//sef00 +//sca02 //Raw data out + +//sef00 +//scb00 // Normal mode +// +//sef01 +//s7000 // AE/AWB off //Jee hwan: 06.10.27 +// +//sef02 //shutter off //Jee hwan: 06.10.27 +//s0122 + +sef02 // CIS page +//s4b5E // PCLK driving current max +s23d8 // Tx width +s3a20 // double shutter off +s6508 // CIS mode +s0a90 // Display WCW +s0126 // E-shutter enable + +s0378 // S1R END **** Revised at EVT1 +s0500 // S1S end value control +s07E5 // S2 END +s090E // S4 END +s0b81 //85 //81 // Analog offset +s1320 //a0 // R_REF +//s1580 // EC COMP 100'b +s1c57 // global gain **** Revised at EVT1 +s243d // i_cds **** Revised at EVT1 +s2625 // clamp level control **** Revised at EVT1 +s298f // CFPN start frame (16) +s4b5b // IO driving current +s5605 // Line ADLC +s5861 // amp bias current source select (71h : self bias) +s5f06 // aps bias current +s673c // EC_COMP & SAVG_END +s6810 // i_rmp control +s6913 // i_mid + +s5821 // PLL for 45MHz 20fps +s5910 +s5a2d + +//s5821 // PLL on +//s591A // pll_s=0, pll_p=26, +//s5A1A // pll_m=26 + +s289B // CFPN on **** Revised at EVT1 + +//061011 +sef01 +sd18a // for 16.8MHz //d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000 +//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000 +//sd915 //AE saturation CHIP_DEBUG + +////////// +//page 0 +////////// +sef00 +//s093e //gr gain + +sef00 +s2960 //GrGb + +// AE Window +sef00 +s5500 // AE window +s5800 +s5931 +s5a02 +s5b47 +s5c00 +s5d64 +s5e01 +s5fac +s6000 +s6173 +s6202 +s630c +s6400 +s65ab +s6601 +s677e + +sef01 // AE weight +s7701 +s7801 +//s7903 +//s7a03 +//s7b04 +//s7c04 + +sef00 +s5718 // AE Lux min threshold + +sd9c0 // color edge threshold + +///////////////////////////////////////////////////// +//page 1///////////////////////////////////////////// +///////////////////////////////////////////////////// +sef01 +s837d // R gain max +s8430 // B gain max + +saf00 //L.L Brightness +sb4b0 //a0 // N.L contrast +sb5b0 //a0 // L.L contrast + +sb746 //58 //68 // N.L color saturation +sb830 //52 // L.L color saturation + +s7097 //17 // fix PAL(50Hz) +s715a //68 //70 //6f //4d //60 //78 //AE target +s720c //12 //0a //05 //12 // AE threshold +s7460 //70 //74 //70 // low agc max +s7540 // normal agc max + +sa640 //80 //N.L sharpness H/V Gain +sab24 //18 //60 //N.L NR Edge +sad40 //20 //L.L NR Edge +//sa330 //AWB speed //EVT0Àº °íÁ¤µÇ¾î ÀÖÀ½.(0x03) //EVT1Àº º¯°æ °¡´É. + +scc09 //08 //Flicker threshold 12 +sd522 //32 //Chip_Debug2 + +se008 // NT Max +se208 //07 //18 // Low NT max +se106 // PAL Max +se306 //07 //18 // Low PAL max + +se401 // 24MHz VblankH (H.L) //FPS (24MHz, 28~5fps) +se5a9 //ea // 24MHz NT VblankL (H.L) +//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 28~5fps) +//se52a // 13MHz VblankL (H.L) + +se843 //44 //84 //97 // ae speed + +sef00 +//s8c0e //skin color detection +sc80a //YC delay + + +//////////////////////////////////////// +// Color Correction -> Shading -> Gamma -> AWB -> Hue +//////////////////////////////////////// + +// Color Correction + +sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old +s4c40 //95 //95 //81 //8a //50 //62 //56 +s4d92 //c2 //c2 //ba //d2 //af //a9 //8d +s4e0f //92 //92 //87 //07 //1f //07 //89 +s4f9a //9b //9b //98 //9e //9e //a2 //94 +s503b //73 //73 //64 //4c //2e //47 //5c +s511e //98 //98 //8c //12 //30 //1b //8b +s5282 //80 //80 //80 //80 //86 //85 //80 +s53bf //b3 //b3 //ad //cd //eb //f2 //91 +s547f //73 //73 //6d //8e //b2 //b8 //51 + +//////CW +//sef00 +//s4c92 +//s4dcf +//s4e82 +//s4fad +//s506e +//s5180 +//s5287 +//s53eb +//s54b2 +// +////D65 +//sef00 +//s4c8a +//s4dc2 +//s4e88 +//s4f9f +//s5072 +//s5193 +//s5281 +//s53ca +//s548c + +//Default +//sef00 +//s4c56 +//s4d8d +//s4e89 +//s4f96 +//s505d +//s5188 +//s5294 +//s5389 +//s545d + +// Shading2 //// RGB Shading// RGB Shading// RGB Shading + // // //linear//old +sef00 //sef00 //sef00 //00 //00 //00 //00 +s3001 //s3001 //s3001 //01 //01 //01 //01 +s322a //0a //s3200 //s3200 //00 //00 //00 //00 +s360a //s3600 //s3600 //00 //00 //00 //00 +s3a0a //s3a00 //s3a00 //00 //00 //00 //00 +s3300 //s3301 //s3300 //00 //01 //00 //01 +s3400 //s3450 //s3400 //32 //50 //00 //50 +s3700 //s3701 //s3700 //00 //01 //00 //01 +s3800 //s3850 //s3800 //50 //50 //00 //50 +s3b00 //s3b01 //s3b00 //00 //01 //00 //01 +s3c00 //s3c50 //s3c00 //00 //50 //00 //50 +s31b6 //fd //s31df //s3187 //ff //ff //5e //ff +s35df //da //s35b8 //s3569 //d7 //da //54 //da +s39bf //c1 //s39a9 //s395a //be //e6 //4d //e6 +s3f01 //s3f01 //s3f01 //01 //01 //01 //01 +s4036 //4a //s4040 //s4040 //4a //40 //40 //40 +s3d01 //s3d00 //s3d01 //00 //00 //01 //00 +s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0 + +//sef00 +////Gamma(Red) +//s4800 +//s4900 +//s4A08 +//s4BF0 +//s4801 +//s4900 +//s4A10 +//s4BB6 +//s4802 +//s4900 +//s4A20 +//s4B5F +//s4803 +//s4900 +//s4A40 +//s4B4F +//s4804 +//s4900 +//s4A80 +//s4B37 +//s4805 +//s4901 +//s4A00 +//s4B27 +//s4806 +//s4901 +//s4AC0 +//s4B1C +//s4807 +//s4902 +//s4A80 +//s4B14 +//s4808 +//s4903 +//s4A00 +//s4B14 +//s4809 +//s4903 +//s4A80 +//s4B12 +//s480A +//s4903 +//s4AC0 +//s4B10 +//s480D +//s4B14 +////Gamma(Green) +//s4810 +//s4900 +//s4A08 +//s4BF0 +//s4811 +//s4900 +//s4A10 +//s4BB6 +//s4812 +//s4900 +//s4A20 +//s4B5F +//s4813 +//s4900 +//s4A40 +//s4B4F +//s4814 +//s4900 +//s4A80 +//s4B37 +//s4815 +//s4901 +//s4A00 +//s4B27 +//s4816 +//s4901 +//s4AC0 +//s4B1C +//s4817 +//s4902 +//s4A80 +//s4B14 +//s4818 +//s4903 +//s4A00 +//s4B14 +//s4819 +//s4903 +//s4A80 +//s4B12 +//s481A +//s4903 +//s4AC0 +//s4B10 +//s481D +//s4B14 +////Gamma(Blue) +//s4820 +//s4900 +//s4A08 +//s4BF0 +//s4821 +//s4900 +//s4A10 +//s4BB6 +//s4822 +//s4900 +//s4A20 +//s4B5F +//s4823 +//s4900 +//s4A40 +//s4B4F +//s4824 +//s4900 +//s4A80 +//s4B37 +//s4825 +//s4901 +//s4A00 +//s4B27 +//s4826 +//s4901 +//s4AC0 +//s4B1C +//s4827 +//s4902 +//s4A80 +//s4B14 +//s4828 +//s4903 +//s4A00 +//s4B14 +//s4829 +//s4903 +//s4A80 +//s4B12 +//s482A +//s4903 +//s4AC0 +//s4B10 +//s482D +//s4B14 +//s4880 + +//gamma5 +sef00 +//Gamma(Red) +s4800 +s4900 +s4A08 +s4B1B +s4801 +s4900 +s4A10 +s4B4E +s4802 +s4900 +s4A20 +s4B6F +s4803 +s4900 +s4A40 +s4B59 +s4804 +s4900 +s4A80 +s4B33 +s4805 +s4901 +s4A00 +s4B2B +s4806 +s4901 +s4AC0 +s4B20 +s4807 +s4902 +s4A80 +s4B19 +s4808 +s4903 +s4A00 +s4B16 +s4809 +s4903 +s4A80 +s4B13 +s480A +s4903 +s4AC0 +s4B12 +s480B +s4B14 +//Gamma(Green) +s4810 +s4900 +s4A08 +s4B1B +s4811 +s4900 +s4A10 +s4B4E +s4812 +s4900 +s4A20 +s4B6F +s4813 +s4900 +s4A40 +s4B59 +s4814 +s4900 +s4A80 +s4B33 +s4815 +s4901 +s4A00 +s4B2B +s4816 +s4901 +s4AC0 +s4B20 +s4817 +s4902 +s4A80 +s4B19 +s4818 +s4903 +s4A00 +s4B16 +s4819 +s4903 +s4A80 +s4B13 +s481A +s4903 +s4AC0 +s4B12 +s481B +s4B14 +//Gamma(Blue) +s4820 +s4900 +s4A08 +s4B1B +s4821 +s4900 +s4A10 +s4B4E +s4822 +s4900 +s4A20 +s4B6F +s4823 +s4900 +s4A40 +s4B59 +s4824 +s4900 +s4A80 +s4B33 +s4825 +s4901 +s4A00 +s4B2B +s4826 +s4901 +s4AC0 +s4B20 +s4827 +s4902 +s4A80 +s4B19 +s4828 +s4903 +s4A00 +s4B16 +s4829 +s4903 +s4A80 +s4B13 +s482A +s4903 +s4AC0 +s4B12 +s482B +s4B14 +s4880 + +//AWB +//sef00 +//s9301 // AWB map +//sa00f +//s9f0f +//s9300 + +//AWB mode : auto(??) +//sef01 +//s8000 + +// Hue + +sef00 +s8c0c //Skin Color Detection On/Off +s7400 //00 //Hue & Saturation Off=00, On=01 +s7958 //Saturation Gain +s7501 //Hue & Saturation Cosine 1 +s7660 //ff //Hue & Saturation Cosine 2 +s7702 //Hue & Saturation Sine 1 +s7811 //Hue & Saturation Sine 2 +s72b0 //90 //Contrast Gain +//s7389 //Brightness Gain +sd800 //Edge color suppress + +//sef02 +//s0f40 + +//AWB white's count low 0f00 --> 0708 +sef01 +s8507 //0f //07 +s8608 //00 //08 + +//AWB boundary +//sef00 +//sb100 +//sb221 +//sb300 +//sb42c +//sb501 +//sb6e0 +//sb702 +//sb870 + +// Bad Pixel Replacement + +//sef00 +//s1a01 +//s1b00 +//s1e00 +//s1c00 +//s1f00 +//s1d00 +//s2000 + +sef01 +sb930 +sba00 + +seb40 //6f //Low Light Indication AGC +// +//sef02 //shutter on //Jee hwan: 06.10.27 +//s0126 +// +//sef01 // AE/AWB on //Jee hwan: 06.10.27 +//s7017 diff --git a/build/libraries/camera/ARM7/A3AFX_EVT3_30fps_Scaledown_16.7M_50Hz.set b/build/libraries/camera/ARM7/A3AFX_EVT3_30fps_Scaledown_16.7M_50Hz.set new file mode 100644 index 0000000..2b021cd --- /dev/null +++ b/build/libraries/camera/ARM7/A3AFX_EVT3_30fps_Scaledown_16.7M_50Hz.set @@ -0,0 +1,649 @@ +//3.13 Pearl settingÀ¸·Î ½ÃÀÛ. + +//------------------------------------------------------------------ +// Set File +// - S5KA3AFX_xshade_061018.xls generates +// - date : 2007-03-12¿ÀÈÄ 3:20:55 +//------------------------------------------------------------------ + +sef01 +s7000 //AE,AWB OFF + +//QVGA +sef00 +s7ce0 +s8101 +s8250 +s7f00 +s80f0 +sc209 +sc601 +sc740 +sc400 +sc5F0 + + +//// Page : 00 +//sef00 +//s0d03 +//s0e00 +//s0f1F +//s1000 +//s1137 +//s1208 +//s1342 +//s1400 +//s1512 +//s169E +//s1900 +//s1707 +//s18E0 +//s1901 +//s1707 +//s18E3 +//s1902 +//s1707 +//s18ED +//s1903 +//s1707 +//s18CA +//s1904 +//s1707 +//s18D2 +//s1905 +//s1707 +//s18EC +//s1906 +//s1707 +//s18E5 +//s1907 +//s1700 +//s1812 +//s1908 +//s1707 +//s18E6 +//s1909 +//s1700 +//s1808 +//s190A +//s1707 +//s18EA +//s190B +//s1707 +//s18DA +//s190C +//s1707 +//s18E3 +//s190D +//s1707 +//s18F9 +//s190E +//s1700 +//s181C +//s190F +//s1700 +//s1812 +//s1910 +//s1700 +//s1818 +//s1911 +//s1700 +//s1808 +//s1912 +//s1707 +//s18EB +//s1913 +//s1707 +//s18F9 +//s1914 +//s1707 +//s18F4 +//s1915 +//s1700 +//s181F +//s1916 +//s1700 +//s1815 +//s1917 +//s1700 +//s1811 +//s1918 +//s1700 +//s180E +//s1919 +//s1700 +//s1808 +//s191A +//s1707 +//s18FE +//s191B +//s1707 +//s18F4 +//s191C +//s1700 +//s1824 +//s191D +//s1700 +//s1803 +//s191E +//s1700 +//s1802 +//s191F +//s1707 +//s18FF +//s1920 +//s1700 +//s1812 +//s1921 +//s1707 +//s18E5 +//s1922 +//s1707 +//s18D1 +//s1940 +// + +sef02 +s5950 //P, S +s5a32 //M +s5821 //PLL + +////////////////////////////////////////////////////////// + +sef02 // CIS page +//s4b5E // PCLK driving current max +//s23d8 // Tx width +s3a20 // double shutter off +s6508 // CIS mode +s0a90 // Display WCW +s0126 // E-shutter enable + +s0378 // S1R END **** Revised at EVT1 +s0500 // S1S end value control +s07E5 // S2 END +s090E // S4 END +s0b84 //85 //81 // Analog offset +s13a0 //20 // R_REF +//s1580 // EC COMP 100'b +s1c58 //20070304AM //57 // global gain **** Revised at EVT1 +s243d // i_cds **** Revised at EVT1 +s2625 // clamp level control **** Revised at EVT1 +s298f // CFPN start frame (16) +s4b5b // IO driving current +s5605 // Line ADLC +//s5861 // amp bias current source select (71h : self bias) +s5f06 // aps bias current +s673c // EC_COMP & SAVG_END +s6810 // i_rmp control +s6913 // i_mid + +//s5821 // PLL on +//s591A // pll_s=0, pll_p=26, +//s5A1A // pll_m=26 + +s289B // CFPN on **** Revised at EVT1 + +//061011 +sef01 +sd1e6 //89:16.7MHz, d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000 +//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000 +//sd915 //AE saturation CHIP_DEBUG + +////////// +//page 0 +////////// +sef00 +//s093e //gr gain + +sef00 +s2740 //08 //GR/GB Correction Limitation Value +s2960 //GrGb Edge Threshold Value + +// AE Window +sef00 +s5500 //Window diplay off +s5800 +s5900 +s5a02 +s5b80 +s5c00 +s5d00 +s5e01 +s5fe0 +s6000 +s6100 +s6202 +s6380 +s6400 +s6500 +s6601 +s67e0 + +sef01 // AE weight +s7701 +s7801 +//s7903 +//s7a03 +//s7b04 +//s7c04 + +sef00 +//s5718 // AE Lux min threshold + +sd9c0 // color edge threshold + +////AWB Luminance check +////20070212 Added for low light starting env. +sef00 +sad03 //Luminance upper_level[9:8] +sae20 //Luminance upper_level[7:0] +saf00 //Luminance lower_level[9:8] +sb090 //Luminance lower_level[7:0] + +///////////////////////////////////////////////////// +//page 1///////////////////////////////////////////// +///////////////////////////////////////////////////// +sef01 +////20070212 Modified for low light starting env. +s8372 //7d //AWB R/B Max Gain : <0.44>'s max +s8438 //30 //AWB R/B Min Gain : <0.42>'s max + +sa841 //20070222 //shutter Control +sa9d4 //20070222 //Shutter Threshold + +saf04 //20070213PM //00 //L.L Brightness +sb488 //20070213 //b0 //a0 // N.L contrast +sb588 //20070213 //b0 //a0 // L.L contrast +sbc56 //20070305PM //26 //20070213 //AWB skip point (default:16) + +sb746 //58 //68 // N.L color saturation +sb846 //20070305PM //30 //52 // L.L color saturation + +//s7097 //17 // fix PAL(50Hz) +s716a //20070213PM //55 //5a //68 //70 //6f //4d //60 //78 //AE target +s7209 //20070214PM //07 //0c //12 //0a //05 //12 // AE threshold +//s7334 //20070214PM //AE Step Guard Value +s7466 //6b //60 //70 //74 //70 // low agc max +s7540 // normal agc max + +sa640 //80 //N.L sharpness H/V Gain +sab40 //38 //18 //60 //N.L NR Edge +sad80 //40 //20 //L.L NR Edge +//sa330 //AWB speed //EVT0Àº °íÁ¤µÇ¾î ÀÖÀ½.(0x03) //EVT1Àº º¯°æ °¡´É. + +scc09 //08 //Flicker threshold 12 +sd522 //23 //32 //Chip_Debug2 + +se004 // NT Max +se204 //07 //18 // Low NT max +se103 // PAL Max +se303 //07 //18 // Low PAL max + +se400 // 24MHz VblankH (H.L) //FPS (24MHz, 15fps) +se527 //ea // 24MHz NT VblankL (H.L) +//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 15fps) +//se52a // 13MHz VblankL (H.L) + +se600 //20070215AM // 24MHz VblankH (H.L) //FPS (24MHz, 15fps) +se727 //20070215AM //ea // 24MHz NT VblankL (H.L) + +se868 //44 //84 //97 // ae speed +se984 //Double shutter ON +//se987 +sef00 +//s8c0e //skin color detection +sc80a //YC delay + + +//////////////////////////////////////// +// Color Correction -> Shading -> Gamma -> AWB -> Hue +//////////////////////////////////////// + +// Color Correction + +//sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old +//s4c40 //95 //95 //81 //8a //50 //62 //56 +//s4d92 //c2 //c2 //ba //d2 //af //a9 //8d +//s4e0f //92 //92 //87 //07 //1f //07 //89 +//s4f9a //9b //9b //98 //9e //9e //a2 //94 +//s503b //73 //73 //64 //4c //2e //47 //5c +//s511e //98 //98 //8c //12 //30 //1b //8b +//s5282 //80 //80 //80 //80 //86 //85 //80 +//s53bf //b3 //b3 //ad //cd //eb //f2 //91 +//s547f //73 //73 //6d //8e //b2 //b8 //51 + +////CW +sef00 +s4c92 +s4dcf +s4e82 +s4fad +s506e +s5180 +s5287 +s53eb +s54b2 +// +////D65 +//sef00 +//s4c8a +//s4dc2 +//s4e88 +//s4f9f +//s5072 +//s5193 +//s5281 +//s53ca +//s548c + +//Default +//sef00 +//s4c56 +//s4d8d +//s4e89 +//s4f96 +//s505d +//s5188 +//s5294 +//s5389 +//s545d + +//// Shading2 //// RGB Shading// RGB Shading// RGB Shading +// // // //linear//old +sef00 //sef00 //sef00 //00 //00 //00 //00 +s3001 //s3001 //s3001 //01 //01 //01 //01 +s32b8 //s3200 //s3200 //00 //00 //00 //00 +s3690 //s3600 //s3600 //00 //00 //00 //00 +s3a90 //s3a00 //s3a00 //00 //00 //00 //00 +s3301 //s3301 //s3300 //00 //01 //00 //01 +s3422 //s3450 //s3400 //32 //50 //00 //50 +s3701 //s3701 //s3700 //00 //01 //00 //01 +s3822 //s3850 //s3800 //50 //50 //00 //50 +s3b01 //s3b01 //s3b00 //00 //01 //00 //01 +s3c22 //s3c50 //s3c00 //00 //50 //00 //50 +s31f8 //s31df //s3187 //ff //ff //5e //ff +s35ce //s35b8 //s3569 //d7 //da //54 //da +s39ca //s39a9 //s395a //be //e6 //4d //e6 +s3f01 //s3f01 //s3f01 //01 //01 //01 //01 +s4054 //s4040 //s4040 //4a //40 //40 //40 +s3d01 //s3d00 //s3d01 //00 //00 //01 //00 +s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0 + +//gamma5 +sef00 +//Gamma(Red) +s4800 +s4900 +s4A08 +s4B1B +s4801 +s4900 +s4A10 +s4B4E +s4802 +s4900 +s4A20 +s4B6F +s4803 +s4900 +s4A40 +s4B59 +s4804 +s4900 +s4A80 +s4B33 +s4805 +s4901 +s4A00 +s4B2B +s4806 +s4901 +s4AC0 +s4B20 +s4807 +s4902 +s4A80 +s4B19 +s4808 +s4903 +s4A00 +s4B16 +s4809 +s4903 +s4A80 +s4B13 +s480A +s4903 +s4AC0 +s4B12 +s480B +s4B14 +//Gamma(Green) +s4810 +s4900 +s4A08 +s4B1B +s4811 +s4900 +s4A10 +s4B4E +s4812 +s4900 +s4A20 +s4B6F +s4813 +s4900 +s4A40 +s4B59 +s4814 +s4900 +s4A80 +s4B33 +s4815 +s4901 +s4A00 +s4B2B +s4816 +s4901 +s4AC0 +s4B20 +s4817 +s4902 +s4A80 +s4B19 +s4818 +s4903 +s4A00 +s4B16 +s4819 +s4903 +s4A80 +s4B13 +s481A +s4903 +s4AC0 +s4B12 +s481B +s4B14 +//Gamma(Blue) +s4820 +s4900 +s4A08 +s4B1B +s4821 +s4900 +s4A10 +s4B4E +s4822 +s4900 +s4A20 +s4B6F +s4823 +s4900 +s4A40 +s4B59 +s4824 +s4900 +s4A80 +s4B33 +s4825 +s4901 +s4A00 +s4B2B +s4826 +s4901 +s4AC0 +s4B20 +s4827 +s4902 +s4A80 +s4B19 +s4828 +s4903 +s4A00 +s4B16 +s4829 +s4903 +s4A80 +s4B13 +s482A +s4903 +s4AC0 +s4B12 +s482B +s4B14 +s4880 + +//AWB +//sef00 +//s9301 // AWB map +//sa00f +//s9f0f +//s9300 + +//AWB mode : auto(??) +//sef01 +//s8000 + +// Hue + +sef00 +s8c0c //Skin Color Detection On/Off +s7401 //20070214 //00 //Hue & Saturation Off=00, On=01 +s7946 //20070214 //58 //Saturation Gain +s7501 //Hue & Saturation Cosine 1 +s7600 //a0 //20070214 //ff //Hue & Saturation Cosine 2 +s7702 //Hue & Saturation Sine 1 +s7800 //20070214 //11 //Hue & Saturation Sine 2 +s7288 //20070213 //b0 //90 //Contrast Gain +//s7389 //Brightness Gain +sd800 //Edge color suppress + +//sef02 +//s0f40 + +//AWB white's count low 0f00 --> 0708 +sef01 +s8500 //07 //0f //07 +s86f0 //08 //00 //08 + +//AWB boundary +//sef00 +//sb100 +//sb221 +//sb300 +//sb42c +//sb501 +//sb6e0 +//sb702 +//sb870 + +// Bad Pixel Replacement + +//sef00 +//s1a01 +//s1b00 +//s1e00 +//s1c00 +//s1f00 +//s1d00 +//s2000 + +sef01 +sb908 //10 //30 //BPR Gain Setting +sba00 +sbd00 + +seb50 //40 //6f //Low Light Indication AGC + +//20070213 +//AWB Map 1 +sef01 +s9480 //00 +s95c0 //c0 +s96c0 //f0 +s97f0 //c0 +s9878 //78 +s9978 //78 +s9a7c //7c +s9b3c //3f +s9c1e //1f +s9d0f //0f +s9e07 //07 +s9f03 //03 +sa000 //01 +sa1c8 +sa202 +s9302 + +//20070213 +//AWB Map Direct Write +sef00 +s9480 //00 +s95c0 //c0 +s96c0 //f0 +s97f0 //c0 +s9878 //78 +s9978 //78 +sa07c //7c +sa13c //3f +sa21e //1f +sa30f //0f +sa407 //07 +sa503 //03 +sa600 //01 + +//Auto Flicker Correction +sef01 +sdd31 +scd21 +sde31 + +//Frame AE Control - L.L 5fps +//*** Frame °íÁ¤½Ã´Â ¾Æ·¡ ºÎºÐÀ» ¸ðµÎ ÁÖ¼®Ã³¸® ÇÒ °Í.*** +sef00 +s5700 +//sef01 +//se218 +//se316 +//se888 +//****************************************************** + +//sef00 +//s4340 //20070222 //fixed value +//s423d //AWB R start point +//s446b //AWB B start point + +sef01 //shadow line +sa500 + +s7097 //17 // fix PAL(50Hz) + +sef00 +sb902 +sba80 +sbb80 +sbc98 +sbd30 + + diff --git a/build/libraries/camera/ARM7/A3AFX_EVT3_30fps_Subsampling_16.7M_50Hz.set b/build/libraries/camera/ARM7/A3AFX_EVT3_30fps_Subsampling_16.7M_50Hz.set new file mode 100644 index 0000000..faa296f --- /dev/null +++ b/build/libraries/camera/ARM7/A3AFX_EVT3_30fps_Subsampling_16.7M_50Hz.set @@ -0,0 +1,655 @@ +// 3.13 Pearl settingºÎÅÍ ½ÃÀÛ. +// AWB_Low/High_CNT Á¶Á¤(subsampling¿¡ ¸Âµµ·Ï) +//------------------------------------------------------------------ +// Set File +// - S5KA3AFX_xshade_061018.xls generates +// - date : 2007-03-12¿ÀÈÄ 3:20:55 +//------------------------------------------------------------------ + +sef01 +s7000 //AE,AWB OFF + +//// Page : 00 +//sef00 +//s0d03 +//s0e00 +//s0f1F +//s1000 +//s1137 +//s1208 +//s1342 +//s1400 +//s1512 +//s169E +//s1900 +//s1707 +//s18E0 +//s1901 +//s1707 +//s18E3 +//s1902 +//s1707 +//s18ED +//s1903 +//s1707 +//s18CA +//s1904 +//s1707 +//s18D2 +//s1905 +//s1707 +//s18EC +//s1906 +//s1707 +//s18E5 +//s1907 +//s1700 +//s1812 +//s1908 +//s1707 +//s18E6 +//s1909 +//s1700 +//s1808 +//s190A +//s1707 +//s18EA +//s190B +//s1707 +//s18DA +//s190C +//s1707 +//s18E3 +//s190D +//s1707 +//s18F9 +//s190E +//s1700 +//s181C +//s190F +//s1700 +//s1812 +//s1910 +//s1700 +//s1818 +//s1911 +//s1700 +//s1808 +//s1912 +//s1707 +//s18EB +//s1913 +//s1707 +//s18F9 +//s1914 +//s1707 +//s18F4 +//s1915 +//s1700 +//s181F +//s1916 +//s1700 +//s1815 +//s1917 +//s1700 +//s1811 +//s1918 +//s1700 +//s180E +//s1919 +//s1700 +//s1808 +//s191A +//s1707 +//s18FE +//s191B +//s1707 +//s18F4 +//s191C +//s1700 +//s1824 +//s191D +//s1700 +//s1803 +//s191E +//s1700 +//s1802 +//s191F +//s1707 +//s18FF +//s1920 +//s1700 +//s1812 +//s1921 +//s1707 +//s18E5 +//s1922 +//s1707 +//s18D1 +//s1940 +// + + +////////////////////////////////////////////////////////// + +sef02 // CIS page +s0205 //sub +//s4b5E // PCLK driving current max +//s23d8 // Tx width +s3a20 // double shutter off +s6508 // CIS mode +s0a90 // Display WCW +s0126 // E-shutter enable + +s0378 // S1R END **** Revised at EVT1 +s0580 //00 // S1S end value control +s07E5 // S2 END +s090E // S4 END +s0b87 //85 //81 // Analog offset +s13a0 //20 // R_REF +//s1580 // EC COMP 100'b +s1c52 //58 //20070304AM //57 // global gain **** Revised at EVT1 +s243d // i_cds **** Revised at EVT1 +s2625 // clamp level control **** Revised at EVT1 +s298f // CFPN start frame (16) +s4b5b // IO driving current +s5605 // Line ADLC +s5861 // amp bias current source select (71h : self bias) +s5f06 // aps bias current +s673c // EC_COMP & SAVG_END +s6810 // i_rmp control +s6913 // i_mid + +//s5821 // PLL on +//s591A // pll_s=0, pll_p=26, +//s5A1A // pll_m=26 + +s288b //9B // CFPN on + **** Revised at EVT1 + +//061011 +sef01 +sd189 //89:16.7MHz, d2:24MHz 64:13MHz dc:25MHz 13MHz //d2 //d2(24MHz) Mclk Value (Mclk - 30d)/100,000 +//sd164 //64(13MHz) Mclk Value (Mclk - 30d)/100,000 +//sd915 //AE saturation CHIP_DEBUG + +////////// +//page 0 +////////// +sef00 +//s093e //gr gain + +sef00 +s2740 //08 //GR/GB Correction Limitation Value +s2960 //GrGb Edge Threshold Value + +// AE Window //// AE Window +sef00 //sef00 +s5500 //s5500 //Window diplay off +s5800 //s5800 +s591f //s5900 +s5a01 //s5a02 +s5b44 //s5b80 +s5c00 //s5c00 +s5d1d //s5d00 +s5e00 //s5e01 +s5fec //s5fe0 +s6000 //s6000 +s6128 //s6100 +s6201 //s6202 +s633b //s6380 +s6400 //s6400 +s6523 //s6500 +s6600 //s6601 +s67e6 //s67e0 + // +sef01 //sef01 // AE weight +s7701 //s7701 +s7801 //s7801 +s7900 ////s7903 +s7a00 ////s7a03 +s7b00 ////s7b04 +s7c00 ////s7c04 + +sef00 +//s5718 // AE Lux min threshold + +sd9c0 // color edge threshold + +////AWB Luminance check +////20070212 Added for low light starting env. +sef00 +sad03 //Luminance upper_level[9:8] +sae20 //Luminance upper_level[7:0] +saf00 //Luminance lower_level[9:8] +sb090 //Luminance lower_level[7:0] + +///////////////////////////////////////////////////// +//page 1///////////////////////////////////////////// +///////////////////////////////////////////////////// +sef01 +////20070212 Modified for low light starting env. +s8372 //7d //AWB R/B Max Gain : <0.44>'s max +s8438 //30 //AWB R/B Min Gain : <0.42>'s max + +sa841 //20070222 //shutter Control +sa9d4 //20070222 //Shutter Threshold + +saf04 //0f //20070213PM //00 //L.L Brightness +sb488 //20070213 //b0 //a0 // N.L contrast +sb588 //20070213 //b0 //a0 // L.L contrast +sbc56 //20070305PM //26 //20070213 //AWB skip point (default:16) + +sb746 //58 //68 // N.L color saturation +sb846 //20070305PM //30 //52 // L.L color saturation + +//s7097 //17 // fix PAL(50Hz) +s716a //20070213PM //55 //5a //68 //70 //6f //4d //60 //78 //AE target +s7209 //20070214PM //07 //0c //12 //0a //05 //12 // AE threshold +//s7334 //20070214PM //AE Step Guard Value +s7466 //6b //60 //70 //74 //70 // low agc max +s7540 // normal agc max + +sa640 //80 //N.L sharpness H/V Gain +sab40 //38 //18 //60 //N.L NR Edge +sad80 //40 //20 //L.L NR Edge +//sa330 //AWB speed //EVT0Àº °íÁ¤µÇ¾î ÀÖÀ½.(0x03) //EVT1Àº º¯°æ °¡´É. + +scc09 //08 //Flicker threshold 12 +sd522 //23 //32 //Chip_Debug2 + +se004 // NT Max +se204 //07 //18 // Low NT max +se103 // PAL Max +se303 //07 //18 // Low PAL max + +se400 // 24MHz VblankH (H.L) //FPS (24MHz, 15fps) +se55e //ea // 24MHz NT VblankL (H.L) +//se400 // 13MHz VblankH (H.L) //FPS (24MHz, 15fps) +//se52a // 13MHz VblankL (H.L) + +se600 //20070215AM // 24MHz VblankH (H.L) //FPS (24MHz, 15fps) +se75e //20070215AM //ea // 24MHz NT VblankL (H.L) + +se868 //44 //84 //97 // ae speed + +se984 //87 +sef00 +//s8c0e //skin color detection +sc80a //YC delay + + +//////////////////////////////////////// +// Color Correction -> Shading -> Gamma -> AWB -> Hue +//////////////////////////////////////// + +// Color Correction + +//sef00 // //D65-1 //D65 //CW //U30-6 //U30 //Old +//s4c40 //95 //95 //81 //8a //50 //62 //56 +//s4d92 //c2 //c2 //ba //d2 //af //a9 //8d +//s4e0f //92 //92 //87 //07 //1f //07 //89 +//s4f9a //9b //9b //98 //9e //9e //a2 //94 +//s503b //73 //73 //64 //4c //2e //47 //5c +//s511e //98 //98 //8c //12 //30 //1b //8b +//s5282 //80 //80 //80 //80 //86 //85 //80 +//s53bf //b3 //b3 //ad //cd //eb //f2 //91 +//s547f //73 //73 //6d //8e //b2 //b8 //51 + +////CW +sef00 +s4c92 +s4dcf +s4e82 +s4fad +s506e +s5180 +s5287 +s53eb +s54b2 +// +////D65 +//sef00 +//s4c8a +//s4dc2 +//s4e88 +//s4f9f +//s5072 +//s5193 +//s5281 +//s53ca +//s548c + +//Default +//sef00 +//s4c56 +//s4d8d +//s4e89 +//s4f96 +//s505d +//s5188 +//s5294 +//s5389 +//s545d + +// RGB Shading //// RGB Shading ////// Shading2 //// RGB Shading// RGB Shading// RGB Shading + // //// // // //linear//old +sef00 //sef00 //sef00 //sef00 //sef00 //00 //00 //00 //00 +s3001 //s3001 //s3001 //s3001 //s3001 //01 //01 //01 //01 +s3264 //s323c //s32b8 //s3200 //s3200 //00 //00 //00 //00 +s363c //s363c //s3690 //s3600 //s3600 //00 //00 //00 //00 +s3a3c //s3a3c //s3a90 //s3a00 //s3a00 //00 //00 //00 //00 +s3300 //s3300 //s3301 //s3301 //s3300 //00 //01 //00 //01 +s3400 //s3400 //s3422 //s3450 //s3400 //32 //50 //00 //50 +s3700 //s3700 //s3701 //s3701 //s3700 //00 //01 //00 //01 +s3800 //s3800 //s3822 //s3850 //s3800 //50 //50 //00 //50 +s3b00 //s3b00 //s3b01 //s3b01 //s3b00 //00 //01 //00 //01 +s3c00 //s3c00 //s3c22 //s3c50 //s3c00 //00 //50 //00 //50 +s31f8 //s31f8 //s31f8 //s31df //s3187 //ff //ff //5e //ff +s35ce //s35ce //s35ce //s35b8 //s3569 //d7 //da //54 //da +s39c8 //s39ca //s39ca //s39a9 //s395a //be //e6 //4d //e6 +s3f00 //s3f00 //s3f01 //s3f01 //s3f01 //01 //01 //01 //01 +s40a0 //s40a0 //s4054 //s4040 //s4040 //4a //40 //40 //40 +s3d00 //s3d00 //s3d01 //s3d00 //s3d01 //00 //00 //01 //00 +s3e78 //s3e78 //s3e04 //s3ef0 //s3e18 //fa //f0 //18 //f0 + // +//gamma5 +sef00 +//Gamma(Red) +s4800 +s4900 +s4A08 +s4B1B +s4801 +s4900 +s4A10 +s4B4E +s4802 +s4900 +s4A20 +s4B6F +s4803 +s4900 +s4A40 +s4B59 +s4804 +s4900 +s4A80 +s4B33 +s4805 +s4901 +s4A00 +s4B2B +s4806 +s4901 +s4AC0 +s4B20 +s4807 +s4902 +s4A80 +s4B19 +s4808 +s4903 +s4A00 +s4B16 +s4809 +s4903 +s4A80 +s4B13 +s480A +s4903 +s4AC0 +s4B12 +s480B +s4B14 +//Gamma(Green) +s4810 +s4900 +s4A08 +s4B1B +s4811 +s4900 +s4A10 +s4B4E +s4812 +s4900 +s4A20 +s4B6F +s4813 +s4900 +s4A40 +s4B59 +s4814 +s4900 +s4A80 +s4B33 +s4815 +s4901 +s4A00 +s4B2B +s4816 +s4901 +s4AC0 +s4B20 +s4817 +s4902 +s4A80 +s4B19 +s4818 +s4903 +s4A00 +s4B16 +s4819 +s4903 +s4A80 +s4B13 +s481A +s4903 +s4AC0 +s4B12 +s481B +s4B14 +//Gamma(Blue) +s4820 +s4900 +s4A08 +s4B1B +s4821 +s4900 +s4A10 +s4B4E +s4822 +s4900 +s4A20 +s4B6F +s4823 +s4900 +s4A40 +s4B59 +s4824 +s4900 +s4A80 +s4B33 +s4825 +s4901 +s4A00 +s4B2B +s4826 +s4901 +s4AC0 +s4B20 +s4827 +s4902 +s4A80 +s4B19 +s4828 +s4903 +s4A00 +s4B16 +s4829 +s4903 +s4A80 +s4B13 +s482A +s4903 +s4AC0 +s4B12 +s482B +s4B14 +s4880 + +//AWB +//sef00 +//s9301 // AWB map +//sa00f +//s9f0f +//s9300 + +//AWB mode : auto(??) +//sef01 +//s8000 + +// Hue + +sef00 +s8c0c //Skin Color Detection On/Off +s7401 //20070214 //00 //Hue & Saturation Off=00, On=01 +s7946 //20070214 //58 //Saturation Gain +s7501 //Hue & Saturation Cosine 1 +s7600 //a0 //20070214 //ff //Hue & Saturation Cosine 2 +s7702 //Hue & Saturation Sine 1 +s7800 //20070214 //11 //Hue & Saturation Sine 2 +s7288 //20070213 //b0 //90 //Contrast Gain +//s7389 //Brightness Gain +sd800 //Edge color suppress + +//sef02 +//s0f40 + +//AWB white's count low 0f00 --> 0708 +sef01 +s8500 //07 //0f //07 +s863c //2d //08 //00 //08 +s8713 //0e +s88c0 //d0 + +//AWB boundary +sef00 +sb100 +sb200 +sb300 +sb400 +sb500 +sb6f0 +sb701 +sb840 + +// Bad Pixel Replacement + +//sef00 +//s1a01 +//s1b00 +//s1e00 +//s1c00 +//s1f00 +//s1d00 +//s2000 + +sef01 +sb908 //10 //30 //BPR Gain Setting +sba00 +sbd00 + +seb60 //40 //6f //Low Light Indication AGC + +//20070213 +//AWB Map 1 +sef01 +s9480 //00 +s95c0 //c0 +s96c0 //f0 +s97f0 //c0 +s9878 //78 +s9978 //78 +s9a7c //7c +s9b3c //3f +s9c1e //1f +s9d0f //0f +s9e07 //07 +s9f03 //03 +sa000 //01 +sa1c8 +sa202 +s9382 //AWB window //02 + +//20070213 +//AWB Map Direct Write +sef00 +s9480 //00 +s95c0 //c0 +s96c0 //f0 +s97f0 //c0 +s9878 //78 +s9978 //78 +sa07c //7c +sa13c //3f +sa21e //1f +sa30f //0f +sa407 //07 +sa503 //03 +sa600 //01 + +//Auto Flicker Correction +sef01 +sdd31 +scd21 +sde31 + +//Frame AE Control - L.L 5fps +//*** Frame °íÁ¤½Ã´Â ¾Æ·¡ ºÎºÐÀ» ¸ðµÎ ÁÖ¼®Ã³¸® ÇÒ °Í.*** +sef00 +s5700 +//sef01 +//se218 +//se316 +//se888 +//****************************************************** + +//sef00 +//s4340 //20070222 //fixed value +//s423d //AWB R start point +//s446b //AWB B start point + +sef01 //shadow line +sa500 + +sef00 +sb902 +sba80 +sbb80 +sbc98 +sbd30 + +// +sef00 +s0400 +s05f8 +sc208 +sc308 +sc400 +sc5f0 +sc601 +sc740 + +sef02 +s0a9a +s08f7 + +s1a01 +s1be6 + +sef01 +sca01 +scbe6 + +s7097 //17 // fix PAL(50Hz) diff --git a/build/libraries/camera/ARM7/Makefile b/build/libraries/camera/ARM7/Makefile new file mode 100644 index 0000000..731ca38 --- /dev/null +++ b/build/libraries/camera/ARM7/Makefile @@ -0,0 +1,74 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - camera/ARM7 +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Log: $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +TWL_CODEGEN_ALL ?= True + +# Codegen for sub processer +TWL_PROC = ARM7 + +SRCDIR = ../common . + +SRCS = \ + camera_i2c.c \ + camera_control.c \ + +L_SET_FILE := A3AFX_EVT2_20fps_16M_PLLoff_hVGA_070209.set \ + A3AFX_EVT2_30fps_16M_QVGA_070206.set \ + A3AFX_EVT2_20fps_16M_070206.set \ + 320x240_noPLL_20fps_070306.set \ + 320x240_PLL_30fps_070306.set \ + A3AFX_EVT3_30fps_Scaledown_16.7M_50Hz.set \ + A3AFX_EVT3_30fps_Subsampling_16.7M_50Hz.set \ + +L_CONVERT_EXE := convert.pl +L_SETC_FILE := $(L_SET_FILE:%.set=%.autogen.c) +SRCS += $(L_SETC_FILE) + +TARGET_LIB = libcamera_sp$(TWL_LIBSUFFIX).a + + +#---------------------------------------------------------------------------- + +# DEBUG”Ńrƒ‹ƒh‚Ìê‡ARELEASE”łŃrƒ‹ƒh‚µ‚Ä +# DEBUG”ł̃‰ƒCƒuƒ‰ƒŠ‚ð‘•‚¢‚Ü‚·B + +ifdef NITRO_DEBUG +NITRO_BUILD_TYPE = RELEASE +endif + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(TWL_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +%.autogen.c: %.set $(L_CONVERT_EXE) + perl $(L_CONVERT_EXE) $< > $@ + +#===== End of Makefile ===== diff --git a/build/libraries/camera/ARM7/camera_control.c b/build/libraries/camera/ARM7/camera_control.c new file mode 100644 index 0000000..52b0639 --- /dev/null +++ b/build/libraries/camera/ARM7/camera_control.c @@ -0,0 +1,357 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - library - camera + File: camera_sp.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +/*---------------------------------------------------------------------------* + ’è”’è‹` + *---------------------------------------------------------------------------*/ +#define CAMERA_STBYN_MASK REG_EXI_GPIO2DATA_IO18_1_MASK + +#define CAMERA_PXI_SIZE_CHECK(nums) \ + if (cameraWork.total != (nums)) { \ + CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_PARAMETER); \ + break; \ + } + +// ƒAƒ‰ƒCƒƒ“ƒg’²®‚µ‚ăRƒs[‚·‚é +#define CAMERA_UNPACK_U16(d, s) \ + (*(d) = (u16)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8))) +#define CAMERA_UNPACK_U32(d, s) \ + (*(d) = (u32)((((u8*)s)[0] << 0) | (((u8*)s)[1] << 8) | (((u8*)s)[2] << 16) | (((u8*)s)[3] << 24))) + +#define CAMERA_SET_GPIO(r) ((r) |= CAMERA_STBYN_MASK) +#define CAMERA_CLEAR_GPIO(r) ((r) &= ~CAMERA_STBYN_MASK) + +/*---------------------------------------------------------------------------* + Œ^’è‹` + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + ÓI•Ï”’è‹` + *---------------------------------------------------------------------------*/ +static BOOL cameraInitialized; // ‰Šú‰»Šm”Fƒtƒ‰ƒO +static CAMERAWork cameraWork; // ƒ[ƒN•Ï”‚ð‚܂Ƃ߂½\‘¢‘Ì + +/*---------------------------------------------------------------------------* + “à•”ŠÖ”’è‹` + *---------------------------------------------------------------------------*/ +static void CameraPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void CameraReturnResult(CAMERAPxiCommand command, CAMERAPxiResult result); +static void CameraReturnResultEx(CAMERAPxiCommand command, CAMERAPxiResult result, u8 size, u8* data); +static void CameraThread(void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_Init + + Description: CAMERAƒ‰ƒCƒuƒ‰ƒŠ‚ð‰Šú‰»‚·‚éB + + Arguments: priority + + Returns: None. + *---------------------------------------------------------------------------*/ +void CAMERA_Init(u32 priority) +{ + // ‰Šú‰»Ï‚Ý‚ðŠm”F + if (cameraInitialized) + { + return; + } + cameraInitialized = 1; + + // GPIO‰ŠúÝ’è + CAMERA_CLEAR_GPIO(reg_EXI_GPIO2IE); // Š„‚螂݂Ȃµ + CAMERA_SET_GPIO(reg_EXI_GPIO2DIR); // o—ÍÝ’è + CAMERA_CLEAR_GPIO(reg_EXI_GPIO2DATA); // ‰Šú’l0 + + // PXIŠÖ˜A‚ð‰Šú‰» + PXI_Init(); + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_CAMERA, CameraPxiCallback); + + // ŽÀˆ—‚ðs‚¤ƒXƒŒƒbƒh‚ðì¬ + OS_InitMessageQueue(&cameraWork.msgQ, cameraWork.msgArray, CAMERA_MESSAGE_ARRAY_MAX); + OS_CreateThread(&cameraWork.thread, + CameraThread, + 0, + (void *)(cameraWork.stack + (CAMERA_THREAD_STACK_SIZE / sizeof(u64))), + CAMERA_THREAD_STACK_SIZE, priority); + OS_WakeupThreadDirect(&cameraWork.thread); +} + +/*---------------------------------------------------------------------------* + Name: CameraPxiCallback + + Description: PXIŒo—R‚ÅŽóM‚µ‚½ƒf[ƒ^‚ð‰ðÍ‚·‚éB + + Arguments: tag - PXIŽí•Ê‚ðŽ¦‚·ƒ^ƒOB + data - ŽóM‚µ‚½ƒf[ƒ^B‰ºˆÊ26bit‚ª—LŒøB + err - PXI’ÊM‚É‚¨‚¯‚éƒGƒ‰[ƒtƒ‰ƒOB + ARM9‘¤‚ɂē¯Ží•Ê‚ÌPXI‚ª‰Šú‰»‚³‚ê‚Ä‚¢‚È‚¢‚±‚Æ‚ðŽ¦‚·B + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CameraPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + + // PXI’ÊMƒGƒ‰[‚ðƒ`ƒFƒbƒN + if (err) + { + return; + } + // 擪ƒf[ƒ^ + if (data & CAMERA_PXI_START_BIT) + { + cameraWork.total = (u8)((data & CAMERA_PXI_DATA_NUMS_MASK) >> CAMERA_PXI_DATA_NUMS_SHIFT); + cameraWork.current = 0; + cameraWork.command = (CAMERAPxiCommand)((data & CAMERA_PXI_COMMAND_MASK) >> CAMERA_PXI_COMMAND_SHIFT); + cameraWork.data[cameraWork.current++] = (u8)((data & CAMERA_PXI_1ST_DATA_MASK) >> CAMERA_PXI_1ST_DATA_SHIFT); +//OS_TPrintf("START_BIT (total=%d, command=%X).\n", cameraWork.total, cameraWork.command); + } + // Œã‘±ƒf[ƒ^ + else + { + cameraWork.data[cameraWork.current++] = (u8)((data & 0xFF0000) >> 16); + cameraWork.data[cameraWork.current++] = (u8)((data & 0x00FF00) >> 8); + cameraWork.data[cameraWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + + // ƒpƒPƒbƒgŠ®¬ + if (cameraWork.current >= cameraWork.total) // Å‘å‚Å2‚—]•ª‚Ɏ擾‚·‚é + { + // ŽóM‚µ‚½ƒRƒ}ƒ“ƒh‚ð‰ðÍ + switch (cameraWork.command) + { + // Šù’m‚̃Rƒ}ƒ“ƒhŒQ + case CAMERA_PXI_COMMAND_SET_STBYN: + // I2CŠî–{‘€ì + case CAMERA_PXI_COMMAND_WRITE_REGISTERS: + case CAMERA_PXI_COMMAND_READ_REGISTERS: + case CAMERA_PXI_COMMAND_SET_PARAMS: + case CAMERA_PXI_COMMAND_SET_FLAGS: + case CAMERA_PXI_COMMAND_CLEAR_FLAGS: + // I2C‰ž—p‘€ì + 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: + // ƒXƒŒƒbƒh‚ðÄŠJ + if (!OS_SendMessage(&cameraWork.msgQ, NULL, OS_MESSAGE_NOBLOCK)) + { + CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_FATAL_ERROR); + } + break; + + // –¢’m‚̃Rƒ}ƒ“ƒh + default: + CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_COMMAND); + } + } +} + +/*---------------------------------------------------------------------------* + Name: CameraReturnResult + + Description: PXIŒo—R‚ň—Œ‹‰Ê‚ðARM9‚É‘—M‚·‚éB + + Arguments: command - ‘ÎÛƒRƒ}ƒ“ƒh + result - CAMERAPxiResult‚̂ЂƂ + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CameraReturnResult(CAMERAPxiCommand command, CAMERAPxiResult result) +{ + u32 pxiData = (u32)(CAMERA_PXI_START_BIT | CAMERA_PXI_RESULT_BIT | + ((command << CAMERA_PXI_COMMAND_SHIFT) & CAMERA_PXI_COMMAND_MASK) | + ((1 << CAMERA_PXI_DATA_NUMS_SHIFT) & CAMERA_PXI_DATA_NUMS_MASK) | + ((result << CAMERA_PXI_1ST_DATA_SHIFT) & CAMERA_PXI_1ST_DATA_MASK)); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0)) + { + } +} + +/*---------------------------------------------------------------------------* + Name: CameraReturnResultEx + + Description: Žw’èŒã‘±ƒf[ƒ^‚ðPXIŒo—R‚ÅARM7‚É‘—M‚·‚éB + + Arguments: command - ‘ÎÛƒRƒ}ƒ“ƒh + result - CAMERAPxiResult‚̂ЂƂ + size - •t‰Áƒf[ƒ^ƒTƒCƒY + data - •t‰Áƒf[ƒ^ + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CameraReturnResultEx(CAMERAPxiCommand command, CAMERAPxiResult result, u8 size, u8* data) +{ + u32 pxiData = (u32)(CAMERA_PXI_START_BIT | CAMERA_PXI_RESULT_BIT | + ((command << CAMERA_PXI_COMMAND_SHIFT) & CAMERA_PXI_COMMAND_MASK) | + (((size+1) << CAMERA_PXI_DATA_NUMS_SHIFT) & CAMERA_PXI_DATA_NUMS_MASK) | + ((result << CAMERA_PXI_1ST_DATA_SHIFT) & CAMERA_PXI_1ST_DATA_MASK)); + int i; + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0)) + { + } + for (i = 0; i < size; i += 3) + { + pxiData = (u32)((data[i] << 16) | (data[i+1] << 8) | data[i+2]); + while (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0)) + { + } + } +} + +/*---------------------------------------------------------------------------* + Name: CameraThread + + Description: CAMERA‘€ì‚ÌŽÀˆ—‚ðs‚¤ƒXƒŒƒbƒhB + + Arguments: arg - Žg—p‚µ‚È‚¢B + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CameraThread(void *arg) +{ +#pragma unused( arg ) + + OSMessage msg; + BOOL result; + u16 data16a; + u16 data16b; + u16 data16c; + u16 data16d; + u8 dataArray[CAMERA_PXI_DATA_SIZE_MAX]; // •s’è’·ƒf[ƒ^Ši”[—p + + while (TRUE) + { + // ƒƒbƒZ[ƒW‚ª”­s‚³‚ê‚é‚Ü‚ÅQ‚é + (void)OS_ReceiveMessage(&(cameraWork.msgQ), &msg, OS_MESSAGE_BLOCK); + + // ƒRƒ}ƒ“ƒh‚É]‚Á‚ÄŠeŽíˆ—‚ðŽÀs + switch (cameraWork.command) + { + case CAMERA_PXI_COMMAND_SET_STBYN: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_SET_STBYN); + if (cameraWork.data[0]) + { + CAMERA_SET_GPIO(reg_EXI_GPIO2DATA); // High + } + else + { + CAMERA_CLEAR_GPIO(reg_EXI_GPIO2DATA); // Low + } + CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + // I2CŠî–{‘€ì + case CAMERA_PXI_COMMAND_WRITE_REGISTERS: // IN: addr, data... OUT: TRUE/FALSE + if (cameraWork.total <= 1) + { + CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_PARAMETER); + break; + } + result = CAMERA_WriteRegisters(cameraWork.data[0], &cameraWork.data[1], (size_t)(cameraWork.total-1)); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_READ_REGISTERS: // IN: addr, size OUT: TRUE/FALSE, data... + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_READ_REGISTERS); + result = CAMERA_ReadRegisters(cameraWork.data[0], dataArray, cameraWork.data[1]); + if (result) + { + CameraReturnResultEx(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_TRUE, cameraWork.data[1], dataArray); + } + else + { + CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚ÌŽ¸”s‚ð’Ê’B + } + break; + + case CAMERA_PXI_COMMAND_SET_PARAMS: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_SET_PARAMS); + result = CAMERA_SetParams(cameraWork.data[0], cameraWork.data[1], cameraWork.data[2]); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_SET_FLAGS: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_SET_FLAGS); + result = CAMERA_SetFlags(cameraWork.data[0], cameraWork.data[1]); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_CLEAR_FLAGS: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_CLEAR_FLAGS); + result = CAMERA_ClearFlags(cameraWork.data[0], cameraWork.data[1]); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_I2C_INIT: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_INIT); + result = CAMERA_I2CInit(); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_I2C_PRESET: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PRESET); + result = CAMERA_I2CPreset((CameraPreset)cameraWork.data[0]); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_I2C_PRE_SLEEP: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PRE_SLEEP); + result = CAMERA_I2CPreSleep(); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_I2C_POST_SLEEP: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_POST_SLEEP); + result = CAMERA_I2CPostSleep(); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_I2C_SET_CROPPING: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_SET_CROPPING); + CAMERA_UNPACK_U16(&data16a, &cameraWork.data[0]); + CAMERA_UNPACK_U16(&data16b, &cameraWork.data[2]); + CAMERA_UNPACK_U16(&data16c, &cameraWork.data[4]); + CAMERA_UNPACK_U16(&data16d, &cameraWork.data[6]); + result = CAMERA_I2CSetCropping(data16a, data16b, data16c, data16d); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_I2C_PAUSE: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_PAUSE); + result = CAMERA_I2CPause(); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + case CAMERA_PXI_COMMAND_I2C_RESUME: + CAMERA_PXI_SIZE_CHECK(CAMERA_PXI_SIZE_I2C_RESUME); + result = CAMERA_I2CResume(); + CameraReturnResult(cameraWork.command, result ? CAMERA_PXI_RESULT_SUCCESS_TRUE : CAMERA_PXI_RESULT_SUCCESS_FALSE); // ARM9‚Ɉ—‚̬Œ÷‚ð’Ê’B + break; + + // ƒTƒ|[ƒg‚µ‚È‚¢ƒRƒ}ƒ“ƒh + default: + CameraReturnResult(cameraWork.command, CAMERA_PXI_RESULT_INVALID_COMMAND); + } + } +} diff --git a/build/libraries/camera/ARM7/camera_i2c.c b/build/libraries/camera/ARM7/camera_i2c.c new file mode 100644 index 0000000..24444cc --- /dev/null +++ b/build/libraries/camera/ARM7/camera_i2c.c @@ -0,0 +1,266 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraties - camera + File: camera_i2c.c + + Copyright 2006 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +//#define USE_MULTIPLE_IO // use [Read|Write]Registers(); + +// for samsung 1/10 + +extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M_PLLoff_hVGA( void ); +extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_30fps_16M_QVGA( void ); +extern BOOL CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M( void ); +extern BOOL CAMERAi_I2CPreset_320x240_noPLL_20fps( void ); +extern BOOL CAMERAi_I2CPreset_320x240_PLL_30fps( void ); +extern BOOL CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Scaledown_16_7M_50Hz( void ); +extern BOOL CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Subsampling_16_7M_50Hz( void ); + +typedef BOOL (*CameraI2CPresetFunc)(void); + +static CameraI2CPresetFunc gs_preset[] = { + CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M_PLLoff_hVGA, + CAMERAi_I2CPreset_A3AFX_EVT2_30fps_16M_QVGA, + CAMERAi_I2CPreset_A3AFX_EVT2_20fps_16M, + CAMERAi_I2CPreset_320x240_noPLL_20fps, + CAMERAi_I2CPreset_320x240_PLL_30fps, + CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Scaledown_16_7M_50Hz, + CAMERAi_I2CPreset_A3AFX_EVT3_30fps_Subsampling_16_7M_50Hz, +}; + +BOOL CAMERA_I2CPreset(CameraPreset preset) +{ + if (preset >= CAMERA_PRESET_MAX) { + return FALSE; + } + if (gs_preset[preset] == NULL) { + return FALSE; + } + (void)I2C_Lock(); + if (gs_preset[preset]() == FALSE) { + (void)I2C_Unlock(); + return FALSE; + } + (void)I2C_Unlock(); + return TRUE; +} + + +#define PAGE_ADDR 0xef + +#define MIRROR_MODE 0x02 //[6:7] only? +#define WRP_DOWN 0x04 +#define WCP_DOWN 0x06 + +BOOL CAMERA_I2CSetFlipMode(CameraFlipMode mode) +{ + + (void)I2C_Lock(); + + switch (mode) + { + case CAMERA_FLIPMODE_NONE: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE || + CAMERAi_WriteRegister(MIRROR_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(WRP_DOWN, 0x00) == FALSE || + CAMERAi_WriteRegister(WCP_DOWN, 0x00) == FALSE) { + goto error; + } + break; + case CAMERA_FLIPMODE_HORIZONTAL: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE || + CAMERAi_WriteRegister(MIRROR_MODE, 0x40) == FALSE || + CAMERAi_WriteRegister(WRP_DOWN, 0x00) == FALSE || + CAMERAi_WriteRegister(WCP_DOWN, 0x01) == FALSE) { + goto error; + } + break; + case CAMERA_FLIPMODE_VERTICAL: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE || + CAMERAi_WriteRegister(MIRROR_MODE, 0x80) == FALSE || + CAMERAi_WriteRegister(WRP_DOWN, 0x01) == FALSE || + CAMERAi_WriteRegister(WCP_DOWN, 0x00) == FALSE) { + goto error; + } + break; + case CAMERA_FLIPMODE_HORIZONTAL_VERTICAL: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x02) == FALSE || + CAMERAi_WriteRegister(MIRROR_MODE, 0xC0) == FALSE || + CAMERAi_WriteRegister(WRP_DOWN, 0x01) == FALSE || + CAMERAi_WriteRegister(WCP_DOWN, 0x01) == FALSE) { + goto error; + } + break; + default: + goto error; + } + (void)I2C_Unlock(); + return TRUE; +error: + (void)I2C_Unlock(); + return FALSE; +} + +#define NEVAGIVE_EFFECT_MODE 0xD3 +#define SEPIA_EFFECT_MODE 0xD4 +#define SEPIA_EFFECT_CB 0xD5 +#define SEPIA_EFFECT_CR 0xD6 + +BOOL CAMERA_I2CSetSpecialMode(CameraSpecialMode mode) +{ + + (void)I2C_Lock(); + + switch (mode) + { + case CAMERA_SPECIALMODE_NONE: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE || + CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0x2C) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) { + goto error; + } + break; + case CAMERA_SPECIALMODE_NEVATIVE: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE || + CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x01) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0x2C) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) { + goto error; + } + break; + case CAMERA_SPECIALMODE_SEPIA: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE || + CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0x2C) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) { + goto error; + } + break; + //case CAMERA_SPECIALMODE_AQUA: + case CAMERA_SPECIALMODE_BLUISH: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE || + CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0xAC) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x81) == FALSE) { + goto error; + } + break; + case CAMERA_SPECIALMODE_REDDISH: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE || + CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0xAC) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0xC1) == FALSE) { + goto error; + } + break; + case CAMERA_SPECIALMODE_GREENISH: + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE || + CAMERAi_WriteRegister(NEVAGIVE_EFFECT_MODE, 0x00) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_MODE, 0x03) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CB, 0xAC) == FALSE || + CAMERAi_WriteRegister(SEPIA_EFFECT_CR, 0x41) == FALSE) { + goto error; + } + break; + default: + goto error; + } + (void)I2C_Unlock(); + return TRUE; +error: + (void)I2C_Unlock(); + return FALSE; +} + +#define DEST_ADDR 0x7F +#define CAPT_ADDR 0xC4 +BOOL CAMERA_I2CSetCroppingParams(u16 width, u16 height) +{ +#ifdef USE_MULTIPLE_IO + u8 data[4]; +#endif + if (width > 640 || height > 480) { + return FALSE; + } + (void)I2C_Lock(); + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE) { + (void)I2C_Unlock(); + return FALSE; + } + // set destination registers +#ifdef USE_MULTIPLE_IO + data[0] = (height + 0x10) >> 8; + data[1] = (height + 0x10) & 0xFF; + data[2] = (width + 0x10) >> 8; + data[3] = (width + 0x10) & 0xFF; + if (CAMERAi_WriteRegisters(DEST_ADDR, data, 4) == FALSE) { +#else + if (CAMERAi_WriteRegister(DEST_ADDR, (u8)((height + 0x10) >> 8)) == FALSE || + CAMERAi_WriteRegister(DEST_ADDR+1, (u8)((height + 0x10) & 0xFF)) ==FALSE || + CAMERAi_WriteRegister(DEST_ADDR+2, (u8)((width + 0x10) >> 8)) == FALSE || + CAMERAi_WriteRegister(DEST_ADDR+3, (u8)((width + 0x10) & 0xFF)) == FALSE) { +#endif + (void)I2C_Unlock(); + return FALSE; + } + // set capture registers +#ifdef USE_MULTIPLE_IO + data[0] = height >> 8; + data[1] = height & 0xFF; + data[2] = width >> 8; + data[3] = width & 0xFF; + if (CAMERAi_WriteRegisters(CAPT_ADDR, data, 4) == FALSE) { +#else + if (CAMERAi_WriteRegister(CAPT_ADDR, (u8)(height >> 8)) == FALSE || + CAMERAi_WriteRegister(CAPT_ADDR+1, (u8)(height & 0xFF)) ==FALSE || + CAMERAi_WriteRegister(CAPT_ADDR+2, (u8)(width >> 8)) == FALSE || + CAMERAi_WriteRegister(CAPT_ADDR+3, (u8)(width & 0xFF)) == FALSE) { +#endif + (void)I2C_Unlock(); + return FALSE; + } + (void)I2C_Unlock(); + return TRUE; +} + +BOOL CAMERA_I2CGetCroppingParams(u16 *pWidth, u16 *pHeight) +{ + u8 data[4]; + (void)I2C_Lock(); + if (CAMERAi_WriteRegister(PAGE_ADDR, 0x00) == FALSE) { + (void)I2C_Unlock(); + return FALSE; + } + data[0] = CAMERAi_ReadRegister(CAPT_ADDR); + data[1] = CAMERAi_ReadRegister(CAPT_ADDR+1); + data[2] = CAMERAi_ReadRegister(CAPT_ADDR+2); + data[3] = CAMERAi_ReadRegister(CAPT_ADDR+3); + + (void)I2C_Unlock(); + + if (pWidth) { + *pWidth = (u16)(data[3] | (data[2] << 8)); + } + if (pHeight) { + *pHeight = (u16)(data[1] | (data[0] << 8)); + } + return TRUE; +} diff --git a/build/libraries/camera/ARM7/convert.pl b/build/libraries/camera/ARM7/convert.pl new file mode 100644 index 0000000..06d5a56 --- /dev/null +++ b/build/libraries/camera/ARM7/convert.pl @@ -0,0 +1,146 @@ +#!/usr/bin/perl -- + +my $support_multiple_write = undef; + +my $file_head_format =<<'EOF'; +/*---------------------------------------------------------------------------* + Project: TwlSDK - libraties - camera + File: %1$s + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include + +//#define PRINT_DEBUG + +#ifdef PRINT_DEBUG +#include +#define DBG_PRINTF vlink_dos_printf +#define DBG_CHAR vlink_dos_put_console +#else +#define DBG_PRINTF( ... ) ((void)0) +#define DBG_CHAR( c ) ((void)0) +#endif + +BOOL %2$s( void ); +BOOL %2$s( void ) +{ +EOF + +my $file_foot_format =<<'EOF'; + return TRUE; +} +EOF + +my $packet_first_format =<<'EOF'; + { + const u8 data[] = { +EOF + +my $packet_last_format =<<'EOF'; + }; + if (CAMERAi_WriteRegisters(0x%s, data, %d) == FALSE) { + DBG_PRINTF("Failed to initialize! (%%d)\n", __LINE__); + return FALSE; + } + } +EOF + +my $packet_single_format =<<'EOF'; + if (CAMERAi_WriteRegister(0x%s, 0x%s) == FALSE) { + DBG_PRINTF("Failed to initialize! (%%d)\n", __LINE__); + return FALSE; + } +EOF + +sub print_data { + my $text = ''; + my $i = 0; + foreach my $data (@_) { + if ($i % 8 == 0) { + $text .= ' '; + } else { + $text .= ' '; + } + $text .= sprintf('0x%s,', $data); + $i++; + if ($i % 8 == 0) { + $text .= "\n"; + } + } + if ($i % 8 != 0) { + $text .= "\n"; + } + return $text; +} + +sub print_single { + return sprintf($packet_single_format, $_[0], $_[1]); +} + +sub print_packet { + my($first, @data) = @_; + if (@data == 1) { + return print_single($first, $data[0]); + } else { + return $packet_first_format, + print_data(@data), + sprintf($packet_last_format, $first, scalar(@data)); + } +} + +die "USAGE: convert.pl [INFILE] > [OUTFILE]\n" if ($#ARGV != 0); + +my $infile = $ARGV[0]; +(my $funcname = $infile) =~ s/(_\d{6})?\.set$//; +$funcname =~ s/[^0-9a-zA-Z_]/_/g; # +my $outfile = $funcname . ".autogen.c"; +my $funcname = "CAMERAi_I2CPreset_" . $funcname; + +open IN, $infile or die "Cannot open the file!\n"; + +my @packets; # ƒpƒPƒbƒgƒwƒbƒ_{ƒpƒPƒbƒg‚Ì’†g‚ÌW‚Ü‚è +my @data; # ƒf[ƒ^ŒQ + +my $first = -1; # 擪ƒAƒhƒŒƒX +my $current = -1; # Šú‘ÒƒAƒhƒŒƒX + +if ($support_multiple_write) { + while () { + 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 { # ˜A‘±‘‚«ž‚Ý”ñ‘Ήž”Å + while () { + 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; diff --git a/build/libraries/camera/ARM9/Makefile b/build/libraries/camera/ARM9/Makefile new file mode 100644 index 0000000..641dd4c --- /dev/null +++ b/build/libraries/camera/ARM9/Makefile @@ -0,0 +1,56 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - camera/ARM9 +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Log: $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +# build ARM & THUMB libraries +TWL_CODEGEN_ALL ?= True + +SRCDIR = ../common . + +SRCS = camera_api.c \ + camera.c + +TARGET_LIB = libcamera$(TWL_LIBSUFFIX).a + + +#---------------------------------------------------------------------------- + +# DEBUG”Ńrƒ‹ƒh‚Ìê‡ARELEASE”łŃrƒ‹ƒh‚µ‚Ä +# DEBUG”ł̃‰ƒCƒuƒ‰ƒŠ‚ð‘•‚¢‚Ü‚·B + +ifdef NITRO_DEBUG +NITRO_BUILD_TYPE = RELEASE +endif + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + +INSTALL_TARGETS = $(TARGETS) +INSTALL_DIR = $(TWL_INSTALL_LIBDIR) + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/libraries/camera/ARM9/camera.c b/build/libraries/camera/ARM9/camera.c new file mode 100644 index 0000000..2c868f5 --- /dev/null +++ b/build/libraries/camera/ARM9/camera.c @@ -0,0 +1,465 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - library - camera + File: camera.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +/*---------------------------------------------------------------------------* + ’è”’è‹` + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Œ^’è‹` + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + ÓI•Ï”’è‹` + *---------------------------------------------------------------------------*/ +static CameraSelect currentCamera; +static BOOL prestate; + +/*---------------------------------------------------------------------------* + “à•”ŠÖ”’è‹` + *---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------* + Name: CAMERA_SelectCamera + + Description: set stbyn + + Arguments: camera one of CameraSelect + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SelectCamera( CameraSelect camera ) +{ + if (currentCamera == camera) + { + return; + } + + switch (camera) + { + case CAMERA_SELECT_FIRST: + CAMERA_SetStbyn2(FALSE); + break; + case CAMERA_SELECT_SECOND: + CAMERA_SetStbyn(FALSE); + break; + default: + return; + } + currentCamera = camera; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetStbyn + + Description: set STBYn for current camera + + Arguments: BOOL High/Low + + Returns: BOOL last state + *---------------------------------------------------------------------------*/ +BOOL CAMERA_SetStbyn( BOOL high ) +{ + static BOOL prev = FALSE; + BOOL temp = prev; + switch (currentCamera) + { + case CAMERA_SELECT_FIRST: + if (high) + { + reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_STBYN_MASK; + } + else + { + reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_STBYN_MASK; + } + break; + case CAMERA_SELECT_SECOND: + CAMERA_SetStbyn2(high); + break; + default: + return temp; + } + prev = high; + return temp; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_PowerOn + + Description: power camera on + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_PowerOn( void ) +{ + reg_CFG_CLK |= REG_CFG_CLK_CAM_MASK; + if ((reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) == 0) { + reg_CAM_CAM_MCNT |= (REG_CAM_CAM_MCNT_V28_MASK // VDD2.8 POWER ON + | REG_CAM_CAM_MCNT_INI_MASK);// setup data line after CPU is powered on + OS_SpinWaitSysCycles( 4 ); // wait to raise VDD2.8 + reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_V18_MASK; // VDD1.8 POWER ON + OS_SpinWaitSysCycles( 4 ); // wait to raise VDD1.8 + reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_VIO_MASK; // VDDIO POWER ON + OS_SpinWaitSysCycles( 4 ); // wait to raise VDDIO + + reg_CFG_CLK |= REG_CFG_CLK_CAM_CKI_MASK;// MCLK on + OS_SpinWaitSysCycles( 100 ); // wait for over 100 MCLK cycles + + reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_RSTN_MASK; // RSTN => Hi + CAMERA_SetStbyn(TRUE); // STBYN => Hi + OS_SpinWaitSysCycles( 1800000 ); // wait for over 1800000 MCLK cycles (over 100msec!!!) + + reg_CAM_CAM_CNT = REG_CAM_CAM_CNT_CL_MASK; // full reset CNT + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_PowerOff + + Description: power camera off + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void CAMERA_PowerOff( void ) +{ + if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) { + reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_E_MASK; // stop cmaera output + + CAMERA_SetStbyn(FALSE); // STBYN => Lo + OS_SpinWaitSysCycles( 20 ); // wait for over 20 MCLK cycles + reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_RSTN_MASK; + OS_SpinWaitSysCycles( 20 ); // wait for over 20 MCLK cycles + + reg_CFG_CLK &= ~REG_CFG_CLK_CAM_CKI_MASK; // MCLK off + // no wait + + reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_VIO_MASK; // VDDIO POWER OFF + OS_SpinWaitSysCycles( 4 ); // wait a moment + reg_CAM_CAM_MCNT |= REG_CAM_CAM_MCNT_V18_MASK; // VDD1.8 POWER OFF + OS_SpinWaitSysCycles( 4 ); // wait a moment + reg_CAM_CAM_MCNT &= ~REG_CAM_CAM_MCNT_V28_MASK; // VDD2.8 POWER OFF + OS_SpinWaitSysCycles( 4 ); // wait a moment + } + reg_CFG_CLK &= ~REG_CFG_CLK_CAM_MASK; /* •K—v‚ ‚é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) { + prestate = CAMERA_SetStbyn(FALSE); + OS_SpinWaitSysCycles( 20 ); // wait for over 20 MCLK cycles + // MCLK will stop automatically + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_PostSleep + + Description: pre-sleep process for CAMERA without power off + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_PostSleep( void ) +{ + if (reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) { + // MCLK started automatically + if (prestate) + { + CAMERA_SetStbyn(TRUE); + OS_SpinWaitSysCycles( 100000 ); // wait for over 100000 MCLK cycles + } + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_IsBusy + + Description: whether camera is busy + + Arguments: None + + Returns: TRUE if camera is busy + *---------------------------------------------------------------------------*/ +BOOL CAMERA_IsBusy( void ) +{ + return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_E_MASK) ? TRUE : FALSE; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_Start + + Description: start to receive camera data + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_Start( void ) +{ + reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_E_MASK; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_Stop + + Description: stop to receive camera data + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_Stop( void ) +{ + reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_E_MASK; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetSyncLowActive + + Description: set CAMERA sync polarity + + Arguments: isLowActive if low active, set TRUE + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetSyncLowActive( BOOL isLowActive ) +{ + if (isLowActive) { + reg_CAM_CAM_CNT |= (1 << REG_CAM_CAM_MCNT_SYNC_SHIFT); + } else { + reg_CAM_CAM_CNT &= ~(1 << REG_CAM_CAM_MCNT_SYNC_SHIFT); + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetRclkNegativeEdge + + Description: set CAMERA rclk edge. + Should call while master clock is stopping. + + Arguments: isNegativeEdge if negative edge, set TRUE + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetRclkNegativeEdge( BOOL isNegativeEdge ) +{ + if ((reg_CFG_CLK & REG_CFG_CLK_CAM_CKI_MASK) == 0) { + if (isNegativeEdge) { + reg_CAM_CAM_CNT |= (1 << REG_CAM_CAM_MCNT_IRCLK_SHIFT); + } else { + reg_CAM_CAM_CNT &= ~(1 << REG_CAM_CAM_MCNT_IRCLK_SHIFT); + } + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTrimmingParamsCenter + + Description: set camera trimming by centering + expecting original image size is VGA. + + Arguments: destWidth width of image to output + destHeight height of image to output + srcWidth original width of image + srcHeight original height of image + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTrimmingParamsCenter(u16 destWidth, u16 destHeight, u16 srcWidth, u16 srcHeight) +{ + destWidth -= 2; + destHeight -= 1; + reg_CAM_SOFS_H = (u16)((srcWidth-destWidth) >> 1); + reg_CAM_SOFS_V = (u16)((srcHeight-destHeight) >> 1); + reg_CAM_EOFS_H = (u16)((srcWidth+destWidth) >> 1); + reg_CAM_EOFS_V = (u16)((srcHeight+destHeight) >> 1); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTrimmingParams + + Description: set camera trimming + NOTE: widht = x2 - x1; height = y2 - y1; + + Arguments: x1 X of top-left trimming point (multiple of 2) + y1 Y of top-left trimming point + x2 X of bottom-right trimming point (multiple of 2) + y2 Y of bottom-right trimming point + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTrimmingParams(u16 x1, u16 y1, u16 x2, u16 y2) +{ + reg_CAM_SOFS_H = x1; + reg_CAM_SOFS_V = y1; + reg_CAM_EOFS_H = (u16)(x2 - 2); + reg_CAM_EOFS_V = (u16)(y2 - 1); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTrimming + + Description: set trimming enable/disable + + Arguments: enabled TRUE if set trimming will be enabled + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTrimming( BOOL enabled ) +{ + if (enabled) { + reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_T_MASK; + } else { + reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_T_MASK; + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetOutputFormat + + Description: set CAMERA output format. + + Arguments: output one of CameraOutput to set. + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetOutputFormat( CameraOutput output ) +{ + switch (output) { + case CAMERA_OUTPUT_YUV: + reg_CAM_CAM_CNT &= ~(1 << REG_CAM_CAM_CNT_F_SHIFT); + break; + case CAMERA_OUTPUT_RGB: + reg_CAM_CAM_CNT |= (1 << REG_CAM_CAM_CNT_F_SHIFT); + break; + default: + break; + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_GetErrorStatus + + Description: whether line buffer has occurred some errors or not + + Arguments: None + + Returns: TRUE if error has occurred + *---------------------------------------------------------------------------*/ +BOOL CAMERA_GetErrorStatus( void ) +{ + return (reg_CAM_CAM_CNT & REG_CAM_CAM_CNT_ERR_MASK) ? TRUE : FALSE; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ClearBuffer + + Description: clear line buffer and error status + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_ClearBuffer( void ) +{ + reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_CL_MASK; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetMasterIntrrupt + + Description: set interrupt mode + + Arguments: enabled TRUE if set master interrupt will be enabled + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetMasterIntrrupt( BOOL enabled ) +{ + if (enabled) { + reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_IREQ_I_MASK; + } else { + reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_IREQ_I_MASK; + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetVsyncIntrrupt + + Description: set vsync interrupt mode + + Arguments: type one of CameraIntrVsync to set + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetVsyncIntrrupt( CameraIntrVsync type ) +{ + reg_CAM_CAM_CNT = (u16)((reg_CAM_CAM_CNT & ~REG_CAM_CAM_CNT_IREQ_VS_MASK) | type); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetBufferErrorIntrrupt + + Description: set buffer error interrupt mode + + Arguments: enabled TRUE if set buffer error interrupt will be enabled + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetBufferErrorIntrrupt( BOOL enabled ) +{ + if (enabled) { + reg_CAM_CAM_CNT |= REG_CAM_CAM_CNT_IREQ_BE_MASK; + } else { + reg_CAM_CAM_CNT &= ~REG_CAM_CAM_CNT_IREQ_BE_MASK; + } +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTransferLines + + Description: set number of lines to store the buffer at once. + + Arguments: lines number of lines + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTransferLines( int lines ) +{ + if (lines >= 1 && lines <= 16) + { + u16 bits = (u16)((lines - 1) << REG_CAM_CAM_CNT_TL_SHIFT); + reg_CAM_CAM_CNT = (u16)((reg_CAM_CAM_CNT & ~REG_CAM_CAM_CNT_TL_MASK) | bits); + } +} diff --git a/build/libraries/camera/ARM9/camera_api.c b/build/libraries/camera/ARM9/camera_api.c new file mode 100644 index 0000000..a839eb8 --- /dev/null +++ b/build/libraries/camera/ARM9/camera_api.c @@ -0,0 +1,1164 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - library - camera + File: camera.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#include +#include + +/*---------------------------------------------------------------------------* + ’è”’è‹` + *---------------------------------------------------------------------------*/ +// ‹l‚߂ăRƒs[‚·‚é +#define CAMERA_PACK_U16(d, s) \ + ((d)[0] = (u8)((*((u16*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u16*)s) >> 8) & 0xFF)) + +#define CAMERA_PACK_U32(d, s) \ + ((d)[0] = (u8)((*((u32*)s) >> 0) & 0xFF), \ + (d)[1] = (u8)((*((u32*)s) >> 8) & 0xFF), \ + (d)[2] = (u8)((*((u32*)s) >> 16) & 0xFF), \ + (d)[3] = (u8)((*((u32*)s) >> 24) & 0xFF)) + +// ƒf[ƒ^”‚ðÝ’è‚·‚é +#define CAMERA_SUBSEQUENT_NUMS(a) (((a) << CAMERA_PXI_SUBSEQUENT_NUMS_SHIFT) & CAMERA_PXI_SUBSEQUENT_NUMS_MASK) + +/*---------------------------------------------------------------------------* + Œ^’è‹` + *---------------------------------------------------------------------------*/ +typedef struct CAMERAWork +{ + BOOL lock; + CAMERACallback callback; + CAMERAResult result; // 擪ƒf[ƒ^‚¾‚¯•ʘg + void *callbackArg; + CAMERAPxiCommand command; // ƒRƒ}ƒ“ƒhŽí•Ê + CAMERAPxiResult pxiResult; // 擪ƒf[ƒ^‚¾‚¯•ʘg + u8 current; // ŽóMς݃f[ƒ^ŒÂ” (ƒoƒCƒg’PˆÊ) (擪‚𜂭!!) + u8 total; // ÅIƒf[ƒ^ŒÂ” (1 + Œã‘±ƒRƒ}ƒ“ƒh*3) + u8 *data; // save API arg if any + size_t size; // save API arg if any +} +CAMERAWork; + +/*---------------------------------------------------------------------------* + ÓI•Ï”’è‹` + *---------------------------------------------------------------------------*/ +static BOOL cameraInitialized; +static CAMERAWork cameraWork; + +/*---------------------------------------------------------------------------* + “à•”ŠÖ”’è‹` + *---------------------------------------------------------------------------*/ +static BOOL CameraSendPxiCommand(CAMERAPxiCommand command, u8 size, u8 data); +static BOOL CameraSendPxiData(u8 *pData); +static void CameraPxiCallback(PXIFifoTag tag, u32 data, BOOL err); +static void CameraSyncCallback(CAMERAResult result, void *arg); +static void CameraCallCallbackAndUnlock(CAMERAResult result); +static void CameraWaitBusy(void); + +/*---------------------------------------------------------------------------* + Name: CAMERA_Init + + Description: CAMERAƒ‰ƒCƒuƒ‰ƒŠ‚ð‰Šú‰»‚·‚éB + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void CAMERA_Init(void) +{ + // ‰Šú‰»Ï‚Ý‚ðŠm”F + if (cameraInitialized) + { + return; + } + cameraInitialized = 1; + + // •Ï”‰Šú‰» + cameraWork.lock = FALSE; + cameraWork.callback = NULL; + + // PXIŠÖ˜A‚ð‰Šú‰» + PXI_Init(); + while (!PXI_IsCallbackReady(PXI_FIFO_TAG_CAMERA, PXI_PROC_ARM7)) + { + } + PXI_SetFifoRecvCallback(PXI_FIFO_TAG_CAMERA, CameraPxiCallback); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetStbyn2Async + + Description: select STBYN for 2nd CAMERA + async version + + Arguments: state - High/Low + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetStbyn2Async(BOOL state, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_SET_STBYN; + const u8 size = CAMERA_PXI_SIZE_SET_STBYN; + OSIntrMode enabled; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + return CameraSendPxiCommand(command, size, (u8)state) ? CAMERA_RESULT_SUCCESS : CAMERA_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetStbyn2 + + Description: select STBYN for 2nd CAMERA + sync version. + + Arguments: state - High/Low + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetStbyn2(BOOL state) +{ + cameraWork.result = CAMERA_SetStbyn2Async(state, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + + +/*---------------------------------------------------------------------------* + Name: CAMERA_WriteRegistersAsync + + Description: write CAMERA registers via I2C. + async version. + + Arguments: addr - start address + bufp - buffer to write + length - length of bufp + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_WriteRegistersAsync(u8 addr, const u8* bufp, size_t length, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_WRITE_REGISTERS; + u8 size; // variable!! + OSIntrMode enabled; + u8 data[CAMERA_PXI_DATA_SIZE_MAX]; + int i; + + SDK_NULL_ASSERT(bufp); + SDK_NULL_ASSERT(callback); + + if (length + 2 > CAMERA_PXI_DATA_SIZE_MAX) + { + return CAMERA_RESULT_ILLEGAL_PARAMETER; // too long + } + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + // ƒf[ƒ^ì¬ + data[0] = addr; + data[1] = (u8)length; + MI_CpuCopy8(bufp, &data[2], length); + size = (u8)(length + 2); + + // ƒRƒ}ƒ“ƒh‘—M + if (CameraSendPxiCommand(command, size, data[0]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + for (i = 1; i < size; i+=3) { + if (CameraSendPxiData(&data[i]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + } + + return CAMERA_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_WriteRegisters + + Description: write CAMERA registers via I2C. + sync version. + + Arguments: addr - start address + bufp - buffer to write + length - length of bufp + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_WriteRegisters(u8 addr, const u8* bufp, size_t length) +{ + cameraWork.result = CAMERA_WriteRegistersAsync(addr, bufp, length, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ReadRegistersAsync + + Description: read CAMERA registers via I2C. + + Arguments: addr - start address + bufp - buffer to read + length - length of bufp + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ReadRegistersAsync(u8 addr, u8* bufp, size_t length, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_READ_REGISTERS; + const u8 size = CAMERA_PXI_SIZE_READ_REGISTERS; + OSIntrMode enabled; + u8 data[size]; + int i; + + SDK_NULL_ASSERT(bufp); + SDK_NULL_ASSERT(callback); + + if (length + 2 > CAMERA_PXI_DATA_SIZE_MAX) + { + return CAMERA_RESULT_ILLEGAL_PARAMETER; // too long + } + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + // ƒf[ƒ^ì¬ + data[0] = addr; + data[1] = (u8)length; + + // ˆø”•Û‘¶ + cameraWork.data = bufp; + cameraWork.size = (u8)length; + + // ƒRƒ}ƒ“ƒh‘—M + if (CameraSendPxiCommand(command, size, data[0]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + for (i = 1; i < size; i+=3) { + if (CameraSendPxiData(&data[i]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + } + + return CAMERA_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ReadRegisters + + Description: set CAMERA key normally + sync version. + + Arguments: pKey - pointer to key data + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ReadRegisters(u8 addr, u8* bufp, size_t length) +{ + cameraWork.result = CAMERA_ReadRegistersAsync(addr, bufp, length, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetParamsAsync + + Description: set register as reg = (reg & ~mask) | (bits & mask); + + Arguments: addr - address to access + bits - bits to set + mask - mask to touch + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetParamsAsync(u8 addr, u8 bits, u8 mask, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_SET_PARAMS; + const u8 size = CAMERA_PXI_SIZE_SET_PARAMS; + OSIntrMode enabled; + u8 data[size]; + int i; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + // ƒf[ƒ^ì¬ + data[0] = addr; + data[1] = bits; + data[2] = mask; + + // ƒRƒ}ƒ“ƒh‘—M + if (CameraSendPxiCommand(command, size, data[0]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + for (i = 1; i < size; i+=3) { + if (CameraSendPxiData(&data[i]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + } + + return CAMERA_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetParams + + Description: set register as reg = (reg & ~mask) | (bits & mask); + + Arguments: addr - address to access + bits - bits to set + mask - mask to touch + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetParams(u8 addr, u8 bits, u8 mask) +{ + cameraWork.result = CAMERA_SetParamsAsync(addr, bits, mask, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetFlagsAsync + + Description: set register as reg |= bits; + + Arguments: addr - address to access + bits - bits to set + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetFlagsAsync(u8 addr, u8 bits, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_SET_FLAGS; + const u8 size = CAMERA_PXI_SIZE_SET_FLAGS; + OSIntrMode enabled; + u8 data[size]; + int i; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + // ƒf[ƒ^ì¬ + data[0] = addr; + data[1] = bits; + + // ƒRƒ}ƒ“ƒh‘—M + if (CameraSendPxiCommand(command, size, data[0]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + for (i = 1; i < size; i+=3) { + if (CameraSendPxiData(&data[i]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + } + + return CAMERA_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetFlags + + Description: set register as reg |= bits; + + Arguments: addr - address to access + bits - bits to set + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetFlags(u8 addr, u8 bits) +{ + cameraWork.result = CAMERA_SetFlagsAsync(addr, bits, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ClearFlagsAsync + + Description: set register as reg &= ~bits; + + Arguments: addr - address to access + bits - bits to clear + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ClearFlagsAsync(u8 addr, u8 bits, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_CLEAR_FLAGS; + const u8 size = CAMERA_PXI_SIZE_CLEAR_FLAGS; + OSIntrMode enabled; + u8 data[size]; + int i; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + // ƒf[ƒ^ì¬ + data[0] = addr; + data[1] = bits; + + // ƒRƒ}ƒ“ƒh‘—M + if (CameraSendPxiCommand(command, size, data[0]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + for (i = 1; i < size; i+=3) { + if (CameraSendPxiData(&data[i]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + } + + return CAMERA_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ClearFlags + + Description: set register as reg &= ~bits; + + Arguments: addr - address to access + bits - bits to set + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ClearFlags(u8 addr, u8 bits) +{ + cameraWork.result = CAMERA_ClearFlagsAsync(addr, bits, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CInitAsync + + Description: initialize camera registers via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CInitAsync(CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_I2C_INIT; + const u8 size = CAMERA_PXI_SIZE_I2C_INIT; + OSIntrMode enabled; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + return CameraSendPxiCommand(command, size, 0) ? CAMERA_RESULT_SUCCESS : CAMERA_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CInit + + Description: initialize camera registers via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CInit(void) +{ + cameraWork.result = CAMERA_I2CInitAsync(CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPresetAsync + + Description: set camera registers with specified preset via I2C + async version + + Arguments: preset - preset type + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPresetAsync(CameraPreset preset, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_I2C_PRESET; + const u8 size = CAMERA_PXI_SIZE_I2C_PRESET; + OSIntrMode enabled; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + return CameraSendPxiCommand(command, size, (u8)preset) ? CAMERA_RESULT_SUCCESS : CAMERA_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreset + + Description: set camera registers with specified preset via I2C + sync version. + + Arguments: preset - preset type + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPreset(CameraPreset preset) +{ + cameraWork.result = CAMERA_I2CPresetAsync(preset, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreSleepAsync + + Description: pre-sleep process in camera registers via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPreSleepAsync(CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_I2C_PRE_SLEEP; + const u8 size = CAMERA_PXI_SIZE_I2C_PRE_SLEEP; + OSIntrMode enabled; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + return CameraSendPxiCommand(command, size, 0) ? CAMERA_RESULT_SUCCESS : CAMERA_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreSleep + + Description: pre-sleep process in camera registers via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPreSleep(void) +{ + cameraWork.result = CAMERA_I2CPreSleepAsync(CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPostSleepAsync + + Description: post-sleep process in camera registers via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPostSleepAsync(CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_I2C_POST_SLEEP; + const u8 size = CAMERA_PXI_SIZE_I2C_POST_SLEEP; + OSIntrMode enabled; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + return CameraSendPxiCommand(command, size, 0) ? CAMERA_RESULT_SUCCESS : CAMERA_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPostSleep + + Description: post-sleep process in camera registers via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPostSleep(void) +{ + cameraWork.result = CAMERA_I2CPostSleepAsync(CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetCroppingAsync + + Description: set offset and size + + Arguments: x_off - x offset to start capturing + y_off - y offset to start capturing + width - width of image + height - height of image + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetCroppingAsync(u16 x_off, u16 y_off, u16 width, u16 height, CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_I2C_SET_CROPPING; + const u8 size = CAMERA_PXI_SIZE_I2C_SET_CROPPING; + OSIntrMode enabled; + u8 data[size]; + int i; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + // ƒf[ƒ^ì¬ + CAMERA_PACK_U16(&data[0], &x_off); + CAMERA_PACK_U16(&data[2], &y_off); + CAMERA_PACK_U16(&data[4], &width); + CAMERA_PACK_U16(&data[6], &height); + + // ƒRƒ}ƒ“ƒh‘—M + if (CameraSendPxiCommand(command, size, data[0]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + for (i = 1; i < size; i+=3) { + if (CameraSendPxiData(&data[i]) == FALSE) + { + return CAMERA_RESULT_SEND_ERROR; + } + } + + return CAMERA_RESULT_SUCCESS; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetCropping + + Description: set offset and size + + Arguments: x_off - x offset to start capturing + y_off - y offset to start capturing + width - width of image + height - height of image + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetCropping(u16 x_off, u16 y_off, u16 width, u16 height) +{ + cameraWork.result = CAMERA_SetCroppingAsync(x_off, y_off, width, height, CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_PauseAsync + + Description: pause camera via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_PauseAsync(CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_I2C_PAUSE; + const u8 size = CAMERA_PXI_SIZE_I2C_PAUSE; + OSIntrMode enabled; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + return CameraSendPxiCommand(command, size, 0) ? CAMERA_RESULT_SUCCESS : CAMERA_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_Pause + + Description: pause camera via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_Pause(void) +{ + cameraWork.result = CAMERA_PauseAsync(CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ResumeAsync + + Description: resume camera from pausing via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ResumeAsync(CAMERACallback callback, void *arg) +{ + const CAMERAPxiCommand command = CAMERA_PXI_COMMAND_I2C_RESUME; + const u8 size = CAMERA_PXI_SIZE_I2C_RESUME; + OSIntrMode enabled; + + SDK_NULL_ASSERT(callback); + + enabled = OS_DisableInterrupts(); + if (cameraWork.lock) + { + (void)OS_RestoreInterrupts(enabled); + return CAMERA_RESULT_BUSY; + } + cameraWork.lock = TRUE; + (void)OS_RestoreInterrupts(enabled); + // ƒR[ƒ‹ƒoƒbƒNÝ’è + cameraWork.callback = callback; + cameraWork.callbackArg = arg; + + return CameraSendPxiCommand(command, size, 0) ? CAMERA_RESULT_SUCCESS : CAMERA_RESULT_SEND_ERROR; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_Resume + + Description: resume camera from pausing via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_Resume(void) +{ + cameraWork.result = CAMERA_ResumeAsync(CameraSyncCallback, 0); + if (cameraWork.result == CAMERA_RESULT_SUCCESS) + { + CameraWaitBusy(); + } + return cameraWork.result; +} + +/*---------------------------------------------------------------------------* + Name: CameraSendPxiCommand + + Description: Žw’èæ“ªƒRƒ}ƒ“ƒh‚ðPXIŒo—R‚ÅARM7‚É‘—M‚·‚éB + + Arguments: command - ‘ÎÛƒRƒ}ƒ“ƒh + size - ‘—Mƒf[ƒ^ƒTƒCƒY (ƒoƒCƒg’PˆÊ) + data - 擪ƒf[ƒ^ (1ƒoƒCƒg‚Ì‚Ý) + + Returns: BOOL - PXI‚ɑ΂µ‚Ä‘—M‚ªŠ®—¹‚µ‚½ê‡TRUE‚ðA + PXI‚É‚æ‚é‘—M‚ÉŽ¸”s‚µ‚½ê‡FALSE‚ð•Ô‚·B + *---------------------------------------------------------------------------*/ +static BOOL CameraSendPxiCommand(CAMERAPxiCommand command, u8 size, u8 data) +{ + u32 pxiData = (u32)(CAMERA_PXI_START_BIT | + ((command << CAMERA_PXI_COMMAND_SHIFT) & CAMERA_PXI_COMMAND_MASK) | + ((size << CAMERA_PXI_DATA_NUMS_SHIFT) & CAMERA_PXI_DATA_NUMS_MASK) | + ((data << CAMERA_PXI_1ST_DATA_SHIFT) & CAMERA_PXI_1ST_DATA_MASK)); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: CameraSendPxiData + + Description: Žw’èŒã‘±ƒf[ƒ^‚ðPXIŒo—R‚ÅARM7‚É‘—M‚·‚éB + + Arguments: pData - 3ƒoƒCƒgƒf[ƒ^‚Ìæ“ª‚ւ̃|ƒCƒ“ƒ^ + + Returns: BOOL - PXI‚ɑ΂µ‚Ä‘—M‚ªŠ®—¹‚µ‚½ê‡TRUE‚ðA + PXI‚É‚æ‚é‘—M‚ÉŽ¸”s‚µ‚½ê‡FALSE‚ð•Ô‚·B + *---------------------------------------------------------------------------*/ +static BOOL CameraSendPxiData(u8 *pData) +{ + u32 pxiData = (u32)((pData[0] << 16) | (pData[1] << 8) | pData[2]); + if (0 > PXI_SendWordByFifo(PXI_FIFO_TAG_CAMERA, pxiData, 0)) + { + return FALSE; + } + return TRUE; +} + +/*---------------------------------------------------------------------------* + Name: CameraPxiCallback + + Description: ”ñ“¯ŠúRTCŠÖ”—p‚Ì‹¤’ʃR[ƒ‹ƒoƒbƒNŠÖ”B + + Arguments: tag - PXI tag which show message type. + data - message from ARM7. + err - PXI transfer error flag. + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CameraPxiCallback(PXIFifoTag tag, u32 data, BOOL err) +{ +#pragma unused( tag ) + CAMERAResult result; + + // PXI’ÊMƒGƒ‰[‚ðŠm”F + if (err) + { + // ƒV[ƒPƒ“ƒX‚ð‹­§I—¹ + CameraCallCallbackAndUnlock(CAMERA_RESULT_FATAL_ERROR); + return; + } + // 擪ƒf[ƒ^ + if (data & CAMERA_PXI_START_BIT) + { + // ŽóMƒf[ƒ^‚ð‰ðÍ + SDK_ASSERT((data & CAMERA_PXI_RESULT_BIT) == CAMERA_PXI_RESULT_BIT); + cameraWork.total = (u8)((data & CAMERA_PXI_DATA_NUMS_MASK) >> CAMERA_PXI_DATA_NUMS_SHIFT); + cameraWork.current = 0; + cameraWork.command = (CAMERAPxiCommand)((data & CAMERA_PXI_COMMAND_MASK) >> CAMERA_PXI_COMMAND_SHIFT); + cameraWork.pxiResult = (CAMERAPxiResult)((data & CAMERA_PXI_1ST_DATA_MASK) >> CAMERA_PXI_1ST_DATA_SHIFT); + } + // Œã‘±ƒf[ƒ^ + else + { + if (cameraWork.data == NULL) + { + // ƒV[ƒPƒ“ƒX‚ð‹­§I—¹ + CameraCallCallbackAndUnlock(CAMERA_RESULT_FATAL_ERROR); + return; + } + if (cameraWork.current < cameraWork.size) + { + cameraWork.data[cameraWork.current++] = (u8)((data & 0xFF0000) >> 16); + } + if (cameraWork.current < cameraWork.size) + { + cameraWork.data[cameraWork.current++] = (u8)((data & 0x00FF00) >> 8); + } + if (cameraWork.current < cameraWork.size) + { + cameraWork.data[cameraWork.current++] = (u8)((data & 0x0000FF) >> 0); + } + } + + if (cameraWork.current >= cameraWork.total-1) // > ‚Í–³‚¢‚Í‚¸ + { + // ˆ—Œ‹‰Ê‚ðŠm”F + switch (cameraWork.pxiResult) + { + case CAMERA_PXI_RESULT_SUCCESS: + result = CAMERA_RESULT_SUCCESS; + break; + case CAMERA_PXI_RESULT_SUCCESS_TRUE: + result = CAMERA_RESULT_SUCCESS_TRUE; + break; + case CAMERA_PXI_RESULT_SUCCESS_FALSE: + result = CAMERA_RESULT_SUCCESS_FALSE; + break; + case CAMERA_PXI_RESULT_INVALID_COMMAND: + result = CAMERA_RESULT_INVALID_COMMAND; + break; + case CAMERA_PXI_RESULT_INVALID_PARAMETER: + result = CAMERA_RESULT_ILLEGAL_PARAMETER; + break; + case CAMERA_PXI_RESULT_ILLEGAL_STATUS: + result = CAMERA_RESULT_ILLEGAL_STATUS; + break; + case CAMERA_PXI_RESULT_BUSY: + result = CAMERA_RESULT_BUSY; + break; + default: + result = CAMERA_RESULT_FATAL_ERROR; + } + + // ƒR[ƒ‹ƒoƒbƒN‚̌ĂÑo‚µ + CameraCallCallbackAndUnlock(result); + } +} + +/*---------------------------------------------------------------------------* + Name: CameraSyncCallback + + Description: “¯ŠúAPI—p‚̃R[ƒ‹ƒoƒbƒN + + Arguments: result - ARM7‚©‚ç‘—‚ç‚ꂽŒ‹‰Ê + arg - –¢Žg—p + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CameraSyncCallback(CAMERAResult result, void *arg) +{ +#pragma unused(arg) + cameraWork.result = result; +} + +/*---------------------------------------------------------------------------* + Name: CameraCallCallbackAndUnlock + + Description: ƒR[ƒ‹ƒoƒbƒN‚̌ĂÑo‚µ‚ƃƒbƒN‚̉ðœ‚ðs‚¤ + + Arguments: result - ARM7‚©‚ç‘—‚ç‚ꂽŒ‹‰Ê + + Returns: None. + *---------------------------------------------------------------------------*/ +static void CameraCallCallbackAndUnlock(CAMERAResult result) +{ + CAMERACallback cb; + + if (cameraWork.lock) + { + cameraWork.lock = FALSE; + } + if (cameraWork.callback) + { + cb = cameraWork.callback; + cameraWork.callback = NULL; + cb(result, cameraWork.callbackArg); + } +} + +/*---------------------------------------------------------------------------* + Name: CameraWaitBusy + + Description: CAMERA‚Ì”ñ“¯Šúˆ—‚ªƒƒbƒN‚³‚ê‚Ä‚¢‚éŠÔ‘Ò‚ÂB + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +#if 0 +#include +static asm void CameraWaitBusy(void) +{ + ldr r12, =cameraWork.lock +loop: + ldr r0, [ r12, #0 ] + cmp r0, #TRUE + beq loop + bx lr +} +#include +#else +extern void PXIi_HandlerRecvFifoNotEmpty(void); +static void CameraWaitBusy(void) +{ + volatile BOOL *p = &cameraWork.lock; + + while (*p) + { + if (OS_GetCpsrIrq() == OS_INTRMODE_IRQ_DISABLE) + { + PXIi_HandlerRecvFifoNotEmpty(); + } + } +} +#endif diff --git a/build/libraries/camera/Makefile b/build/libraries/camera/Makefile new file mode 100644 index 0000000..59b8458 --- /dev/null +++ b/build/libraries/camera/Makefile @@ -0,0 +1,34 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - libraries - aes +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Log: $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = ARM9 + +ifdef TWL_WITH_ARM7 +SUBDIRS += ARM7 +endif + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/Makefile b/build/tests/Makefile index 49be822..7db7251 100644 --- a/build/tests/Makefile +++ b/build/tests/Makefile @@ -23,7 +23,8 @@ include $(TWLSDK_ROOT)/build/buildtools/commondefs SUBDIRS = os \ mi \ aes \ - snd + snd \ + camera \ #---------------------------------------------------------------------------- diff --git a/build/tests/camera/Makefile b/build/tests/camera/Makefile new file mode 100644 index 0000000..e3c54c1 --- /dev/null +++ b/build/tests/camera/Makefile @@ -0,0 +1,31 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - tests - camera +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Log: $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +SUBDIRS = camera-1 + + +#---------------------------------------------------------------------------- + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/camera/camera-1/ARM7/Makefile b/build/tests/camera/camera-1/ARM7/Makefile new file mode 100644 index 0000000..30e5acf --- /dev/null +++ b/build/tests/camera/camera-1/ARM7/Makefile @@ -0,0 +1,44 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - CAMERA - demos - camera-1 +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Log: $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +#TWL_CODEGEN = THUMB +TWL_PROC = ARM7 + +TARGET_BIN = main.axf + +SRCS = main.c + +#SRCDIR = # using default +#LCFILE = # using default + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + + +#===== End of Makefile ===== diff --git a/build/tests/camera/camera-1/ARM7/src/main.c b/build/tests/camera/camera-1/ARM7/src/main.c new file mode 100644 index 0000000..9463064 --- /dev/null +++ b/build/tests/camera/camera-1/ARM7/src/main.c @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - tests - snd - channel + File: main.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: main.c,v $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include +#include + +/*---------------------------------------------------------------------------* + ’è”’è‹` + *---------------------------------------------------------------------------*/ +// ===== ƒXƒŒƒbƒh—Dæ“x ===== + +#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‰Šú‰»AARM9‚Æ“¯Šú + PXI_Init(); + + // ƒq[ƒv—̈æÝ’è + heapHandle = InitializeAllocateSystem(); + + // ƒJƒƒ‰‰Šú‰» + CAMERA_Init(THREAD_PRIO_CAMERA); + + // ƒ{ƒ^ƒ““ü—̓T[ƒ`‰Šú‰» + (void)PAD_InitXYButton(); + + // Š„ž‚Ý‹–‰Â + (void)OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)GX_VBlankIntr(TRUE); + (void)OS_EnableIrq(); + (void)OS_EnableInterrupts(); + + // SPI‰Šú‰» +// SPI_Init(THREAD_PRIO_SPI); + + while (TRUE) + { + OS_Halt(); + + //---- check reset + if (OS_IsResetOccurred()) + { + OS_ResetSystem(); + } + } +} + +/*---------------------------------------------------------------------------* + Name: InitializeAllocateSystem + + Description: ƒƒ‚ƒŠŠ„“–‚ăVƒXƒeƒ€‚ð‰Šú‰»‚·‚éB + + 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); + + // ƒAƒŠ[ƒi‚ð0ƒNƒŠƒA + MI_CpuClear8(tempLo, (u32)OS_GetWramSubPrivArenaHi() - (u32)tempLo); + + // ƒAƒŠ[ƒi‰ºˆÊƒAƒhƒŒƒX‚ðÝ’è + OS_SetArenaLo(OS_ARENA_WRAM_SUBPRIV, tempLo); + + // ƒq[ƒvì¬ + hh = OS_CreateHeap(OS_ARENA_WRAM_SUBPRIV, + OS_GetWramSubPrivArenaLo(), OS_GetWramSubPrivArenaHi()); + + if (hh < 0) + { + OS_Panic("ARM7: Fail to create heap.\n"); + } + + // ƒJƒŒƒ“ƒgƒq[ƒv‚ÉÝ’è + (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 + *---------------------------------------------------------------------------*/ diff --git a/build/tests/camera/camera-1/ARM9/Makefile b/build/tests/camera/camera-1/ARM9/Makefile new file mode 100644 index 0000000..c5404f3 --- /dev/null +++ b/build/tests/camera/camera-1/ARM9/Makefile @@ -0,0 +1,41 @@ +#! make -f +#---------------------------------------------------------------------------- +# Project: TwlSDK - CAMERA - demos - camera-1 +# File: Makefile +# +# Copyright 2007 Nintendo. All rights reserved. +# +# These coded instructions, statements, and computer programs contain +# proprietary information of Nintendo of America Inc. and/or Nintendo +# Company Ltd., and are protected by Federal copyright law. They may +# not be disclosed to third parties or copied or duplicated in any form, +# in whole or in part, without the prior written consent of Nintendo. +# +# $Log: Makefile,v $ +# $NoKeywords: $ +#---------------------------------------------------------------------------- + +SUBDIRS = + + +#---------------------------------------------------------------------------- + +#TWL_CODEGEN = THUMB + +TARGET_BIN = main.axf + +SRCS = main.c + +#SRCDIR = # using default +#LCFILE = # using default + +include $(TWLSDK_ROOT)/build/buildtools/commondefs + + +#---------------------------------------------------------------------------- + +do-build: $(TARGETS) + +include $(TWLSDK_ROOT)/build/buildtools/modulerules + +#===== End of Makefile ===== diff --git a/build/tests/camera/camera-1/ARM9/src/main.c b/build/tests/camera/camera-1/ARM9/src/main.c new file mode 100644 index 0000000..7420ac9 --- /dev/null +++ b/build/tests/camera/camera-1/ARM9/src/main.c @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - SND - demos - capture + File: main.c + + Copyright 2005,2006 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: main.c,v $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#include +#include + +#define DMA_NO 5 +#define WIDTH 256 +#define HEIGHT 192 + +static void VBlankIntr(void); +static void CameraIntr(void); + +/*---------------------------------------------------------------------------* + Name: TwlMain + + Description: main + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void TwlMain() +{ + // ‰Šú‰» + OS_Init(); + GX_Init(); + OS_InitTick(); + + // Vƒuƒ‰ƒ“ƒNŠ„‚èž‚ÝÝ’è + OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr); + (void)OS_EnableIrqMask(OS_IE_V_BLANK); + (void)OS_EnableIrq(); + (void)GX_VBlankIntr(TRUE); + { + u16 bg_color = GX_RGB(31, 0, 0); + GX_LoadBGPltt(&bg_color, 0, sizeof(u16)); + } + + // VRAM•\ަƒ‚[ƒh + 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(); + + // ƒJƒƒ‰‰Šú‰» + CAMERA_Init(); + + CAMERA_SelectCamera(CAMERA_SELECT_FIRST); + CAMERA_PowerOn(); + CAMERA_I2CInit(); + CAMERA_I2CPreset(CAMERA_PRESET_QVGA_30SD); + + CAMERA_SetTrimmingParamsCenter(WIDTH, HEIGHT, 320, 240); // clipped by camera i/f + CAMERA_SetTrimming(TRUE); + CAMERA_SetOutputFormat(CAMERA_OUTPUT_RGB); + CAMERA_SetTransferLines(CAMERA_GET_MAX_LINES(WIDTH)); + + // ƒJƒƒ‰Š„‚èž‚ÝÝ’è + CAMERA_SetVsyncIntrrupt(CAMERA_INTR_VSYNC_NEGATIVE_EDGE); + CAMERA_SetBufferErrorIntrrupt(TRUE); + CAMERA_SetMasterIntrrupt(TRUE); + OS_SetIrqFunction(OS_IE_CAM, CameraIntr); + (void)OS_EnableIrqMask(OS_IE_CAM); + + // ƒJƒƒ‰ƒXƒ^[ƒg + CAMERA_ClearBuffer(); + // DMA will be started by CameraIntr() + CAMERA_Start(); + + while (1) + { + OS_WaitVBlankIntr(); + } +} + +//-------------------------------------------------------------------------------- +// ‚uƒuƒ‰ƒ“ƒNŠ„‚螂݈— +// +void VBlankIntr(void) +{ + OS_SetIrqCheckFlag(OS_IE_V_BLANK); // checking VBlank interrupt +} +#define PRINT_RATE 32 +void CameraIntr(void) +{ + if (CAMERA_GetErrorStatus()) + { + OS_TPrintf("Error was occurred.\n"); + CAMERA_Stop(); + MIi_StopExDma(DMA_NO); + while (CAMERA_IsBusy()) + { + } + CAMERA_ClearBuffer(); + CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, CAMERA_GET_LINE_BYTES(WIDTH) * CAMERA_GET_MAX_LINES(WIDTH), CAMERA_GET_LINE_BYTES(WIDTH) * HEIGHT); + CAMERA_Start(); + } + else + { + static int count = 0; + static OSTick prev = 0; + static OSTick save[PRINT_RATE]; + OSTick current = OS_GetTick(); + if (MIi_IsExDmaBusy(DMA_NO)) + { + OS_TPrintf("Why??? %d\n", (int)current); + OS_SetIrqCheckFlag(OS_IE_CAM); + return; + } + CAMERA_DmaRecvAsync(DMA_NO, (void *)HW_LCDC_VRAM_A, CAMERA_GET_LINE_BYTES(WIDTH) * CAMERA_GET_MAX_LINES(WIDTH), CAMERA_GET_LINE_BYTES(WIDTH) * HEIGHT); + if (count == PRINT_RATE) + { + int i; + OSTick uspf = 0; + for (i = 0; i < count; i++) + { + uspf += OS_TicksToMicroSeconds(save[i]); + } + uspf /= count; + OS_TPrintf("%2d.%03d fps\n", (int)(1000000LL / uspf), (int)(1000000000LL / uspf) % 1000); + count = 0; + } + if (prev) + save[count++] = current - prev; + prev = current; + } + OS_SetIrqCheckFlag(OS_IE_CAM); // checking camera interrupt +} diff --git a/build/tests/camera/camera-1/Makefile b/build/tests/camera/camera-1/Makefile new file mode 100644 index 0000000..078ec37 --- /dev/null +++ b/build/tests/camera/camera-1/Makefile @@ -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 ===== diff --git a/include/nitro/pxi/common/fifo.h b/include/nitro/pxi/common/fifo.h index 20c1697..25ff4c8 100644 --- a/include/nitro/pxi/common/fifo.h +++ b/include/nitro/pxi/common/fifo.h @@ -112,6 +112,7 @@ typedef enum PXI_FIFO_TAG_CTRDG_Ex, // Cartridge Ex PXI_FIFO_TAG_CTRDG_PHI, // Cartridge PHI PXI_FIFO_TAG_AES, // AES + PXI_FIFO_TAG_CAMERA, // Camera PXI_MAX_FIFO_TAG = 32 // MAX FIFO TAG } diff --git a/include/twl/camera.h b/include/twl/camera.h new file mode 100644 index 0000000..d52d00a --- /dev/null +++ b/include/twl/camera.h @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - CAMERA - include + File: camera.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef TWL_CAMERA_H_ +#define TWL_CAMERA_H_ + +#include +#include + +#ifdef SDK_ARM7 + +#include +#include + +#else + +#include +#include +#include + +#endif + +/* TWL_LCDC_H_ */ +#endif diff --git a/include/twl/camera/ARM7/control.h b/include/twl/camera/ARM7/control.h new file mode 100644 index 0000000..cea9c48 --- /dev/null +++ b/include/twl/camera/ARM7/control.h @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - library - camera + File: control.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef TWL_CAMERA_CONTROL_H_ +#define TWL_CAMERA_CONTROL_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +/*---------------------------------------------------------------------------* + ’è”’è‹` + *---------------------------------------------------------------------------*/ +#define CAMERA_MESSAGE_ARRAY_MAX 4 // ƒXƒŒƒbƒh“¯Šú—pƒƒbƒZ[ƒWƒLƒ…[‚̃TƒCƒY +#define CAMERA_THREAD_STACK_SIZE 256 // ƒXƒŒƒbƒh‚̃Xƒ^ƒbƒNƒTƒCƒY + +/*---------------------------------------------------------------------------* + \‘¢‘Ì’è‹` + *---------------------------------------------------------------------------*/ +// CAMERAƒ‰ƒCƒuƒ‰ƒŠ—pƒ[ƒN\‘¢‘Ì + +typedef struct CAMERAWork +{ + OSMessageQueue msgQ; // ƒXƒŒƒbƒh“¯Šú—pƒƒbƒZ[ƒWƒLƒ…[ + OSMessage msgArray[CAMERA_MESSAGE_ARRAY_MAX]; + // ƒƒbƒZ[ƒW‚ðŠi”[‚·‚éƒoƒbƒtƒ@ + OSThread thread; // CAMERA—pƒXƒŒƒbƒh + u64 stack[CAMERA_THREAD_STACK_SIZE / sizeof(u64)]; + // CAMERA—pƒXƒŒƒbƒh‚̃Xƒ^ƒbƒN + + CAMERAPxiCommand command; // ƒRƒ}ƒ“ƒhŽí•Ê + u8 current; // ŽóMς݃f[ƒ^ŒÂ” (ƒoƒCƒg’PˆÊ) + u8 total; // ÅIƒf[ƒ^ŒÂ” (1 + Œã‘±ƒRƒ}ƒ“ƒh*3) + u8 data[CAMERA_PXI_DATA_SIZE_MAX]; + // ARM9‚©‚ç‚̃f[ƒ^•Û‘¶—p +} +CAMERAWork; + +/*---------------------------------------------------------------------------* + ŠÖ”’è‹` + *---------------------------------------------------------------------------*/ +void CAMERA_Init(u32 priority); // ‰Šú‰»A‹y‚уXƒŒƒbƒh‚ðŠJŽn +void CAMERA_Lock(void); // ARM7‘¤‚ÅŽg‚¤‚½‚߂ɃƒbƒN‚·‚é +BOOL CAMERA_TryLock(void); // ARM7‘¤‚ÅŽg‚¤‚½‚߂ɃƒbƒN‚ðŽŽ‚Ý‚é +void CAMERA_Unlock(void); // ARM7‘¤‚̃ƒbƒN‚ð‰ðœ‚·‚é + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_CONTROL_H_ */ diff --git a/include/twl/camera/ARM7/i2c.h b/include/twl/camera/ARM7/i2c.h new file mode 100644 index 0000000..d4369e6 --- /dev/null +++ b/include/twl/camera/ARM7/i2c.h @@ -0,0 +1,381 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - camera + File: camera_i2c.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef TWL_CAMERA_CAMERA_I2CH_ +#define TWL_CAMERA_CAMERA_I2CH_ + +#include +#include +#include + +#define CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO + +#ifdef _cplusplus +extern "C" { +#endif + +//================================================================================ +// I2C_ ACCESS +//================================================================================ +/*---------------------------------------------------------------------------* + Name: CAMERA_WriteRegister + + Description: set value to decive register through I2C_. + + Arguments: reg : decive register + data : value to be written + + Returns: None + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERAi_WriteRegister( u8 reg, u8 data ) +{ + return I2Ci_WriteRegister( I2C_SLAVE_CAMERA, reg, data ); +} +static inline BOOL CAMERA_WriteRegister( u8 reg, u8 data ) +{ + return I2C_WriteRegister( I2C_SLAVE_CAMERA, reg, data ); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ReadRegister + + Description: get value from decive register through I2C_. + + Arguments: reg : decive register + + Returns: value which is read from specified decive register + *---------------------------------------------------------------------------*/ +static inline u8 CAMERAi_ReadRegister( u8 reg ) +{ + return I2Ci_ReadRegisterSC( I2C_SLAVE_CAMERA, reg ); +} +static inline u8 CAMERA_ReadRegister( u8 reg ) +{ + return I2C_ReadRegisterSC( I2C_SLAVE_CAMERA, reg ); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_WriteRegisters + + Description: set value to decive registers through I2C_. + + Arguments: reg : decive register + data : value to be written + + Returns: None + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERAi_WriteRegisters( u8 reg, const u8 *bufp, size_t size ) +{ +#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO + while ( size > 0 ) + { + if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) ) + { + break; + } + size--; + } + return (size == 0 ? TRUE : FALSE); +#else + return I2Ci_WriteRegisters( I2C_SLAVE_CAMERA, reg, bufp, size ); +#endif +} +static inline BOOL CAMERA_WriteRegisters( u8 reg, const u8 *bufp, size_t size ) +{ +#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO + (void)I2C_Lock(); + while ( size > 0 ) + { + if ( FALSE == I2Ci_WriteRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) ) + { + break; + } + size--; + } + (void)I2C_Unlock(); + return (size == 0 ? TRUE : FALSE); +#else + return I2C_WriteRegisters( I2C_SLAVE_CAMERA, reg, bufp, size ); +#endif +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ReadRegisters + + Description: get value from decive registers through I2C_. + + Arguments: reg : decive register + + Returns: value which is read from specified decive register + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERAi_ReadRegisters( u8 reg, u8 *bufp, size_t size ) +{ +#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO + while ( size > 0 ) + { + if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) ) + { + break; + } + size--; + } + return (size == 0 ? TRUE : FALSE); +#else + return I2Ci_ReadRegistersSC( I2C_SLAVE_CAMERA, reg, bufp, size ); +#endif +} +static inline BOOL CAMERA_ReadRegisters( u8 reg, u8 *bufp, size_t size ) +{ +#ifdef CAMERA_DOES_NOT_SUPPORT_MULTIPLE_IO + (void)I2C_Lock(); + while ( size > 0 ) + { + if ( FALSE == I2Ci_ReadRegisters( I2C_SLAVE_CAMERA, reg++, bufp++, 1 ) ) + { + break; + } + size--; + } + (void)I2C_Unlock(); + return (size == 0 ? TRUE : FALSE); +#else + return I2C_ReadRegistersSC( I2C_SLAVE_CAMERA, reg, bufp, size ); +#endif +} + +//================================================================================ +// I2C_ BIT CONTROL +//================================================================================ +/*---------------------------------------------------------------------------* + Name: CAMERA_SetParams + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + maskBits : bits to mask + + Returns: None + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERAi_SetParams( u8 reg, u8 setBits, u8 maskBits ) +{ + return I2Ci_SetParams( I2C_SLAVE_CAMERA, reg, setBits, maskBits ); +} +static inline BOOL CAMERA_SetParams( u8 reg, u8 setBits, u8 maskBits ) +{ + return I2C_SetParams( I2C_SLAVE_CAMERA, reg, setBits, maskBits ); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetFlags + + Description: set control bit to device register + + Arguments: reg : device register + setBits : bits to set + + Returns: None + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERAi_SetFlags( u8 reg, u8 setBits ) +{ + return CAMERAi_SetParams( reg, setBits, setBits ); +} +static inline BOOL CAMERA_SetFlags( u8 reg, u8 setBits ) +{ + return CAMERA_SetParams( reg, setBits, setBits ); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_ClearFlags + + Description: clear control bit to device register + + Arguments: reg : device register + clrBits : bits to clear + + Returns: None + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERAi_ClearFlags( u8 reg, u8 clrBits ) +{ + return CAMERAi_SetParams( reg, 0, clrBits ); +} +static inline BOOL CAMERA_ClearFlags( u8 reg, u8 clrBits ) +{ + return CAMERA_SetParams( reg, 0, clrBits ); +} + +//================================================================================ +// I2C_ API +//================================================================================ +#define CAMERA_I2CSetCropping(x, y, w, h) CAMERA_I2CSetCroppingParams(w, h) + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CSetFlipMode + + Description: set CAMERA's flip mode + + Arguments: mode one of CameraFlipMode to apply + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL CAMERA_I2CSetFlipMode(CameraFlipMode mode); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CSetSpecialMode + + Description: set CAMERA's special mode + + Arguments: mode one of CameraSpecialMode to apply + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL CAMERA_I2CSetSpecialMode(CameraSpecialMode mode); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CSetCroppingParams + + Description: set CAMERA_ cropping parameters. + + Arguments: width width of image (up to 640) + height height of image (up to 480) + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL CAMERA_I2CSetCroppingParams(u16 width, u16 height); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CGetCroppingParams + + Description: get current CAMERA_ cropping parameters. + + Arguments: pWidth address to store the width + pHeight address to store the height + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL CAMERA_I2CGetCroppingParams(u16 *pWidth, u16 *pHeight); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPause + + Description: pause to send frame + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERA_I2CPause(void) +{ + BOOL result; + (void)I2C_Lock(); + result = CAMERAi_WriteRegister( 0xef, 0x00 ) && + CAMERAi_ClearFlags( 0xde, 0x04 ); + (void)I2C_Unlock(); + return result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CResume + + Description: resume from pause state + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERA_I2CResume(void) +{ + BOOL result; + (void)I2C_Lock(); + result = CAMERAi_WriteRegister( 0xef, 0x00 ) && + CAMERAi_SetFlags( 0xde, 0x04 ); + (void)I2C_Unlock(); + return result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreSleep + + Description: pre-sleep + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERA_I2CPreSleep(void) +{ + BOOL result; + (void)I2C_Lock(); + // not impremented yet + (void)I2C_Unlock(); + return result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPostSleep + + Description: post-sleep + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERA_I2CPostSleep(void) +{ + BOOL result; + (void)I2C_Lock(); + // not impremented yet + (void)I2C_Unlock(); + return result; +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreset + + Description: preset CAMERA registers + + Arguments: preset one of CameraPreset + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +BOOL CAMERA_I2CPreset(CameraPreset preset); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CInit + + Description: initialize CAMERA + + Arguments: None + + Returns: TRUE if success + *---------------------------------------------------------------------------*/ +static inline BOOL CAMERA_I2CInit(void) +{ + if (CAMERA_I2CPreset(CAMERA_PRESET_DEFAULT) == FALSE) { + return FALSE; + } + if (CAMERA_I2CSetFlipMode(CAMERA_FLIPMODE_DEFAULT) == FALSE) { + return FALSE; + } + return TRUE; +} + + +#ifdef _cplusplus +} /* extern "C" */ +#endif + +/* TWL_CAMERA_CAMERA_I2CH_ */ +#endif diff --git a/include/twl/camera/ARM9/camera.h b/include/twl/camera/ARM9/camera.h new file mode 100644 index 0000000..ad5e8fc --- /dev/null +++ b/include/twl/camera/ARM9/camera.h @@ -0,0 +1,298 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - camera + File: camera.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef TWL_CAMERA_CAMERA_H_ +#define TWL_CAMERA_CAMERA_H_ + +#include +#include +#include +#include + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif +#define CAMERA_GET_MAX_LINES(width) MIN((1024 / width), 16) +#define CAMERA_GET_LINE_BYTES(width) (width << 1) + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + CAMERA_SELECT_FIRST, + CAMERA_SELECT_SECOND +} CameraSelect; + +typedef enum { + CAMERA_OUTPUT_YUV, + CAMERA_OUTPUT_RGB +} CameraOutput; + +typedef enum { + CAMERA_INTR_VSYNC_NONE = (0 << REG_CAM_CAM_CNT_IREQ_VS_SHIFT), + CAMERA_INTR_VSYNC_NEGATIVE_EDGE = (2 << REG_CAM_CAM_CNT_IREQ_VS_SHIFT), + CAMERA_INTR_VSYNC_POSITIVE_EDGE = (3 << REG_CAM_CAM_CNT_IREQ_VS_SHIFT) +} CameraIntrVsync; + +/*---------------------------------------------------------------------------* + Name: CAMERA_SelectCamera + + Description: set stbyn + + Arguments: camera one of CameraSelect + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SelectCamera( CameraSelect camera ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetStbyn + + Description: set stbyn + + Arguments: BOOL High/Low + + Returns: BOOL last state + *---------------------------------------------------------------------------*/ +BOOL CAMERA_SetStbyn( BOOL high ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_PowerOn + + Description: power camera on + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_PowerOn( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_PowerOff + + Description: power camera off + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_PowerOff( void ); + +/*---------------------------------------------------------------------------* + Name: cameraPreSleep + + Description: pre-sleep process for CAMERA without power off + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_PreSleep( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_PostSleep + + Description: pre-sleep process for CAMERA without power off + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_PostSleep( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_IsBusy + + Description: whether camera is busy + + Arguments: None + + Returns: TRUE if camera is busy + *---------------------------------------------------------------------------*/ +BOOL CAMERA_IsBusy( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_Start + + Description: start to receive camera data + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_Start( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_Stop + + Description: stop to receive camera data + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_Stop( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetSyncLowActive + + Description: set CAMERA sync polarity + + Arguments: isLowActive if low active, set TRUE + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetSyncLowActive( BOOL isLowActive ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetRclkNegativeEdge + + Description: set CAMERA rclk edge. + Should call while master clock is stopping. + + Arguments: isNegativeEdge if negative edge, set TRUE + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetRclkNegativeEdge( BOOL isNegativeEdge ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTrimmingParamsCenter + + Description: set camera trimming parameters by centering + expecting original image size is VGA. + NOTE: should call CAMERA_SetTrimming to enable trimming + + Arguments: destWidth width of image to output + destHeight height of image to output + srcWidth original width of image + srcHeight original height of image + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTrimmingParamsCenter(u16 destWidth, u16 destHeight, u16 srcWidth, u16 srcHeight); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTrimmingParams + + Description: set camera trimming parameters + NOTE: widht = x2 - x1; height = y2 - y1; + NOTE: should call CAMERA_SetTrimming to enable trimming + + Arguments: x1 X of top-left trimming point (multiple of 2) + y1 Y of top-left trimming point + x2 X of bottom-right trimming point (multiple of 2) + y2 Y of bottom-right trimming point + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTrimmingParams(u16 x1, u16 y1, u16 x2, u16 y2); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTrimming + + Description: set trimming enable/disable + + Arguments: enabled TRUE if set trimming will be enabled + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTrimming( BOOL enabled ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetOutputFormat + + Description: set CAMERA output format. + + Arguments: output one of CameraOutput to set. + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetOutputFormat( CameraOutput output ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_GetErrorStatus + + Description: whether line buffer has occurred some errors or not + + Arguments: None + + Returns: TRUE if error has occurred + *---------------------------------------------------------------------------*/ +BOOL CAMERA_GetErrorStatus( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_ClearBuffer + + Description: clear line buffer and error status + + Arguments: None + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_ClearBuffer( void ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetMasterIntrrupt + + Description: set interrupt mode + + Arguments: enabled TRUE if set master interrupt will be enabled + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetMasterIntrrupt( BOOL enabled ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetVsyncIntrrupt + + Description: set vsync interrupt mode + + Arguments: type one of CameraIntrVsync to set + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetVsyncIntrrupt( CameraIntrVsync type ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetBufferErrorIntrrupt + + Description: set buffer error interrupt mode + + Arguments: enabled TRUE if set buffer error interrupt will be enabled + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetBufferErrorIntrrupt( BOOL enabled ); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetTransferLines + + Description: set number of lines to store the buffer at once. + + Arguments: lines number of lines + + Returns: None + *---------------------------------------------------------------------------*/ +void CAMERA_SetTransferLines( int lines ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* TWL_CAMERA_CAMERA_H_ */ +#endif diff --git a/include/twl/camera/ARM9/camera_api.h b/include/twl/camera/ARM9/camera_api.h new file mode 100644 index 0000000..df79af0 --- /dev/null +++ b/include/twl/camera/ARM9/camera_api.h @@ -0,0 +1,408 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - library - camera + File: camera_api.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef TWL_CAMERA_CAMERA_API_H_ +#define TWL_CAMERA_CAMERA_API_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// ˆ—Œ‹‰Ê’è‹` +typedef enum CAMERAResult +{ + CAMERA_RESULT_SUCCESS = 0, + CAMERA_RESULT_SUCCESS_TRUE, + CAMERA_RESULT_SUCCESS_FALSE, + CAMERA_RESULT_BUSY, + CAMERA_RESULT_ILLEGAL_PARAMETER, + CAMERA_RESULT_SEND_ERROR, + CAMERA_RESULT_INVALID_COMMAND, + CAMERA_RESULT_ILLEGAL_STATUS, + CAMERA_RESULT_FATAL_ERROR, + CAMERA_RESULT_MAX +} +CAMERAResult; + +// ƒR[ƒ‹ƒoƒbƒN +typedef void (*CAMERACallback)(CAMERAResult result, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_Init + + Description: CAMERAƒ‰ƒCƒuƒ‰ƒŠ‚ð‰Šú‰»‚·‚éB + + Arguments: None. + + Returns: None. + *---------------------------------------------------------------------------*/ +void CAMERA_Init(void); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetStbyn2Async + + Description: select STBYN for 2nd CAMERA + async version + + Arguments: state - High/Low + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetStbyn2Async(BOOL state, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetStbyn2 + + Description: select STBYN for 2nd CAMERA + sync version. + + Arguments: state - High/Low + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetStbyn2(BOOL state); + +/*---------------------------------------------------------------------------* + Name: CAMERA_WriteRegistersAsync + + Description: write CAMERA registers via I2C. + async version. + + Arguments: addr - start address + bufp - buffer to write + length - length of bufp + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_WriteRegistersAsync(u8 addr, const u8* bufp, size_t length, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_WriteRegisters + + Description: write CAMERA registers via I2C. + sync version. + + Arguments: addr - start address + bufp - buffer to write + length - length of bufp + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_WriteRegisters(u8 addr, const u8* bufp, size_t length); + +/*---------------------------------------------------------------------------* + Name: CAMERA_ReadRegistersAsync + + Description: read CAMERA registers via I2C. + + Arguments: addr - start address + bufp - buffer to read + length - length of bufp + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ReadRegistersAsync(u8 addr, u8* bufp, size_t length, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_ReadRegisters + + Description: set CAMERA key normally + sync version. + + Arguments: pKey - pointer to key data + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ReadRegisters(u8 addr, u8* bufp, size_t length); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetParamsAsync + + Description: set register as reg = (reg & ~mask) | (bits & mask); + + Arguments: addr - address to access + bits - bits to set + mask - mask to touch + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetParamsAsync(u8 addr, u8 bits, u8 mask, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetParams + + Description: set register as reg = (reg & ~mask) | (bits & mask); + + Arguments: addr - address to access + bits - bits to set + mask - mask to touch + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetParams(u8 addr, u8 bits, u8 mask); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetFlagsAsync + + Description: set register as reg |= bits; + + Arguments: addr - address to access + bits - bits to set + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetFlagsAsync(u8 addr, u8 bits, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetFlags + + Description: set register as reg |= bits; + + Arguments: addr - address to access + bits - bits to set + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetFlags(u8 addr, u8 bits); + +/*---------------------------------------------------------------------------* + Name: CAMERA_ClearFlagsAsync + + Description: set register as reg &= ~bits; + + Arguments: addr - address to access + bits - bits to clear + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ClearFlagsAsync(u8 addr, u8 bits, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_ClearFlags + + Description: set register as reg &= ~bits; + + Arguments: addr - address to access + bits - bits to set + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ClearFlags(u8 addr, u8 bits); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CInitAsync + + Description: initialize camera registers via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CInitAsync(CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CInit + + Description: initialize camera registers via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CInit(void); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPresetAsync + + Description: set camera registers with specified preset via I2C + async version + + Arguments: preset - preset type + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPresetAsync(CameraPreset preset, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreset + + Description: set camera registers with specified preset via I2C + sync version. + + Arguments: preset - preset type + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPreset(CameraPreset preset); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreSleepAsync + + Description: pre-sleep process in camera registers via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPreSleepAsync(CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPreSleep + + Description: pre-sleep process in camera registers via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPreSleep(void); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPostSleepAsync + + Description: post-sleep process in camera registers via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPostSleepAsync(CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_I2CPostSleep + + Description: post-sleep process in camera registers via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_I2CPostSleep(void); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetCroppingAsync + + Description: set offset and size + + Arguments: x_off - x offset to start capturing + y_off - y offset to start capturing + width - width of image + height - height of image + callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetCroppingAsync(u16 x_off, u16 y_off, u16 width, u16 height, CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_SetCropping + + Description: set offset and size + + Arguments: x_off - x offset to start capturing + y_off - y offset to start capturing + width - width of image + height - height of image + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_SetCropping(u16 x_off, u16 y_off, u16 width, u16 height); + +/*---------------------------------------------------------------------------* + Name: CAMERA_PauseAsync + + Description: pause camera via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_PauseAsync(CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_Pause + + Description: pause camera via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_Pause(void); + +/*---------------------------------------------------------------------------* + Name: CAMERA_ResumeAsync + + Description: resume camera from pausing via I2C + async version. + + Arguments: callback - ”ñ“¯Šúˆ—‚ªŠ®—¹‚µ‚½Ä‚ɌĂÑo‚·ŠÖ”‚ðŽw’è + arg - ƒR[ƒ‹ƒoƒbƒNŠÖ”‚̌ĂÑo‚µŽž‚̈ø”‚ðŽw’èB + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_ResumeAsync(CAMERACallback callback, void *arg); + +/*---------------------------------------------------------------------------* + Name: CAMERA_Resume + + Description: resume camera from pausing via I2C + sync version. + + Arguments: None. + + Returns: CAMERAResult + *---------------------------------------------------------------------------*/ +CAMERAResult CAMERA_Resume(void); + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_CAMERA_API_H_ */ diff --git a/include/twl/camera/ARM9/transfer.h b/include/twl/camera/ARM9/transfer.h new file mode 100644 index 0000000..db4f946 --- /dev/null +++ b/include/twl/camera/ARM9/transfer.h @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - library - camera + File: camera_transfer.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ + +#ifndef TWL_CAMERA_TRANSFER_H_ +#define TWL_CAMERA_TRANSFER_H_ + +#include +#include + +#define CAMERA_DMA_BLOCK_SIZE MI_EXDMA_BLOCK_64B +#define CAMERA_DMA_INTERVAL 8 +#define CAMERA_DMA_PRESCALER MI_EXDMA_PRESCALER_1 + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +/*---------------------------------------------------------------------------* + Name: CAMERA_DmaRecv + + Description: receiving a frame data from CAMERA buffer. + Sync version. + + Arguments: dmaNo : DMA channel No. (4 - 7) + dest : destination address + unit : transfer length at once (byte)(width * lines at once) + length : transfer length (byte) (frame size) + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void CAMERA_DmaRecv(u32 dmaNo, void *dest, u32 unit, u32 length) +{ + MIi_ExDmaRecvCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, length, unit, + CAMERA_DMA_BLOCK_SIZE, CAMERA_DMA_INTERVAL, CAMERA_DMA_PRESCALER, + MI_EXDMA_CONTINUOUS_OFF, MI_EXDMA_SRC_RLD_OFF, MI_EXDMA_DEST_RLD_OFF, + MI_EXDMA_TIMING_CAMERA ); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_DmaRecvAsync + + Description: receiving a frame data from CAMERA buffer. + Async version. + + Arguments: dmaNo : DMA channel No. (4 - 7) + dest : destination address + unit : transfer length at once (byte)(width * lines at once) + length : transfer length (byte) (frame size) + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void CAMERA_DmaRecvAsync(u32 dmaNo, void *dest, u32 unit, u32 length) +{ + MIi_ExDmaRecvAsyncCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, length, unit, + CAMERA_DMA_BLOCK_SIZE, CAMERA_DMA_INTERVAL, CAMERA_DMA_PRESCALER, + MI_EXDMA_CONTINUOUS_OFF, MI_EXDMA_SRC_RLD_OFF, MI_EXDMA_DEST_RLD_OFF, + MI_EXDMA_TIMING_CAMERA ); +} + +/*---------------------------------------------------------------------------* + Name: CAMERA_DmaRecvInfinity + + Description: receiving data from CAMERA buffer. + Once starting DMA, it will transfer every frame automatically. + You should call MIi_StopExDma(dmaNo) to stop + + Arguments: dmaNo : DMA channel No. (4 - 7) + dest : destination address + unit : transfer length at once (byte)(width * lines at once) + length : transfer length (byte) (frame size) + + Returns: None + *---------------------------------------------------------------------------*/ +static inline void CAMERA_DmaRecvInfinity(u32 dmaNo, void *dest, u32 unit, u32 length) +{ + MIi_ExDmaRecvAsyncCore( dmaNo, (void*)REG_CAM_DAT_ADDR, dest, length, unit, + CAMERA_DMA_BLOCK_SIZE, CAMERA_DMA_INTERVAL, CAMERA_DMA_PRESCALER, + MI_EXDMA_CONTINUOUS_ON, MI_EXDMA_SRC_RLD_OFF, MI_EXDMA_DEST_RLD_ON, + MI_EXDMA_TIMING_CAMERA ); +} + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TRANSFER_H_ */ diff --git a/include/twl/camera/common/fifo.h b/include/twl/camera/common/fifo.h new file mode 100644 index 0000000..76ee7f2 --- /dev/null +++ b/include/twl/camera/common/fifo.h @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - camera - include + File: fifo.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef TWL_CAMERA_FIFO_H_ +#define TWL_CAMERA_FIFO_H_ + +/*---------------------------------------------------------------------------* + ’è”’è‹` + *---------------------------------------------------------------------------*/ +// ƒvƒƒgƒRƒ‹ŠÖ˜A’è‹` +#define CAMERA_PXI_CONTINUOUS_PACKET_MAX 4 // ˜A‘±ƒpƒPƒbƒg‚ÌÅ‘å˜A‘±‰ñ” +#define CAMERA_PXI_DATA_SIZE_MAX ((CAMERA_PXI_CONTINUOUS_PACKET_MAX-1)*3+1) // Å‘åƒf[ƒ^” + +#define CAMERA_PXI_START_BIT 0x02000000 // 擪ƒpƒPƒbƒg‚ðˆÓ–¡‚·‚é +#define CAMERA_PXI_RESULT_BIT 0x00008000 // PXI‚̉ž“š‚ðŽ¦‚· + +/* 擪ƒpƒPƒbƒg‚݂̂̋K‘¥ */ +#define CAMERA_PXI_DATA_NUMS_MASK 0x00ff0000 // ƒf[ƒ^”—̈æ +#define CAMERA_PXI_DATA_NUMS_SHIFT 16 // ƒf[ƒ^”ˆÊ’u +#define CAMERA_PXI_COMMAND_MASK 0x00007f00 // ƒRƒ}ƒ“ƒhŠi”[•”•ª‚̃}ƒXƒN +#define CAMERA_PXI_COMMAND_SHIFT 8 // ƒRƒ}ƒ“ƒhŠi”[•”•ª‚̈ʒu +#define CAMERA_PXI_1ST_DATA_MASK 0x000000ff // 擪ƒpƒPƒbƒg‚̃f[ƒ^—̈æ +#define CAMERA_PXI_1ST_DATA_SHIFT 0 // 擪ƒpƒPƒbƒg‚̃f[ƒ^ˆÊ’u + +/* Œã‘±ƒpƒPƒbƒg‚݂̂̋K‘¥ */ +#define CAMERA_PXI_DATA_MASK 0x00ffffff // ƒf[ƒ^—̈æ +#define CAMERA_PXI_DATA_SHIFT 0 // ƒf[ƒ^ˆÊ’u + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +// PXIƒRƒ}ƒ“ƒh’è‹` +typedef enum CAMERAPxiCommand +{ + CAMERA_PXI_COMMAND_SET_STBYN = 0x00, // STBYN‘€ì + // I2CŠî–{‘€ì + CAMERA_PXI_COMMAND_WRITE_REGISTERS = 0x10, + CAMERA_PXI_COMMAND_READ_REGISTERS = 0x11, + CAMERA_PXI_COMMAND_SET_PARAMS = 0x12, + CAMERA_PXI_COMMAND_SET_FLAGS = 0x13, + CAMERA_PXI_COMMAND_CLEAR_FLAGS = 0x14, + // I2C‰ž—p‘€ì + CAMERA_PXI_COMMAND_I2C_INIT = 0x20, // ”Ä—p‰Šú‰» + CAMERA_PXI_COMMAND_I2C_PRESET = 0x21, // ŠeŽíƒvƒŠƒZƒbƒg + + CAMERA_PXI_COMMAND_I2C_PRE_SLEEP = 0x28, // ƒXƒŠ[ƒv‘Oˆ— + CAMERA_PXI_COMMAND_I2C_POST_SLEEP = 0x29, // ƒXƒŠ[ƒvŒãˆ— + + CAMERA_PXI_COMMAND_I2C_SET_CROPPING = 0x30, // ˆÊ’u‚ƃTƒCƒYÝ’è + + CAMERA_PXI_COMMAND_I2C_PAUSE = 0x38, // ˆêŽž’âŽ~ + CAMERA_PXI_COMMAND_I2C_RESUME = 0x39 // •œ‹A +} +CAMERAPxiCommand; + +// PXIƒRƒ}ƒ“ƒhƒTƒCƒY’è‹` +typedef enum CAMERAPxiSize +{ + CAMERA_PXI_SIZE_SET_STBYN = 1, // BOOL + // I2CŠî–{‘€ì + CAMERA_PXI_SIZE_WRITE_REGISTERS = 3, // addr, size, data... + CAMERA_PXI_SIZE_READ_REGISTERS = 2, // addr, size + CAMERA_PXI_SIZE_SET_PARAMS = 3, // addr, bits, mask + CAMERA_PXI_SIZE_SET_FLAGS = 2, // addr, bits + CAMERA_PXI_SIZE_CLEAR_FLAGS = 2, // addr, bits + // I2C‰ž—p‘€ì + CAMERA_PXI_SIZE_I2C_INIT = 0, + CAMERA_PXI_SIZE_I2C_PRESET = 1, // preset + + CAMERA_PXI_SIZE_I2C_PRE_SLEEP = 0, + CAMERA_PXI_SIZE_I2C_POST_SLEEP = 0, + + CAMERA_PXI_SIZE_I2C_SET_CROPPING = 8, // (u16)x_offset, (u16)y_offset, (u16)width, (u16)height + + CAMERA_PXI_SIZE_I2C_PAUSE = 0, + CAMERA_PXI_SIZE_I2C_RESUME = 0 +} +CAMERAPxiSize; + +// ‰ž“š’è‹` +typedef enum CAMERAPxiResult +{ + CAMERA_PXI_RESULT_SUCCESS = 0, // ˆ—¬Œ÷ (void/void*Œ^) // ꇂɂæ‚èŒã‘±ƒpƒPƒbƒg‚ ‚è + CAMERA_PXI_RESULT_SUCCESS_TRUE, // ˆ—¬Œ÷ (BOOLŒ^) + CAMERA_PXI_RESULT_SUCCESS_FALSE, // ˆ—¬Œ÷ (BOOLŒ^) + CAMERA_PXI_RESULT_INVALID_COMMAND, // •s³‚ÈPXIƒRƒ}ƒ“ƒh + CAMERA_PXI_RESULT_INVALID_PARAMETER, // •s³‚ȃpƒ‰ƒ[ƒ^ + CAMERA_PXI_RESULT_ILLEGAL_STATUS, // RTC‚Ìó‘Ô‚É‚æ‚舗‚ðŽÀs•s”\ + CAMERA_PXI_RESULT_BUSY, // ‘¼‚ÌƒŠƒNƒGƒXƒg‚ðŽÀs’† + CAMERA_PXI_RESULT_FATAL_ERROR, // ‚»‚Ì‘¼‰½‚ç‚©‚ÌŒ´ˆö‚ň—‚ÉŽ¸”s + CAMERA_PXI_RESULT_MAX +} +CAMERAPxiResult; + + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_FIFO_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/ diff --git a/include/twl/camera/common/types.h b/include/twl/camera/common/types.h new file mode 100644 index 0000000..39f2593 --- /dev/null +++ b/include/twl/camera/common/types.h @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------* + Project: TwlSDK - camera - include + File: types.h + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Log: $ + $NoKeywords: $ + *---------------------------------------------------------------------------*/ +#ifndef TWL_CAMERA_TYPES_H_ +#define TWL_CAMERA_TYPES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*===========================================================================*/ + +typedef enum { + CAMERA_FLIPMODE_NONE, + CAMERA_FLIPMODE_HORIZONTAL, + CAMERA_FLIPMODE_VERTICAL, + CAMERA_FLIPMODE_HORIZONTAL_VERTICAL, + CAMERA_FLIPMODE_MAX, + + CAMERA_FLIPMODE_DEFAULT = CAMERA_FLIPMODE_HORIZONTAL +} CameraFlipMode; + +typedef enum { + CAMERA_SPECIALMODE_NONE, + CAMERA_SPECIALMODE_NEVATIVE, + CAMERA_SPECIALMODE_SEPIA, + CAMERA_SPECIALMODE_BLUISH, + CAMERA_SPECIALMODE_REDDISH, + CAMERA_SPECIALMODE_GREENISH, + CAMERA_SPECIALMODE_MAX, + + CAMERA_SPECIALMODE_AQUA = CAMERA_SPECIALMODE_BLUISH, + CAMERA_SPECIALMODE_DEFAULT = CAMERA_SPECIALMODE_NONE +} CameraSpecialMode; + +typedef enum { + CAMERA_PRESET_HVGA_20, + CAMERA_PRESET_DS_30, + CAMERA_PRESET_VGA_20, + CAMERA_PRESET_QVGA_20, + CAMERA_PRESET_QVGA_30, + CAMERA_PRESET_QVGA_30SD, + CAMERA_PRESET_QVGA_30SS, + CAMERA_PRESET_MAX, + + CAMERA_PRESET_DEFAULT = CAMERA_PRESET_HVGA_20 +} CameraPreset; + + +/*===========================================================================*/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* TWL_CAMERA_TYPES_H_ */ + +/*---------------------------------------------------------------------------* + End of file + *---------------------------------------------------------------------------*/