"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
-
Upload
nanik-tolaram -
Category
Entertainment & Humor
-
view
2.837 -
download
13
description
Transcript of "Learning AOSP" - Android Hardware Abstraction Layer (HAL)
““Learning AOSP”Learning AOSP”Hardware Abstraction LayerHardware Abstraction Layer
Nanik TolaramNanik Tolaram@nanikjava@nanikjava
(kernel).ozandroid.info(kernel).ozandroid.infoplus.google.com/+NanikTplus.google.com/+NanikT
Thank You !Thank You !
ArchitectureArchitecture
Questions !Questions ! What is HAL ?What is HAL ?
Why is it such a big deal ?Why is it such a big deal ?
Why do we care ?Why do we care ?
What hardware is part of HAL ?What hardware is part of HAL ?
What is relationship between Android and HAL ?What is relationship between Android and HAL ?
Hardware LayerHardware Layer
What is HAL ?What is HAL ? Cater for non-GPL vendor codeCater for non-GPL vendor code
Included in Android image as blob (.so)Included in Android image as blob (.so)
Freeing developer to focus on their app (Camera3 multiple Freeing developer to focus on their app (Camera3 multiple camera support - KitKat)camera support - KitKat)
Software layer that interact with kernel drivers *NOT* to hardwareSoftware layer that interact with kernel drivers *NOT* to hardware
/system/lib/hw /system/lib/hw and and /vendor/lib/hw/vendor/lib/hw
HardwareHardware
Nexus 7 (2012) [“grouper” ] : Camera, Sensors, Wi-Fi, Bluetooth, Nexus 7 (2012) [“grouper” ] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Touch Panel, Orientation Sensor, Graphics, NFC, DRMGPS, Touch Panel, Orientation Sensor, Graphics, NFC, DRM
Nexus 7 (2013) [“razor”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Nexus 7 (2013) [“razor”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Graphics, NFC, DRM, Audio, Sensors, Media, DSP, USBGraphics, NFC, DRM, Audio, Sensors, Media, DSP, USB
Nexus 5 [“hammerhead”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Nexus 5 [“hammerhead”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Graphics, NFC, Audio, GSM, Camera, Media, DSP, USBGraphics, NFC, Audio, GSM, Camera, Media, DSP, USB
Framework and HALFramework and HAL
HAL StubsHAL Stubs
Android provides the interface that vendors must implement Android provides the interface that vendors must implement ((/hardware/libhardware/include/hardware/hardware/libhardware/include/hardware))
HAL processHAL process1.1. Java application call hardware framework service APIJava application call hardware framework service API2.2. Framework service call internal APIFramework service call internal API3.3. HAL framework loads hardware libraryHAL framework loads hardware library4.4. Obtain device structure from memoryObtain device structure from memory5.5. Call HAL stub functionCall HAL stub function
Example - Power HAL Example - Power HAL DisplayPowerState.java
PowerManagerService.java
power.c
com_android_server_power_PowerManagerService.cpp
/sys/devices/system/cpu/cpufreq/interactive/timer_rate/sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
/sys/devices/system/cpu/cpufreq/interactive/input_boost
Example – LCD BacklightExample – LCD Backlight
DisplayPowerState.java
LightsService.java
device/asus/grouper/liblights/lights.c
com_android_server_LightsService.cpp
/sys/class/backlight/pwm-backlight/brightness
HAL StructureHAL Structure
hw_device_t
hw_module_t
hw_module_methods_t
* open (..)
camera_device nfc_nci_device audio_hw_device
'open' generally called to obtain device implementation structure
different structure implementation for different hardware
Device specific structure contain hw_module_t which is queried by Android framework from HAL library through hw_get_module function
(1)
(2)
Thank YouThank You