Android Hardware Abstraction Layer
Data Structures | Macros | Typedefs | Functions
hardware.h File Reference
#include <stdint.h>
#include <sys/cdefs.h>
#include <cutils/native_handle.h>
#include <system/graphics.h>

Go to the source code of this file.

Data Structures

struct  hw_module_t
 
struct  hw_module_methods_t
 
struct  hw_device_t
 

Macros

#define MAKE_TAG_CONSTANT(A, B, C, D)   (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
 
#define HARDWARE_MODULE_TAG   MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
 
#define HARDWARE_DEVICE_TAG   MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
 
#define HARDWARE_MAKE_API_VERSION(maj, min)   ((((maj) & 0xff) << 8) | ((min) & 0xff))
 
#define HARDWARE_MAKE_API_VERSION_2(maj, min, hdr)   ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff))
 
#define HARDWARE_API_VERSION_2_MAJ_MIN_MASK   0xffff0000
 
#define HARDWARE_API_VERSION_2_HEADER_MASK   0x0000ffff
 
#define HARDWARE_HAL_API_VERSION   HARDWARE_MAKE_API_VERSION(1, 0)
 
#define HARDWARE_MODULE_API_VERSION(maj, min)   HARDWARE_MAKE_API_VERSION(maj,min)
 
#define HARDWARE_MODULE_API_VERSION_2(maj, min, hdr)   HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
 
#define HARDWARE_DEVICE_API_VERSION(maj, min)   HARDWARE_MAKE_API_VERSION(maj,min)
 
#define HARDWARE_DEVICE_API_VERSION_2(maj, min, hdr)   HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
 
#define version_major   module_api_version
 
#define version_minor   hal_api_version
 
#define HAL_MODULE_INFO_SYM   HMI
 
#define HAL_MODULE_INFO_SYM_AS_STR   "HMI"
 

Typedefs

typedef struct hw_module_t hw_module_t
 
typedef struct hw_module_methods_t hw_module_methods_t
 
typedef struct hw_device_t hw_device_t
 

Functions

int hw_get_module (const char *id, const struct hw_module_t **module)
 
int hw_get_module_by_class (const char *class_id, const char *inst, const struct hw_module_t **module)
 

Macro Definition Documentation

#define HAL_MODULE_INFO_SYM   HMI

Name of the hal_module_info

Definition at line 199 of file hardware.h.

#define HAL_MODULE_INFO_SYM_AS_STR   "HMI"

Name of the hal_module_info as a string

Definition at line 204 of file hardware.h.

#define HARDWARE_API_VERSION_2_HEADER_MASK   0x0000ffff

Definition at line 43 of file hardware.h.

#define HARDWARE_API_VERSION_2_MAJ_MIN_MASK   0xffff0000

Definition at line 42 of file hardware.h.

#define HARDWARE_DEVICE_API_VERSION (   maj,
  min 
)    HARDWARE_MAKE_API_VERSION(maj,min)

Definition at line 74 of file hardware.h.

#define HARDWARE_DEVICE_API_VERSION_2 (   maj,
  min,
  hdr 
)    HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)

Definition at line 75 of file hardware.h.

#define HARDWARE_DEVICE_TAG   MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')

Definition at line 35 of file hardware.h.

#define HARDWARE_HAL_API_VERSION   HARDWARE_MAKE_API_VERSION(1, 0)

Definition at line 57 of file hardware.h.

#define HARDWARE_MAKE_API_VERSION (   maj,
  min 
)    ((((maj) & 0xff) << 8) | ((min) & 0xff))

Definition at line 37 of file hardware.h.

#define HARDWARE_MAKE_API_VERSION_2 (   maj,
  min,
  hdr 
)    ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff))

Definition at line 40 of file hardware.h.

#define HARDWARE_MODULE_API_VERSION (   maj,
  min 
)    HARDWARE_MAKE_API_VERSION(maj,min)

Definition at line 68 of file hardware.h.

#define HARDWARE_MODULE_API_VERSION_2 (   maj,
  min,
  hdr 
)    HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)

Definition at line 69 of file hardware.h.

#define HARDWARE_MODULE_TAG   MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')

Definition at line 34 of file hardware.h.

#define MAKE_TAG_CONSTANT (   A,
  B,
  C,
  D 
)    (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))

Definition at line 32 of file hardware.h.

#define version_major   module_api_version

Definition at line 112 of file hardware.h.

#define version_minor   hal_api_version

Definition at line 130 of file hardware.h.

Typedef Documentation

typedef struct hw_device_t hw_device_t

Every device data structure must begin with hw_device_t followed by module specific public methods and attributes.

typedef struct hw_module_t 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.

Function Documentation

int hw_get_module ( const char *  id,
const struct hw_module_t **  module 
)

Get the module info associated with a module by id.

Returns
: 0 == success, <0 == error and *module == NULL
int hw_get_module_by_class ( const char *  class_id,
const char *  inst,
const struct hw_module_t **  module 
)

Get the module info associated with a module instance by class 'class_id' and instance 'inst'.

Some modules types necessitate multiple instances. For example audio supports multiple concurrent interfaces and thus 'audio' is the module class and 'primary' or 'a2dp' are module interfaces. This implies that the files providing these modules would be named audio.primary.<variant>.so and audio.a2dp.<variant>.so

Returns
: 0 == success, <0 == error and *module == NULL