diff options
author | Tom Hughes <tomhughes@chromium.org> | 2020-11-24 16:41:00 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-08 09:50:15 +0000 |
commit | 80810322a91cd5fc2e32aef9c29da81870094b3a (patch) | |
tree | ac5a5a724c1beed86f5fbccf789eba07f315ec0f | |
parent | 739138c1e0e1fd2b191b56060933d1ebe4c1690c (diff) | |
download | chrome-ec-80810322a91cd5fc2e32aef9c29da81870094b3a.tar.gz |
ec_commands: Add GENMASK macros
GENMASK is used in ec_commands.h, but is not defined if not compiling in
kernel or Chrome OS EC environments.
BRANCH=none
BUG=b:144959033
TEST=make buildall
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I439b0d77c47f3921f7bf2afd04c62cc72d668ea6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558857
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603088
Tested-by: David Huang <david.huang@quanta.corp-partner.google.com>
Auto-Submit: David Huang <david.huang@quanta.corp-partner.google.com>
Commit-Queue: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3211321
Tested-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Reviewed-by: Shou-Chieh Hsu <shouchieh@chromium.org>
Commit-Queue: Shou-Chieh Hsu <shouchieh@chromium.org>
-rw-r--r-- | include/ec_commands.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index 2b7cb31f90..5291ed5af7 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -423,6 +423,14 @@ extern "C" { #define __packed __attribute__((packed)) #endif +#ifndef GENMASK +#define GENMASK(h, l) (((BIT(h) << 1) - 1) ^ (BIT(l) - 1)) +#endif + +#ifndef GENMASK_ULL +#define GENMASK_ULL(h, l) (((BIT_ULL(h) << 1) - 1) ^ (BIT_ULL(l) - 1)) +#endif + #ifndef __aligned #define __aligned(x) __attribute__((aligned(x))) #endif |