aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/gpio.h
diff options
context:
space:
mode:
authorMichal Meloun <mmel@FreeBSD.org>2016-04-28 12:03:22 +0000
committerMichal Meloun <mmel@FreeBSD.org>2016-04-28 12:03:22 +0000
commit39f6c1bdf48ae6a4e1e13d762d88e4ad431fc18c (patch)
tree00380a7fe91fc930efff33bed8dd079eafcc6a3c /sys/sys/gpio.h
parentf9ac50ac450ac66102147393587147df36368a1a (diff)
downloadsrc-39f6c1bdf48ae6a4e1e13d762d88e4ad431fc18c.tar.gz
src-39f6c1bdf48ae6a4e1e13d762d88e4ad431fc18c.zip
GPIO: Add support for gpio pin interrupts.
Add new function gpio_alloc_intr_resource(), which allows an allocation of interrupt resource associated to given gpio pin. It also allows to specify interrupt configuration. Note: This functionality is dependent on INTRNG, and must be implemented in each GPIO controller.
Notes
Notes: svn path=/head/; revision=298738
Diffstat (limited to 'sys/sys/gpio.h')
-rw-r--r--sys/sys/gpio.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/sys/sys/gpio.h b/sys/sys/gpio.h
index c8724cbe6e89..9b0a1b554984 100644
--- a/sys/sys/gpio.h
+++ b/sys/sys/gpio.h
@@ -60,16 +60,26 @@
#define GPIOMAXNAME 64
/* GPIO pin configuration flags */
-#define GPIO_PIN_INPUT 0x0001 /* input direction */
-#define GPIO_PIN_OUTPUT 0x0002 /* output direction */
-#define GPIO_PIN_OPENDRAIN 0x0004 /* open-drain output */
-#define GPIO_PIN_PUSHPULL 0x0008 /* push-pull output */
-#define GPIO_PIN_TRISTATE 0x0010 /* output disabled */
-#define GPIO_PIN_PULLUP 0x0020 /* internal pull-up enabled */
-#define GPIO_PIN_PULLDOWN 0x0040 /* internal pull-down enabled */
-#define GPIO_PIN_INVIN 0x0080 /* invert input */
-#define GPIO_PIN_INVOUT 0x0100 /* invert output */
-#define GPIO_PIN_PULSATE 0x0200 /* pulsate in hardware */
+#define GPIO_PIN_INPUT 0x00000001 /* input direction */
+#define GPIO_PIN_OUTPUT 0x00000002 /* output direction */
+#define GPIO_PIN_OPENDRAIN 0x00000004 /* open-drain output */
+#define GPIO_PIN_PUSHPULL 0x00000008 /* push-pull output */
+#define GPIO_PIN_TRISTATE 0x00000010 /* output disabled */
+#define GPIO_PIN_PULLUP 0x00000020 /* internal pull-up enabled */
+#define GPIO_PIN_PULLDOWN 0x00000040 /* internal pull-down enabled */
+#define GPIO_PIN_INVIN 0x00000080 /* invert input */
+#define GPIO_PIN_INVOUT 0x00000100 /* invert output */
+#define GPIO_PIN_PULSATE 0x00000200 /* pulsate in hardware */
+/* GPIO interrupt capabilities */
+#define GPIO_INTR_NONE 0x00000000 /* no interrupt support */
+#define GPIO_INTR_LEVEL_LOW 0x00010000 /* level trigger, low */
+#define GPIO_INTR_LEVEL_HIGH 0x00020000 /* level trigger, high */
+#define GPIO_INTR_EDGE_RISING 0x00040000 /* edge trigger, rising */
+#define GPIO_INTR_EDGE_FALLING 0x00080000 /* edge trigger, falling */
+#define GPIO_INTR_EDGE_BOTH 0x00100000 /* edge trigger, both */
+#define GPIO_INTR_MASK (GPIO_INTR_LEVEL_LOW | GPIO_INTR_LEVEL_HIGH | \
+ GPIO_INTR_EDGE_RISING | \
+ GPIO_INTR_EDGE_FALLING | GPIO_INTR_EDGE_BOTH)
struct gpio_pin {
uint32_t gp_pin; /* pin number */