diff options
author | Anton Staaf <robotboy@chromium.org> | 2016-02-29 13:55:32 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-03-02 11:22:51 -0800 |
commit | c86c7799dd89af5d8d0303d38c264e6bcc0271e5 (patch) | |
tree | 65abd4054bc25dd6e218a34749b6c26b3e4c17f9 /include/compile_time_macros.h | |
parent | 62055e53b6fa4a914618d4e97617663a2b62980a (diff) | |
download | chrome-ec-c86c7799dd89af5d8d0303d38c264e6bcc0271e5.tar.gz |
NPCX: Refactor GPIO driver for functionality and size
Body 5678901234567890123456789012345678901234567890123456789012345678901
Previously the GPIO driver used quite redundant encodings for its WUI
and DEVALT mapping tables. This refactor compresses those tables
significantly, while adding the ability to represent an inverted DEVALT
bit. The resulting RO firmware image for Wheatley is 384 bytes smaller.
This commit also corrects the interpretation of the func parameter to
gpio_set_alternate_function. Any non-negative func should be
interpreted as a request to switch a pin to an alternate mode.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=make buildall -j
Ran on Wheatley, manually verified basic functionality
Change-Id: I3a56a4b56d13a70a30c388e7e2c77dd7acd3838a
Reviewed-on: https://chromium-review.googlesource.com/329761
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include/compile_time_macros.h')
-rw-r--r-- | include/compile_time_macros.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/compile_time_macros.h b/include/compile_time_macros.h index 9b543f9493..f25ffd8407 100644 --- a/include/compile_time_macros.h +++ b/include/compile_time_macros.h @@ -18,6 +18,10 @@ /* Number of elements in an array */ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +/* Make for loops that iterate over pointers to array entries more readable */ +#define ARRAY_BEGIN(array) (array) +#define ARRAY_END(array) ((array) + ARRAY_SIZE(array)) + /* Just in case - http://gcc.gnu.org/onlinedocs/gcc/Offsetof.html */ #ifndef offsetof #define offsetof(type, member) __builtin_offsetof(type, member) |