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