Android Deep Exploration notes-Nineth Chapter

Source: Internet
Author: User

The HAL layer belongs to the application layer on the Linux kernel layer in order to avoid direct access to Linux drivers and protect "private property" from the application. The Linux driver with the HAL is equivalent to uploading data from the HAL to the Register, or from the register to the data setter of the HAL.

The main purpose of joining HAL: 1: Unified Hardware Call Interface, 2: Fixed GPL copyright issue, 3: for some special requirements.

The location of the Android HAL source code store is not fixed and is typically stored in the Android source directory/hardware directory.

To write a Linux driver that supports HA: 1: Write Linux drivers; 2: Write the HAL library, which has an interface for this type of library file. by Hal_module_info_ sym variable; 3: Write Service Library;

If more than one Android virtual machine is started or multiple Android devices are connected. The build.sh script file detects these devices and lists them for user selection.

Each part of the program should be tested in the process of writing Linux drivers and driver-related programs.

The HAL module has a fixed-name struct-body variable hal_module_info_sym. The HAL module consists of LEDs HAL.C and LEDs. Hal.h. Leds_hal.h header files are used to define structs, macros, and header files that reference some systems.

The steps and principles for writing the HAL module are as follows: 1: Defining structs and Macros, 2: Writing the Open function of the HAL module, 3: defining Hw_module_methods_ t struct variables, 4: Defining Hal_module_info_sym variables, 5: Writing the HAL module's Close function; 6: Write the function that controls the LED;

Android Deep Exploration notes-Nineth Chapter

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.