From e1acec0e750012edb2a2122b397a40f783c2aa1e Mon Sep 17 00:00:00 2001 From: Bamvor Jian Zhang Date: Fri, 14 Oct 2016 10:48:25 +0800 Subject: tools/gpio: add gpio basic opereations Add basic gpio operations. User could get/set gpio value for specific line of gpiochip. Reference "tools/gpio/gpio-hammer.c" or "tools/testing/selftest/gpio/gpio-mockup-chardev.c" for how to use it. Signed-off-by: Bamvor Jian Zhang Reviewed-by: Michael Welling Signed-off-by: Linus Walleij --- tools/gpio/gpio-utils.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tools/gpio/gpio-utils.h') diff --git a/tools/gpio/gpio-utils.h b/tools/gpio/gpio-utils.h index 5f57133b8c04..344ea041f8d4 100644 --- a/tools/gpio/gpio-utils.h +++ b/tools/gpio/gpio-utils.h @@ -24,4 +24,20 @@ static inline int check_prefix(const char *str, const char *prefix) strncmp(str, prefix, strlen(prefix)) == 0; } +int gpiotools_request_linehandle(const char *device_name, unsigned int *lines, + unsigned int nlines, unsigned int flag, + struct gpiohandle_data *data, + const char *consumer_label); +int gpiotools_set_values(const int fd, struct gpiohandle_data *data); +int gpiotools_get_values(const int fd, struct gpiohandle_data *data); +int gpiotools_release_linehandle(const int fd); + +int gpiotools_get(const char *device_name, unsigned int line); +int gpiotools_gets(const char *device_name, unsigned int *lines, + unsigned int nlines, struct gpiohandle_data *data); +int gpiotools_set(const char *device_name, unsigned int line, + unsigned int value); +int gpiotools_sets(const char *device_name, unsigned int *lines, + unsigned int nlines, struct gpiohandle_data *data); + #endif /* _GPIO_UTILS_H_ */ -- cgit