1*54fd6939SJiyong Park /* 2*54fd6939SJiyong Park * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved. 3*54fd6939SJiyong Park * 4*54fd6939SJiyong Park * SPDX-License-Identifier: BSD-3-Clause 5*54fd6939SJiyong Park */ 6*54fd6939SJiyong Park 7*54fd6939SJiyong Park #ifndef GPIO_H 8*54fd6939SJiyong Park #define GPIO_H 9*54fd6939SJiyong Park 10*54fd6939SJiyong Park #include <export/drivers/gpio_exp.h> 11*54fd6939SJiyong Park 12*54fd6939SJiyong Park #define GPIO_DIR_OUT ARM_TF_GPIO_DIR_OUT 13*54fd6939SJiyong Park #define GPIO_DIR_IN ARM_TF_GPIO_DIR_IN 14*54fd6939SJiyong Park 15*54fd6939SJiyong Park #define GPIO_LEVEL_LOW ARM_TF_GPIO_LEVEL_LOW 16*54fd6939SJiyong Park #define GPIO_LEVEL_HIGH ARM_TF_GPIO_LEVEL_HIGH 17*54fd6939SJiyong Park 18*54fd6939SJiyong Park #define GPIO_PULL_NONE ARM_TF_GPIO_PULL_NONE 19*54fd6939SJiyong Park #define GPIO_PULL_UP ARM_TF_GPIO_PULL_UP 20*54fd6939SJiyong Park #define GPIO_PULL_DOWN ARM_TF_GPIO_PULL_DOWN 21*54fd6939SJiyong Park 22*54fd6939SJiyong Park typedef struct gpio_ops { 23*54fd6939SJiyong Park int (*get_direction)(int gpio); 24*54fd6939SJiyong Park void (*set_direction)(int gpio, int direction); 25*54fd6939SJiyong Park int (*get_value)(int gpio); 26*54fd6939SJiyong Park void (*set_value)(int gpio, int value); 27*54fd6939SJiyong Park void (*set_pull)(int gpio, int pull); 28*54fd6939SJiyong Park int (*get_pull)(int gpio); 29*54fd6939SJiyong Park } gpio_ops_t; 30*54fd6939SJiyong Park 31*54fd6939SJiyong Park int gpio_get_direction(int gpio); 32*54fd6939SJiyong Park void gpio_set_direction(int gpio, int direction); 33*54fd6939SJiyong Park int gpio_get_value(int gpio); 34*54fd6939SJiyong Park void gpio_set_value(int gpio, int value); 35*54fd6939SJiyong Park void gpio_set_pull(int gpio, int pull); 36*54fd6939SJiyong Park int gpio_get_pull(int gpio); 37*54fd6939SJiyong Park void gpio_init(const gpio_ops_t *ops); 38*54fd6939SJiyong Park 39*54fd6939SJiyong Park #endif /* GPIO_H */ 40