[PATCH 6/9] termios: Notify driver about inactive transmit
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Jun 10 13:11:54 UTC 2013
Returning this state in the return value leads to race conditions on
SMP. The inactive state notification must be inside the critical
section.
---
cpukit/libcsupport/src/termios.c | 3 +++
doc/bsp_howto/console.t | 6 ++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index d459843..c13f331 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -1404,6 +1404,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
wakeUpWriterTask = true;
}
+ (*tty->device.write) (tty->minor, NULL, 0);
nToSend = 0;
} else {
len = tty->t_dqlen;
@@ -1423,6 +1424,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
* Buffer has become empty
*/
tty->rawOutBufState = rob_idle;
+ (*tty->device.write) (tty->minor, NULL, 0);
nToSend = 0;
/*
@@ -1439,6 +1441,7 @@ rtems_termios_refill_transmitter (struct rtems_termios_tty *tty)
/* set flag, that output has been stopped */
tty->flow_ctrl |= FL_OSTOP;
tty->rawOutBufState = rob_busy; /*apm*/
+ (*tty->device.write) (tty->minor, NULL, 0);
nToSend = 0;
} else {
/*
diff --git a/doc/bsp_howto/console.t b/doc/bsp_howto/console.t
index f04a67f..555cf04 100644
--- a/doc/bsp_howto/console.t
+++ b/doc/bsp_howto/console.t
@@ -408,6 +408,12 @@ static ssize_t my_driver_interrupt_write(int minor, const char *buf, size_t n)
* characters in the device data structure.
*/
+ /*
+ * Termios will set n to zero to indicate that the transmitter is
+ * now inactive. The output buffer is empty in this case. The
+ * driver may disable the transmit interrupts now.
+ */
+
return 0;
@}
@end group
--
1.7.7
More information about the devel
mailing list