summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/termios.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libcsupport/src/termios.c')
-rw-r--r--cpukit/libcsupport/src/termios.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index bcf8d8acb3..cd127f80fc 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -354,6 +354,29 @@ drainOutput (struct rtems_termios_tty *tty)
}
}
+static void
+flushOutput (struct rtems_termios_tty *tty)
+{
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable (level);
+ tty->rawOutBuf.Tail = 0;
+ tty->rawOutBuf.Head = 0;
+ tty->rawOutBufState = rob_idle;
+ rtems_interrupt_enable (level);
+}
+
+static void
+flushInput (struct rtems_termios_tty *tty)
+{
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable (level);
+ tty->rawInBuf.Tail = 0;
+ tty->rawInBuf.Head = 0;
+ rtems_interrupt_enable (level);
+}
+
rtems_status_code
rtems_termios_close (void *arg)
{
@@ -572,6 +595,24 @@ rtems_termios_ioctl (void *arg)
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;
+ }
+ break;
+
case RTEMS_IO_SNDWAKEUP:
tty->tty_snd = *wakeup;
break;