summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/termios.c
diff options
context:
space:
mode:
authorKevin Kirspel <kevin-kirspel@idexx.com>2017-03-21 15:39:48 -0400
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-03-22 11:55:04 +0100
commit1c6926c11f2e5efcb166c668b097d64a0321d66e (patch)
tree30683dcf11979f51273413aade68a3828d00da10 /cpukit/libcsupport/src/termios.c
parentbsp/atsam: Fix DMA support of some drivers (diff)
downloadrtems-1c6926c11f2e5efcb166c668b097d64a0321d66e.tar.bz2
termios: Synchronize with latest FreeBSD headers
Adding modified FreeBSD headers to synchronize RTEMS termios with FreeBSD. Modify termios to support dedicated input and output baud for termios structure. Updated BSPs to use dedicated input and output baud in termios structure. Updated tools to use dedicated input and output baud in termios structure. Updated termios testsuites to use dedicated input and output baud in termios structure. Close #2897.
Diffstat (limited to 'cpukit/libcsupport/src/termios.c')
-rw-r--r--cpukit/libcsupport/src/termios.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index 9eace2eeea..a7944ecc1e 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
+#include <sys/fcntl.h>
#include <sys/ttycom.h>
#include <rtems/termiostypes.h>
@@ -846,6 +847,7 @@ rtems_termios_ioctl (void *arg)
struct rtems_termios_tty *tty = args->iop->data1;
struct ttywakeup *wakeup = (struct ttywakeup *)args->buffer;
rtems_status_code sc;
+ int flags = *((int *)args->buffer);
args->ioctl_return = 0;
sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
@@ -865,13 +867,21 @@ rtems_termios_ioctl (void *arg)
}
break;
- case RTEMS_IO_GET_ATTRIBUTES:
+ case TIOCGETA:
*(struct termios *)args->buffer = tty->termios;
break;
- case RTEMS_IO_SET_ATTRIBUTES:
+ case TIOCSETA:
+ case TIOCSETAW:
+ case TIOCSETAF:
tty->termios = *(struct termios *)args->buffer;
+ if (args->command == TIOCSETAW || args->command == TIOCSETAF) {
+ drainOutput (tty);
+ if (args->command == TIOCSETAF) {
+ flushInput (tty);
+ }
+ }
/* check for and process change in flow control options */
termios_set_flowctrl(tty);
@@ -880,7 +890,7 @@ rtems_termios_ioctl (void *arg)
tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT;
tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT;
} else {
- tty->vtimeTicks = tty->termios.c_cc[VTIME] *
+ tty->vtimeTicks = tty->termios.c_cc[VTIME] *
rtems_clock_get_ticks_per_second() / 10;
if (tty->termios.c_cc[VTIME]) {
tty->rawInBufSemaphoreOptions = RTEMS_WAIT;
@@ -905,25 +915,21 @@ rtems_termios_ioctl (void *arg)
}
break;
- case RTEMS_IO_TCDRAIN:
+ case TIOCDRAIN:
drainOutput (tty);
break;
- case RTEMS_IO_TCFLUSH:
- switch ((intptr_t) args->buffer) {
- case TCIFLUSH:
- flushInput (tty);
- break;
- case TCOFLUSH:
- flushOutput (tty);
- break;
- case TCIOFLUSH:
- flushOutput (tty);
- flushInput (tty);
- break;
- default:
- sc = RTEMS_INVALID_NAME;
- break;
+ case TIOCFLUSH:
+ if (flags == 0) {
+ flags = FREAD | FWRITE;
+ } else {
+ flags &= FREAD | FWRITE;
+ }
+ if (flags & FWRITE) {
+ flushOutput (tty);
+ }
+ if (flags & FREAD) {
+ flushInput (tty);
}
break;