diff options
author | CHLin <CHLIN56@nuvoton.com> | 2020-04-08 01:59:54 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-21 07:40:28 +0000 |
commit | 2ce293fafb570d1e4d85d6c783f37275c8cf5d34 (patch) | |
tree | 9863b72625f18d6e21e9d49d9f5868bba21b2848 | |
parent | 91faf6ab44df50d49d0a428aebf744d6a4db3f23 (diff) | |
download | chrome-ec-2ce293fafb570d1e4d85d6c783f37275c8cf5d34.tar.gz |
npcx: add chip family code
If a hardware feature is supported across two or more chip families but
not supported in the older chip family, using the chip family code can
simplify the guard of the new feature.
For example, we can use:
#if (NPCX_FAMILY_VERSION >= NPCX_FAMILY_NPCX7)
Implementation of the new feature
#endif
instead of:
#if defined(CHIP_FAMILY_NPCX7) | defined(CHIP_FAMILY_NPCX8) ....
Implementation of the new feature
#endif
BUG=none
BRANCH=none
TEST=No error for "make buildall"
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Change-Id: I09614428034f64f16ed446b73bf0797ee81538c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2142834
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
-rw-r--r-- | chip/npcx/config_chip.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chip/npcx/config_chip.h b/chip/npcx/config_chip.h index 45c8a60754..9b7e9bd8eb 100644 --- a/chip/npcx/config_chip.h +++ b/chip/npcx/config_chip.h @@ -9,11 +9,20 @@ /* CPU core BFD configuration */ #include "core/cortex-m/config_core.h" +/* + * Set the chip family version to 4 digits to keep the flexibility in case + * we need the minor version for chip variants in a family. + */ +#define NPCX_FAMILY_NPCX5 5000 +#define NPCX_FAMILY_NPCX7 7000 + /* Features depend on chip family */ #if defined(CHIP_FAMILY_NPCX5) #include "config_chip-npcx5.h" +#define NPCX_FAMILY_VERSION NPCX_FAMILY_NPCX5 #elif defined(CHIP_FAMILY_NPCX7) #include "config_chip-npcx7.h" +#define NPCX_FAMILY_VERSION NPCX_FAMILY_NPCX7 #else #error "Unsupported chip family" #endif |