summaryrefslogtreecommitdiffstats
path: root/libopenbmc_intf/gpio.h
blob: 8cfc59f7a82a6e47a375cda603d57a61ab8d1bc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef __OBJECTS_GPIO_UTILITIES_H__
#define __OBJECTS_GPIO_UTILITIES_H__

#include <stdint.h>
#include <gio/gio.h>
#include <stdbool.h>

typedef struct {
  gchar* name;
  gchar* dev;
  uint16_t num;
  gchar* direction;
  int fd;
  bool irq_inited;
} GPIO;


//gpio functions
#define GPIO_OK           0x00
#define GPIO_ERROR        0x01
#define GPIO_OPEN_ERROR   0x02
#define GPIO_INIT_ERROR   0x04
#define GPIO_READ_ERROR   0x08
#define GPIO_WRITE_ERROR  0x10
#define GPIO_LOOKUP_ERROR 0x20

int gpio_init(GDBusConnection*, GPIO*);
void gpio_close(GPIO*);
int  gpio_open(GPIO*);
int gpio_open_interrupt(GPIO*, GIOFunc, gpointer);
int gpio_write(GPIO*, uint8_t);
int gpio_writec(GPIO*, char);
int gpio_clock_cycle(GPIO*, int);
int gpio_read(GPIO*,uint8_t*);

#endif
OpenPOWER on IntegriCloud