版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、-3-ContentsTOC o 1-5 h z HYPERLINK l bookmark2 o Current Document 一、手機(jī)CAMERA的物理結(jié)構(gòu):4- HYPERLINK l bookmark4 o Current Document 二、CAMERA的成像原理:-4-三、CAMERA常見的數(shù)據(jù)輸出格式:5- HYPERLINK l bookmark8 o Current Document 四、閱讀CAMERA的規(guī)格書(以TRULY模組OV5647_RAW為例):6- HYPERLINK l bookmark12 o Current Document 五、CAMERA的硬件原理
2、圖及引腳7-1、電源部分:-7-2、SENSORINPUT部分:-7-3、SENSOROUTPUT部分:-7-4、I2C部分:SCL,I2C時(shí)鐘信號(hào)線和SDA,I2C數(shù)據(jù)信號(hào)線。-7- HYPERLINK l bookmark20 o Current Document 六、MTK平臺(tái)CAMERA驅(qū)動(dòng)架構(gòu):8-七、MTK平臺(tái)CAMERA相關(guān)代碼文件(以下代碼均為MTK6575平臺(tái)):9-1CAMERASENSOR驅(qū)動(dòng)相關(guān)文件-9-2、SENSORID和一些枚舉類型的定義-9-3、SENSOR供電-9-4、KERNELSPACE的SENSORLIST,IMGSENSOR模塊注冊-9-5、userS
3、pace的sensorlist,向用戶空間提供支持的sensorlist-10-6、SENSOR效果調(diào)整的接口-10-八、CAMERA模塊驅(qū)動(dòng)、設(shè)備與總線結(jié)構(gòu):-11-A)驅(qū)動(dòng)的注冊:-11-B)設(shè)備的注冊:-11-C)總線的匹配:-12- HYPERLINK l bookmark40 o Current Document 九、CAMERA驅(qū)動(dòng)工作流程:-13- HYPERLINK l bookmark52 o Current Document 十、CAMERA驅(qū)動(dòng)添加、調(diào)試流程:-17-GhongConfidentialRevision0.1-Feb.1420122012Ghonginc.C
4、ameraDriveranalysisintheplatformofMTKPreliminaryInformation-4-GhongConfidential、手機(jī)Camera的物理結(jié)構(gòu):FPC:FlexiblePrintedCircuit可撓性印刷電路板Holder:基座Lens:鏡頭Sensor:圖象傳感器11IR:紅外濾波片感光區(qū)二、Camera的成像原理:景物通過鏡頭(LENS)生成的光學(xué)圖像投射到圖像傳感器(Sensor)表面上,然后轉(zhuǎn)為模擬的電信號(hào),經(jīng)過A/D(模數(shù)轉(zhuǎn)換)轉(zhuǎn)換后變?yōu)閿?shù)字圖像信號(hào),再送到數(shù)字信號(hào)處理芯片CPU處理(DSP)中加工處理,再通過IO接口傳輸?shù)紺PU中處理,
5、通過LCD就可以看到圖像了。Revision0.1-Feb.1420122012Ghonginc.CameraDriveranalysisintheplatformofMTKPreliminaryInformationGhongConfidentialRevision0.1-Feb.142012-5-2012Ghonginc.圖像傳感器(SENSOR)是一種半導(dǎo)體芯片,其表面包含有幾十萬到幾百萬的光電二極管。光電二極管受到光照射時(shí),就會(huì)產(chǎn)生電荷。目前的SENSOR類型有兩種:CCD(ChargeCoupleDevice),電荷耦合器件,它是目前高像素類sensor中比較成熟的成像器件,是以一行
6、為單位的電流信號(hào)。CMOS(ComplementaryMetalOxideSemiconductor),互補(bǔ)金屬氧化物半導(dǎo)體。CMOS的信號(hào)是以點(diǎn)為單位的電荷信號(hào),更為敏感,速度也更快,更為省電。ISP的性能是決定影像流暢的關(guān)鍵,JPEGencoder的性能也是關(guān)鍵指標(biāo)之一。而JPEGencoder又分為硬件JPEG壓縮方式,和軟件RGB壓縮方式。DSP控制芯片的作用是:將感光芯片獲取的數(shù)據(jù)及時(shí)快速地傳到baseband中并刷新感光芯片,因此控制芯片的好壞,直接決定畫面品質(zhì)(比如色彩飽和度、清晰度)與流暢度。三、Camera常見的數(shù)據(jù)輸出格式:常見的數(shù)據(jù)輸出格式有:Rawdata格式、YUV格
7、式、RGB格式。RGB格式:采用這種編碼方法,每種顏色都可用三個(gè)變量來表示紅色、綠色以及藍(lán)色的強(qiáng)度。每一個(gè)像素有三原色R紅色、G綠色、B藍(lán)色組成。YUV格式:其中“Y”表示明亮度(Luminance或Luma),就是灰階值;而“U”和“V”表示色度(Chrominance或Chroma),是描述影像色彩及飽和度,用于指定像素的顏色。RAWDATA格式:是CCD或CMOS在將光信號(hào)轉(zhuǎn)換為電信號(hào)時(shí)的電平高低的原始記錄,單純地將沒有進(jìn)行任何處理的圖像數(shù)據(jù),即攝像元件直接得到的電信號(hào)進(jìn)行數(shù)字化處理而得到的。支持YUV/RGB格式的模組,一般會(huì)在模組上集成ISP(ImageSingleProcessor
8、),經(jīng)過A/D轉(zhuǎn)換過的原始數(shù)據(jù)經(jīng)過ISP處理生成YUV標(biāo)準(zhǔn)格式傳到BB。一般來說,這種設(shè)計(jì)適用于低像素Camera的要求,會(huì)在主板上省去一個(gè)DSP,可降低成本。在調(diào)試過程中,YUV/RGB格式的攝像頭,其所有參數(shù)都可在kernel層通過寄存器來控制。調(diào)試一般由sensor的原廠支持。支持RawData格式的模組,由于感光區(qū)域的需求,不會(huì)再模組內(nèi)集成ISP以最大程度的增大感光區(qū)域的面積,提高照片質(zhì)量。模組把原始的數(shù)字信號(hào)傳給BB上的DSP進(jìn)行處理,MTK自帶的DSP一般包含ISP、JPEGencoder、和DSP控制芯片。在調(diào)試的時(shí)候圖像的效果需要MTK在HAL層的參數(shù)進(jìn)行支持。CameraDr
9、iveranalysisintheplatformofMTKPreliminaryInformationGhongConfidentialRevision0.1-Feb.142012-6-2012Ghonginc.四、閱讀Camera的規(guī)格書(以Truly模組OV5647_Raw為例):8.50+0.10PINNO.SIGNAL1D52D63D74D8岳D96NC7RESET8NC9DOVDD1.8V10AVI)D_2.8V11AF_VCC_2.8V12PWDN13DGND14STRORE15DI16DGND17XCLK18PCLK19D220D321D422NC23HREF24VSYNC25
10、SIOD26SIOC27AGND28DGND29DO30DNGD主要參數(shù)(ModuleSpecification)焦距(EFL)3,37mm光W(KNO)2.85%搜場角(Vie*Angle)67.42a崎變(Distortion)ATA9|LCfelHEEEl6型煙回1I2C1_SM|6!l2C13CLr65_63029288衛(wèi)10藥ZB-a732FToT5MainCamera宀ii嗣iyCAM_IpPMIJ|.、IiCMDATAOl6叵測ffl兇6疋底晝L6醴坯伍6亟飯匚4.7U.FC411lOOnFC4106!CMPi5Ni|卩二二二!cam_strobej/嘶嚇%6【錘施CR4O54.
11、7KlOOnF4.7uF47KAXK7L30227G/P30/PANASNOICJ12從上面可看出,連接Camera的30根Pin腳可大致分為以下幾類:1、電源部分:a)VCAMD就是DVDD數(shù)字供電,主要給ISP供電,由于RAWDATA格式的sensor其ISP是在BB端,所以將其引腳將其NC。從上面的規(guī)格書上可以看出DVDD是內(nèi)部BB端供電。模組已將其NC掉了;VCAM_IO就是VDDIO數(shù)字IO電源主要給I2C部分供電;VCAMA就是AVDD模擬供電,主要給感光區(qū)和ADC部分供電;VCAM_AF是對(duì)Camera自動(dòng)對(duì)焦馬達(dá)的供電。2、SensorInput部分:Reset信號(hào),用于復(fù)位、
12、初始化。Standby/PowerDown信號(hào),用于進(jìn)入待機(jī)模式,降低功耗。Mclk,即MasterClock信號(hào),是由BB端提供。3、SensorOutPut部分:Pclk,即PixelClock信號(hào),由MCLK分頻得到,作為外部時(shí)鐘控制圖像傳輸幀率HSYNC,行同步信號(hào),其上升沿表示新一列行圖像數(shù)據(jù)的開始。VSYNC,幀同步信號(hào),其下降沿表示新的一幀圖片的開始。D0-D9一共10根數(shù)據(jù)線(8/10根等);4、I2C部分:SCL,I2C時(shí)鐘信號(hào)線和SDA,I2C數(shù)據(jù)信號(hào)線。I2CParallelSensorcaiiiSntcamhsvncMini日總taI古n甘CMMCLKCM_PDNMip
13、lelklaneBaseBandcam_pclkcam_dat9:0J_乍MIPISensorGhongConfidentialRevision0.1-Feb.1420122012Ghonginc.CameraDriveranalysisintheplatformofMTKPreliminaryInformation六、MTK平臺(tái)Camera驅(qū)動(dòng)架構(gòu):IFMbum空;LAPPL1CAT】CIZ冃LinuxKernelHomeDialerSMS/MMSBrov/serCameraAlarmCakulatorVoiceDialEmailClockPackageManagerTelephonyMan
14、agerDisplayDriverUSBOnYerAudioDriversContactsCalendarResourceManagerLocationManagerARDWAREABSTRACTI口ZLAYERGPSRadio(RlLjWiFiCameraCriverBluetoothDriverGlaredMemoryDriverEinder(IPC)DriverK每padDhyerWiFiDriYerPowerManagementMediaPlayerApplicationFrameYiewSystemC:penGL|=SPhotoRKActivityManagerWindowManag
15、erContentProvidersNotificationManagerSurfakManageAudioManagerMediaFrameworkLt曰RARIESSQLiteV/ebKitLibcAnD民口ldIRuNT1MECoreLibrariesCarrenBluetooth上圖的架構(gòu)相信大家都有了一定的了解android將系統(tǒng)大致分為應(yīng)用層、庫文件和硬件抽象層、Linux內(nèi)核三層。在底層的內(nèi)核空間,Camera的driver將其驅(qū)動(dòng)起來以后,將硬件驅(qū)動(dòng)的接口交給硬件抽象層(hal:HardwareAbstractionLayer),android上層的Camera應(yīng)用程序在and
16、roid實(shí)時(shí)系統(tǒng)中的虛擬機(jī)中,加載android留給Camera公用的一些庫文件,調(diào)用硬件抽象層(hal)的接口來控制Camera硬件來實(shí)現(xiàn)功能。當(dāng)然,如果是Raw模式的Camera,還需要在硬件抽象層(hal)調(diào)用一些參數(shù)來控制Camera的效果。GhongConfidentialRevision0.1-Feb.1420122012Ghonginc.七、MTK平臺(tái)Camera相關(guān)代碼文件(以下代碼均為MTK6575平臺(tái)):1、CameraSensor驅(qū)動(dòng)相關(guān)文件kernel-3.10/drivers/misc/mediatek/imgsensor/src/platform/alpsmedia
17、tek匸ustomcommonkemetimgsensorov5647_raw驅(qū)動(dòng)代碼ov5647_CameraCustomized.hov5647_CameraSensorpara.hov5647_Sensor.cov5647_Sensorf2、SensorID和一些枚舉類型的定義vendor/mediatek/proprietary/custom/common/kernel/imgsensor/inc/kd_imgsensor.h3、Sensor供電kernel-3.10/drivers/misc/mediatek/mach/platform/project/camera/camera/k
18、d_camera_hw.c4、KernelSpace的SensorList,imgsensor模塊注冊kernel-3.10/drivers/misc/mediatek/imgsensor/src/platform/kd_sensorlist.h- -GhongConfidentialRevision0.1-Feb.1420122012Ghonginc.CameraDriveranalysisintheplatformofMTKPreliminaryInformationGhongConfidentialRevision0.1-Feb.142012- -2012Ghonginc.5、UserS
19、pace的SensorList,向用戶空間提供支持的SensorListvendor/mediatek/proprietary/custom/platform/hal/D1(D2)/imgsensor_src/sensorlist.cpp6575W19-aialpsmediatekcustomcommonhalimgsensorsrcF-sensoilistxpp提供給陰戶空間的SensorList6、Sensor效果調(diào)整的接口CameraDriveranalysisintheplatformofMTKPreliminaryInformation- -八、Camera模塊驅(qū)動(dòng)、設(shè)備與總線結(jié)構(gòu):
20、一般在Linux設(shè)備驅(qū)動(dòng)模型中,我們只需要關(guān)心總線、設(shè)備、驅(qū)動(dòng)這三個(gè)實(shí)體。總線會(huì)充當(dāng)紅娘對(duì)加載于其上的設(shè)備與驅(qū)動(dòng)進(jìn)行配對(duì),對(duì)于Camera模塊也不例外,下面從總線、設(shè)備、驅(qū)動(dòng)的角度來分析Camera模塊驅(qū)動(dòng)的注冊、匹配與加載過程。驅(qū)動(dòng)的注冊:在(customcommonkernelimgsensorsrcKd_sensorlist.c)CAMERA_HW_i2C_init這個(gè)函數(shù)里通過Platform_driver_register(&g_stCAMERA_HW_Driver)把Camera模塊驅(qū)動(dòng)注冊至UPlatform總線上。而g_stCAMERA_HW_Driver是對(duì)結(jié)構(gòu)體Platfo
21、rm_driver這個(gè)結(jié)構(gòu)體的填充。staticstructplatform_drivergstCAMERAHWDriver=.probe=CAMERA-HW-probe,廠已move=CAMERAHWremovej.suspend=CAMERAHWsuspend,.resum已=CAMERAIHWresume,.driver=-.name=iiridig已_5:仃5口.owner=THISMODULE,;(KernelincludelinuxPlatform_device.h)structplatfDrm_driverintXpe*obe)(structplatfonn_d&wice駕.in
22、t(removeXstructpIatform_device:void*shutdown)(structplatforin_devLce爭);int(*suspend)(structplatforin_device*)pm_inesage_tstate);int(*resume)(structplatform-device*)structdevice_driyerdriver;:honststructpIatforin_dtvjce_id*id_table;Platform_driver這個(gè)結(jié)構(gòu)體包含Probe()、Remove()等函數(shù)來完成驅(qū)動(dòng)的填充。設(shè)備的注冊:對(duì)platform_dev
23、ice的定義通常在BSP的板級(jí)文件:(kernelarchshboardsmach-ap325rxaSetup.c)中實(shí)現(xiàn),在板級(jí)文件中,將platform_device歸納為一個(gè)數(shù)組,最終通過platform_add_device()函數(shù)統(tǒng)一注冊::staticstructplatform_devicecamera_device=.name=so.ccainera_pIatform,.dev=.platform_data=camera_info,.release=dummy_relea5ej:GhongConfidentialRevision0.1-Feb.1420122012Ghongin
24、c.CameraDriveranalysisintheplatformofMTKPreliminaryInformationGhongConfidentialRevision0.1-Feb.142012- -2012Ghonginc.staticintap325rXa_Camera_add(structsoc_camera_link*1|,structdevice*dey)if(icl!=c&mer_/inkcamera_probe()=o)return-ENODiv;C3mer3_info.dev=dev;returnplatform_device_register(.camera_devi
25、ce);沁“叮1.bus_id=0.add_device=ap325rxa_camera_addJ.del_device=ap325rxa_camera_del,module_n日rme=soc_cairiera_platfonTiJ.privfcmer&_info;總線的匹配:既然是驅(qū)動(dòng)Platform_device那對(duì)應(yīng)的設(shè)備必然是掛載Platform總線上的Platform_device,Platform總線是Linux系統(tǒng)提供的一種機(jī)制,不同于I2C、I2S等總線它是一種虛擬的總線。Linux系統(tǒng)為Platform總線定義了一個(gè)bus_type的實(shí)例Platform_bus_type:
26、Kerneldriversbaseplatform.c)structbusjypeplattorm_bus_type=m_opsfPlatform總線通過platform_match這個(gè)成員函數(shù)來確定platform_device與platform_driver如何進(jìn)行匹配:十亠”staticintpIatrorm_mateh(structdevice*deVjstructdaice_drierdrv)Istructplatfonn_cleviGe.*pdev=to_pIatfonn_device(dev)jstructplatform_clnv-erpdrv=to_pIatfrm_drive
27、r(drv/.*matchagainsttheidtablefirst柑訐(pdrv-;d_tablejreturnplatform_match_id(pdrv-1d_tablejpdev)!=NULL;/fall-backtodrivernamematch*/returni(.5trcinp(pdev-riame;drv-naine)=九、Camera驅(qū)動(dòng)工作流程:從上圖可以清晰的了解到Camera的一個(gè)工作流程主要分為這么七步:打開CameraPowerLDO,讓Camera有能量保證。打開IIC,設(shè)置PDN引腳,使Camera退出出Standby模式,按照要求讓Reset腳做一個(gè)復(fù)位動(dòng)作
28、。讀一下sensor的版本ID,這樣可以讓你確認(rèn)是否連接上你想要的sensor。對(duì)Sensor進(jìn)行初始化下載最基本的參數(shù)讓Sensor工作起來,可能包括軟復(fù)位。下載preview的參數(shù),為預(yù)覽動(dòng)作準(zhǔn)備。下載Capture的參數(shù),為拍照動(dòng)作準(zhǔn)備。設(shè)置PDN引腳,使Sensor進(jìn)入Standby模式,或者關(guān)掉LDO等動(dòng)作,退出Camera。我們都知道,Linux內(nèi)核是通過模塊的機(jī)制來加載設(shè)備驅(qū)動(dòng)的,那么接下來我們就從設(shè)備模塊加載的角度來看下Camera工作流程的驅(qū)動(dòng)代碼是如何工作的。在-alpsmediatekcustomcommonkernelimgsensorsrckd_sensorlist.
29、c中可以看到:module_init(CAMERA_HW_i2C_init);module_exit(CAMERA_HW_i2C_exit);在這里L(fēng)inux內(nèi)核加載和卸載Camera模塊。CameraDriveranalysisintheplatformofMTKPreliminaryInformationstaticstructplatform_driverg_stCAMERA_HW_Driver=.probe=CAMERA_HW_probe,.remove=CAMERA_HW_remove,.suspend=CAMERA_HW_suspend,.resume=CAMERA_HW_resu
30、me,.driver=I!f!.name=image_sensor,.owner=THIS_MODULE,;Camera模塊初始化開始向總線注冊驅(qū)動(dòng),在Platform_driver的成員函數(shù).probe()中,通過i2c_add_driver(&CAMERA_HW_i2c_driver)向I2C申請(qǐng),而CAMERA_HW_i2c_driver這個(gè)結(jié)構(gòu)體里填充的是將Camera作為一個(gè)字符設(shè)備在I2C上進(jìn)行注冊:structi2c_driverCAMERA_HW_i2c_driver=.probe=CAMERA_HW_i2c_probej.remove=CAMERA_HW_i2c_remove
31、,.detect=CAMERA_HW.=CAMERA_HW_DR/NAME,.id_table=CAMERA-HWjZcJd,.addres5_data=addr_dat:a)h;staticintCAMERA_HW_i2c_probe(structi2c_client*clientjconststructi2c_device*id)inti4RetValue=0;PK_DBG(CAMERA_HWAttachI2Cn);/getsensori2cclientg_pstI2Cclient=client;/setI2Cclockrateg_pstI2Cclient-timin
32、g=200;/200k/Registerchardriveri4RetValue=RegisterCAMERA_HWCharDrv();if(i4RetValue)PK_ERR(CAMERA_HWregisterchardevicefailed!n);returni4RetValue;/spin_lock_init(&g_CamHWLock);PK_DBG(CAMERA_HWAttached!n);return0;?endCAMERA_HW_i2c_prc.be?在RegisterCAMERA_HWCharDrv()中cdev_init(g_pCAMERA_HW_CharDrv,&g_stCA
33、MERA_HW_fops)對(duì)設(shè)備進(jìn)行初始化,并將g_stCAMERA_HW_fops這個(gè)文件操作函數(shù)作為上層對(duì)Camera設(shè)備操作的接口留給上層進(jìn)行調(diào)用:GhongConfidentialRevision0.1-Feb.142012-14-2012Ghonginc.CameraDriveranalysisintheplatformofMTKPreliminaryInformation- -staticconststructfile_operationsg_stCAMERA_HW_fops=.owner=THIS-MCiDULE,.open=CAMERA_HW_Open.release=CAME
34、RA_HW_ReleaseJ#ifdefUSE_NEW_IOCTL.unlocl_GETRESOLUTION:i4RetValue=adopt_CAMERA_HW_GetResolution(pBuff)$break;caseKDIMGSENSQRIO.C_X_FEATUREC0NCTROL:i4RetValue=adopt_CAMERA_HW_FeatureCantrol(pBuff);break;caseKDIMjGSENSORIOC_JS_t.ONTROL:i4RetValue=adopt_CAMERA_HW_Control(pBuff);break;caseKDIMGSENSORIOC
35、_T_CLCiSE:i4RetValue=adopt_CAMERA_HW_Clo5e();break;caseKDIMSENSORIOC_T_CHE匚k_I吿_ALIVE:i4RetValue=adopt_CAMERA_HW_CheckIsAlive();break;default:PK_DBG(No-suchcommandi4RetValue=-EPERM;break;通過判斷Sensor狀態(tài)的邏輯值來進(jìn)行具體的操作,對(duì)于這個(gè)值的定義在:MediatekcustomcommonkernelimgsensorincKd_imgsensor.h中GhongConfidentialRevision
36、0.1-Feb.1420122012Ghonginc.CameraDriveranalysisintheplatformofMTKPreliminaryInformation7/ThisconmnandwillTBD#defin&KDIMGSENSORIDC_T_OPEN-IQflMSENSORMAGIC.o)/sensorGetlnfoZ/This:coimnandwillTBD#defineKDIMGSENSORXS:C_X_GETINFO-IQWRflMGSENSORMAGICjACDK/Jsenso;rGetResolutionp/Thi?coimnand顧illTBD#defineK
37、DIMGSENSORIOC_X_GETRESOLUTIWN.IOWRtlMGSENORMAGlC.lOE/menscirFe日tueGcintrcd/ThiscoimnandwillTBDdefineKDIMGSENSORIIC_K_FEATURECONCTROL.IOWRtlMGSENS&RMAGIC,!/sensorControl7/This-cjoimnand円illTBD#defineKDIMGSENSORWC_X_C匚NTFtULaWRflMGSENSORMAGIC.EO.ACD./sensorClose/Thisctjimnand楝槪TBD/$etsensordriver#defi
38、ne/sensorSeaKjchdefineKDIMGSENSORIOC_T_CLOSE-IO.tlMGSENSORMAGIC.ZS).IOWRtlMGSENSORMAGICO.uSKDIMGSENSOR1GCXSETDRIVEdefineKDIMGSENSORIOC_T_CHECK_IS_ALIVE_IOIMGSENSORMAGICj30)在KdSetDriver()中通過判斷name和ID匹配具體型號(hào)的sensor的驅(qū)動(dòng),判斷它是主攝還是次攝,并對(duì)它進(jìn)行初始化:if(drvldxMAX_NUM_OF_SUPPORT_SENSOR):=”PowerOFF:M匸;T1SubCameraE1S*
39、:PowerOn:lrIf7i廠廠i設(shè)置CMPDNI止從攝進(jìn)入卩DN設(shè)flCMRSTI止從攝R琢t無效:WOV5647規(guī)格書.5上電順序供電:1:7-_:;.j-:MI9VI14規(guī)格書;:上電盹序供電:-:jj5jjcj:juLIij:ifir:!:!-丄丄.:r弗:ii3Set1-pinSetIdxIDX_PSCMPDNrpinSet1-pinSetIdXJIDX_PS_CMP廿(mt2sef卵io皿9訃渝313肓口1:1曲和口_用曰迎I,GPIO_DIROUT)if(iiit、Etgpioout(pinSEXmnSEHdxID)Cp3j;pinsEtpirSEtIdx述壬兩聲電拠匹為眄歩)
40、|紆是從研始比他笫七住是u32pinSetldx=0;/defaultmainsensor#defineIDXPSMODE1#defineIDXPSONZdefineIDXPSjOFF0u32pinSet38XjStfor沁GlGPIOGPIOOUT空gpiocamera3GPIO_OUONEr_GPIOOUTZEROpGPIOCAMERACMPDNl_PINr報(bào)據(jù)它前面的iF條件GPIOCAMERACMPDN1_PIN_M_GPIOr判航這SpinSetld=ltGPIO_OUT_ONEr所以1-pinSeto就睪對(duì)GPIO_OUT_ZERO,MalnSensorPON憶,曲遵嚴(yán)、/form
41、air_2sensorJ:FGPIOCAMERA2CMRSTPIN,if(DUAL_CAMERAJUJN_SENSOR二二Sensorldx)pinSetldx:elseif(DUALCSpinSetldx:elseif(DUALCAIIEftAMAIN5EC0h!D5ENS0R=SemoHcIx)Pietldx=2;用作后攝兼容或雙后攝供電創(chuàng)建SensorFuncOV5647這樣一個(gè)數(shù)據(jù)結(jié)構(gòu)SENSOR_FUNCTION_STRUCTSensorFuncOV5647=OV5647Open,OV5647GetInfo,OV5647GetResolution,OV5647FeatureContr
42、ol,OV5647Control,OV5647Close;GhongConfidentialRevision0.1-Feb.1420122012Ghonginc.CameraDriveranalysisintheplatformofMTKPreliminaryInformation- -UINT320V56470pen(void)讀取IDkal_uintl6sensor_id=0;sensor_id=(0V5647reademossense0X3B0ASENSORif(sensorreturnERRORSENSOftCONNECTFAIL;如果ID匹蟲:前調(diào)用初始化函礎(chǔ)二0V5647Senso
43、rInitf);returnERRORNONE;/*0V56470penA/根據(jù)ClV5647DaT3Sheet010V5647reademossenV:7-JlTtTTqTT3-TZdefineOV5630SENSOID#define0V7675_SENS0R_ID#define0V5647SENSORID0X300B0X56340X7673OV5647Open初始化操作就是對(duì)SensorIC中寄存器的操作,調(diào)試主要由IC原廠支持。Open函數(shù)結(jié)束后返回ERROR_NONE表示初始化成功,可以正常使用。OV5647GetInfoUINT32OV5647GetInfo(MSDK_SCENARI
44、O_ID_ENUMScenarioId,MSDK_SENSOR_INFO_STRUCT*pSensorInfo,MSDK_SENSOR_CONFIG_STRUCT*pSensorConfigData)第一個(gè)參數(shù)ScenarioId來自于MSDK_SCENARIO_ID_ENUM這個(gè)數(shù)組,在kd_imgsensor_define.h中是這樣定義的:#defineMSDK_SCENARIO_ID_ENUMACDK_SCENARIO_ID_ENUMtypedefenumACDK_SCENARIO_ID_CAMERA_PREVIEW=0,ACDK_SCENARIO_ID_VIDEO_PREVIEW,A
45、CDK_SCENARIO_ID_VIDEO_CAPTURE_MPEG4,ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG,ACDK_SCENARIO_ID_CAMERA_CAPTURE_MEM,ACDK_SCENARIO_ID_CAMERA_BURST_CAPTURE_JPEG,ACDK_SCENARIO_ID_VIDEO_DECODE_MPEG4,ACDK_SCENARIO_ID_VIDEO_DECODE_H263,ACDK_SCENARIO_ID_VIDEO_DECODE_H264,ACDK_SCENARIO_ID_VIDEO_DECODE_WMV78,ACDK_S
46、CENARIO_ID_VIDEO_DECODE_WMV9,ACDK_SCENARIO_ID_VIDEO_DECODE_MPEG2,ACDK_SCENARIO_ID_IMAGE_YUV2RGB,ACDK_SCENARIO_ID_IMAGE_RESIZE,ACDK_SCENARIO_ID_IMAGE_ROTATE,GhongConfidentialRevision0.1-Feb.1420122012Ghonginc.PreliminaryInformationCameraDriveranalysisintheplatformofMTKPreliminaryInformationACDK_SCENA
47、RIO_ID_IMAGE_POST_PROCESS,ACDK_SCENARIO_ID_JPEG_RESIZE,ACDK_SCENARIO_ID_JPEG_DECODE,ACDK_SCENARIO_ID_JPEG_PARSE,ACDK_SCENARIO_ID_JPEG_ENCODE,ACDK_SCENARIO_ID_JPEG_ENCODE_THUMBNAIL,ACDK_SCENARIO_ID_DRIVER_IO_CONTROL,ACDK_SCENARIO_ID_DO_NOT_CARE,ACDK_SCENARIO_ID_IMAGE_DSPL_BUFFER_ALLOC,ACDK_SCENARIO_I
48、D_TV_OUT,ACDK_SCENARIO_ID_MAX,ACDK_SCENARIO_ID_VIDOE_ENCODE_WITHOUT_PREVIEW,ACDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG_BACK_PREVIEW,ACDK_SCENARIO_ID_VIDEO_DECODE_RV8,ACDK_SCENARIO_ID_VIDEO_DECODE_RV9,ACDK_SCENARIO_ID_CAMERA_ZSD,ACDK_SCENARIO_ID_ENUM;通過這個(gè)數(shù)組定義Camera的各種模式,并且給他們從0開始給一個(gè)模擬的ID,通過這個(gè)ScenarioID來控制C
49、amera的工作模式是在拍照、攝像等等。想要了解*pSensorInfo這個(gè)指針的內(nèi)容就得看MSDK_SENSOR_INFO_STRUCT的定義#defineMSDK_SENSOR_INFO_STRUCTACDK_SENSOR_INFO_STRUCTtypedefstructMUINT16SensorPreviewResolutionX;MUINT16SensorPreviewResolutionY;MUINT16SensorFullResolutionX;MUINT16SensorFullResolutionY;MUINT8SensorClockFreq;/*MHz*/MUINT8Senso
50、rCameraPreviewFrameRate;MUINT8SensorVideoFrameRate;MUINT8SensorStillCaptureFrameRate;MUINT8SensorWebCamCaptureFrameRate;MUINT8SensorClockPolarity;/*SENSOR_CLOCK_POLARITY_HIGH/SENSOR_CLOCK_POLARITY_Low*/GhongConfidentialRevision0.1-Feb.142012-21-2012Ghonginc.CameraDriveranalysisintheplatformofMTKMUIN
51、T8SensorClockFallingPolarity;MUINT8SensorClockRisingCount;/*0.15*/MUINT8SensorClockFallingCount;/*0.15*/MUINT8SensorClockDividCount;/*0.15*/MUINT8SensorPixelClockCount;/*0.15*/MUINT8SensorDataLatchCount;/*0.15*/MUINT8SensorHsyncPolarity;MUINT8SensorVsyncPolarity;MUINT8SensorInterruptDelayLines;MINT3
52、2SensorResetActiveHigh;MUINT32SensorResetDelayCount;ACDK_SENSOR_INTERFACE_TYPE_ENUMSensroInterfaceType;ACDK_SENSOR_OUTPUT_DATA_FORMAT_ENUMSensorOutputDataFormat;ACDK_SENSOR_MIPI_LANE_NUMBER_ENUMSensorMIPILaneNumber;CAMERA_ISO_BINNING_INFO_STRUCTSensorISOBinningInfo;MUINT32CaptureDelayFrame;MUINT32Pr
53、eviewDelayFrame;MUINT32VideoDelayFrame;MUINT16SensorGrabStartX;MUINT16SensorGrabStartY;MUINT16SensorDrivingCurrent;MUINT8SensorMasterClockSwitch;MUINT8AEShutDelayFrame;/*Theframeofsettingshutterdefault0forTGint*/MUINT8AESensorGainDelayFrame;/*Theframeofsettingsensorgain*/MUINT8AEISPGainDelayFrame;MU
54、INT8MIPIDataLowPwr2HighSpeedTermDelayCount;MUINT8MIPIDataLowPwr2HighSpeedSettleDelayCount;MUINT8MIPICLKLowPwr2HighSpeedTermDelayCount;MUINT8SensorWidthSampling;MUINT8SensorHightSampling;MUINT8SensorPacketECCOrder;MUINT8SensorDriver3D;ACDK_SENSOR_INFO_STRUCT,*PACDK_SENSOR_INFO_STRUCT;GhongConfidentia
55、lRevision0.1-Feb.142012-22-2012Ghonginc.CameraDriveranalysisintheplatformofMTK這個(gè)結(jié)構(gòu)體列取了Sensor的時(shí)鐘頻率、預(yù)覽時(shí)的幀率、行同步/幀同步頻率等參數(shù)。第三個(gè)參數(shù)*pSensorConfigData同樣根據(jù)MSDK_SENSOR_CONFIG_STRUCT結(jié)構(gòu)體#defineMSDK_SENSOR_CONFIG_STRUCTACDK_SENSOR_CONFIG_STRUCTtypedefstructACDK_SENSOR_IMAGE_MIRROR_ENUMSensorImageMirror;MINT32Enab
56、leShutterTansfer;/*Capture時(shí)的快門設(shè)置*/MINT32EnableFlashlightTansfer;/*有閃光燈的SensorCapture時(shí)的快門設(shè)置*/ACDK_SENSOR_OPERATION_MODE_ENUMSensorOperationMode;/*Capture的圖像寬度*/*Capture的圖像高度*/MUINT16MUINT16MUINT16MUINT16MUINT16MUINT16MUINT16ImageTargetWidth;ImageTargetHeight;CaptureShutter;FlashlightDuty;FlashlightOf
57、fset;FlashlightShutFactor;FlashlightMinShutter;/*Capture時(shí)的快門設(shè)置*/*有閃光燈的SensorCapture時(shí)的快門設(shè)置*/*有閃光燈的SensorCapture時(shí)的快門設(shè)置*/*有閃光燈的SensorCapture時(shí)的快門設(shè)置*/*有閃光燈的SensorCapture時(shí)的快門設(shè)置*/MUINT32Pixels;MUINT32Lines;MUINT32Shutter;MUINT32FrameLines;ACDK_CAMERA_OPERATION_MODE_ENUMMetaMode;MUINT32DefaultPclk;/Sensor默認(rèn)
58、的像素時(shí)鐘頻率(Ex:24000000)ACDK_SENSOR_CONFIG_STRUCT;OV5647GetResolutionUINT32OV5647GetResolution(MSDK_SENSOR_RESOLUTION_INFO_STRUCT*pSensorResolution)此函數(shù)只有一個(gè)參數(shù)*pSensorResolution,找到結(jié)構(gòu)體:MSDK_SENSOR_RESOLUTION_INFO_STRUCT#defineMSDK_SENSOR_RESOLUTION_INFO_STRUCTACDK_SENSOR_RESOLUTION_INFO_STRUCTtypedefstruct
59、MUINT16SensorPreviewWidth;/預(yù)覽時(shí)的圖像寬度MUINT16SensorPreviewHeight;/預(yù)覽時(shí)的圖像高度GhongConfidentialRevision0.1-Feb.142012-23-2012Ghonginc.CameraDriveranalysisintheplatformofMTKPreliminaryInformationMUINT16SensorFullWidth;MUINT16SensorFullHeight;ACDK_SENSOR_RESOLUTION_INFO_STRUCT,*PACDK_SENSOR_RESOLUTION_INFO_STRUCT;到這里可以發(fā)現(xiàn)同樣是獲取Sensor的信息,GetInfo函數(shù)獲取并設(shè)置了Sensor所處的模式、設(shè)置
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 循環(huán)泵產(chǎn)品供應(yīng)鏈分析
- 保險(xiǎn)承保行業(yè)經(jīng)營分析報(bào)告
- 印制的日程表產(chǎn)品供應(yīng)鏈分析
- 電動(dòng)指甲銼細(xì)分市場深度研究報(bào)告
- 制塑料桶罐設(shè)備產(chǎn)業(yè)鏈招商引資的調(diào)研報(bào)告
- 電報(bào)線產(chǎn)品供應(yīng)鏈分析
- 與企業(yè)并購相關(guān)的法律研究行業(yè)經(jīng)營分析報(bào)告
- 提高學(xué)生拼音學(xué)習(xí)效果的教學(xué)策略-探索多種形式的練習(xí)和鞏固
- 測振儀產(chǎn)品供應(yīng)鏈分析
- 導(dǎo)演廣告片行業(yè)營銷策略方案
- 后進(jìn)生轉(zhuǎn)化記錄表4篇-后進(jìn)生轉(zhuǎn)化
- 核心素養(yǎng)導(dǎo)向的初中化學(xué)單元教學(xué)設(shè)計(jì):基于大概念
- 在角色游戲中促進(jìn)幼兒社會(huì)性發(fā)展
- 德育教育(教育學(xué)專業(yè))PPT完整全套教學(xué)課件
- 鋁業(yè)有限公司陽極氧化安全風(fēng)險(xiǎn)分級(jí)管控清單
- 罷工應(yīng)急預(yù)案
- 六年級(jí)上冊快樂讀書吧課外測試題
- 2024年高考英語讀后續(xù)寫復(fù)習(xí)題:教師職業(yè)生涯中的感動(dòng)與責(zé)任講義
- 上海市復(fù)旦大學(xué)附中2022-2023學(xué)年高二上學(xué)期期中語文試題
- 正常產(chǎn)褥病例分析
- 中國少先鋒隊(duì)章程(修正案)
評(píng)論
0/150
提交評(píng)論