Skip to content

Commit

Permalink
gpio.h: Add stripped kernel header
Browse files Browse the repository at this point in the history
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
  • Loading branch information
arfoll committed Mar 5, 2018
1 parent 1665e09 commit 12c1904
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 1 deletion.
81 changes: 81 additions & 0 deletions include/linux/gpio.h
@@ -0,0 +1,81 @@
/*
* This header was manually generated from a Linux kernel header linux/gpio.h,
* to make information necessary for compilation to be available. It contains
* only constants, structures, and macros generated from the original header,
* and thus, contains no copyrightable information.
*/
#ifndef _GPIO_H_
#define _GPIO_H_

#include <linux/ioctl.h>
#include <linux/types.h>

struct gpiochip_info {
char name[32];
char label[32];
__u32 lines;
};

#define GPIOLINE_FLAG_KERNEL (1UL << 0)
#define GPIOLINE_FLAG_IS_OUT (1UL << 1)
#define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2)
#define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3)
#define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4)

struct gpioline_info {
__u32 line_offset;
__u32 flags;
char name[32];
char consumer[32];
};

#define GPIOHANDLES_MAX 64

#define GPIOHANDLE_REQUEST_INPUT (1UL << 0)
#define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1)
#define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
#define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3)
#define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4)

struct gpiohandle_request {
__u32 lineoffsets[GPIOHANDLES_MAX];
__u32 flags;
__u8 default_values[GPIOHANDLES_MAX];
char consumer_label[32];
__u32 lines;
int fd;
};

struct gpiohandle_data {
__u8 values[GPIOHANDLES_MAX];
};

#define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
#define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)

#define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0)
#define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1)
#define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1))

struct gpioevent_request {
__u32 lineoffset;
__u32 handleflags;
__u32 eventflags;
char consumer_label[32];
int fd;
};

#define GPIOEVENT_EVENT_RISING_EDGE 0x01
#define GPIOEVENT_EVENT_FALLING_EDGE 0x02

struct gpioevent_data {
__u64 timestamp;
__u32 id;
};

#define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
#define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
#define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
#define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)

#endif /* _GPIO_H_ */
2 changes: 1 addition & 1 deletion src/gpio/gpio.c
Expand Up @@ -24,7 +24,7 @@
*/
#include "gpio.h"
#include "mraa_internal.h"
#include "chardev_interface/gpio.h"
#include "linux/gpio.h"
#include <dirent.h>

#include <stdlib.h>
Expand Down

0 comments on commit 12c1904

Please sign in to comment.