Nineth Chapter
Hal is a set of libraries built on Linux drivers. This library is not part of the Linux kernel, but rather belongs to the application layer on top of the Linux kernel layer. can be used to protect authors who do not want to expose source code.
The HAL architecture is simple, and the basic principle is to use the library in Android to invoke Linux drivers in kernel space, and then the Android application can access the libraries in the HAL through the NDK program, or access the libraries in the HAL directly in the Android application.
To write a Linux driver that supports HAL:
1, write Linux driver, Linux driver code to try to brief, as far as possible to put business logic into the HAL Library.
2, write HAL Library,hal Library is a common Linux library file, single such library file has an interface. Implemented by Hal_module_info_sym variables.
3, the preparation of service Library, this is the necessary steps.
Test read-Write register operations: During the process of writing Linux drivers and driver-related programs, each part of the program should be tested in pieces, and each part should be tested using the appropriate method to minimize the currently written program bugs.
Steps and principles for writing HAL modules:
1. Define the structure and macros.
2. Write the HAL module's open function as a program entry port.
3, define HW_MODULE_METHODS_T structure variables.
4, define the HAL_MODULE_INFO_SYM variable.
5. Write the close function of the HAL module.
6, write the function of control led.
Reading notes the Nineth Chapter