Android Deep Explore reading notes Nineth Chapter

Source: Internet
Author: User

HALis built onLinuxa set of libraries on top of the driver, which belongs toLinuxthe application layer above the kernel layer. Write a supportHALof theLinuxDriver Program: 1, in order toLinuxdriver AddHAL, to try to protect sensitive data. LinuxThe driver code should be as concise as possible, putting the business logic intoHAL Librarythe. 2,HAclass is normal.Linux Libraryfile, but this type of library file has an interface. ThroughHal_module_info_symvariable implementation. 3,Service Libraryis alsoLinux Library, which meansService Libraryis thatJNI Library,Service Manageris calledService Library, whileAPKprogram will callServiceManagerclass to accessService Library. Writing callsLEDdriven byHALmodule, in thisHALThe module contains theLEDDrive all the business logic that actuallyHAlThe modules are also commonLinuxShared Libraries (. sofile) that can beAndroidThe system automatically mounts, any program that is automatically called by the system will have an interface, and all theHALprogram must have aHal_module_info_symvariable. Specific WritingHALSteps of the module:1, define two new structures, the data type of the first variable of the two structures must behw_module_tand thehw_device_t. Also want toHALmodule to set aID, this step is equivalent to writingleds_hal.hthe code for the header file. 2, writingHALmodule'sOpenfunction,Openfunction isHALThe entry point of the module, the function: Initializehw_device_tthe word structure body;open the device file; initialize the register. 3, definehw_module_methods_tstruct variable. 4, defineHal_module_info_symvariable. 5, writingHALmodule'sClosefunction. 6, write ControlLEDthe function. Final TestledDrive.

http://www.cnblogs.com/sam0304/

Android Deep Explore reading 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.