From: Wook Song Date: Thu, 2 Feb 2017 11:55:32 +0000 (+0900) Subject: hal: Add macros for 16/32-bit tag generation X-Git-Tag: submit/tizen/20170328.004502~55 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27bc482502d55acb13c53aba8511569dc80036f7;p=platform%2Fcore%2Fsystem%2Fpass.git hal: Add macros for 16/32-bit tag generation This patch adds several macros to generate 16-bit or 32-bit tags, which can be used for identification variables. Change-Id: Id633df8f784adf9c0f8d7528f49b35c5b51ab9ea Signed-off-by: Wook Song --- diff --git a/src/hal/hal.h b/src/hal/hal.h index f41c622..b8651fa 100644 --- a/src/hal/hal.h +++ b/src/hal/hal.h @@ -20,9 +20,16 @@ #include #include +#define MAKE_2B_CODE_2(A,B) \ + ((((A) & 0xff) << 8) | ((B) & 0xff)) +#define MAKE_2B_CODE_4(A,B,C,D) \ + ((((A) & 0xf) << 12) | (((B) & 0xf) << 8) | \ + (((C) & 0xf) << 4) | (((D) & 0xf))) +#define MAKE_4B_CODE_4(A,B,C,D) \ + ((((A) & 0xff) << 24) | (((B) & 0xff) << 16) | \ + (((C) & 0xff) << 8) | (((D) & 0xff))) +#define MAKE_TAG_CONSTANT(A,B,C,D) MAKE_4B_CODE_4(A,B,C,D) -#define MAKE_TAG_CONSTANT(A,B,C,D) \ - (((A) << 24) | ((B) << 16) | ((C) << 8) | (D)) #define HARDWARE_INFO_TAG MAKE_TAG_CONSTANT('T','H','I','T') #define MAKE_VERSION(maj,min) ((((maj) & 0xff) << 8) | ((min) & 0xff))