diff options
author | Julius Werner <jwerner@chromium.org> | 2019-05-28 21:03:58 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2019-07-23 20:25:34 -0700 |
commit | 57bf6057721306d1ad1af1122a831789ded92885 (patch) | |
tree | 53dc0c59a20a684d7f9d0784cba78942e4ae56db /include/drivers | |
parent | 9352be88033900f89aa50dfbb13a13d40d698a9e (diff) |
Factor out cross-BL API into export headers suitable for 3rd party code
This patch adds a new include/export/ directory meant for inclusion in
third-party code. This is useful for cases where third-party code needs
to interact with TF-A interfaces and data structures (such as a custom
BL2-implementation like coreboot handing off to BL31). Directly
including headers from the TF-A repository avoids having to duplicate
all these definitions (and risk them going stale), but with the current
header structure this is not possible because handoff API definitions
are too deeply intertwined with other TF code/headers and chain-include
other headers that will not be available in the other environment.
The new approach aims to solve this by separating only the parts that
are really needed into these special headers that are self-contained and
will not chain-include other (non-export) headers. TF-A code should
never include them directly but should instead always include the
respective wrapper header, which will include the required prerequisites
(like <stdint.h>) before including the export header. Third-party code
can include the export headers via its own wrappers that make sure the
necessary definitions are available in whatever way that environment can
provide them.
Change-Id: Ifd769320ba51371439a8e5dd5b79c2516c3b43ab
Signed-off-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'include/drivers')
-rw-r--r-- | include/drivers/gpio.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/drivers/gpio.h b/include/drivers/gpio.h index bef62f73..99c18a4b 100644 --- a/include/drivers/gpio.h +++ b/include/drivers/gpio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -7,15 +7,17 @@ #ifndef GPIO_H #define GPIO_H -#define GPIO_DIR_OUT 0 -#define GPIO_DIR_IN 1 +#include <export/drivers/gpio_exp.h> -#define GPIO_LEVEL_LOW 0 -#define GPIO_LEVEL_HIGH 1 +#define GPIO_DIR_OUT ARM_TF_GPIO_DIR_OUT +#define GPIO_DIR_IN ARM_TF_GPIO_DIR_IN -#define GPIO_PULL_NONE 0 -#define GPIO_PULL_UP 1 -#define GPIO_PULL_DOWN 2 +#define GPIO_LEVEL_LOW ARM_TF_GPIO_LEVEL_LOW +#define GPIO_LEVEL_HIGH ARM_TF_GPIO_LEVEL_HIGH + +#define GPIO_PULL_NONE ARM_TF_GPIO_PULL_NONE +#define GPIO_PULL_UP ARM_TF_GPIO_PULL_UP +#define GPIO_PULL_DOWN ARM_TF_GPIO_PULL_DOWN typedef struct gpio_ops { int (*get_direction)(int gpio); |