xref: /openbmc/skeleton/libopenbmc_intf/gpio.h (revision c0c74e7cca35179a9c4496a49f64e00db4c47870)
140a360c2SBrad Bishop #ifndef __OBJECTS_GPIO_UTILITIES_H__
240a360c2SBrad Bishop #define __OBJECTS_GPIO_UTILITIES_H__
340a360c2SBrad Bishop 
440a360c2SBrad Bishop #include <stdint.h>
540a360c2SBrad Bishop #include <gio/gio.h>
640a360c2SBrad Bishop #include <stdbool.h>
740a360c2SBrad Bishop 
840a360c2SBrad Bishop typedef struct {
940a360c2SBrad Bishop   gchar* name;
1040a360c2SBrad Bishop   gchar* dev;
1140a360c2SBrad Bishop   uint16_t num;
12*c0c74e7cSAnthony Wilson   uint16_t chip_id;
1340a360c2SBrad Bishop   gchar* direction;
1440a360c2SBrad Bishop   int fd;
1540a360c2SBrad Bishop   bool irq_inited;
1640a360c2SBrad Bishop } GPIO;
1740a360c2SBrad Bishop 
1840a360c2SBrad Bishop 
1940a360c2SBrad Bishop //gpio functions
2040a360c2SBrad Bishop #define GPIO_OK           0x00
2140a360c2SBrad Bishop #define GPIO_ERROR        0x01
2240a360c2SBrad Bishop #define GPIO_OPEN_ERROR   0x02
2340a360c2SBrad Bishop #define GPIO_INIT_ERROR   0x04
2440a360c2SBrad Bishop #define GPIO_READ_ERROR   0x08
2540a360c2SBrad Bishop #define GPIO_WRITE_ERROR  0x10
2640a360c2SBrad Bishop #define GPIO_LOOKUP_ERROR 0x20
2740a360c2SBrad Bishop 
2840a360c2SBrad Bishop void gpio_close(GPIO*);
29*c0c74e7cSAnthony Wilson int  gpio_open(GPIO*, uint8_t);
3040a360c2SBrad Bishop int gpio_write(GPIO*, uint8_t);
31*c0c74e7cSAnthony Wilson int gpio_get_params(GPIO*);
3240a360c2SBrad Bishop int gpio_read(GPIO*,uint8_t*);
333a70e938SMatt Spinler void gpio_inits_done();
3440a360c2SBrad Bishop 
3540a360c2SBrad Bishop #endif
36