Android Driver Development Nineth Chapter notes

Source: Internet
Author: User

---restore content starts---

The Nineth Chapter is mainly about the hardware abstraction layer:HAL, which is a set of libraries built on Linux drivers. Just started to introduce why to add HAL to Android , the purpose is three, one, unified hardware call interface. Second, solve the GPL 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 speaks about the Android HAL architecture. The next step is to add HAL to the LED driver , mainly by moving all the business logic from the led driver to the Hal module, while the LED driver retains the function of the read-write register only.

Hal Steps involved:1. Writing Linux drivers 2. Writing Hal Library 3. Writing Service Library Lite led driver

the steps and principles for writing the HAL module are as follows.

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.

The second step: The Open function of writing the HAL module is the entry point of the HAL module. In this example, the led_device_open function is used. 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: Write the close function of the HAL module and call the close function when the HAL module is unloaded

Sixth step: Write the function that controls the LED

In summary, this chapter describes a way to drive Linux in an Android system .

---restore content ends---

Android Driver Development Nineth Chapter notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.