summaryrefslogtreecommitdiffstats
path: root/include/mxc_gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mxc_gpio.h')
-rw-r--r--include/mxc_gpio.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/mxc_gpio.h b/include/mxc_gpio.h
index 002ba61e00..f673dcecd6 100644
--- a/include/mxc_gpio.h
+++ b/include/mxc_gpio.h
@@ -24,6 +24,11 @@
#ifndef __MXC_GPIO_H
#define __MXC_GPIO_H
+/* Converts a GPIO port number and the internal bit position
+ * to the GPIO number
+ */
+#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1) << 5) + (bit & 0x1f))
+
enum mxc_gpio_direction {
MXC_GPIO_DIRECTION_IN,
MXC_GPIO_DIRECTION_OUT,
OpenPOWER on IntegriCloud