diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-12-12 09:25:03 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-12-13 11:36:37 +0100 |
commit | b0da5796089191f85daac8ebca957cd0a104fde1 (patch) | |
tree | 1f1cf3bcfad1ede2377142e88d6062eb3df0c9db /cpukit/libcsupport/src/termios.c | |
parent | termios: Fix tcflow() error status (diff) | |
download | rtems-b0da5796089191f85daac8ebca957cd0a104fde1.tar.bz2 |
termios: Implement tcflush()
New IO control RTEMS_IO_TCFLUSH.
Diffstat (limited to 'cpukit/libcsupport/src/termios.c')
-rw-r--r-- | cpukit/libcsupport/src/termios.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index bcf8d8acb3..16dd754a0e 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -354,6 +354,28 @@ 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; + 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 +594,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; |