From c86c7799dd89af5d8d0303d38c264e6bcc0271e5 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Mon, 29 Feb 2016 13:55:32 -0800 Subject: 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 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 Tested-by: Anton Staaf Reviewed-by: Mulin Chao Reviewed-by: Shawn N --- include/compile_time_macros.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/compile_time_macros.h') 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) -- cgit v1.2.1