1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/omx-plugin/include/ics/hardware/hardware.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,139 @@ 1.4 +/* 1.5 + * Copyright (C) 2008 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H 1.21 +#define ANDROID_INCLUDE_HARDWARE_HARDWARE_H 1.22 + 1.23 +#include <stdint.h> 1.24 +#include <sys/cdefs.h> 1.25 + 1.26 +#include <cutils/native_handle.h> 1.27 +#include <system/graphics.h> 1.28 + 1.29 +__BEGIN_DECLS 1.30 + 1.31 +/* 1.32 + * Value for the hw_module_t.tag field 1.33 + */ 1.34 + 1.35 +#define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D)) 1.36 + 1.37 +#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T') 1.38 +#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T') 1.39 + 1.40 +struct hw_module_t; 1.41 +struct hw_module_methods_t; 1.42 +struct hw_device_t; 1.43 + 1.44 +/** 1.45 + * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM 1.46 + * and the fields of this data structure must begin with hw_module_t 1.47 + * followed by module specific information. 1.48 + */ 1.49 +typedef struct hw_module_t { 1.50 + /** tag must be initialized to HARDWARE_MODULE_TAG */ 1.51 + uint32_t tag; 1.52 + 1.53 + /** major version number for the module */ 1.54 + uint16_t version_major; 1.55 + 1.56 + /** minor version number of the module */ 1.57 + uint16_t version_minor; 1.58 + 1.59 + /** Identifier of module */ 1.60 + const char *id; 1.61 + 1.62 + /** Name of this module */ 1.63 + const char *name; 1.64 + 1.65 + /** Author/owner/implementor of the module */ 1.66 + const char *author; 1.67 + 1.68 + /** Modules methods */ 1.69 + struct hw_module_methods_t* methods; 1.70 + 1.71 + /** module's dso */ 1.72 + void* dso; 1.73 + 1.74 + /** padding to 128 bytes, reserved for future use */ 1.75 + uint32_t reserved[32-7]; 1.76 + 1.77 +} hw_module_t; 1.78 + 1.79 +typedef struct hw_module_methods_t { 1.80 + /** Open a specific device */ 1.81 + int (*open)(const struct hw_module_t* module, const char* id, 1.82 + struct hw_device_t** device); 1.83 + 1.84 +} hw_module_methods_t; 1.85 + 1.86 +/** 1.87 + * Every device data structure must begin with hw_device_t 1.88 + * followed by module specific public methods and attributes. 1.89 + */ 1.90 +typedef struct hw_device_t { 1.91 + /** tag must be initialized to HARDWARE_DEVICE_TAG */ 1.92 + uint32_t tag; 1.93 + 1.94 + /** version number for hw_device_t */ 1.95 + uint32_t version; 1.96 + 1.97 + /** reference to the module this device belongs to */ 1.98 + struct hw_module_t* module; 1.99 + 1.100 + /** padding reserved for future use */ 1.101 + uint32_t reserved[12]; 1.102 + 1.103 + /** Close this device */ 1.104 + int (*close)(struct hw_device_t* device); 1.105 + 1.106 +} hw_device_t; 1.107 + 1.108 +/** 1.109 + * Name of the hal_module_info 1.110 + */ 1.111 +#define HAL_MODULE_INFO_SYM HMI 1.112 + 1.113 +/** 1.114 + * Name of the hal_module_info as a string 1.115 + */ 1.116 +#define HAL_MODULE_INFO_SYM_AS_STR "HMI" 1.117 + 1.118 +/** 1.119 + * Get the module info associated with a module by id. 1.120 + * 1.121 + * @return: 0 == success, <0 == error and *module == NULL 1.122 + */ 1.123 +int hw_get_module(const char *id, const struct hw_module_t **module); 1.124 + 1.125 +/** 1.126 + * Get the module info associated with a module instance by class 'class_id' 1.127 + * and instance 'inst'. 1.128 + * 1.129 + * Some modules types necessitate multiple instances. For example audio supports 1.130 + * multiple concurrent interfaces and thus 'audio' is the module class 1.131 + * and 'primary' or 'a2dp' are module interfaces. This implies that the files 1.132 + * providing these modules would be named audio.primary.<variant>.so and 1.133 + * audio.a2dp.<variant>.so 1.134 + * 1.135 + * @return: 0 == success, <0 == error and *module == NULL 1.136 + */ 1.137 +int hw_get_module_by_class(const char *class_id, const char *inst, 1.138 + const struct hw_module_t **module); 1.139 + 1.140 +__END_DECLS 1.141 + 1.142 +#endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */