media/omx-plugin/include/ics/hardware/hardware.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Copyright (C) 2008 The Android Open Source Project
michael@0 3 *
michael@0 4 * Licensed under the Apache License, Version 2.0 (the "License");
michael@0 5 * you may not use this file except in compliance with the License.
michael@0 6 * You may obtain a copy of the License at
michael@0 7 *
michael@0 8 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 9 *
michael@0 10 * Unless required by applicable law or agreed to in writing, software
michael@0 11 * distributed under the License is distributed on an "AS IS" BASIS,
michael@0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
michael@0 13 * See the License for the specific language governing permissions and
michael@0 14 * limitations under the License.
michael@0 15 */
michael@0 16
michael@0 17 #ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H
michael@0 18 #define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
michael@0 19
michael@0 20 #include <stdint.h>
michael@0 21 #include <sys/cdefs.h>
michael@0 22
michael@0 23 #include <cutils/native_handle.h>
michael@0 24 #include <system/graphics.h>
michael@0 25
michael@0 26 __BEGIN_DECLS
michael@0 27
michael@0 28 /*
michael@0 29 * Value for the hw_module_t.tag field
michael@0 30 */
michael@0 31
michael@0 32 #define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
michael@0 33
michael@0 34 #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
michael@0 35 #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
michael@0 36
michael@0 37 struct hw_module_t;
michael@0 38 struct hw_module_methods_t;
michael@0 39 struct hw_device_t;
michael@0 40
michael@0 41 /**
michael@0 42 * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
michael@0 43 * and the fields of this data structure must begin with hw_module_t
michael@0 44 * followed by module specific information.
michael@0 45 */
michael@0 46 typedef struct hw_module_t {
michael@0 47 /** tag must be initialized to HARDWARE_MODULE_TAG */
michael@0 48 uint32_t tag;
michael@0 49
michael@0 50 /** major version number for the module */
michael@0 51 uint16_t version_major;
michael@0 52
michael@0 53 /** minor version number of the module */
michael@0 54 uint16_t version_minor;
michael@0 55
michael@0 56 /** Identifier of module */
michael@0 57 const char *id;
michael@0 58
michael@0 59 /** Name of this module */
michael@0 60 const char *name;
michael@0 61
michael@0 62 /** Author/owner/implementor of the module */
michael@0 63 const char *author;
michael@0 64
michael@0 65 /** Modules methods */
michael@0 66 struct hw_module_methods_t* methods;
michael@0 67
michael@0 68 /** module's dso */
michael@0 69 void* dso;
michael@0 70
michael@0 71 /** padding to 128 bytes, reserved for future use */
michael@0 72 uint32_t reserved[32-7];
michael@0 73
michael@0 74 } hw_module_t;
michael@0 75
michael@0 76 typedef struct hw_module_methods_t {
michael@0 77 /** Open a specific device */
michael@0 78 int (*open)(const struct hw_module_t* module, const char* id,
michael@0 79 struct hw_device_t** device);
michael@0 80
michael@0 81 } hw_module_methods_t;
michael@0 82
michael@0 83 /**
michael@0 84 * Every device data structure must begin with hw_device_t
michael@0 85 * followed by module specific public methods and attributes.
michael@0 86 */
michael@0 87 typedef struct hw_device_t {
michael@0 88 /** tag must be initialized to HARDWARE_DEVICE_TAG */
michael@0 89 uint32_t tag;
michael@0 90
michael@0 91 /** version number for hw_device_t */
michael@0 92 uint32_t version;
michael@0 93
michael@0 94 /** reference to the module this device belongs to */
michael@0 95 struct hw_module_t* module;
michael@0 96
michael@0 97 /** padding reserved for future use */
michael@0 98 uint32_t reserved[12];
michael@0 99
michael@0 100 /** Close this device */
michael@0 101 int (*close)(struct hw_device_t* device);
michael@0 102
michael@0 103 } hw_device_t;
michael@0 104
michael@0 105 /**
michael@0 106 * Name of the hal_module_info
michael@0 107 */
michael@0 108 #define HAL_MODULE_INFO_SYM HMI
michael@0 109
michael@0 110 /**
michael@0 111 * Name of the hal_module_info as a string
michael@0 112 */
michael@0 113 #define HAL_MODULE_INFO_SYM_AS_STR "HMI"
michael@0 114
michael@0 115 /**
michael@0 116 * Get the module info associated with a module by id.
michael@0 117 *
michael@0 118 * @return: 0 == success, <0 == error and *module == NULL
michael@0 119 */
michael@0 120 int hw_get_module(const char *id, const struct hw_module_t **module);
michael@0 121
michael@0 122 /**
michael@0 123 * Get the module info associated with a module instance by class 'class_id'
michael@0 124 * and instance 'inst'.
michael@0 125 *
michael@0 126 * Some modules types necessitate multiple instances. For example audio supports
michael@0 127 * multiple concurrent interfaces and thus 'audio' is the module class
michael@0 128 * and 'primary' or 'a2dp' are module interfaces. This implies that the files
michael@0 129 * providing these modules would be named audio.primary.<variant>.so and
michael@0 130 * audio.a2dp.<variant>.so
michael@0 131 *
michael@0 132 * @return: 0 == success, <0 == error and *module == NULL
michael@0 133 */
michael@0 134 int hw_get_module_by_class(const char *class_id, const char *inst,
michael@0 135 const struct hw_module_t **module);
michael@0 136
michael@0 137 __END_DECLS
michael@0 138
michael@0 139 #endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */

mercurial