Android Deep Explore (Vol. 1) Hal with driver development Nineth Hardware Abstraction Layer: HAL Reading notes

Source: Internet
Author: User

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. One of the main purposes of HAL is to protect "private property" and the other is to try to avoid direct access to the Linux driver by the application.

Linux drivers in traditional Linux systems typically have two types of code, access to hardware registers and business logic code. There is no secret to accessing the hardware register code, because it is a standard operation that calls the standard functions of the Linux kernel. And the business logic part of Linux for some enterprises or individuals do not want to speak the source code disclosure. The Linux kernel uses the GPL protocol, so the Linux driver has to expose the source code. Google added HAL to the Android system runtime layer. Because it's part of Android, it doesn't have to be open source. In short, the function of HAL is as follows: 1. The calling interface of the unified hardware; 2. Fixed the GPL copyright issue; 3. for special requirements.

Android HAL Architecture. The rationale is to use the library (. so file) in the Android system to invoke Linux drivers located in kernel space (typically accessed through device files). The android application (apk file) can then access the library in the HAL through the NDK program, or access the library in the HAL directly from the Android application. The new version adds the entry code for the HAL schema that is required by the HAL architecture.

Added HAL for LED driver.

1 to write a Linux driver that supports HAL. One. Write Linux drivers. Two. Write the HAL Library. Three. Write the service library.

2 Thin LED Driver

3 Test read-write register operation

4 Write the HAL module that calls the LED driver. To write the HAL module: I. Define structs and macros. Two. Write the HAL module's open function. Three. Define hw_module_method_t structure variables. Four. Define the HAL_MODULE_INFO_SYM variable. Five. Write the close function of the HAL module. Six. Write the function that controls the LEDs.

5 writing the service that invokes the HAL module

Storage path and naming rules for 6HAL modules

7 Writing the Java library that invokes the service

8 Test LED Driver

Software 1308 class 31st Zhang Fan Blog Park address: http://home.cnblogs.com/u/sxauzzz/

Android Deep Explore (Vol. 1) Hal with driver development Nineth Hardware Abstraction Layer: HAL Reading notes

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.