summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2021-08-12 09:51:55 +0200
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2022-02-10 09:02:03 +0100
commit9942ff80c46d5658f22dc5ac9fae4dcaba4f9966 (patch)
tree3182d1d45c7da1a524c1e3290d27b8213868eff6
parentbsp/atsam: Optionally use DMA for UART Rx (diff)
downloadrtems-9942ff80c46d5658f22dc5ac9fae4dcaba4f9966.tar.bz2
termios: Pass number of sent chars to l_start
At the moment the line discipline start function (l_start) has no possibility to get feedback about the number of characters that have been sent. This patch passes that information via an additional parameter. The change might trigger a warning on existing code because of a pointer mismatch but it shouldn't break it. An existing function with the old API will just ignore the additional parameter. Update #4494
-rw-r--r--cpukit/include/rtems/termiostypes.h6
-rw-r--r--cpukit/libcsupport/src/termios.c5
2 files changed, 8 insertions, 3 deletions
diff --git a/cpukit/include/rtems/termiostypes.h b/cpukit/include/rtems/termiostypes.h
index 6930e5958b..59b1b3dd96 100644
--- a/cpukit/include/rtems/termiostypes.h
+++ b/cpukit/include/rtems/termiostypes.h
@@ -367,6 +367,10 @@ typedef struct rtems_termios_tty {
*/
rtems_id rxTaskId;
rtems_id txTaskId;
+ /*
+ * Information for the tx task how many characters have been dequeued.
+ */
+ int txTaskCharsDequeued;
/*
* line discipline related stuff
@@ -482,7 +486,7 @@ struct rtems_termios_linesw {
int (*l_read )(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
int (*l_write)(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args);
int (*l_rint )(int c,struct rtems_termios_tty *tp);
- int (*l_start)(struct rtems_termios_tty *tp);
+ int (*l_start)(struct rtems_termios_tty *tp,int len);
int (*l_ioctl)(struct rtems_termios_tty *tp,rtems_libio_ioctl_args_t *args);
int (*l_modem)(struct rtems_termios_tty *tp,int flags);
};
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index 75925cf8ec..2b354203e9 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/termios.c
@@ -1966,6 +1966,7 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
/*
* send wake up to transmitter task
*/
+ tty->txTaskCharsDequeued = len;
sc = rtems_event_send(tty->txTaskId, TERMIOS_TX_START_EVENT);
if (sc != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred (sc);
@@ -1977,7 +1978,7 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
* call PPP line discipline start function
*/
if (rtems_termios_linesw[tty->t_line].l_start != NULL) {
- rtems_termios_linesw[tty->t_line].l_start(tty);
+ rtems_termios_linesw[tty->t_line].l_start(tty, len);
}
return 0; /* nothing to output in IRQ... */
}
@@ -2012,7 +2013,7 @@ static rtems_task rtems_termios_txdaemon(rtems_task_argument argument)
* call any line discipline start function
*/
if (rtems_termios_linesw[tty->t_line].l_start != NULL) {
- rtems_termios_linesw[tty->t_line].l_start(tty);
+ rtems_termios_linesw[tty->t_line].l_start(tty, tty->txTaskCharsDequeued);
if (tty->t_line == PPPDISC) {
/*