Read the "Hardware abstraction Layer: HAL" experience

Source: Internet
Author: User

1 HAL is a set of libraries built on Linux drivers that are not part of the Linux kernel but belong to the application layer on the Linux kernel layer. Its purpose is to protect "private property" and to avoid direct access to Linux Drivers by the application .

2 There are two ways to use Linux drivers in an Android system. One is to interact directly with Linux in a traditional way , such as directly reading data from a device file. The other is Andrid Unique, is through the HAL module.

The 3 HAL module essentially interactswith Linux drivers through a Linux shared library (.so). The application then accesses the Linux shared library.

4 each HAL Shared library specifies an ID to locate the corresponding .so by ID . File (called Stubhere). Google also recommends using stubs to write HAL modules.

5 steps and principles for writing HAL modules:

(1) Defining structures and macros

(2) Writing the HAL module's open function

(3) Define hw_module_methods_t structure variables

(4) Define hal_module_info_sym variables

(5) Write the close function of the HAL module

(6) Write a function to control the LED

6Android System's properties file Total 4 : /default.prop;/system/build.prop;/system/default.prop;/data/ Local.prop. Android will automatically load these properties files at startup.

My blog Address
http://www.cnblogs.com/zhanghui4521/

Read the "Hardware abstraction Layer: HAL" experience

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: info-contact@alibabacloud.com 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.