Camera study (1)

1. Necessary knowledge for getting started with Android Camera driver development

The direction of the camera:
1. Camera driver debugging (kernel layer) - C language
2. Camera hal layer debugging development - C++ (involving JNI)
3. Camera application layer development - java

1: Hardware related

        You need to understand simple digital circuits and understand the circuit diagram (this is very simple), and you can find the GPIO connected to the corresponding Camera hardware according to the circuit, and configure the GPIO to the corresponding mode according to the chip manual; for example, GPIO mode, input IO or output IO; or Configure it in PWM mode; the GPIO works in different modes in different modes; there are also Camera DVDD AVDD IOVDD power-on control, and I2C configuration.

2: Camera driver

        For example, ov5640; you need to find a book related to Linux drivers, such as "linux device drivers" to know the simple way of writing linux device drivers; of course, you don't need to write the camera driver at work, you can use it if you have references, but refer to the driver Generally support video recording and camera functions, other white balance, focus, etc. need to be adjusted by yourself;

3: V4L2 protocol

        V4L2 English abbreviation video for linux version 2.

        At present, Qualcomm, Samsung, MTK and Allwinner platforms have V4L2 camera driver architectures, except for the MTK platform. The MTK camera driver architecture uses its own set of character device driver architectures.

        Because the driver exports the /dev/video0 interface through the V4L2 protocol; the application of the upper layer C also accesses /dev/video0 through the V4L2 protocol; the actual V4L2 protocol communicates with the underlying driver through some flag linux ioctl() functions; the V4L2 protocol is In order to shield the differences of various Camera drivers (such as usb camera, mipi interface camera), the unified and camera driver communication specification is provided;

4: Language

        You need to know the relevant knowledge of C++ class, it is best to be able to see the code of C++, since you have the knowledge of C, how can you understand the face-to-face object of C++, just know the class of C++; why do you need to know C++? Because the Android Camera HAL access to /dev/video0 is written in C++, more than 20 different classes of xxxx.cpp are implemented by mutual inheritance; and you need to understand the writing method of the Android HAL layer, at least check the information to know where to use it ;Generally CameraModule.cpp or CameraHal.cpp;

5: Framework JNI call

        It is best to know the writing method of JNI, at least you can copy it, because these writing methods are fixed, because sometimes you have to track the code from the java layer to the HAL layer to the driver during the debugging process;

6: Linux system

        You need to be able to use Linux, because all Android source codes are compiled under Linux; you need to know the ARM architecture, cross compiler; such as arm-linux-gcc; know how to compile Android and kernel source code; how to flash; how to debug; It is best to buy an Android development board with a Camera.

Reference link: https://www.zhihu.com/question/21573611/answer/65120008

おすすめ

転載: blog.csdn.net/qq_44933149/article/details/127574919