xref: /openbmc/skeleton/libopenbmc_intf/gpio.h (revision a7ac805b)
1 #ifndef __OBJECTS_GPIO_UTILITIES_H__
2 #define __OBJECTS_GPIO_UTILITIES_H__
3 
4 #include <stdint.h>
5 #include <gio/gio.h>
6 #include <stdbool.h>
7 
8 typedef struct {
9   gchar* name;
10   gchar* dev;
11   uint16_t num;
12   gchar* direction;
13   int fd;
14   bool irq_inited;
15 } GPIO;
16 
17 
18 //gpio functions
19 #define GPIO_OK           0x00
20 #define GPIO_ERROR        0x01
21 #define GPIO_OPEN_ERROR   0x02
22 #define GPIO_INIT_ERROR   0x04
23 #define GPIO_READ_ERROR   0x08
24 #define GPIO_WRITE_ERROR  0x10
25 #define GPIO_LOOKUP_ERROR 0x20
26 
27 int gpio_init(GDBusConnection*, GPIO*);
28 void gpio_close(GPIO*);
29 int  gpio_open(GPIO*);
30 int gpio_open_interrupt(GPIO*, GIOFunc, gpointer);
31 int gpio_write(GPIO*, uint8_t);
32 int gpio_writec(GPIO*, char);
33 int gpio_clock_cycle(GPIO*, int);
34 int gpio_read(GPIO*,uint8_t*);
35 
36 #endif
37