This chapter focuses on the hardware abstraction layer:HAL, it is built onLinuxA set of libraries on top of the driver. I was just beginning to explain whyAndroidJoin inHAL, the purpose is to have three, one, unified hardware call interface. Two, to solve theGPL Copyright issue. Third, for some special requirements. You can use the HAL code located in user space to assist the Linux driver in doing some work.
The next section saysAndroid HALArchitecture. Next, we'll talk aboutLedDrive increaseHal, which mainly moves all the business logic from the led driver to the HAL module, while the LED driver retains only the function of the read-write register.
Involved inHALSteps:1.WriteLinuxDriven2. Write HAL Library 3. Write Service Library Lite LED driver
hal
The first step: defining structs and Macros writing HAL modules requires 3 very important structures, and in the first step you need to define two new structures.
Step Two: WriteHALModule'sOpenFunctionOpenfunction isHALThe entry point of the module. In this example, you are using theThe led_device_open function. This function mainly does the following three work. Initializes the hw_device_t of the sub-structure. Open the device file. initializes the register.
Step three: Define hw_module_methhods_t structure variables
Fourth step: Define the hal_module_info_sym function
Fifth Step: WriteHALModule'sclose when halclose
led
In summary, this chapter describes a way to drive Linux in an Android system .
My Blog Park address is: http://www.cnblogs.com/zzp036/p/5449784.html
Andriod Deep Exploration (Vol. 1) Hal and Driver Development Nineth Chapter reading experience