summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2012-03-20 23:15:50 -0700
committerDima Zavin <dima@android.com>2012-03-20 23:23:06 -0700
commit65820e4d7a0b89108b194284b94f6f82d28a875c (patch)
treea15297ec8ecb21b6f05b9e9b66c34f2e29f132df
parent8dc4e710c0dfa66564c8cea0af53f7b4e8e0f80a (diff)
downloadlibhardware-65820e4d7a0b89108b194284b94f6f82d28a875c.tar.gz
libhardware: add current HAL version and a module version macro
Change-Id: I30c67a6c5231f8b270b57f78bd6322c201b90859 Signed-off-by: Dima Zavin <dima@android.com>
-rw-r--r--include/hardware/hardware.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/hardware/hardware.h b/include/hardware/hardware.h
index 3d341c87..67ba9f17 100644
--- a/include/hardware/hardware.h
+++ b/include/hardware/hardware.h
@@ -34,6 +34,29 @@ __BEGIN_DECLS
#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))
+
+/*
+ * The current HAL API version.
+ *
+ * All module implementations must set the hw_module_t.hal_api_version field
+ * to this value when declaring the module with HAL_MODULE_INFO_SYM.
+ *
+ * Note that previous implementations have always set this field to 0.
+ * Therefore, libhardware HAL API will always consider versions 0.0 and 1.0
+ * to be 100% binary compatible.
+ *
+ */
+#define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0)
+
+/*
+ * Helper macro for module implementors.
+ *
+ * Use this macro to set the hw_module_t.module_api_version field.
+ */
+#define HARDWARE_MODULE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min)
+
struct hw_module_t;
struct hw_module_methods_t;
struct hw_device_t;