Home | History | Annotate | Download | only in drivers
      1 /*
      2  * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
      3  *
      4  * SPDX-License-Identifier: BSD-3-Clause
      5  */
      6 
      7 #ifndef __GPIO_H__
      8 #define __GPIO_H__
      9 
     10 #define GPIO_DIR_OUT		0
     11 #define GPIO_DIR_IN		1
     12 
     13 #define GPIO_LEVEL_LOW		0
     14 #define GPIO_LEVEL_HIGH		1
     15 
     16 #define GPIO_PULL_NONE		0
     17 #define GPIO_PULL_UP		1
     18 #define GPIO_PULL_DOWN		2
     19 
     20 typedef struct gpio_ops {
     21 	int (*get_direction)(int gpio);
     22 	void (*set_direction)(int gpio, int direction);
     23 	int (*get_value)(int gpio);
     24 	void (*set_value)(int gpio, int value);
     25 	void (*set_pull)(int gpio, int pull);
     26 	int (*get_pull)(int gpio);
     27 } gpio_ops_t;
     28 
     29 int gpio_get_direction(int gpio);
     30 void gpio_set_direction(int gpio, int direction);
     31 int gpio_get_value(int gpio);
     32 void gpio_set_value(int gpio, int value);
     33 void gpio_set_pull(int gpio, int pull);
     34 int gpio_get_pull(int gpio);
     35 void gpio_init(const gpio_ops_t *ops);
     36 
     37 #endif	/* __GPIO_H__ */
     38