aboutsummaryrefslogtreecommitdiffstats
path: root/src/linux/internal.h
diff options
context:
space:
mode:
authorLucio Tarantino <lucio.tarantino@gmail.com>2020-06-06 18:47:11 +0200
committerGitHub <noreply@github.com>2020-06-06 12:47:11 -0400
commitb7699d374ab17e6054d0d83a9deb7be9e70dcdc8 (patch)
treec5f27d9402cdaf124814ab71891c70e6cd730c8b /src/linux/internal.h
parent7912c39f9ed1601d3fcd230d3216ee8f1750c31a (diff)
downloadkutter-b7699d374ab17e6054d0d83a9deb7be9e70dcdc8.tar.gz
kutter-b7699d374ab17e6054d0d83a9deb7be9e70dcdc8.tar.xz
kutter-b7699d374ab17e6054d0d83a9deb7be9e70dcdc8.zip
linux: Ability to use multiple GPIO chips (#2935)
Signed-off-by: Lucio Tarantino <lucio.tarantino@gmail.com>
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)