[PATCH rtems 2/2] termios: Pass number of sent chars to l_start

Christian MAUDERER christian.mauderer at embedded-brains.de
Fri Aug 13 07:17:37 UTC 2021


Hello Gedare,

Am 12.08.21 um 19:46 schrieb Gedare Bloom:
> This is fine, but should do some testing on a few BSPs if you can.

at the moment I tested only with two drivers on the ATSAM BSP (one is 
the ATSAM UART and one is the SC16IS752 driver). I'm a bit limited with 
the boards that I can reach right now due to the point that I'm still 
working from home. But I'll try to find a few more that I can use for tests.

Best regards

Christian

> 
> On Thu, Aug 12, 2021 at 5:42 AM Christian Mauderer
> <christian.mauderer at embedded-brains.de> wrote:
>>
>> 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 #4493
>> ---
>>   cpukit/include/rtems/termiostypes.h | 6 +++++-
>>   cpukit/libcsupport/src/termios.c    | 5 +++--
>>   2 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/cpukit/include/rtems/termiostypes.h b/cpukit/include/rtems/termiostypes.h
>> index ef2c958271..5821d52775 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 829c2bf158..4a4a7e77ac 100644
>> --- a/cpukit/libcsupport/src/termios.c
>> +++ b/cpukit/libcsupport/src/termios.c
>> @@ -1969,6 +1969,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);
>> @@ -1980,7 +1981,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... */
>>     }
>> @@ -2015,7 +2016,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) {
>>           /*
>> --
>> 2.31.1
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel

-- 
--------------------------------------------
embedded brains GmbH
Herr Christian MAUDERER
Dornierstr. 4
82178 Puchheim
Germany
email: christian.mauderer at embedded-brains.de
phone: +49-89-18 94 741 - 18
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list