aboutsummaryrefslogtreecommitdiffstats
path: root/src/linux/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/linux/internal.h')
-rw-r--r--src/linux/internal.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/linux/internal.h b/src/linux/internal.h
index 592c4588..ac4f3f13 100644
--- a/src/linux/internal.h
+++ b/src/linux/internal.h
@@ -5,6 +5,12 @@
#include <time.h> // struct timespec
#include "autoconf.h" // CONFIG_CLOCK_FREQ
+#define MAX_GPIO_LINES 256
+#define GPIO(PORT, NUM) ((PORT) * MAX_GPIO_LINES + (NUM))
+#define GPIO2PORT(PIN) ((PIN) / MAX_GPIO_LINES)
+#define GPIO2PIN(PIN) ((PIN) % MAX_GPIO_LINES)
+
+
#define NSECS 1000000000
#define NSECS_PER_TICK (NSECS / CONFIG_CLOCK_FREQ)