linux: Ability to use multiple GPIO chips (#2935)

Signed-off-by: Lucio Tarantino <lucio.tarantino@gmail.com>
This commit is contained in:
Lucio Tarantino
2020-06-06 18:47:11 +02:00
committed by GitHub
parent 7912c39f9e
commit b7699d374a
4 changed files with 53 additions and 20 deletions

View File

@@ -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)