summaryrefslogtreecommitdiffstats
path: root/include/hardware/hardware.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:50 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:50 -0800
commit51704bed795b5b0e5e3c7b792dcdc2bf2d96a9e9 (patch)
tree57cf7487c9e5e66c3c2d8b4e0cebe30e1662a02c /include/hardware/hardware.h
parentd6054a36475b5ff502b4af78f7d272a713c1a8e7 (diff)
downloadhardware_libhardware-51704bed795b5b0e5e3c7b792dcdc2bf2d96a9e9.zip
hardware_libhardware-51704bed795b5b0e5e3c7b792dcdc2bf2d96a9e9.tar.gz
hardware_libhardware-51704bed795b5b0e5e3c7b792dcdc2bf2d96a9e9.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'include/hardware/hardware.h')
-rw-r--r--include/hardware/hardware.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/include/hardware/hardware.h b/include/hardware/hardware.h
new file mode 100644
index 0000000..65ce8d0
--- /dev/null
+++ b/include/hardware/hardware.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H
+#define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/*
+ * Value for the hw_module_t.tag field
+ */
+#define HARDWARE_MODULE_TAG 'HWMT'
+#define HARDWARE_DEVICE_TAG 'HWDT'
+
+struct hw_module_t;
+struct hw_module_methods_t;
+struct hw_device_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.
+ */
+struct hw_module_t {
+ /** tag must be initialized to HARDWARE_MODULE_TAG */
+ uint32_t tag;
+
+ /** major version number for the module */
+ uint16_t version_major;
+
+ /** minor version number of the module */
+ uint16_t version_minor;
+
+ /** Identifier of module */
+ const char *id;
+
+ /** Name of this module */
+ const char *name;
+
+ /** Author/owner/implementor of the module */
+ const char *author;
+
+ /** Modules methods */
+ struct hw_module_methods_t* methods;
+
+ /** padding to 128 bytes, reserved for future use */
+ uint32_t reserved[32-6];
+};
+
+struct hw_module_methods_t {
+ /** Open a specific device */
+ int (*open)(const struct hw_module_t* module, const char* id,
+ struct hw_device_t** device);
+};
+
+/**
+ * Every device data structure must begin with hw_device_t
+ * followed by module specific public methods and attributes.
+ */
+struct hw_device_t {
+ /** tag must be initialized to HARDWARE_DEVICE_TAG */
+ uint32_t tag;
+
+ /** version number for hw_device_t */
+ uint32_t version;
+
+ /** reference to the module this device belongs to */
+ struct hw_module_t* module;
+
+ /** padding reserved for future use */
+ uint32_t reserved[12];
+
+ /** Close this device */
+ int (*close)(struct hw_device_t* device);
+};
+
+/**
+ * Name of the hal_module_info
+ */
+#define HAL_MODULE_INFO_SYM HMI
+
+/**
+ * Name of the hal_module_info as a string
+ */
+#define HAL_MODULE_INFO_SYM_AS_STR "HMI"
+
+/**
+ * Get the module info associated with a module by id.
+ * @return: 0 == success, <0 == error and *pHmi == NULL
+ */
+int hw_get_module(const char *id, const struct hw_module_t **module);
+
+__END_DECLS
+
+#endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */