Hardware Abstraction Layer: HAL

Source: Internet
Author: User

The HAL hardware abstraction layer is a set of libraries built on Linux drivers. belongs to the application layer on the Linux kernel layer. The main purpose of HAL is to avoid direct access to the Linux driver for the application and to protect "private property". Traditional Linux drivers typically have two types of code: the code that accesses the hardware register and the business logic code.

Why on Android adding HAL to the

To meet the requirements of Linux driver authors who do not want open source. The HAL is located at the Android System Runtime layer. That is, HAL is part of Android. So there's no need for open source.

Google's main purpose for adding HAL to Android

1. The calling interface of the unified hardware. Because HAL has a standard calling interface, HAL can be used to mask Linux to drive complex, non-uniform interfaces.

2. Fixed the GPL copyright issue. Because the Linux kernel is based on the GPL protocol, Android is based on the Apache Licence 2.0 protocol. So Google shifted the sensitive code that was already on Linux to drive China up one level. This way, these sensitive code is freed from the GPL, and the Linux drivers who don't want open source don't need to open up.

3. For a number of special requirements. For some hardware, you may need access to some user-space resources, or work that is inconvenient in kernel space, and special needs. In this case, the HAL code located in the user space can be used to assist the Linux driver to do some work.

Android HAL Architecture

Added HAL for LED driver

To write a Linux driver that supports HAL

1. Writing Linux Drivers

2. Writing the HAL Library

3. Writing the service Library

There are two ways to use Linux drivers in an Android system: 1. Interact directly with Linux drivers in a traditional way. 2.android unique, through the HAL module. Essentially, the Linux shared library (. So) interacts with the Linux driver and then the application accesses the Linux shared library.

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.