termios: Introduce doTransmit()

This commit is contained in:
Sebastian Huber
2017-02-23 15:19:47 +01:00
parent 5244d31ef7
commit c41b47e3e4

View File

@@ -1020,11 +1020,9 @@ startXmit (
/* /*
* Send characters to device-specific code * Send characters to device-specific code
*/ */
void static void
rtems_termios_puts ( doTransmit (const char *buf, size_t len, rtems_termios_tty *tty)
const void *_buf, size_t len, struct rtems_termios_tty *tty)
{ {
const char *buf = _buf;
unsigned int newHead; unsigned int newHead;
rtems_termios_device_context *ctx = tty->device_context; rtems_termios_device_context *ctx = tty->device_context;
rtems_interrupt_lock_context lock_context; rtems_interrupt_lock_context lock_context;
@@ -1092,6 +1090,13 @@ rtems_termios_puts (
} }
} }
void
rtems_termios_puts (
const void *_buf, size_t len, struct rtems_termios_tty *tty)
{
doTransmit (_buf, len, tty);
}
/* /*
* Handle output processing * Handle output processing
*/ */
@@ -1163,7 +1168,7 @@ oproc (unsigned char c, struct rtems_termios_tty *tty)
tty->column = oldColumn + columnAdj; tty->column = oldColumn + columnAdj;
} }
rtems_termios_puts (buf, len, tty); doTransmit (buf, len, tty);
} }
static uint32_t static uint32_t
@@ -1179,7 +1184,7 @@ rtems_termios_write_tty (struct rtems_termios_tty *tty, const char *buffer,
while (count--) while (count--)
oproc (*buffer++, tty); oproc (*buffer++, tty);
} else { } else {
rtems_termios_puts (buffer, initial_count, tty); doTransmit (buffer, initial_count, tty);
} }
return initial_count; return initial_count;
@@ -1217,7 +1222,7 @@ echo (unsigned char c, struct rtems_termios_tty *tty)
echobuf[0] = '^'; echobuf[0] = '^';
echobuf[1] = c ^ 0x40; echobuf[1] = c ^ 0x40;
rtems_termios_puts (echobuf, 2, tty); doTransmit (echobuf, 2, tty);
tty->column += 2; tty->column += 2;
} else { } else {
oproc (c, tty); oproc (c, tty);
@@ -1277,18 +1282,18 @@ erase (struct rtems_termios_tty *tty, int lineFlag)
* Back up over the tab * Back up over the tab
*/ */
while (tty->column > col) { while (tty->column > col) {
rtems_termios_puts ("\b", 1, tty); doTransmit ("\b", 1, tty);
tty->column--; tty->column--;
} }
} }
else { else {
if (iscntrl (c) && (tty->termios.c_lflag & ECHOCTL)) { if (iscntrl (c) && (tty->termios.c_lflag & ECHOCTL)) {
rtems_termios_puts ("\b \b", 3, tty); doTransmit ("\b \b", 3, tty);
if (tty->column) if (tty->column)
tty->column--; tty->column--;
} }
if (!iscntrl (c) || (tty->termios.c_lflag & ECHOCTL)) { if (!iscntrl (c) || (tty->termios.c_lflag & ECHOCTL)) {
rtems_termios_puts ("\b \b", 3, tty); doTransmit ("\b \b", 3, tty);
if (tty->column) if (tty->column)
tty->column--; tty->column--;
} }