API and header names will evolve and change continuously. Some changes may be not backward compatible. Application need some mechanism to support at least a few recent revisions of ODP API. Hence add a few macros to be able to compare ODP API versions.
Macros can be used in a following way: #include <odp_version.h> #if ODP_VERSION_API >= ODP_VERSION(2,0,0) /* Call ODP v2.0 API */ #elif ODP_VERSION_API >= ODP_VERSION(1,0,0) /* Call ODP v1.0 API */ #else /* Call pre v1.0 API */ #endif Signed-off-by: Taras Kondratiuk <[email protected]> Signed-off-by: Taras Kondratiuk <[email protected]> --- platform/linux-generic/include/api/odp_version.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/platform/linux-generic/include/api/odp_version.h b/platform/linux-generic/include/api/odp_version.h index c823e2d..97f8e26 100644 --- a/platform/linux-generic/include/api/odp_version.h +++ b/platform/linux-generic/include/api/odp_version.h @@ -44,6 +44,22 @@ extern "C" { */ #define ODP_VERSION_API_BUG 1 +/** + * Macro to merge three parts of ODP API version into one word + * + * Merge ODP version into one word: + * byte 0 - bug correction version + * byte 1 - sub version + * byte 2 - main version + */ +#define ODP_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) + +/** + * Current version of ODP API in one word form + */ +#define ODP_VERSION_API ODP_VERSION((ODP_VERSION_API_MAIN), \ + (ODP_VERSION_API_SUB), \ + (ODP_VERSION_API_BUG)) /** @internal Version string expand */ #define ODP_VERSION_STR_EXPAND(x) #x -- 1.7.9.5 _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
