Andriod Deep Exploration of-hal and Driver Development Nineth Chapter reading notes and a little experience

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. Google adds HAL 's main purpose to Android In addition to avoiding direct application access Linux Drivers, there is another important reason, that is to protect "private property."

Google for abdroid to join HAL mainly for the following purposes:

Debug interface for Unified hardware.

Fixed the GPL copyright issue.

For some special requirements.

To write a Linux driver that supports HAL

First step: Writing Linux Drivers

Step two: Write HAL libray

Step three: Writing the Server libary

steps and principles for writing HAL modules

First step: defining structs and macros

Describes the hw_module_t structure of the HAL module

Describes the hw_device_t structure of a HAL device

hw_module_methods_t structure describing the module entry function

Step two: Write the HAL module's open function

Initialize the hw_device_t of a struct

Open the device file

Initializing registers

Step three: Define hw_module_methods_t structure variables

Fourth Step: Define the hal_module_info_sym variable

Fifth step: Write the close function of the HAL module

Sixth step: Write the function that controls the LED

Experience: There are two ways to use Linux drivers in Android. One is to interact directly with Linux drivers in a traditional way. The other is Android-specific, which is through the HAL module. The HAL module essentially interacts with the Linux driver through a Linux shared library, and then the application accesses the Linux shared library.

My blog address: http://home.cnblogs.com/u/jie617530/

Andriod Deep Exploration of-hal and Driver Development Nineth Chapter reading notes and a little 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.