Nineth Hardware Abstraction Layer: HAL

Source: Internet
Author: User

Nineth Hardware Abstraction Layer: HAL

The Nineth chapter mainly introduces a set of library HAL (Hardware abstraction Layer) built on Linux driver. This library is not part of the Linux kernel, but rather belongs to the application layer on top of the Linux kernel layer.

Google's main purpose of adding Hal to Android is to protect "private property" in addition to avoiding direct access to Linux drivers. HAL is the gospel for businesses or individuals who want to publish Android-based Linux drivers without exposing their core logic.

Why do I add HAL to Android in the first section?

Linux is only a "data setter" for Linux driver authors who don't want to open the source. In other words, the Linux driver should not keep any business logic code that you do not want to expose (the code is in the HAL), but only the code that interacts with the register, and the access register can only be done by the relevant functions of the Linux kernel. If this is the case, the Linux driver has only one shell left, and the only function is to receive the data sent by the HAL, write the data to the specified register, or read the data from the register and return it to the HAL. From this point of view, the Linux driver with HAL is equivalent to uploading data from the HAL to the sensor, or from the register to the HAL's "Data Setter".

Section II Android HAL Architecture

The core code in the HAL module does not change, just add some new HAL schema required entry code, so that these libraries can be automatically recognized by the Android system. The code that calls the HAL module does not need to load the. So file directly, but only requires an ID to locate the corresponding. So file (this is called stub). There is also a layer of service libraries between stubs and JNI, which uses the mechanism provided by the Android system to call the HAL to access the service library in the HAL. Then the Android app calls the service library again.

Section III for LED driver add HAL

Steps:

Writing Linux Drivers

Writing the HAL Library

Write Service Library

Nineth Hardware Abstraction Layer: HAL

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.