diff options
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index ddd310f5d4..fc9e46c56e 100644 --- a/include/common.h +++ b/include/common.h @@ -124,6 +124,11 @@ #endif #endif +/* Macros for combining bytes into uint16s. */ +#define UINT16_FROM_BYTES(lsb, msb) ((lsb) | (msb) << 8) +#define UINT16_FROM_BYTE_ARRAY_LE(data, lsb_index) \ + UINT16_FROM_BYTES((data)[(lsb_index)], (data)[(lsb_index + 1)]) + /* There isn't really a better place for this */ #define C_TO_K(temp_c) ((temp_c) + 273) #define K_TO_C(temp_c) ((temp_c) - 273) @@ -227,6 +232,33 @@ enum ec_error_list { #endif /* + * Weak symbol markers + * + * These macros are used to annotate weak definitions, their declarations, and + * overriding definitions. + * + * __override_proto: declarations + * __override: definitions which take precedence + * __overridable: default (weak) definitions + * + * For example, in foo.h: + * __override_proto void foo(void); + * + * and in foo.c: + * __overridable void foo(void) { + * ... + * } + * + * and in board.c: + * __override void foo(void) { + * ... + * } + */ +#define __override_proto +#define __override +#define __overridable __attribute__((weak)) + +/* * Mark functions that collide with stdlib so they can be hidden when linking * against libraries that require stdlib. HIDE_EC_STDLIB should be defined * before including common.h from code that links to cstdlib. |