Android HAL层的目的在于保护硬件厂商的利益,不开源硬件的源码,对硬件源码用HAL封装起来,提供统一的调用接口。
Android HAL层涉及到三个关键结构体: struct hw_module_t、struct hw_module_methods_t、struct hw_devict_t
但是HAL规定不能直接调用hw_module_t结构,有如下英文注释:
//Every hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this data structure must begin with hw_module_t followed by module specific information.
我们拿camera的部分HAL代码来举例: