mirror of
https://github.com/CTCaer/switch-l4t-atf.git
synced 2024-12-13 21:58:51 +00:00
57bf605772
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>
40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
/*
|
|
* Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef GPIO_H
|
|
#define GPIO_H
|
|
|
|
#include <export/drivers/gpio_exp.h>
|
|
|
|
#define GPIO_DIR_OUT ARM_TF_GPIO_DIR_OUT
|
|
#define GPIO_DIR_IN ARM_TF_GPIO_DIR_IN
|
|
|
|
#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);
|
|
void (*set_direction)(int gpio, int direction);
|
|
int (*get_value)(int gpio);
|
|
void (*set_value)(int gpio, int value);
|
|
void (*set_pull)(int gpio, int pull);
|
|
int (*get_pull)(int gpio);
|
|
} gpio_ops_t;
|
|
|
|
int gpio_get_direction(int gpio);
|
|
void gpio_set_direction(int gpio, int direction);
|
|
int gpio_get_value(int gpio);
|
|
void gpio_set_value(int gpio, int value);
|
|
void gpio_set_pull(int gpio, int pull);
|
|
int gpio_get_pull(int gpio);
|
|
void gpio_init(const gpio_ops_t *ops);
|
|
|
|
#endif /* GPIO_H */
|