Android Deep explore HAL and Driver Development-—— 9th Chapter

Source: Internet
Author: User

The Nineth chapter:
As long as you're talking about hardware abstraction Layer Hal,hal is a set of libraries built on Linux drivers. Hal is not part of the Linux kernel but is located on the Android system runtime layer. The first thing to say is the benefits of joining HAL. Includes: Unified hardware call excuse, to solve the GPL copyright issues, for some special requirements. The basic principle of the HAL architecture is to use libraries in the Android system to invoke Linux drivers located in kernel space, and then the Android application can access the libraries in the HAL through the NDK program, or access the libraries in the HAL directly in the Android application. The location of the Android HAL source code store is not fixed and is typically stored in the Android source directory medium. The final compiled. So file is primarily placed in the/SYSTEM/LIB/HW directory of the Android system.
The general steps for writing a Linux driver that supports HAL are: The first step: writing Linux drivers, and when adding HAL for Linux drivers to protect sensitive data, the Linux code needs to be concise to put the business logic into the HAL Library. Step two: Write the HAL Library, which is the normal Linux library file, and the Service Library locates the HAL by the ID defined in the interface. Step three: Write the service Library. ServiceManager calls the service library,apk program to call the Servicemanger class to access the service Library. Each part of the program should be tested in the process of writing Linux drivers and driver-related programs.
Writing HAL module steps and principles: First step: Define struct and macro, step two: Write Hal module Open function, step three: Define hw_module_methods_t struct variable, fourth step: Define HAL_MODULE_INFO_SYM variable, Fifth step: Write the HAL module close function, step sixth: write the control led function.

Android Deep explore HAL and Driver Development-—— 9th 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.