hal: Add macros for 16/32-bit tag generation 95/112795/2
authorWook Song <wook16.song@samsung.com>
Thu, 2 Feb 2017 11:55:32 +0000 (20:55 +0900)
committerWook Song <wook16.song@samsung.com>
Fri, 3 Feb 2017 01:00:09 +0000 (10:00 +0900)
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 <wook16.song@samsung.com>
src/hal/hal.h

index f41c622c4fb45ca9f4dac7756a73361902cd3f89..b8651fa6c40aed56541ba87d9dd05e117e378988 100644 (file)
 #include <stdio.h>
 #include <stdint.h>
 
+#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))