diff options
author | Christian Mauderer <christian.mauderer@embedded-brains.de> | 2018-02-09 08:59:27 +0100 |
---|---|---|
committer | Christian Mauderer <christian.mauderer@embedded-brains.de> | 2018-02-12 14:36:23 +0100 |
commit | bf7070232fe2b26de0375bc7517213e655ce9e5d (patch) | |
tree | ce2fe42cccc667e2c1dcc86a360e29af20bbde6d /cpukit/dev/serial/sc16is752.c | |
parent | bsp/atsam: Fix cache / DMA handling in SPI. (diff) | |
download | rtems-bf7070232fe2b26de0375bc7517213e655ce9e5d.tar.bz2 |
dev/sc16is752: Add GPIO access via ioctl.
Diffstat (limited to '')
-rw-r--r-- | cpukit/dev/serial/sc16is752.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cpukit/dev/serial/sc16is752.c b/cpukit/dev/serial/sc16is752.c index 74c3ad3d7a..153b589ac1 100644 --- a/cpukit/dev/serial/sc16is752.c +++ b/cpukit/dev/serial/sc16is752.c @@ -282,6 +282,7 @@ static int sc16is752_ioctl( ) { sc16is752_context *ctx = (sc16is752_context *)base; + uint8_t regval; switch (request) { case SC16IS752_SET_SLEEP_MODE: @@ -290,6 +291,25 @@ static int sc16is752_ioctl( case SC16IS752_GET_SLEEP_MODE: *(int *)buffer = is_sleep_mode_enabled(ctx); break; + case SC16IS752_SET_IOCONTROL: + regval = (*(uint8_t *)buffer) & ~SC16IS752_IOCONTROL_SRESET; + write_reg(ctx, SC16IS752_IOCONTROL, ®val, 1); + break; + case SC16IS752_GET_IOCONTROL: + read_reg(ctx, SC16IS752_IOCONTROL, (uint8_t *)buffer, 1); + break; + case SC16IS752_SET_IODIR: + write_reg(ctx, SC16IS752_IODIR, (uint8_t *)buffer, 1); + break; + case SC16IS752_GET_IODIR: + read_reg(ctx, SC16IS752_IODIR, (uint8_t *)buffer, 1); + break; + case SC16IS752_SET_IOSTATE: + write_reg(ctx, SC16IS752_IOSTATE, (uint8_t *)buffer, 1); + break; + case SC16IS752_GET_IOSTATE: + read_reg(ctx, SC16IS752_IOSTATE, (uint8_t *)buffer, 1); + break; default: rtems_set_errno_and_return_minus_one(EINVAL); } |