This chapter focuses on the hardware abstraction layer:HAL. HAL is a set of libraries built on Linux drivers thatGoogle adds to Android HAL The main purposes are as follows.
1. Calling interface for unified hardware
2. Fixed the issue of GPI Copyright
3. For a number of special requirements
In the LED driver, we joined HAL to use the program does not need to care about the Linux driver and device files interactive way. To write a linux driver that supports HAL:
First step: Writing Linux drivers
Step two: Write the HAL Library
Step three: Write the Service library
The steps and principles for writing the HAL module are as follows:
First step: defining structs and macros
Describes the hw-module-t structure of the HAL module
Describes the hw-device-t structure of a HAL device
hw-module-methods-t structure describing the module entry function
Step two: Write the HAL module's open function
Step three: Define hw-module-methods-t structure variables
Fourth step: Define the hal-module-info-sym variable
Fifth step: Write the close function of the HAL module
Sixth step: Write the function that controls the LED
Linux drivers are used in Android Systems in two ways. One is the traditional way to directly interact with the Linux driver, the other is Android -specific, is the HAL module.
http://home.cnblogs.com/u/zivjeli/
Android Deep Exploration (Vol. 1) Hal and Driver Development Nineth Chapter Summary