diff options
author | Michał Barnaś <mb@semihalf.com> | 2021-11-08 18:14:50 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-09 20:03:47 +0000 |
commit | 8f6f43ffe51bbebfe355bab6898368b4d105fb80 (patch) | |
tree | af9cd959bdd533d1f68c45c40514a5e3a022bed4 /include/gpio.h | |
parent | 01afc0fb674113c3ec59b7b19a071840e18a1888 (diff) | |
download | chrome-ec-8f6f43ffe51bbebfe355bab6898368b4d105fb80.tar.gz |
zephyr: extract common gpio logic
Remove static from functions that convert flags between
zephyr and cros. Make them available to other source files on zephyr
builds.
Extract macro that verifies if specified flags are correct.
BRANCH=main
BUG=b:202701452
TEST=compile cros and zephyr ec
Change-Id: I0a07471aa8d3df3d4a4eb226f37d495a9d0e4eda
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3270676
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/gpio.h')
-rw-r--r-- | include/gpio.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h index 77cb6117d1..5a41c7ea88 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -253,6 +253,26 @@ int gpio_get_flags(enum gpio_signal signal); int gpio_get_flags_by_mask(uint32_t port, uint32_t mask); #endif +#ifdef CONFIG_ZEPHYR + +/** + * Convert flags from Zephyr to CrOS EC format + * + * @param zephyr flags in Zephyr format + * @returns flags in CrOS EC format + */ +int convert_from_zephyr_flags(const gpio_flags_t zephyr); + +/** + * Convert flags from CrOS EC to Zephyr format + * + * @param ec_flags flags in CrOS EC format + * @returns flags in Zephyr format + */ +gpio_flags_t convert_to_zephyr_flags(int ec_flags); + +#endif + /** * Get the default flags for a signal. * |