Changeset 1c6926c1 in rtems


Ignore:
Timestamp:
Mar 21, 2017, 7:39:48 PM (2 years ago)
Author:
Kevin Kirspel <kevin-kirspel@…>
Branches:
master
Children:
94a4865
Parents:
c4b058ca
git-author:
Kevin Kirspel <kevin-kirspel@…> (03/21/17 19:39:48)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/22/17 10:55:04)
Message:

termios: Synchronize with latest FreeBSD headers

Adding modified FreeBSD headers to synchronize RTEMS termios with
FreeBSD. Modify termios to support dedicated input and output baud for
termios structure. Updated BSPs to use dedicated input and output baud
in termios structure. Updated tools to use dedicated input and output
baud in termios structure. Updated termios testsuites to use dedicated
input and output baud in termios structure.

Close #2897.

Files:
3 added
74 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/csb336/console/uart.c

    rc4b058ca r1c6926c1  
    323323    int baud;
    324324
    325     baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     325    baud = rtems_termios_baud_to_number(t->c_ospeed);
    326326    imx_uart_set_baud(minor, baud);
    327327
  • c/src/lib/libbsp/arm/lpc32xx/console/hsu.c

    rc4b058ca r1c6926c1  
    179179  lpc32xx_hsu_context *ctx = (lpc32xx_hsu_context *) base;
    180180  volatile lpc32xx_hsu *hsu = ctx->hsu;
    181   int baud_flags = term->c_cflag & CBAUD;
     181  int baud_flags = term->c_ospeed;
    182182
    183183  if (baud_flags != 0) {
  • c/src/lib/libbsp/i386/shared/comm/tty_drv.c

    rc4b058ca r1c6926c1  
    228228  unsigned long baud, databits, parity, stopbits;
    229229
    230   baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     230  baud = rtems_termios_baud_to_number(t->c_ospeed);
    231231  if ( baud > 115200 )
    232232    rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
  • c/src/lib/libbsp/lm32/shared/milkymist_console/console.c

    rc4b058ca r1c6926c1  
    4242  int baud;
    4343
    44   switch (t->c_cflag & CBAUD) {
     44  switch (t->c_ospeed) {
    4545    case B0:
    4646      baud = 0;
  • c/src/lib/libbsp/m68k/av5282/console/console.c

    rc4b058ca r1c6926c1  
    180180  if ( t != (const struct termios *)0 ) {
    181181    /* determine baud rate index */
    182     baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     182    baud = rtems_termios_baud_to_number(t->c_ospeed);
    183183
    184184    /* determine data bits */
     
    241241 * determines which channel caused the interrupt before queueing any received
    242242 * chars and dequeueing chars waiting for transmission.
    243  */ 
     243 */
    244244static rtems_isr IntUartInterruptHandler(rtems_vector_number v)
    245245{
     
    304304 * internal uarts. If the internal uart is to be interrupt driven then the
    305305 * interrupt vectors are hooked.
    306  */ 
     306 */
    307307static void IntUartInitialize(void)
    308308{
  • c/src/lib/libbsp/m68k/gen68340/console/console.c

    rc4b058ca r1c6926c1  
    475475 rtems_interrupt_level level;
    476476 float ispeed, ospeed;
    477  int isp, osp;
    478 
    479  /* output speed */
    480  if (t->c_cflag & CBAUDEX)
    481     osp = (t->c_cflag & CBAUD) + CBAUD + 1;
    482  else
    483     osp = t->c_cflag & CBAUD;
    484 
    485  /* input speed */
    486  isp = (t->c_cflag / (CIBAUD / CBAUD)) &  CBAUD;
    487477
    488478 /* convert it */
    489  ispeed = rtems_termios_baud_to_number(isp);
    490  ospeed = rtems_termios_baud_to_number(osp);
     479 ispeed = rtems_termios_baud_to_number(t->c_ispeed);
     480 ospeed = rtems_termios_baud_to_number(t->c_ospeed);
    491481
    492482 if (ispeed || ospeed) {
     
    516506
    517507 /* if serial module configuration has been changed */
    518  if (t->c_cflag & (CBAUD | CIBAUD | CSIZE | PARENB)) {
     508 if (t->c_cflag & (CSIZE | PARENB)) {
    519509    rtems_interrupt_disable(level);
    520510    /* reinit the UART */
     
    694684        rtems_libio_ioctl_args_t *args = arg;
    695685
    696         if (args->command == RTEMS_IO_SET_ATTRIBUTES)
     686  if (args->command == TIOCSETA)
    697687                SetAttributes (minor, (struct termios *)args->buffer);
    698688
  • c/src/lib/libbsp/m68k/gen68360/console/console.c

    rc4b058ca r1c6926c1  
    8787  int baud;
    8888
    89   baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     89  baud = rtems_termios_baud_to_number(t->c_ospeed);
    9090  if (baud > 0)
    9191    m360.brgc1 = smc1BRGC (baud);
  • c/src/lib/libbsp/m68k/genmcf548x/console/console.c

    rc4b058ca r1c6926c1  
    308308        {
    309309                /* determine baud rate index */
    310                 baud = GetBaud( t->c_cflag & CBAUD );
     310    baud = GetBaud( t->c_ospeed );
    311311
    312312                /* determine data bits */
  • c/src/lib/libbsp/m68k/mcf52235/console/console.c

    rc4b058ca r1c6926c1  
    153153  if (t != (const struct termios *) 0) {
    154154    /* determine baud rate index */
    155     baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     155    baud = rtems_termios_baud_to_number(t->c_ospeed);
    156156
    157157    /* determine data bits */
     
    599599
    600600    if (tcgetattr(STDIN_FILENO, &term) >= 0) {
    601       term.c_cflag &= ~(CBAUD | CSIZE);
    602       term.c_cflag |= CS8 | B19200;
     601      term.c_cflag &= ~(CSIZE);
     602      term.c_cflag |= CS8;
     603      term.c_ispeed = B19200;
     604      term.c_ospeed = B19200;
    603605      tcsetattr(STDIN_FILENO, TCSANOW, &term);
    604606    }
  • c/src/lib/libbsp/m68k/mcf5225x/console/console.c

    rc4b058ca r1c6926c1  
    151151   value and sets it. At the moment this just sets the baud rate.
    152152
    153    Note: The highest baudrate is 115200 as this stays within 
     153   Note: The highest baudrate is 115200 as this stays within
    154154   an error of +/- 5% at 25MHz processor clock
    155155 ***************************************************************************/
     
    167167  if (t != (const struct termios *) 0) {
    168168    /* determine baud rate index */
    169     baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     169    baud = rtems_termios_baud_to_number(t->c_ospeed);
    170170
    171171    /* determine data bits */
     
    244244                        MCF_GPIO_PORTTC |= MCF_GPIO_PORTTC_PORTTC0;
    245245#endif
    246                
     246
    247247    /* read data and put into the receive buffer */
    248248    while (MCF_UART_USR(chan) & MCF_UART_USR_RXRDY) {
     
    360360   Function : IntUartInterruptWrite
    361361
    362    Description : This writes a single character to the appropriate uart 
     362   Description : This writes a single character to the appropriate uart
    363363   channel. This is either called during an interrupt or in the user's task
    364    to initiate a transmit sequence. Calling this routine enables Tx 
     364   to initiate a transmit sequence. Calling this routine enables Tx
    365365   interrupts.
    366366 ***************************************************************************/
     
    477477   Function : IntUartPollRead
    478478
    479    Description : This reads a character from the internal uart. It returns 
     479   Description : This reads a character from the internal uart. It returns
    480480   to the caller without blocking if not character is waiting.
    481481 ***************************************************************************/
     
    492492   Function : IntUartPollWrite
    493493
    494    Description : This writes out each character in the buffer to the 
    495    appropriate internal uart channel waiting till each one is sucessfully 
     494   Description : This writes out each character in the buffer to the
     495   appropriate internal uart channel waiting till each one is sucessfully
    496496   transmitted.
    497497 ***************************************************************************/
     
    563563   Function : console_open
    564564
    565    Description : This actually opens the device depending on the minor 
     565   Description : This actually opens the device depending on the minor
    566566   number set during initialisation. The device specific access routines are
    567567   passed to termios when the devices is opened depending on whether it is
     
    632632
    633633    if (tcgetattr(STDIN_FILENO, &term) >= 0) {
    634       term.c_cflag &= ~(CBAUD | CSIZE);
    635       term.c_cflag |= CS8 | B115200;
     634      term.c_cflag &= ~(CSIZE);
     635      term.c_cflag |= CS8;
     636      term.c_ispeed = B115200;
     637      term.c_ospeed = B115200;
    636638      tcsetattr(STDIN_FILENO, TCSANOW, &term);
    637639    }
  • c/src/lib/libbsp/m68k/mcf5235/console/console.c

    rc4b058ca r1c6926c1  
    175175        {
    176176                /* determine baud rate index */
    177                 baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     177    baud = rtems_termios_baud_to_number(t->c_ospeed);
    178178
    179179                /* determine data bits */
     
    682682    if (tcgetattr (STDIN_FILENO, &term) >= 0)
    683683    {
    684       term.c_cflag &= ~(CBAUD | CSIZE);
    685       term.c_cflag |= CS8 | B19200;
     684      term.c_cflag &= ~(CSIZE);
     685      term.c_cflag |= CS8;
     686      term.c_ispeed = B19200;
     687      term.c_ospeed = B19200;
    686688      tcsetattr (STDIN_FILENO, TCSANOW, &term);
    687689    }
  • c/src/lib/libbsp/m68k/mcf5329/console/console.c

    rc4b058ca r1c6926c1  
    171171  if (t != (const struct termios *) 0) {
    172172    /* determine baud rate index */
    173     baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     173    baud = rtems_termios_baud_to_number(t->c_ospeed);
    174174
    175175    /* determine data bits */
     
    614614
    615615    if (tcgetattr(STDIN_FILENO, &term) >= 0) {
    616       term.c_cflag &= ~(CBAUD | CSIZE);
    617       term.c_cflag |= CS8 | B19200;
     616      term.c_cflag &= ~(CSIZE);
     617      term.c_cflag |= CS8;
     618      term.c_ispeed = B19200;
     619      term.c_ospeed = B19200;
    618620      tcsetattr(STDIN_FILENO, TCSANOW, &term);
    619621    }
  • c/src/lib/libbsp/m68k/mrm332/console/sci.c

    rc4b058ca r1c6926c1  
    676676    /* set the baud rate */
    677677
    678     baud_requested = t->c_cflag & CBAUD;        /* baud rate */
     678    baud_requested = t->c_ospeed;               /* baud rate */
    679679
    680680    if (!baud_requested)
  • c/src/lib/libbsp/m68k/mvme167/console/console.c

    rc4b058ca r1c6926c1  
    726726   */
    727727  newarg.iop = args->iop;
    728   newarg.command = RTEMS_IO_GET_ATTRIBUTES;
     728  newarg.command = TIOCGETA;
    729729  newarg.buffer = &termios;
    730730  sc = rtems_termios_ioctl (&newarg);
     
    739739   */
    740740  termios.c_cflag |= CLOCAL;    /* Ignore modem status lines */
    741   newarg.command = RTEMS_IO_SET_ATTRIBUTES;
     741  newarg.command = TIOCGETA;
    742742  sc = rtems_termios_ioctl (&newarg);
    743743  if (sc != RTEMS_SUCCESSFUL)
     
    845845
    846846  /* baud rates */
    847   out_baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
    848   in_baud  = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     847  out_baud = rtems_termios_baud_to_number(t->c_ospeed);
     848  in_baud  = rtems_termios_baud_to_number(t->c_ispeed);
    849849
    850850  /* Number of bits per char */
  • c/src/lib/libbsp/m68k/uC5282/console/console.c

    rc4b058ca r1c6926c1  
    191191        {
    192192                /* determine baud rate index */
    193                 baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     193    baud = rtems_termios_baud_to_number(t->c_ospeed);
    194194
    195195                /* determine data bits */
     
    448448                break;
    449449        case 2:
    450                 MCF5282_GPIO_PASPAR = 
     450                MCF5282_GPIO_PASPAR =
    451451                  (MCF5282_GPIO_PASPAR
    452452                   & ~(MCF5282_GPIO_PASPAR_PASPA3(3)|MCF5282_GPIO_PASPAR_PASPA2(3)))
  • c/src/lib/libbsp/powerpc/acinclude.m4

    rc4b058ca r1c6926c1  
    3333  tqm8xx )
    3434    AC_CONFIG_SUBDIRS([tqm8xx]);;
    35   virtex )
    36     AC_CONFIG_SUBDIRS([virtex]);;
    3735  virtex4 )
    3836    AC_CONFIG_SUBDIRS([virtex4]);;
    3937  virtex5 )
    4038    AC_CONFIG_SUBDIRS([virtex5]);;
     39  virtex )
     40    AC_CONFIG_SUBDIRS([virtex]);;
    4141  *)
    4242    AC_MSG_ERROR([Invalid BSP]);;
  • c/src/lib/libbsp/powerpc/gen5200/console/console.c

    rc4b058ca r1c6926c1  
    193193
    194194  /* Baud rate */
    195   baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     195  baud = rtems_termios_baud_to_number(t->c_ospeed);
    196196  if (baud > 0) {
    197197   /*
  • c/src/lib/libbsp/powerpc/shared/console/console.c

    rc4b058ca r1c6926c1  
    305305  rtems_termios_baud_t baud;
    306306
    307   baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
     307  baud = rtems_termios_baud_to_number(t->c_ospeed);
    308308  if ( baud > 115200 )
    309309    rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
  • c/src/lib/libbsp/powerpc/tqm8xx/console/console.c

    rc4b058ca r1c6926c1  
    393393  int baud;
    394394
    395   switch (t->c_cflag & CBAUD) {
     395  switch (t->c_ospeed) {
    396396  default:      baud = -1;      break;
    397397  case B50:     baud = 50;      break;
  • c/src/lib/libbsp/shared/console.c

    rc4b058ca r1c6926c1  
    245245       */
    246246      IoctlArgs.iop     = args->iop;
    247       IoctlArgs.command = RTEMS_IO_GET_ATTRIBUTES;
     247      IoctlArgs.command = TIOCGETA;
    248248      IoctlArgs.buffer  = &Termios;
    249249      rtems_termios_ioctl( &IoctlArgs );
    250250
    251251      Termios.c_lflag   = ICANON;
    252       IoctlArgs.command = RTEMS_IO_SET_ATTRIBUTES;
     252      IoctlArgs.command = TIOCSETA;
    253253      rtems_termios_ioctl( &IoctlArgs );
    254254    }
  • c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c

    rc4b058ca r1c6926c1  
    4040#define DBG(x...) printk(x)
    4141#else
    42 #define DBG(x...) 
     42#define DBG(x...)
    4343#endif
    4444
     
    8686#endif
    8787
    88 struct drvmgr_drv_ops apbuart_ops = 
     88struct drvmgr_drv_ops apbuart_ops =
    8989{
    9090        .init = {apbuart_init1, NULL, NULL, NULL},
     
    568568
    569569        /* Baud rate */
    570         baud = apbuart_baud_num2baud(t->c_cflag & CBAUD);
     570  baud = apbuart_baud_num2baud(t->c_ospeed);
    571571        if (baud > 0){
    572572                /* Get APBUART core frequency */
     
    589589        struct apbuart_baud *baud;
    590590
    591         t->c_cflag = t->c_cflag & ~(CSIZE|PARENB|PARODD|CLOCAL|CBAUD);
     591  t->c_cflag = t->c_cflag & ~(CSIZE|PARENB|PARODD|CLOCAL);
    592592
    593593        /* Hardware support only CS8 */
  • c/src/lib/libcpu/arm/at91rm9200/usart/usart.c

    rc4b058ca r1c6926c1  
    241241        mode |= US_MR_PAR_NONE;
    242242
    243   baud_requested = t->c_cflag & CBAUD;
     243  baud_requested = t->c_ospeed;
    244244
    245245  /* If not, set the dbgu console baud as USART baud default */
  • c/src/lib/libcpu/arm/s3c24xx/include/s3c2400.h

    rc4b058ca r1c6926c1  
    555555                          /*    10 = ACTIVE */
    556556                          /*    11 = FRONT Porch */
    557     unsigned VSTATUS:2;   /* TFT: Vertical Status (Read only). */
     557    unsigned _VSTATUS:2;   /* TFT: Vertical Status (Read only). */
    558558                          /*    00 = VSYNC */
    559559                          /*    01 = BACK Porch. */
  • c/src/lib/libcpu/arm/s3c24xx/include/s3c2410.h

    rc4b058ca r1c6926c1  
    703703                          /*    10 = ACTIVE */
    704704                          /*    11 = FRONT Porch */
    705     unsigned VSTATUS:2;   /* TFT: Vertical Status (Read only). */
     705    unsigned _VSTATUS:2;   /* TFT: Vertical Status (Read only). */
    706706                          /*    00 = VSYNC */
    707707                          /*    01 = BACK Porch. */
  • c/src/lib/libcpu/bfin/serial/uart.c

    rc4b058ca r1c6926c1  
    1010 *  http://www.rtems.org/license/LICENSE.
    1111 */
    12  
     12
    1313#include <rtems.h>
    1414#include <rtems/libio.h>
     
    160160
    161161  base = uartsConfig->channels[minor].uart_baseAddress;
    162   switch (termios->c_cflag & CBAUD) {
     162  switch (termios->c_ospeed) {
    163163    case B0:      baud = 0;      break;
    164164    case B50:     baud = 50;     break;
  • c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c

    rc4b058ca r1c6926c1  
    363363
    364364        /* Baud rate */
    365         switch (t->c_cflag & CBAUD) {
     365  switch (t->c_ospeed) {
    366366                case B50: br = 50; break;
    367367                case B75: br = 75; break;
  • c/src/lib/libcpu/powerpc/mpc5xx/console-generic/console-generic.c

    rc4b058ca r1c6926c1  
    191191
    192192  /* Baud rate */
    193   baud = rtems_termios_baud_to_number( t->c_cflag & CBAUD );
     193  baud = rtems_termios_baud_to_number( t->c_ospeed );
    194194  if (baud > 0) {
    195195    sccr0 &= ~QSMCM_SCI_BAUD(-1);
  • c/src/lib/libcpu/powerpc/mpc8260/console-generic/console-generic.c

    rc4b058ca r1c6926c1  
    109109
    110110  /* Baud rate */
    111   switch (t->c_cflag & CBAUD) {
     111  switch (t->c_ospeed) {
    112112  default:      baud = -1;      break;
    113113  case B50:     baud = 50;      break;
     
    222222
    223223  /* Baud rate */
    224   switch (t->c_cflag & CBAUD) {
     224  switch (t->c_ospeed) {
    225225  default:      baud = -1;      break;
    226226  case B50:     baud = 50;      break;
  • c/src/lib/libcpu/powerpc/mpc8xx/console-generic/console-generic.c

    rc4b058ca r1c6926c1  
    176176
    177177  /* Baud rate */
    178   switch (t->c_cflag & CBAUD) {
     178  switch (t->c_ospeed) {
    179179  default:      baud = -1;      break;
    180180  case B50:     baud = 50;      break;
     
    272272
    273273  /* Baud rate */
    274   switch (t->c_cflag & CBAUD) {
     274  switch (t->c_ospeed) {
    275275  default:      baud = -1;      break;
    276276  case B50:     baud = 50;      break;
  • c/src/lib/libcpu/powerpc/ppc403/console/console.c

    rc4b058ca r1c6926c1  
    225225  /* FIXME: check c_cflag & CRTSCTS for hardware flowcontrol */
    226226  /* FIXME: check and IMPLEMENT XON/XOFF                     */
    227   switch (t->c_cflag & CBAUD) {
     227  switch (t->c_ospeed) {
    228228  default:      baud = -1;      break;
    229229  case B50:     baud = 50;      break;
  • c/src/lib/libcpu/powerpc/ppc403/console/console405.c

    rc4b058ca r1c6926c1  
    217217  /* FIXME: check c_cflag & CRTSCTS for hardware flowcontrol */
    218218  /* FIXME: check and IMPLEMENT XON/XOFF                     */
    219   switch (t->c_cflag & CBAUD) {
     219  switch (t->c_ospeed) {
    220220  default:      baud = -1;      break;
    221221  case B50:     baud = 50;      break;
  • c/src/lib/libcpu/powerpc/ppc403/tty_drv/tty_drv.c

    rc4b058ca r1c6926c1  
    182182  /* FIXME: check c_cflag & CRTSCTS for hardware flow control */
    183183  /* FIXME: check and IMPLEMENT XON/XOFF                     */
    184   switch (t->c_cflag & CBAUD) {
     184  switch (t->c_ospeed) {
    185185  default:      baud = -1;      break;
    186186  case B50:     baud = 50;      break;
  • c/src/lib/libcpu/sh/sh7032/sci/sci.c

    rc4b058ca r1c6926c1  
    4747  unsigned short                opened ;
    4848  tcflag_t                      cflags ;
     49  speed_t       spd ;
    4950} sci_device[SCI_MINOR_DEVICES] =
    5051{
    51   { "/dev/sci0", SH_SCI_BASE_0, 0, 0, B9600 | CS8 },
    52   { "/dev/sci1", SH_SCI_BASE_1, 1, 0, B9600 | CS8 }
     52  { "/dev/sci0", SH_SCI_BASE_0, 0, 0, CS8, B9600 },
     53  { "/dev/sci1", SH_SCI_BASE_1, 1, 0, CS8, B9600 }
    5354} ;
    5455
    5556/*  imported from scitab.rel */
    5657extern int _sci_get_brparms(
    57   tcflag_t      cflag,
     58  speed_t       spd,
    5859  unsigned char *smr,
    5960  unsigned char *brr );
     
    6263static int _sci_set_cflags(
    6364  struct scidev_t      *sci_dev,
    64   tcflag_t      c_cflag )
     65  tcflag_t      c_cflag,
     66  speed_t       spd )
    6567{
    6668  uint8_t       smr ;
    6769  uint8_t       brr ;
    6870
    69   if ( c_cflag & CBAUD )
    70   {
    71     if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 )
     71  if ( spd )
     72  {
     73    if ( _sci_get_brparms( spd, &smr, &brr ) != 0 )
    7274      return -1 ;
    7375  }
     
    240242    temp8 &= ~(SCI_TE | SCI_RE) ;
    241243    write8(temp8, sci_device[minor].addr + SCI_SCR);    /* Clear SCR */
    242     _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags );
     244    _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags, sci_device[minor].spd );
    243245
    244246/* FIXME: Should be one bit delay */
     
    251253    temp8 &= ~(SCI_TE | SCI_RE) ;
    252254    write8(temp8, sci_device[minor].addr + SCI_SCR);    /* Clear SCR */
    253     _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags );
     255    _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags, sci_device[minor].spd );
    254256
    255257/* FIXME: Should be one bit delay */
  • c/src/lib/libcpu/sh/sh7045/sci/sci.c

    rc4b058ca r1c6926c1  
    7373#define SH_SCI_BASE_1   SCI_SMR1
    7474
    75 #define SH_SCI_DEF_COMM_0   B9600 | CS8
    76 #define SH_SCI_DEF_COMM_1   B38400 | CS8
    77 /*  #define SH_SCI_DEF_COMM_1   B9600 | CS8 */
     75#define SH_SCI_DEF_COMM_0   CS8, B9600
     76#define SH_SCI_DEF_COMM_1   CS8, B38400
     77/*  #define SH_SCI_DEF_COMM_1   CS8, B9600 */
    7878
    7979struct scidev_t {
     
    8383  unsigned short             opened;
    8484  tcflag_t                   cflags;
     85  speed_t                    spd;
    8586} sci_device[SCI_MINOR_DEVICES] =
    8687{
     
    9798static int _sci_set_cflags(
    9899  struct scidev_t  *sci_dev,
    99   tcflag_t          c_cflag
     100  tcflag_t          c_cflag,
     101  speed_t           spd
    100102)
    101103{
     
    103105  uint8_t  brr;
    104106
    105   if ( c_cflag & CBAUD )
     107  if ( spd )
    106108  {
    107     if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 )
     109    if ( _sci_get_brparms( spd, &smr, &brr ) != 0 )
    108110      return -1;
    109111  }
     
    352354      write8(0x00, sci_device[minor].addr + SCI_SCR);   /* Clear SCR */
    353355                                                   /* set SMR and BRR */
    354     _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags );
     356    _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags, sci_device[minor].spd );
    355357
    356358    for (a=0; a < 10000L; a++) {                      /* Delay */
     
    527529static int _sh_sci_set_attributes( int minor, const struct termios *t)
    528530{
    529     return _sci_set_cflags( &sci_device[ minor ], t->c_cflag);
     531    return _sci_set_cflags( &sci_device[ minor ], t->c_cflag, t->c_ospeed);
    530532}
    531533
  • c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c

    rc4b058ca r1c6926c1  
    6060 */
    6161extern int _sci_get_brparms(
    62   tcflag_t      cflag,
     62  speed_t       spd,
    6363  unsigned char *smr,
    6464  unsigned char *brr
     
    7878
    7979    tcflag_t c_cflag = t->c_cflag;
    80 
    81     if ( c_cflag & CBAUD ) {
    82         if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 )
     80    speed_t spd = t->c_ospeed;
     81
     82    if ( spd ) {
     83        if ( _sci_get_brparms( spd, &smr, &brr ) != 0 )
    8384            return -1 ;
    8485    }
  • c/src/libchip/serial/mc68681.c

    rc4b058ca r1c6926c1  
    582582  }
    583583
    584   baud_requested = baud & CBAUD;
     584  baud_requested = baud;
    585585  if (!baud_requested)
    586586    baud_requested = B9600;              /* default to 9600 baud */
  • c/src/libchip/serial/mc68681_baud.c

    rc4b058ca r1c6926c1  
    3131    MC68681_BAUD_NOT_VALID,    /* B19200 */
    3232    0x0C,                      /* B38400 */
     33    MC68681_BAUD_NOT_VALID,    /* B7200 */
     34    MC68681_BAUD_NOT_VALID,    /* B14400 */
     35    MC68681_BAUD_NOT_VALID,    /* B28800 */
    3336    MC68681_BAUD_NOT_VALID,    /* B57600 */
     37    MC68681_BAUD_NOT_VALID,    /* B76800 */
    3438    MC68681_BAUD_NOT_VALID,    /* B115200 */
    3539    MC68681_BAUD_NOT_VALID,    /* B230400 */
    36     MC68681_BAUD_NOT_VALID     /* B460800 */
     40    MC68681_BAUD_NOT_VALID,    /* B460800 */
     41    MC68681_BAUD_NOT_VALID     /* B921600 */
    3742  },
    3843  { /* ACR[7] = 1, X = 0 */
     
    5358    0x0C,                      /* B19200 */
    5459    MC68681_BAUD_NOT_VALID,    /* B38400 */
     60    MC68681_BAUD_NOT_VALID,    /* B7200 */
     61    MC68681_BAUD_NOT_VALID,    /* B14400 */
     62    MC68681_BAUD_NOT_VALID,    /* B28800 */
    5563    MC68681_BAUD_NOT_VALID,    /* B57600 */
     64    MC68681_BAUD_NOT_VALID,    /* B76800 */
    5665    MC68681_BAUD_NOT_VALID,    /* B115200 */
    5766    MC68681_BAUD_NOT_VALID,    /* B230400 */
    58     MC68681_BAUD_NOT_VALID     /* B460800 */
     67    MC68681_BAUD_NOT_VALID,    /* B460800 */
     68    MC68681_BAUD_NOT_VALID     /* B921600 */
    5969  },
    6070  { /* ACR[7] = 0, X = 1 */
     
    7585    0x0C,                      /* B19200 */
    7686    MC68681_BAUD_NOT_VALID,    /* B38400 */
     87    MC68681_BAUD_NOT_VALID,    /* B7200 */
     88    MC68681_BAUD_NOT_VALID,    /* B14400 */
     89    MC68681_BAUD_NOT_VALID,    /* B28800 */
    7790    0x07,                      /* B57600 */
     91    MC68681_BAUD_NOT_VALID,    /* B76800 */
    7892    0x08,                      /* B115200 */
    7993    MC68681_BAUD_NOT_VALID,    /* B230400 */
    80     MC68681_BAUD_NOT_VALID     /* B460800 */
     94    MC68681_BAUD_NOT_VALID,    /* B460800 */
     95    MC68681_BAUD_NOT_VALID     /* B921600 */
    8196  },
    8297  { /* ACR[7] = 1, X = 1 */
     
    97112    MC68681_BAUD_NOT_VALID,    /* B19200 */
    98113    0x0C,                      /* B38400 */
     114    MC68681_BAUD_NOT_VALID,    /* B7200 */
     115    MC68681_BAUD_NOT_VALID,    /* B14400 */
     116    MC68681_BAUD_NOT_VALID,    /* B28800 */
    99117    0x07,                      /* B57600 */
     118    MC68681_BAUD_NOT_VALID,    /* B76800 */
    100119    0x08,                      /* B115200 */
    101120    MC68681_BAUD_NOT_VALID,    /* B230400 */
    102     MC68681_BAUD_NOT_VALID     /* B460800 */
     121    MC68681_BAUD_NOT_VALID,    /* B460800 */
     122    MC68681_BAUD_NOT_VALID     /* B921600 */
    103123  },
    104124};
  • c/src/libchip/serial/z85c30.c

    rc4b058ca r1c6926c1  
    450450   */
    451451
    452   baud_requested = t->c_cflag & CBAUD;
     452  baud_requested = t->c_ospeed;
    453453  if (!baud_requested)
    454454    baud_requested = B9600;              /* default to 9600 baud */
  • cpukit/libcsupport/Makefile.am

    rc4b058ca r1c6926c1  
    5555    src/termios_baud2index.c src/termios_baud2num.c src/termios_num2baud.c \
    5656    src/termios_setinitialbaud.c src/termios_baudtable.c src/cfsetspeed.c \
    57     src/cfmakeraw.c src/termios_setbestbaud.c
     57    src/cfmakeraw.c src/cfmakesane.c src/termios_setbestbaud.c
    5858
    5959SYSTEM_CALL_C_FILES = src/open.c src/close.c src/read.c src/write.c \
  • cpukit/libcsupport/include/rtems/termiostypes.h

    rc4b058ca r1c6926c1  
    528528 *  @retval other Baud constant according to @a baud.
    529529 */
    530 tcflag_t rtems_termios_number_to_baud(rtems_termios_baud_t baud);
     530speed_t rtems_termios_number_to_baud(rtems_termios_baud_t baud);
    531531
    532532/**
     
    538538 *  @retval other Integral baud value.
    539539 */
    540 rtems_termios_baud_t rtems_termios_baud_to_number(tcflag_t c_cflag);
    541 
    542 /** 
    543  *  @brief Convert Bxxx Constant to Index 
     540rtems_termios_baud_t rtems_termios_baud_to_number(speed_t c_cflag);
     541
     542/**
     543 *  @brief Convert Bxxx Constant to Index
    544544 */
    545545int  rtems_termios_baud_to_index(rtems_termios_baud_t termios_baud);
  • cpukit/libcsupport/include/sys/ioccom.h

    rc4b058ca r1c6926c1  
    7070#define _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
    7171
    72 /*
    73  *  IOCTL values
    74  */
    75 
    76 #define       RTEMS_IO_GET_ATTRIBUTES 1
    77 #define       RTEMS_IO_SET_ATTRIBUTES 2
    78 #define       RTEMS_IO_TCDRAIN        3
    79 #define       RTEMS_IO_RCVWAKEUP      4
    80 #define       RTEMS_IO_SNDWAKEUP      5
    81 #define       RTEMS_IO_TCFLUSH        6
    82 
    8372#ifdef _KERNEL
    8473
  • cpukit/libcsupport/include/sys/termios.h

    rc4b058ca r1c6926c1  
    1 /**
    2  * @file
     1/*-
     2 * Copyright (c) 1988, 1989, 1993, 1994
     3 *      The Regents of the University of California.  All rights reserved.
    34 *
    4  * @brief POSIX Termios Implementation for RTEMS Console Device Driver
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *    notice, this list of conditions and the following disclaimer in the
     12 *    documentation and/or other materials provided with the distribution.
     13 * 3. Neither the name of the University nor the names of its contributors
     14 *    may be used to endorse or promote products derived from this software
     15 *    without specific prior written permission.
    516 *
    6  * The Open Group Base Specifications Issue 6
    7  * IEEE Std 1003.1, 2004 Edition
    8  * Chapter 11, General Terminal Interface
     17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     27 * SUCH DAMAGE.
     28 *
     29 *      @(#)termios.h   8.3 (Berkeley) 3/28/94
     30 * $FreeBSD: head/include/termios.h 265878 2014-05-11 13:48:21Z jilles $
    931 */
    1032
    11 /*
    12  *  COPYRIGHT (c) 1989-2011.
    13  *  On-Line Applications Research Corporation (OAR).
    14  *
    15  *  The license and distribution terms for this file may be
    16  *  found in the file LICENSE in this distribution or at
    17  *  http://www.rtems.org/license/LICENSE.
    18  */
     33#ifndef _TERMIOS_H_
     34#define _TERMIOS_H_
    1935
    20 #ifndef TERMIOS_H
    21 #define TERMIOS_H
     36#include <sys/cdefs.h>
     37#include <sys/_termios.h>
     38#include <sys/_types.h>
    2239
    23 #include <sys/types.h>
    24 
    25 #ifdef __cplusplus
    26 extern "C" {
     40#ifndef _PID_T_DECLARED
     41typedef __pid_t         pid_t;
     42#define _PID_T_DECLARED
    2743#endif
    2844
    29 /**
    30  * @ingroup Termios
    31  *
    32  * @brief POSIX Termios Implementation
    33  *
     45#if !_POSIX_SOURCE || __rtems__
     46#define OXTABS          TAB3
     47#define MDMBUF          CCAR_OFLOW
     48#endif
     49
     50#if !_POSIX_SOURCE || __rtems__
     51#define CCEQ(val, c)    ((c) == (val) && (val) != _POSIX_VDISABLE)
     52#endif
     53
     54/*
     55 * Commands passed to tcsetattr() for setting the termios structure.
    3456 */
    35 /**@{**/
     57#define TCSANOW         0               /* make change immediate */
     58#define TCSADRAIN       1               /* drain output, then change */
     59#define TCSAFLUSH       2               /* drain output, flush input */
     60#if !_POSIX_SOURCE || __rtems__
     61#define TCSASOFT        0x10            /* flag - don't alter h.w. state */
     62#endif
    3663
    37 typedef unsigned char   cc_t;
    38 typedef unsigned int    speed_t;
    39 typedef unsigned int    tcflag_t;
     64#define TCIFLUSH        1
     65#define TCOFLUSH        2
     66#define TCIOFLUSH       3
     67#define TCOOFF          1
     68#define TCOON           2
     69#define TCIOFF          3
     70#define TCION           4
    4071
    41 #define NCCS 19
    42 struct termios {
    43         tcflag_t c_iflag;               /* input mode flags */
    44         tcflag_t c_oflag;               /* output mode flags */
    45         tcflag_t c_cflag;               /* control mode flags */
    46         tcflag_t c_lflag;               /* local mode flags */
    47         cc_t c_line;                    /* line discipline */
    48         cc_t c_cc[NCCS];                /* control characters */
    49 };
    50 
    51 /**
    52  * This value is used to disable processing of a member of c_cc
    53  * in the struct termios.
    54  */
    55 #define _POSIX_VDISABLE 0
    56 
    57 /* c_cc characters */
    58 #define VINTR 0
    59 #define VQUIT 1
    60 #define VERASE 2
    61 #define VKILL 3
    62 #define VEOF 4
    63 #define VTIME 5
    64 #define VMIN 6
    65 #define VSWTC 7
    66 #define VSTART 8
    67 #define VSTOP 9
    68 #define VSUSP 10
    69 #define VEOL 11
    70 #define VREPRINT 12
    71 #define VDISCARD 13
    72 #define VWERASE 14
    73 #define VLNEXT 15
    74 #define VEOL2 16
    75 
    76 /* c_iflag bits */
    77 #define IGNBRK  0000001
    78 #define BRKINT  0000002
    79 #define IGNPAR  0000004
    80 #define PARMRK  0000010
    81 #define INPCK   0000020
    82 #define ISTRIP  0000040
    83 #define INLCR   0000100
    84 #define IGNCR   0000200
    85 #define ICRNL   0000400
    86 #define IUCLC   0001000
    87 #define IXON    0002000
    88 #define IXANY   0004000
    89 #define IXOFF   0010000
    90 #define IMAXBEL 0020000
    91 
    92 /* c_oflag bits */
    93 #define OPOST   0000001
    94 #define OLCUC   0000002
    95 #define ONLCR   0000004
    96 #define OCRNL   0000010
    97 #define ONOCR   0000020
    98 #define ONLRET  0000040
    99 #define OFILL   0000100
    100 #define OFDEL   0000200
    101 #define NLDLY   0000400
    102 #define   NL0   0000000
    103 #define   NL1   0000400
    104 #define CRDLY   0003000
    105 #define   CR0   0000000
    106 #define   CR1   0001000
    107 #define   CR2   0002000
    108 #define   CR3   0003000
    109 #define TABDLY  0014000
    110 #define   TAB0  0000000
    111 #define   TAB1  0004000
    112 #define   TAB2  0010000
    113 #define   TAB3  0014000
    114 #define   XTABS 0014000
    115 #define BSDLY   0020000
    116 #define   BS0   0000000
    117 #define   BS1   0020000
    118 #define VTDLY   0040000
    119 #define   VT0   0000000
    120 #define   VT1   0040000
    121 #define FFDLY   0100000
    122 #define   FF0   0000000
    123 #define   FF1   0100000
    124 
    125 /* c_cflag bit meaning */
    126 #define CBAUD   0010017
    127 #define  B0     0000000         /* hang up */
    128 #define  B50    0000001
    129 #define  B75    0000002
    130 #define  B110   0000003
    131 #define  B134   0000004
    132 #define  B150   0000005
    133 #define  B200   0000006
    134 #define  B300   0000007
    135 #define  B600   0000010
    136 #define  B1200  0000011
    137 #define  B1800  0000012
    138 #define  B2400  0000013
    139 #define  B4800  0000014
    140 #define  B9600  0000015
    141 #define  B19200 0000016
    142 #define  B38400 0000017
    143 #define EXTA B19200
    144 #define EXTB B38400
    145 #define CSIZE   0000060
    146 #define   CS5   0000000
    147 #define   CS6   0000020
    148 #define   CS7   0000040
    149 #define   CS8   0000060
    150 #define CSTOPB  0000100
    151 #define CREAD   0000200
    152 #define PARENB  0000400
    153 #define PARODD  0001000
    154 #define HUPCL   0002000
    155 #define CLOCAL  0004000
    156 #define CBAUDEX 0010000
    157 #define  B57600  0010001
    158 #define  B115200 0010002
    159 #define  B230400 0010003
    160 #define  B460800 0010004
    161 #define CIBAUD    002003600000  /* input baud rate (not used) */
    162 #define CRTSCTS   020000000000          /* flow control */
    163 
    164 #define RTEMS_TERMIOS_NUMBER_BAUD_RATES 20
    165 
    166 /* c_lflag bits */
    167 #define ISIG    0000001
    168 #define ICANON  0000002
    169 #define XCASE   0000004
    170 #define ECHO    0000010
    171 #define ECHOE   0000020
    172 #define ECHOK   0000040
    173 #define ECHONL  0000100
    174 #define NOFLSH  0000200
    175 #define TOSTOP  0000400
    176 #define ECHOCTL 0001000
    177 #define ECHOPRT 0002000
    178 #define ECHOKE  0004000
    179 #define FLUSHO  0010000
    180 #define PENDIN  0040000
    181 #define IEXTEN  0100000
    182 
    183 /* tcflow() and TCXONC use these */
    184 #define TCOOFF          0
    185 #define TCOON           1
    186 #define TCIOFF          2
    187 #define TCION           3
    188 
    189 /* tcflush() and TCFLSH use these */
    190 #define TCIFLUSH        0
    191 #define TCOFLUSH        1
    192 #define TCIOFLUSH       2
    193 
    194 /* tcsetattr uses these */
    195 #define TCSANOW         0
    196 #define TCSADRAIN       1
    197 #define TCSAFLUSH       2
    198 
     72__BEGIN_DECLS
     73speed_t cfgetispeed(const struct termios *);
     74speed_t cfgetospeed(const struct termios *);
     75int     cfsetispeed(struct termios *, speed_t);
     76int     cfsetospeed(struct termios *, speed_t);
     77int     tcgetattr(int, struct termios *);
     78int     tcsetattr(int, int, const struct termios *);
    19979int     tcdrain(int);
    20080int     tcflow(int, int);
    20181int     tcflush(int, int);
    202 int     tcgetattr(int, struct termios *);
    203 int     tcsetattr(int, int, struct termios *);
    204 int     tcdrain(int);
    205 pid_t   tcgetprgrp(int);
    206 int     tcsetprgrp(int, pid_t);
    20782int     tcsendbreak(int, int);
    208 speed_t cfgetospeed(const struct termios *tp);
    209 int     cfsetospeed(struct termios *tp, speed_t speed);
    210 speed_t cfgetispeed(const struct termios *tp);
    211 int     cfsetispeed(struct termios *tp, speed_t speed);
    212 void    cfmakeraw(struct termios *tp);
    213 int     cfsetspeed(struct termios *tp, speed_t speed);
    21483
    215 /** @} */
     84#if __POSIX_VISIBLE >= 200112
     85pid_t   tcgetsid(int);
     86#endif
     87#if __BSD_VISIBLE
     88int     tcsetsid(int, pid_t);
    21689
    217 #ifdef __cplusplus
    218 }
     90void    cfmakeraw(struct termios *);
     91void    cfmakesane(struct termios *);
     92int     cfsetspeed(struct termios *, speed_t);
    21993#endif
     94__END_DECLS
    22095
    221 #endif  /* TERMIOS_H */
     96#endif /* !_TERMIOS_H_ */
     97
     98#if !_POSIX_SOURCE || __rtems__
     99#include <sys/ttycom.h>
     100#include <sys/ttydefaults.h>
     101#endif
  • cpukit/libcsupport/include/sys/ttycom.h

    rc4b058ca r1c6926c1  
    6161                                                /* 8-10 compat */
    6262                                                /* 11-12 unused */
    63 #define TIOCEXCL         _IO('t', 13)           /* set exclusive use of tty */
     63#ifdef __rtems__
     64#define RTEMS_IO_SNDWAKEUP _IOW('t', 11, struct ttywakeup ) /* send tty wakeup */
     65#define RTEMS_IO_RCVWAKEUP _IOW('t', 12, struct ttywakeup ) /* recv tty wakeup */
     66#endif /* __rtems__ */
     67#define TIOCEXCL   _IO('t', 13)   /* set exclusive use of tty */
    6468#define TIOCNXCL         _IO('t', 14)           /* reset exclusive use of tty */
    6569#define TIOCGPTN        _IOR('t', 15, int)      /* Get pts number. */
  • cpukit/libcsupport/src/cfgetispeed.c

    rc4b058ca r1c6926c1  
    3131)
    3232{
    33   return (tp->c_cflag / (CIBAUD / CBAUD)) &  CBAUD;
     33  return tp->c_ispeed;
    3434}
    3535#endif
  • cpukit/libcsupport/src/cfgetospeed.c

    rc4b058ca r1c6926c1  
    3434)
    3535{
    36   return tp->c_cflag & CBAUD;
     36  return tp->c_ospeed;
    3737}
    3838#endif
  • cpukit/libcsupport/src/cfmakeraw.c

    rc4b058ca r1c6926c1  
    5555)
    5656{
    57   tp->c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
     57  tp->c_iflag &= ~(IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR);
     58  tp->c_iflag |= IGNBRK;
    5859  tp->c_oflag &= ~OPOST;
    59   tp->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
     60  tp->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|NOFLSH|TOSTOP|PENDIN);
    6061  tp->c_cflag &= ~(CSIZE|PARENB);
    61   tp->c_cflag |= CS8;
    62   /* XXX set MIN/TIME */
     62  tp->c_cflag |= CS8|CREAD;
     63  tp->c_cc[VMIN] = 1;
     64  tp->c_cc[VTIME] = 0;
    6365}
    6466#endif
  • cpukit/libcsupport/src/cfsetispeed.c

    rc4b058ca r1c6926c1  
    2626#include <errno.h>
    2727#include <termios.h>
    28 
    29 #include <rtems/libio_.h>
     28#include <rtems/termiostypes.h>
    3029#include <rtems/seterr.h>
    3130
     
    3837)
    3938{
    40   if ( speed & ~CBAUD )
     39  if ( rtems_termios_baud_to_index( speed ) == -1 )
    4140    rtems_set_errno_and_return_minus_one( EINVAL );
    4241
    43   tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD));
     42  tp->c_ispeed = speed;
    4443  return 0;
    4544}
  • cpukit/libcsupport/src/cfsetospeed.c

    rc4b058ca r1c6926c1  
    2626#include <errno.h>
    2727#include <termios.h>
    28 
    29 #include <rtems/libio_.h>
     28#include <rtems/termiostypes.h>
    3029#include <rtems/seterr.h>
    3130
     
    3837)
    3938{
    40   if ( speed & ~CBAUD )
     39  if ( rtems_termios_baud_to_index( speed ) == -1 )
    4140    rtems_set_errno_and_return_minus_one( EINVAL );
    4241
    43   tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed;
     42  tp->c_ospeed = speed;
    4443  return 0;
    4544}
  • cpukit/libcsupport/src/cfsetspeed.c

    rc4b058ca r1c6926c1  
    2525#include <errno.h>
    2626#include <termios.h>
     27#include <rtems/termiostypes.h>
    2728#include <rtems/seterr.h>
    2829
     
    3233)
    3334{
    34   if ( speed & ~CBAUD )
     35  if ( rtems_termios_baud_to_index( speed ) == -1 )
    3536    rtems_set_errno_and_return_minus_one( EINVAL );
    3637
  • cpukit/libcsupport/src/tcdrain.c

    rc4b058ca r1c6926c1  
    3737)
    3838{
    39   return ioctl( fd, RTEMS_IO_TCDRAIN, 0 );
     39  return ioctl( fd, TIOCDRAIN, 0 );
    4040}
    4141
  • cpukit/libcsupport/src/tcflush.c

    rc4b058ca r1c6926c1  
    1414#endif
    1515
     16#include <sys/fcntl.h>
    1617#include <termios.h>
    1718#include <stdint.h>
    1819#include <sys/ioccom.h>
     20#include <rtems/libio.h>
     21#include <rtems/libio_.h>
     22#include <rtems/seterr.h>
    1923
    20 int tcflush( int fd, int queue )
     24int tcflush( int fd, int which )
    2125{
    22   return ioctl( fd, RTEMS_IO_TCFLUSH, (intptr_t) queue );
     26  int com;
     27
     28  switch (which) {
     29  case TCIFLUSH:
     30    com = FREAD;
     31    break;
     32  case TCOFLUSH:
     33    com = FWRITE;
     34    break;
     35  case TCIOFLUSH:
     36    com = FREAD | FWRITE;
     37    break;
     38  default:
     39    rtems_set_errno_and_return_minus_one( EINVAL );
     40  }
     41  return ioctl( fd, TIOCFLUSH, &com );
    2342}
  • cpukit/libcsupport/src/tcgetattr.c

    rc4b058ca r1c6926c1  
    3535)
    3636{
    37   return ioctl( fd, RTEMS_IO_GET_ATTRIBUTES, tp );
     37  return ioctl( fd, TIOCGETA, tp );
    3838}
    3939#endif
  • cpukit/libcsupport/src/tcsetattr.c

    rc4b058ca r1c6926c1  
    3636 */
    3737int tcsetattr(
    38   int             fd,
    39   int             opt,
    40   struct termios *tp
     38  int                   fd,
     39  int                   opt,
     40  const struct termios *tp
    4141)
    4242{
    43   switch (opt) {
    44   default:
    45     rtems_set_errno_and_return_minus_one( ENOTSUP );
     43  struct termios localterm;
     44
     45  if (opt & TCSASOFT) {
     46    localterm = *tp;
     47    localterm.c_cflag |= CIGNORE;
     48    tp = &localterm;
     49  }
     50
     51  switch (opt & ~TCSASOFT) {
     52
     53  case TCSANOW:
     54    return ioctl( fd, TIOCSETA, tp );
    4655
    4756  case TCSADRAIN:
    48     if (ioctl( fd, RTEMS_IO_TCDRAIN, NULL ) < 0)
    49         return -1;
    50     /*
    51      * Fall through to....
    52      */
    53   case TCSANOW:
    54     return ioctl( fd, RTEMS_IO_SET_ATTRIBUTES, tp );
     57    return ioctl( fd, TIOCSETAW, tp );
     58
     59  case TCSAFLUSH:
     60    return ioctl( fd, TIOCSETAF, tp );
     61
     62  default:
     63    rtems_set_errno_and_return_minus_one( EINVAL );
    5564  }
    5665}
  • cpukit/libcsupport/src/termios.c

    rc4b058ca r1c6926c1  
    3131#include <termios.h>
    3232#include <unistd.h>
     33#include <sys/fcntl.h>
    3334#include <sys/ttycom.h>
    3435
     
    847848  struct ttywakeup         *wakeup = (struct ttywakeup *)args->buffer;
    848849  rtems_status_code sc;
     850  int flags = *((int *)args->buffer);
    849851
    850852  args->ioctl_return = 0;
     
    866868    break;
    867869
    868   case RTEMS_IO_GET_ATTRIBUTES:
     870  case TIOCGETA:
    869871    *(struct termios *)args->buffer = tty->termios;
    870872    break;
    871873
    872   case RTEMS_IO_SET_ATTRIBUTES:
     874  case TIOCSETA:
     875  case TIOCSETAW:
     876  case TIOCSETAF:
    873877    tty->termios = *(struct termios *)args->buffer;
    874878
     879    if (args->command == TIOCSETAW || args->command == TIOCSETAF) {
     880      drainOutput (tty);
     881      if (args->command == TIOCSETAF) {
     882        flushInput (tty);
     883      }
     884    }
    875885    /* check for and process change in flow control options */
    876886    termios_set_flowctrl(tty);
     
    881891      tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT;
    882892    } else {
    883       tty->vtimeTicks = tty->termios.c_cc[VTIME] * 
     893      tty->vtimeTicks = tty->termios.c_cc[VTIME] *
    884894                    rtems_clock_get_ticks_per_second() / 10;
    885895      if (tty->termios.c_cc[VTIME]) {
     
    906916    break;
    907917
    908   case RTEMS_IO_TCDRAIN:
     918  case TIOCDRAIN:
    909919    drainOutput (tty);
    910920    break;
    911921
    912   case RTEMS_IO_TCFLUSH:
    913     switch ((intptr_t) args->buffer) {
    914       case TCIFLUSH:
    915         flushInput (tty);
    916         break;
    917       case TCOFLUSH:
    918         flushOutput (tty);
    919         break;
    920       case TCIOFLUSH:
    921         flushOutput (tty);
    922         flushInput (tty);
    923         break;
    924       default:
    925         sc = RTEMS_INVALID_NAME;
    926         break;
     922  case TIOCFLUSH:
     923    if (flags == 0) {
     924      flags = FREAD | FWRITE;
     925    } else {
     926      flags &= FREAD | FWRITE;
     927    }
     928    if (flags & FWRITE) {
     929      flushOutput (tty);
     930    }
     931    if (flags & FREAD) {
     932      flushInput (tty);
    927933    }
    928934    break;
  • cpukit/libcsupport/src/termios_baud2index.c

    rc4b058ca r1c6926c1  
    4545    case B19200:    baud_index = 14;  break;
    4646    case B38400:    baud_index = 15;  break;
    47     case B57600:    baud_index = 16;  break;
    48     case B115200:   baud_index = 17;  break;
    49     case B230400:   baud_index = 18;  break;
    50     case B460800:   baud_index = 19;  break;
     47    case B7200:     baud_index = 16;  break;
     48    case B14400:    baud_index = 17;  break;
     49    case B28800:    baud_index = 18;  break;
     50    case B57600:    baud_index = 19;  break;
     51    case B76800:    baud_index = 20;  break;
     52    case B115200:   baud_index = 21;  break;
     53    case B230400:   baud_index = 22;  break;
     54    case B460800:   baud_index = 23;  break;
     55    case B921600:   baud_index = 24;  break;
    5156    default:        baud_index = -1;  break;
    5257  }
  • cpukit/libcsupport/src/termios_baud2num.c

    rc4b058ca r1c6926c1  
    2121#include <rtems/termiostypes.h>
    2222
    23 rtems_termios_baud_t rtems_termios_baud_to_number(tcflag_t c_cflag)
     23rtems_termios_baud_t rtems_termios_baud_to_number(speed_t spd)
    2424{
    25   uint32_t remote_value = (uint32_t) (c_cflag & CBAUD);
    26 
    27   return rtems_assoc_local_by_remote(rtems_termios_baud_table, remote_value);
     25  return rtems_assoc_local_by_remote(rtems_termios_baud_table, spd);
    2826}
  • cpukit/libcsupport/src/termios_baudtable.c

    rc4b058ca r1c6926c1  
    3838  { "B19200",  19200,  B19200 },
    3939  { "B38400",  38400,  B38400 },
     40  { "B7200",   7200,   B7200 },
     41  { "B14400",  14400,  B14400 },
     42  { "B28800",  28800,  B28800 },
    4043  { "B57600",  57600,  B57600 },
     44  { "B76800",  76800,  B76800 },
    4145  { "B115200", 115200, B115200 },
    4246  { "B230400", 230400, B230400 },
    4347  { "B460800", 460800, B460800 },
     48  { "B921600", 921600, B921600 },
    4449  { NULL,      0,      0 }
    4550};
  • cpukit/libcsupport/src/termios_setbestbaud.c

    rc4b058ca r1c6926c1  
    2626  const rtems_assoc_t *current = &rtems_termios_baud_table[ 0 ];
    2727  const rtems_assoc_t *last = current;
    28   tcflag_t cbaud_mask = CBAUD;
    29   tcflag_t cbaud;
     28  speed_t spd;
    3029
    3130  while ( current->name != NULL && current->local_value < baud ) {
     
    3736    uint32_t mid = (last->local_value + current->local_value) / UINT32_C( 2 );
    3837
    39     cbaud = baud <= mid ? last->remote_value : current->remote_value;
     38    spd = baud <= mid ? last->remote_value : current->remote_value;
    4039  } else {
    41     cbaud = B460800;
     40    spd = B460800;
    4241  }
    4342
    44   term->c_cflag = (term->c_cflag & ~cbaud_mask) | cbaud;
     43  term->c_ispeed = spd;
     44  term->c_ospeed = spd;
    4545}
  • cpukit/libcsupport/src/termios_setinitialbaud.c

    rc4b058ca r1c6926c1  
    2727{
    2828  int rv = 0;
    29   tcflag_t c_cflag_baud = rtems_termios_number_to_baud(baud);
     29  speed_t spd = rtems_termios_number_to_baud(baud);
    3030
    31   if ( c_cflag_baud != 0 ) {
    32     tcflag_t cbaud = CBAUD;
    33 
    34     tty->termios.c_cflag = (tty->termios.c_cflag & ~cbaud) | c_cflag_baud;
     31  if ( spd != 0 ) {
     32    tty->termios.c_ispeed = spd;
     33    tty->termios.c_ospeed = spd;
    3534  } else {
    3635    rv = -1;
  • cpukit/libnetworking/net/ppp_tty.c

    rc4b058ca r1c6926c1  
    225225    sc->sc_outm = NULL;
    226226    sc->sc_outmc = NULL;
    227    
     227
    228228    /* preallocate mbufs for free queue */
    229229    rtems_bsdnet_semaphore_obtain();
     
    244244    /* initialize values */
    245245    sc->sc_if.if_flags |= IFF_RUNNING;
    246     sc->sc_if.if_baudrate =
    247         rtems_termios_baud_to_number(tty->termios.c_cflag & CBAUD);
     246    sc->sc_if.if_baudrate = tty->termios.c_ispeed;
    248247
    249248    tty->t_sc = (void *)sc;
     
    375374    int                           len;
    376375    int                           maximum    = rw_args->count;
    377     char                         *out_buffer = rw_args->buffer; 
     376    char                         *out_buffer = rw_args->buffer;
    378377    register struct ppp_softc    *sc         = (struct ppp_softc *)tty->t_sc;
    379378    struct mbuf                  *m;
     
    433432
    434433    switch (cmd) {
    435     case RTEMS_IO_GET_ATTRIBUTES:
    436     case RTEMS_IO_SET_ATTRIBUTES:
    437     case RTEMS_IO_TCDRAIN:
     434    case TIOCGETA:
     435    case TIOCSETA:
     436    case TIOCSETAW:
     437    case TIOCSETAF:
     438    case TIOCDRAIN:
    438439    case RTEMS_IO_SNDWAKEUP:
    439440    case RTEMS_IO_RCVWAKEUP:
  • cpukit/preinstall.am

    rc4b058ca r1c6926c1  
    104104        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/ttycom.h
    105105PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/ttycom.h
     106
     107$(PROJECT_INCLUDE)/sys/ttydefaults.h: libcsupport/include/sys/ttydefaults.h $(PROJECT_INCLUDE)/sys/$(dirstamp)
     108        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/ttydefaults.h
     109PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/ttydefaults.h
     110
     111$(PROJECT_INCLUDE)/sys/_termios.h: libcsupport/include/sys/_termios.h $(PROJECT_INCLUDE)/sys/$(dirstamp)
     112        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sys/_termios.h
     113PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys/_termios.h
    106114
    107115$(PROJECT_INCLUDE)/sys/termios.h: libcsupport/include/sys/termios.h $(PROJECT_INCLUDE)/sys/$(dirstamp)
  • testsuites/libtests/termios/init.c

    rc4b058ca r1c6926c1  
    4747void print_c_cflag(struct termios * tp);
    4848void print_c_cc(struct termios * tp);
     49void print_baud(const char* name, speed_t spd);
    4950void print_termios(struct termios *tp);
    5051unsigned long get_baud_rate(void);
     
    119120    printf( "ONLCR " );
    120121
     122  if( tp->c_oflag & ONOEOT )
     123    printf( "ONOEOT " );
     124
    121125  if( tp->c_oflag & OCRNL )
    122126    printf( "OCRNL " );
     
    216220{
    217221  char * c_lflag_bits [] = {
    218     "ISIG",        /* 0000001 */
    219     "ICANON",      /* 0000002 */
    220     "XCASE",       /* 0000004 */
    221     "ECHO",        /* 0000010 */
    222     "ECHOE",       /* 0000020 */
    223     "ECHOK",       /* 0000040 */
    224     "ECHONL",      /* 0000100 */
    225     "NOFLSH",      /* 0000200 */
    226     "TOSTOP",      /* 0000400 */
    227     "ECHOCTL",     /* 0001000 */
    228     "ECHOPRT",     /* 0002000 */
    229     "ECHOKE",      /* 0004000 */
    230     "FLUSHO",      /* 0010000 */
    231     "unknown",     /* 0020000 */
    232     "PENDIN",      /* 0040000 */
    233     "IEXTEN",      /* 0100000 */
    234     "unknown",     /* 0200000 */
    235     "unknown",     /* 0400000 */
    236     "unknown",     /* 1000000 */
    237     "unknown",     /* 2000000 */
    238     "unknown",     /* 4000000 */
     222    "ECHOKE",      /* 0x00000001 */
     223    "ECHOE",       /* 0x00000002 */
     224    "ECHOK",       /* 0x00000004 */
     225    "ECHO",        /* 0x00000008 */
     226    "ECHONL",      /* 0x00000010 */
     227    "ECHOPRT",     /* 0x00000020 */
     228    "ECHOCTL",     /* 0x00000040 */
     229    "ISIG",        /* 0x00000080 */
     230    "ICANON",      /* 0x00000100 */
     231    "ALTWERASE",   /* 0x00000200 */
     232    "IEXTEN",      /* 0x00000400 */
     233    "EXTPROC",     /* 0x00000800 */
     234    "XCASE",       /* 0x00001000 */
     235    "unknown",     /* 0x00002000 */
     236    "unknown",     /* 0x00004000 */
     237    "unknown",     /* 0x00008000 */
     238    "unknown",     /* 0x00010000 */
     239    "unknown",     /* 0x00020000 */
     240    "unknown",     /* 0x00040000 */
     241    "unknown",     /* 0x00080000 */
     242    "unknown",     /* 0x00100000 */
     243    "unknown",     /* 0x00200000 */
     244    "TOSTOP",      /* 0x00400000 */
     245    "FLUSHO",      /* 0x00800000 */
     246    "unknown",     /* 0x01000000 */
     247    "NOKERNINFO",  /* 0x02000000 */
     248    "unknown",     /* 0x04000000 */
     249    "unknown",     /* 0x08000000 */
     250    "unknown",     /* 0x10000000 */
     251    "PENDIN",      /* 0x20000000 */
     252    "unknown",     /* 0x40000000 */
     253    "NOFLSH",      /* 0x80000000 */
    239254  };
    240255
     
    247262void print_c_cflag( struct termios * tp )
    248263{
    249   unsigned int baud;
    250 
    251264  printf( "c_cflag = 0x%08x\n", tp->c_cflag );
    252 
    253   baud = (tp->c_cflag & CBAUD) ;
    254   if ( tp->c_cflag & CBAUDEX )
    255   switch( baud ) {
    256     case B0:
    257       printf( "\tCBAUD =\tB0\n" );
    258       break;
    259 
    260     case B50:
    261       printf( "\tCBAUD =\tB50\n" );
    262       break;
    263 
    264     case B75:
    265       printf( "\tCBAUD =\tB75\n" );
    266       break;
    267 
    268     case B110:
    269       printf( "\tCBAUD =\tB110\n" );
    270       break;
    271 
    272     case B134:
    273       printf( "\tCBAUD =\tB134\n" );
    274       break;
    275 
    276     case B150:
    277       printf( "\tCBAUD =\tB150\n" );
    278       break;
    279 
    280     case B200:
    281       printf( "\tCBAUD =\tB200\n" );
    282       break;
    283 
    284     case B300:
    285       printf( "\tCBAUD =\tB300\n" );
    286       break;
    287 
    288     case B600:
    289       printf( "\tCBAUD =\tB600\n" );
    290       break;
    291 
    292     case B1200:
    293       printf( "\tCBAUD =\tB1200\n" );
    294       break;
    295 
    296     case B1800:
    297       printf( "\tCBAUD =\tB1800\n" );
    298       break;
    299 
    300     case B2400:
    301       printf( "\tCBAUD =\tB2400\n" );
    302       break;
    303 
    304     case B4800:
    305       printf( "\tCBAUD =\tB4800\n" );
    306       break;
    307 
    308     case B9600:
    309       printf( "\tCBAUD =\tB9600\n" );
    310       break;
    311 
    312     case B19200:
    313       printf( "\tCBAUD =\tB19200\n" );
    314       break;
    315 
    316     case B38400:
    317       printf( "\tCBAUD =\tB38400\n" );
    318       break;
    319 
    320     case B57600:
    321       printf( "\tCBAUD =\tB57600\n" );
    322       break;
    323 
    324     case B115200:
    325       printf( "\tCBAUD =\tB115200\n" );
    326       break;
    327 
    328     case B230400:
    329       printf( "\tCBAUD =\tB230400\n" );
    330       break;
    331 
    332     case B460800:
    333       printf( "\tCBAUD =\tB460800\n" );
    334       break;
    335 
    336     default:
    337       printf( "\tCBAUD =\tunknown (0x%08x)\n", baud );
    338       break;
    339     }
    340265
    341266  switch( tp->c_cflag & CSIZE ) {
     
    357282  }
    358283
     284  if( tp->c_cflag & CIGNORE )
     285    printf( "\tCIGNORE set: iqnore c_cflags enabled\n" );
     286  else
     287    printf( "\tCIGNORE clear: iqnore c_cflags disabled\n" );
     288
    359289  if( tp->c_cflag & CSTOPB )
    360290    printf( "\tCSTOPB set: send 2 stop bits\n" );
     
    387317    printf( "\tCLOCAL clear: don't ignore modem lines\n" );
    388318
    389 #if defined(CBAUDEX)
    390   if( tp->c_cflag & CBAUDEX )
    391     printf( "\tCBAUDEX set: What does this do?\n" );
    392   else
    393     printf( "\tCBAUDEX clear: What does this do?\n" );
    394 #endif
     319  if( tp->c_cflag & CCTS_OFLOW )
     320    printf( "\tCCTS_OFLOW: hardware CTS output flow control enabled\n" );
     321  else
     322    printf( "\tCCTS_OFLOW: hardware CTS output flow control disabled\n" );
     323
     324  if( tp->c_cflag & CRTS_IFLOW )
     325    printf( "\tCRTS_IFLOW: hardware RTS input flow control enabled\n" );
     326  else
     327    printf( "\tCRTS_IFLOW: hardware RTS input flow control disabled\n" );
    395328
    396329  if( tp->c_cflag & CRTSCTS )
     
    398331  else
    399332    printf( "\tCRTSCTS: hardware flow control disabled?\n" );
     333
     334  if( tp->c_cflag & CDSR_OFLOW )
     335    printf( "\tCDSR_OFLOW: hardware DSR output flow control enabled\n" );
     336  else
     337    printf( "\tCDSR_OFLOW: hardware DSR output flow control disabled\n" );
     338
     339  if( tp->c_cflag & CDTR_IFLOW )
     340    printf( "\tCDTR_IFLOW: hardware DTR input flow control enabled\n" );
     341  else
     342    printf( "\tCDTR_IFLOW: hardware DTR input flow control disabled\n" );
     343
     344  if( tp->c_cflag & CCAR_OFLOW )
     345    printf( "\tCCAR_OFLOW: hardware CD output flow control enabled\n" );
     346  else
     347    printf( "\tCCAR_OFLOW: hardware CD output flow control disabled\n" );
    400348}
    401349
     
    405353  size_t i;
    406354  char * cc_index_names [ /* NCCS */ ] = {
    407     "[VINTR]   ",   /* 0 */
    408     "[VQUIT]   ",   /* 1 */
    409     "[VERASE]  ",   /* 2 */
    410     "[VKILL]   ",   /* 3 */
    411     "[VEOF]    ",   /* 4 */
    412     "[VTIME]   ",   /* 5 */
    413     "[VMIN]    ",   /* 6 */
    414     "[VSWTC    ",   /* 7 */
    415     "[VSTART]  ",   /* 8 */
    416     "[VSTOP]   ",   /* 9 */
     355    "[VEOF]    ",   /* 0 */
     356    "[VEOL]    ",   /* 1 */
     357    "[VEOL2]   ",   /* 2 */
     358    "[VERASE]  ",   /* 3 */
     359    "[VWERASE] ",   /* 4 */
     360    "[VKILL]   ",   /* 5 */
     361    "[VREPRINT]",   /* 6 */
     362    "[VERASE2] ",   /* 7 */
     363    "[VINTR]   ",   /* 8 */
     364    "[VQUIT]   ",   /* 9 */
    417365    "[VSUSP]   ",   /* 10 */
    418     "[VEOL]    ",   /* 11 */
    419     "[VREPRINT]",   /* 12 */
    420     "[VDISCARD]",   /* 13 */
    421     "[VWERASE] ",   /* 14 */
    422     "[VLNEXT   ",   /* 15 */
    423     "[VEOL2]   ",   /* 16 */
    424     "unknown   ",   /* 17 */
    425     "unknown   ",   /* 18 */
     366    "[VDSUSP]  ",   /* 11 */
     367    "[VSTART]  ",   /* 12 */
     368    "[VSTOP]   ",   /* 13 */
     369    "[VLNEXT]  ",   /* 14 */
     370    "[VDISCARD]",   /* 15 */
     371    "[VMIN]    ",   /* 16 */
     372    "[VTIME]   ",   /* 17 */
     373    "[VSTATUS] ",   /* 18 */
     374    "unknown   ",   /* 19 */
    426375  };
    427376
    428377  for( i = 0; i < sizeof(cc_index_names)/sizeof(char*) ; i++ ) {
    429378    printf( "c_cc%s = 0x%08x\n", cc_index_names[i], tp->c_cc[i] );
     379  }
     380}
     381
     382
     383void print_baud( const char* name, speed_t spd )
     384{
     385  switch( spd ) {
     386  case B0:
     387    printf( "%s = B0\n", name );
     388    break;
     389
     390  case B50:
     391    printf( "%s = B50\n", name );
     392    break;
     393
     394  case B75:
     395    printf( "%s = B75\n", name );
     396    break;
     397
     398  case B110:
     399    printf( "%s = B110\n", name );
     400    break;
     401
     402  case B134:
     403    printf( "%s = B134\n", name );
     404    break;
     405
     406  case B150:
     407    printf( "%s = B150\n", name );
     408    break;
     409
     410  case B200:
     411    printf( "%s = B200\n", name );
     412    break;
     413
     414  case B300:
     415    printf( "%s = B300\n", name );
     416    break;
     417
     418  case B600:
     419    printf( "%s = B600\n", name );
     420    break;
     421
     422  case B1200:
     423    printf( "%s = B1200\n", name );
     424    break;
     425
     426  case B1800:
     427    printf( "%s = B1800\n", name );
     428    break;
     429
     430  case B2400:
     431    printf( "%s = B2400\n", name );
     432    break;
     433
     434  case B4800:
     435    printf( "%s = B4800\n", name );
     436    break;
     437
     438  case B9600:
     439    printf( "%s = B9600\n", name );
     440    break;
     441
     442  case B19200:
     443    printf( "%s = B19200\n", name );
     444    break;
     445
     446  case B38400:
     447    printf( "%s = B38400\n", name );
     448    break;
     449
     450  case B7200:
     451    printf( "%s = B7200\n", name );
     452    break;
     453
     454  case B14400:
     455    printf( "%s = B14400\n", name );
     456    break;
     457
     458  case B28800:
     459    printf( "%s = B28800\n", name );
     460    break;
     461
     462  case B57600:
     463    printf( "%s = B57600\n", name );
     464    break;
     465
     466  case B76800:
     467    printf( "%s = B76800\n", name );
     468    break;
     469
     470  case B115200:
     471    printf( "%s = B115200\n", name );
     472    break;
     473
     474  case B230400:
     475    printf( "%s = B230400\n", name );
     476    break;
     477
     478  case B460800:
     479    printf( "%s = B460800\n", name );
     480    break;
     481
     482  case B921600:
     483    printf( "%s = B921600\n", name );
     484    break;
     485
     486  default:
     487    printf( "%s = unknown (0x%08x)\n", name, (unsigned int)spd );
     488    break;
    430489  }
    431490}
     
    440499  print_c_lflag( tp );
    441500  print_c_cc( tp );
     501  print_baud( "c_ispeed", tp->c_ispeed );
     502  print_baud( "c_ospeed", tp->c_ospeed );
    442503  printf( "\n" );
    443504}
     
    451512    printf( "Enter the numerical value for the new baud rate.\n" );
    452513    printf( "Choices are: 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800\n" );
    453     printf( "2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800\n" );
     514    printf( "2400, 4800, 9600, 19200, 38400, 7200, 14400, 28800, 57600, 76800\n" );
     515    printf( "115200, 230400, 460800, 921600\n" );
    454516    printf( "\nYour choice: " );
    455517    scanf( "%lu", &baud_rate );
     
    471533      case 19200:  return B19200;
    472534      case 38400:  return B38400;
     535      case 7200:   return B7200;
     536      case 14400:  return B14400;
     537      case 28800:  return B28800;
    473538      case 57600:  return B57600;
     539      case 76800:  return B76800;
    474540      case 115200: return B115200;
    475541      case 230400: return B230400;
    476542      case 460800: return B460800;
     543      case 921600: return B921600;
    477544
    478545      default:
     
    590657  sleep( sleep_time );
    591658
    592   tp->c_cflag = CLOCAL | CREAD | parity | stop_bits | data_bits | baud_rate;
     659  tp->c_cflag = CLOCAL | CREAD | parity | stop_bits | data_bits;
     660  tp->c_ispeed = baud_rate;
     661  tp->c_ospeed = baud_rate;
    593662  if( tcsetattr( fileno( stdin ), TCSADRAIN, tp ) < 0 ) {
    594663    perror( "change_line_settings(): tcsetattr() failed" );
  • testsuites/libtests/termios01/init.c

    rc4b058ca r1c6926c1  
    1313
    1414#include "tmacros.h"
     15#define TTYDEFCHARS
    1516#include <termios.h>
    1617#include <rtems/libcsupport.h>
     
    6768  { B19200,   19200 },
    6869  { B38400,   38400 },
     70  { B7200,     7200 },
     71  { B14400,   14400 },
     72  { B28800,   28800 },
    6973  { B57600,   57600 },
     74  { B76800,   76800 },
    7075  { B115200, 115200 },
    7176  { B230400, 230400 },
    7277  { B460800, 460800 },
     78  { B921600, 921600 },
    7379  { INVALID_CONSTANT, INVALID_BAUD }
    7480};
     
    234240  puts( "Test termios setting device baud rate..." );
    235241  for (i=0 ; baud_table[i].constant != INVALID_CONSTANT ; i++ ) {
    236     tcflag_t cbaud = CBAUD;
    237 
    238242    sc = tcgetattr( test, &attr );
    239243    if ( sc != 0 ) {
     
    242246    }
    243247
    244     attr.c_cflag &= ~cbaud;
    245     attr.c_cflag |= baud_table[i].constant;
     248    attr.c_ispeed = baud_table[i].constant;
     249    attr.c_ospeed = baud_table[i].constant;
    246250
    247251    printf(
     
    259263      baud_table[i].baud
    260264    );
    261     sc = tcsetattr( test, TCSANOW, &attr );
     265    sc = tcsetattr( test, TCSADRAIN, &attr );
     266    if ( sc != 0 ) {
     267      printf( "ERROR - return %d\n", sc );
     268      rtems_test_exit(0);
     269    }
     270
     271    printf(
     272      "tcsetattr(TCSAFLUSH, B%" PRIdrtems_termios_baud_t ") - OK\n",
     273      baud_table[i].baud
     274    );
     275    sc = tcsetattr( test, TCSAFLUSH, &attr );
    262276    if ( sc != 0 ) {
    263277      printf( "ERROR - return %d\n", sc );
     
    302316
    303317    printf( "tcsetattr(TCSADRAIN, CS%d) - OK\n", char_size_table[i].bits );
    304     sc = tcsetattr( test, TCSANOW, &attr );
     318    sc = tcsetattr( test, TCSADRAIN, &attr );
     319    if ( sc != 0 ) {
     320      printf( "ERROR - return %d\n", sc );
     321      rtems_test_exit(0);
     322    }
     323
     324    printf( "tcsetattr(TCSAFLUSH, CS%d) - OK\n", char_size_table[i].bits );
     325    sc = tcsetattr( test, TCSAFLUSH, &attr );
     326    if ( sc != 0 ) {
     327      printf( "ERROR - return %d\n", sc );
     328      rtems_test_exit(0);
     329    }
     330
     331    printf( "tcsetattr(TCSASOFT, CS%d) - OK\n", char_size_table[i].bits );
     332    sc = tcsetattr( test, TCSASOFT, &attr );
    305333    if ( sc != 0 ) {
    306334      printf( "ERROR - return %d\n", sc );
     
    345373
    346374    printf( "tcsetattr(TCSADRAIN, %s) - OK\n", parity_table[i].parity );
    347     sc = tcsetattr( test, TCSANOW, &attr );
     375    sc = tcsetattr( test, TCSADRAIN, &attr );
     376    if ( sc != 0 ) {
     377      printf( "ERROR - return %d\n", sc );
     378      rtems_test_exit(0);
     379    }
     380
     381    printf( "tcsetattr(TCSAFLUSH, %s) - OK\n", parity_table[i].parity );
     382    sc = tcsetattr( test, TCSAFLUSH, &attr );
     383    if ( sc != 0 ) {
     384      printf( "ERROR - return %d\n", sc );
     385      rtems_test_exit(0);
     386    }
     387
     388    printf( "tcsetattr(TCSASOFT, %s) - OK\n", parity_table[i].parity );
     389    sc = tcsetattr( test, TCSASOFT, &attr );
    348390    if ( sc != 0 ) {
    349391      printf( "ERROR - return %d\n", sc );
     
    391433
    392434    printf( "tcsetattr(TCSADRAIN, %d bits) - OK\n", stop_bits_table[i].stop );
    393     sc = tcsetattr( test, TCSANOW, &attr );
     435    sc = tcsetattr( test, TCSADRAIN, &attr );
     436    if ( sc != 0 ) {
     437      printf( "ERROR - return %d\n", sc );
     438      rtems_test_exit(0);
     439    }
     440
     441    printf( "tcsetattr(TCSAFLUSH, %d bits) - OK\n", stop_bits_table[i].stop );
     442    sc = tcsetattr( test, TCSAFLUSH, &attr );
     443    if ( sc != 0 ) {
     444      printf( "ERROR - return %d\n", sc );
     445      rtems_test_exit(0);
     446    }
     447
     448    printf( "tcsetattr(TCSASOFT, %d bits) - OK\n", stop_bits_table[i].stop );
     449    sc = tcsetattr( test, TCSASOFT, &attr );
    394450    if ( sc != 0 ) {
    395451      printf( "ERROR - return %d\n", sc );
     
    405461  speed_t speed;
    406462  struct termios term;
    407   tcflag_t        bad;
    408 
    409   bad = CBAUD << 1;
     463  speed_t bad;
     464
     465  bad = B921600 << 1;
    410466  memset( &term, '\0', sizeof(term) );
    411467  puts( "cfsetospeed(BAD BAUD) - EINVAL" );
     
    437493  speed_t         speed;
    438494  struct termios  term;
    439   tcflag_t        bad;
    440 
    441   bad = CBAUD << 1;
     495  speed_t         bad;
     496
     497  bad = B921600 << 1;
    442498  memset( &term, '\0', sizeof(term) );
    443499  puts( "cfsetispeed(BAD BAUD) - EINVAL" );
     
    470526  speed_t         speed;
    471527  struct termios  term;
    472   tcflag_t        bad;
    473 
    474   bad = CBAUD << 1;
     528  speed_t         bad;
     529
     530  bad = B921600 << 1;
    475531  memset( &term, '\0', sizeof(term) );
    476532  puts( "cfsetspeed(BAD BAUD) - EINVAL" );
     
    509565
    510566  /* Check that all of the flags were set correctly */
    511   rtems_test_assert( ~(term.c_iflag & (IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON)) );
     567  rtems_test_assert( ~(term.c_iflag & (IMAXBEL|IXOFF|INPCK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IGNPAR)) );
     568
     569  rtems_test_assert( term.c_iflag & (IGNBRK) );
    512570
    513571  rtems_test_assert( ~(term.c_oflag & OPOST) );
    514572
    515   rtems_test_assert( ~(term.c_lflag & (ECHO|ECHONL|ICANON|ISIG|IEXTEN)) );
     573  rtems_test_assert( ~(term.c_lflag & (ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|NOFLSH|TOSTOP|PENDIN)) );
    516574
    517575  rtems_test_assert( ~(term.c_cflag & (CSIZE|PARENB)) );
    518576
    519   rtems_test_assert( term.c_cflag & CS8 );
     577  rtems_test_assert( term.c_cflag & (CS8|CREAD) );
     578
     579  rtems_test_assert( term.c_cc[VMIN] == 1 );
     580
     581  rtems_test_assert( term.c_cc[VTIME] == 0 );
     582}
     583
     584static void test_termios_cfmakesane(void)
     585{
     586  struct termios  term;
     587
     588  memset( &term, '\0', sizeof(term) );
     589  cfmakesane( &term );
     590  puts( "cfmakesane - OK" );
     591
     592  /* Check that all of the flags were set correctly */
     593  rtems_test_assert( term.c_iflag == TTYDEF_IFLAG );
     594
     595  rtems_test_assert( term.c_oflag == TTYDEF_OFLAG );
     596
     597  rtems_test_assert( term.c_lflag == TTYDEF_LFLAG );
     598
     599  rtems_test_assert( term.c_cflag == TTYDEF_CFLAG );
     600
     601  rtems_test_assert( term.c_ispeed == TTYDEF_SPEED );
     602
     603  rtems_test_assert( term.c_ospeed == TTYDEF_SPEED );
     604
     605  rtems_test_assert( memcmp(&term.c_cc, ttydefchars, sizeof(term.c_cc)) == 0 );
    520606}
    521607
     
    685771  rtems_test_assert( !ctx.done );
    686772  errno = 0;
    687   rv = ioctl( fd, RTEMS_IO_SET_ATTRIBUTES, &term );
     773  rv = ioctl( fd, TIOCSETA, &term );
    688774  rtems_test_assert( rv == -1 );
    689775  rtems_test_assert( errno == EIO );
     
    703789  static const struct {
    704790    uint32_t baud;
    705     tcflag_t cflag;
    706   } baud_to_cflag_table[] = {
     791    speed_t speed;
     792  } baud_to_speed_table[] = {
    707793    { 0,          B0 },
    708794    { 25,         B0 },
     
    732818  };
    733819
    734   size_t n = RTEMS_ARRAY_SIZE(baud_to_cflag_table);
     820  size_t n = RTEMS_ARRAY_SIZE(baud_to_speed_table);
    735821  size_t i;
    736822
    737823  for ( i = 0; i < n; ++i ) {
    738824    struct termios term;
    739     tcflag_t cbaud_mask = CBAUD;
    740825
    741826    memset( &term, 0xff, sizeof( term ) );
    742     rtems_termios_set_best_baud( &term, baud_to_cflag_table[ i ].baud );
    743 
    744     rtems_test_assert(
    745       (term.c_cflag & cbaud_mask) == baud_to_cflag_table[ i ].cflag
    746     );
     827    rtems_termios_set_best_baud( &term, baud_to_speed_table[ i ].baud );
     828
     829    rtems_test_assert( term.c_ispeed == baud_to_speed_table[ i ].speed );
     830    rtems_test_assert( term.c_ospeed == baud_to_speed_table[ i ].speed );
    747831  }
    748832}
     
    792876   * tcsetattr - ERROR invalid operation
    793877   */
    794   puts( "tcsetattr - invalid operation - ENOTSUP" );
     878  puts( "tcsetattr - invalid operation - EINVAL" );
    795879  rc = tcsetattr( test, INT_MAX, &t );
    796880  rtems_test_assert( rc == -1 );
    797   rtems_test_assert( errno == ENOTSUP );
     881  rtems_test_assert( errno == EINVAL );
    798882
    799883  test_termios_cfmakeraw();
    800  
     884  test_termios_cfmakesane();
     885
    801886  /*
    802887   * tcsetattr - TCSADRAIN
  • testsuites/libtests/termios01/termios01.scn

    rc4b058ca r1c6926c1  
    1 *** TEST TERMIOS 01 ***
     1*** BEGIN OF TEST TERMIOS 1 ***
    22Test termios_baud2index...
    33termios_baud_to_index(-2) - NOT OK
     
    1818termios_baud_to_index(B19200) - OK
    1919termios_baud_to_index(B38400) - OK
     20termios_baud_to_index(B7200) - OK
     21termios_baud_to_index(B14400) - OK
     22termios_baud_to_index(B28800) - OK
    2023termios_baud_to_index(B57600) - OK
     24termios_baud_to_index(B76800) - OK
    2125termios_baud_to_index(B115200) - OK
    2226termios_baud_to_index(B230400) - OK
    2327termios_baud_to_index(B460800) - OK
     28termios_baud_to_index(B921600) - OK
    2429
    2530Test termios_baud2number...
     
    4146termios_baud_to_number(B19200) - OK
    4247termios_baud_to_number(B38400) - OK
     48termios_baud_to_number(B7200) - OK
     49termios_baud_to_number(B14400) - OK
     50termios_baud_to_number(B28800) - OK
    4351termios_baud_to_number(B57600) - OK
     52termios_baud_to_number(B76800) - OK
    4453termios_baud_to_number(B115200) - OK
    4554termios_baud_to_number(B230400) - OK
    4655termios_baud_to_number(B460800) - OK
     56termios_baud_to_number(B921600) - OK
    4757
    4858Test termios_number_to_baud...
     
    6474termios_number_to_baud(B19200) - OK
    6575termios_number_to_baud(B38400) - OK
     76termios_number_to_baud(B7200) - OK
     77termios_number_to_baud(B14400) - OK
     78termios_number_to_baud(B28800) - OK
    6679termios_number_to_baud(B57600) - OK
     80termios_number_to_baud(B76800) - OK
    6781termios_number_to_baud(B115200) - OK
    6882termios_number_to_baud(B230400) - OK
    6983termios_number_to_baud(B460800) - OK
     84termios_number_to_baud(B921600) - OK
    7085
    7186Init - rtems_io_register_driver - Termios Test Driver - OK
    7287Termios_test_driver - rtems_io_register /dev/test - OK
    73 Init - Major slot returned = 2
     88Init - Major slot returned = 3
    7489Init - open - /dev/test - OK
    7590Termios_test_driver - rtems_set_initial_baud - bad baud - OK
    7691Termios_test_driver - rtems_set_initial_baud - 38400 - OK
    77 tcsetattr - invalid operation - ENOTSUP
     92tcsetattr - invalid operation - EINVAL
    7893cfmakeraw - OK
     94cfmakesane - OK
    7995
    8096tcsetattr - drain - OK
    81 set_attributes - B0 5-NONE-1
     97set_attributes - B0 8-NONE-2
    8298Test termios setting device baud rate...
    8399tcsetattr(TCSANOW, B0) - OK
    84 set_attributes - B0 5-NONE-1
     100set_attributes - B0 8-NONE-2
    85101tcsetattr(TCSADRAIN, B0) - OK
    86 set_attributes - B0 5-NONE-1
     102set_attributes - B0 8-NONE-2
     103tcsetattr(TCSAFLUSH, B0) - OK
     104set_attributes - B0 8-NONE-2
    87105tcsetattr(TCSANOW, B50) - OK
    88 set_attributes - B50 5-NONE-1
     106set_attributes - B50 8-NONE-2
    89107tcsetattr(TCSADRAIN, B50) - OK
    90 set_attributes - B50 5-NONE-1
     108set_attributes - B50 8-NONE-2
     109tcsetattr(TCSAFLUSH, B50) - OK
     110set_attributes - B50 8-NONE-2
    91111tcsetattr(TCSANOW, B75) - OK
    92 set_attributes - B75 5-NONE-1
     112set_attributes - B75 8-NONE-2
    93113tcsetattr(TCSADRAIN, B75) - OK
    94 set_attributes - B75 5-NONE-1
     114set_attributes - B75 8-NONE-2
     115tcsetattr(TCSAFLUSH, B75) - OK
     116set_attributes - B75 8-NONE-2
    95117tcsetattr(TCSANOW, B110) - OK
    96 set_attributes - B110 5-NONE-1
     118set_attributes - B110 8-NONE-2
    97119tcsetattr(TCSADRAIN, B110) - OK
    98 set_attributes - B110 5-NONE-1
     120set_attributes - B110 8-NONE-2
     121tcsetattr(TCSAFLUSH, B110) - OK
     122set_attributes - B110 8-NONE-2
    99123tcsetattr(TCSANOW, B134) - OK
    100 set_attributes - B134 5-NONE-1
     124set_attributes - B134 8-NONE-2
    101125tcsetattr(TCSADRAIN, B134) - OK
    102 set_attributes - B134 5-NONE-1
     126set_attributes - B134 8-NONE-2
     127tcsetattr(TCSAFLUSH, B134) - OK
     128set_attributes - B134 8-NONE-2
    103129tcsetattr(TCSANOW, B150) - OK
    104 set_attributes - B150 5-NONE-1
     130set_attributes - B150 8-NONE-2
    105131tcsetattr(TCSADRAIN, B150) - OK
    106 set_attributes - B150 5-NONE-1
     132set_attributes - B150 8-NONE-2
     133tcsetattr(TCSAFLUSH, B150) - OK
     134set_attributes - B150 8-NONE-2
    107135tcsetattr(TCSANOW, B200) - OK
    108 set_attributes - B200 5-NONE-1
     136set_attributes - B200 8-NONE-2
    109137tcsetattr(TCSADRAIN, B200) - OK
    110 set_attributes - B200 5-NONE-1
     138set_attributes - B200 8-NONE-2
     139tcsetattr(TCSAFLUSH, B200) - OK
     140set_attributes - B200 8-NONE-2
    111141tcsetattr(TCSANOW, B300) - OK
    112 set_attributes - B300 5-NONE-1
     142set_attributes - B300 8-NONE-2
    113143tcsetattr(TCSADRAIN, B300) - OK
    114 set_attributes - B300 5-NONE-1
     144set_attributes - B300 8-NONE-2
     145tcsetattr(TCSAFLUSH, B300) - OK
     146set_attributes - B300 8-NONE-2
    115147tcsetattr(TCSANOW, B600) - OK
    116 set_attributes - B600 5-NONE-1
     148set_attributes - B600 8-NONE-2
    117149tcsetattr(TCSADRAIN, B600) - OK
    118 set_attributes - B600 5-NONE-1
     150set_attributes - B600 8-NONE-2
     151tcsetattr(TCSAFLUSH, B600) - OK
     152set_attributes - B600 8-NONE-2
    119153tcsetattr(TCSANOW, B1200) - OK
    120 set_attributes - B1200 5-NONE-1
     154set_attributes - B1200 8-NONE-2
    121155tcsetattr(TCSADRAIN, B1200) - OK
    122 set_attributes - B1200 5-NONE-1
     156set_attributes - B1200 8-NONE-2
     157tcsetattr(TCSAFLUSH, B1200) - OK
     158set_attributes - B1200 8-NONE-2
    123159tcsetattr(TCSANOW, B1800) - OK
    124 set_attributes - B1800 5-NONE-1
     160set_attributes - B1800 8-NONE-2
    125161tcsetattr(TCSADRAIN, B1800) - OK
    126 set_attributes - B1800 5-NONE-1
     162set_attributes - B1800 8-NONE-2
     163tcsetattr(TCSAFLUSH, B1800) - OK
     164set_attributes - B1800 8-NONE-2
    127165tcsetattr(TCSANOW, B2400) - OK
    128 set_attributes - B2400 5-NONE-1
     166set_attributes - B2400 8-NONE-2
    129167tcsetattr(TCSADRAIN, B2400) - OK
    130 set_attributes - B2400 5-NONE-1
     168set_attributes - B2400 8-NONE-2
     169tcsetattr(TCSAFLUSH, B2400) - OK
     170set_attributes - B2400 8-NONE-2
    131171tcsetattr(TCSANOW, B4800) - OK
    132 set_attributes - B4800 5-NONE-1
     172set_attributes - B4800 8-NONE-2
    133173tcsetattr(TCSADRAIN, B4800) - OK
    134 set_attributes - B4800 5-NONE-1
     174set_attributes - B4800 8-NONE-2
     175tcsetattr(TCSAFLUSH, B4800) - OK
     176set_attributes - B4800 8-NONE-2
    135177tcsetattr(TCSANOW, B9600) - OK
    136 set_attributes - B9600 5-NONE-1
     178set_attributes - B9600 8-NONE-2
    137179tcsetattr(TCSADRAIN, B9600) - OK
    138 set_attributes - B9600 5-NONE-1
     180set_attributes - B9600 8-NONE-2
     181tcsetattr(TCSAFLUSH, B9600) - OK
     182set_attributes - B9600 8-NONE-2
    139183tcsetattr(TCSANOW, B19200) - OK
    140 set_attributes - B19200 5-NONE-1
     184set_attributes - B19200 8-NONE-2
    141185tcsetattr(TCSADRAIN, B19200) - OK
    142 set_attributes - B19200 5-NONE-1
     186set_attributes - B19200 8-NONE-2
     187tcsetattr(TCSAFLUSH, B19200) - OK
     188set_attributes - B19200 8-NONE-2
    143189tcsetattr(TCSANOW, B38400) - OK
    144 set_attributes - B38400 5-NONE-1
     190set_attributes - B38400 8-NONE-2
    145191tcsetattr(TCSADRAIN, B38400) - OK
    146 set_attributes - B38400 5-NONE-1
     192set_attributes - B38400 8-NONE-2
     193tcsetattr(TCSAFLUSH, B38400) - OK
     194set_attributes - B38400 8-NONE-2
     195tcsetattr(TCSANOW, B7200) - OK
     196set_attributes - B7200 8-NONE-2
     197tcsetattr(TCSADRAIN, B7200) - OK
     198set_attributes - B7200 8-NONE-2
     199tcsetattr(TCSAFLUSH, B7200) - OK
     200set_attributes - B7200 8-NONE-2
     201tcsetattr(TCSANOW, B14400) - OK
     202set_attributes - B14400 8-NONE-2
     203tcsetattr(TCSADRAIN, B14400) - OK
     204set_attributes - B14400 8-NONE-2
     205tcsetattr(TCSAFLUSH, B14400) - OK
     206set_attributes - B14400 8-NONE-2
     207tcsetattr(TCSANOW, B28800) - OK
     208set_attributes - B28800 8-NONE-2
     209tcsetattr(TCSADRAIN, B28800) - OK
     210set_attributes - B28800 8-NONE-2
     211tcsetattr(TCSAFLUSH, B28800) - OK
     212set_attributes - B28800 8-NONE-2
    147213tcsetattr(TCSANOW, B57600) - OK
    148 set_attributes - B57600 5-NONE-1
     214set_attributes - B57600 8-NONE-2
    149215tcsetattr(TCSADRAIN, B57600) - OK
    150 set_attributes - B57600 5-NONE-1
     216set_attributes - B57600 8-NONE-2
     217tcsetattr(TCSAFLUSH, B57600) - OK
     218set_attributes - B57600 8-NONE-2
     219tcsetattr(TCSANOW, B76800) - OK
     220set_attributes - B76800 8-NONE-2
     221tcsetattr(TCSADRAIN, B76800) - OK
     222set_attributes - B76800 8-NONE-2
     223tcsetattr(TCSAFLUSH, B76800) - OK
     224set_attributes - B76800 8-NONE-2
    151225tcsetattr(TCSANOW, B115200) - OK
    152 set_attributes - B115200 5-NONE-1
     226set_attributes - B115200 8-NONE-2
    153227tcsetattr(TCSADRAIN, B115200) - OK
    154 set_attributes - B115200 5-NONE-1
     228set_attributes - B115200 8-NONE-2
     229tcsetattr(TCSAFLUSH, B115200) - OK
     230set_attributes - B115200 8-NONE-2
    155231tcsetattr(TCSANOW, B230400) - OK
    156 set_attributes - B230400 5-NONE-1
     232set_attributes - B230400 8-NONE-2
    157233tcsetattr(TCSADRAIN, B230400) - OK
    158 set_attributes - B230400 5-NONE-1
     234set_attributes - B230400 8-NONE-2
     235tcsetattr(TCSAFLUSH, B230400) - OK
     236set_attributes - B230400 8-NONE-2
    159237tcsetattr(TCSANOW, B460800) - OK
    160 set_attributes - B460800 5-NONE-1
     238set_attributes - B460800 8-NONE-2
    161239tcsetattr(TCSADRAIN, B460800) - OK
    162 set_attributes - B460800 5-NONE-1
     240set_attributes - B460800 8-NONE-2
     241tcsetattr(TCSAFLUSH, B460800) - OK
     242set_attributes - B460800 8-NONE-2
     243tcsetattr(TCSANOW, B921600) - OK
     244set_attributes - B921600 8-NONE-2
     245tcsetattr(TCSADRAIN, B921600) - OK
     246set_attributes - B921600 8-NONE-2
     247tcsetattr(TCSAFLUSH, B921600) - OK
     248set_attributes - B921600 8-NONE-2
    163249Init - close - /dev/test - OK
    164250
     
    169255Test termios setting device character size ...
    170256tcsetattr(TCSANOW, CS5) - OK
    171 set_attributes - B38400 5-NONE-1
     257set_attributes - B38400 5-NONE-2
    172258tcsetattr(TCSADRAIN, CS5) - OK
    173 set_attributes - B38400 5-NONE-1
     259set_attributes - B38400 5-NONE-2
     260tcsetattr(TCSAFLUSH, CS5) - OK
     261set_attributes - B38400 5-NONE-2
     262tcsetattr(TCSASOFT, CS5) - OK
     263set_attributes - B38400 5-NONE-2
    174264tcsetattr(TCSANOW, CS6) - OK
    175 set_attributes - B38400 6-NONE-1
     265set_attributes - B38400 6-NONE-2
    176266tcsetattr(TCSADRAIN, CS6) - OK
    177 set_attributes - B38400 6-NONE-1
     267set_attributes - B38400 6-NONE-2
     268tcsetattr(TCSAFLUSH, CS6) - OK
     269set_attributes - B38400 6-NONE-2
     270tcsetattr(TCSASOFT, CS6) - OK
     271set_attributes - B38400 6-NONE-2
    178272tcsetattr(TCSANOW, CS7) - OK
    179 set_attributes - B38400 7-NONE-1
     273set_attributes - B38400 7-NONE-2
    180274tcsetattr(TCSADRAIN, CS7) - OK
    181 set_attributes - B38400 7-NONE-1
     275set_attributes - B38400 7-NONE-2
     276tcsetattr(TCSAFLUSH, CS7) - OK
     277set_attributes - B38400 7-NONE-2
     278tcsetattr(TCSASOFT, CS7) - OK
     279set_attributes - B38400 7-NONE-2
    182280tcsetattr(TCSANOW, CS8) - OK
    183 set_attributes - B38400 8-NONE-1
     281set_attributes - B38400 8-NONE-2
    184282tcsetattr(TCSADRAIN, CS8) - OK
    185 set_attributes - B38400 8-NONE-1
     283set_attributes - B38400 8-NONE-2
     284tcsetattr(TCSAFLUSH, CS8) - OK
     285set_attributes - B38400 8-NONE-2
     286tcsetattr(TCSASOFT, CS8) - OK
     287set_attributes - B38400 8-NONE-2
    186288Init - close - /dev/test - OK
    187289
     
    192294Test termios setting device parity ...
    193295tcsetattr(TCSANOW, none) - OK
    194 set_attributes - B38400 8-NONE-1
     296set_attributes - B38400 8-NONE-2
    195297tcsetattr(TCSADRAIN, none) - OK
    196 set_attributes - B38400 8-NONE-1
     298set_attributes - B38400 8-NONE-2
     299tcsetattr(TCSAFLUSH, none) - OK
     300set_attributes - B38400 8-NONE-2
     301tcsetattr(TCSASOFT, none) - OK
     302set_attributes - B38400 8-NONE-2
    197303tcsetattr(TCSANOW, even) - OK
    198 set_attributes - B38400 8-ODD-1
     304set_attributes - B38400 8-ODD-2
    199305tcsetattr(TCSADRAIN, even) - OK
    200 set_attributes - B38400 8-ODD-1
     306set_attributes - B38400 8-ODD-2
     307tcsetattr(TCSAFLUSH, even) - OK
     308set_attributes - B38400 8-ODD-2
     309tcsetattr(TCSASOFT, even) - OK
     310set_attributes - B38400 8-ODD-2
    201311tcsetattr(TCSANOW, odd) - OK
    202 set_attributes - B38400 8-EVEN-1
     312set_attributes - B38400 8-EVEN-2
    203313tcsetattr(TCSADRAIN, odd) - OK
    204 set_attributes - B38400 8-EVEN-1
     314set_attributes - B38400 8-EVEN-2
     315tcsetattr(TCSAFLUSH, odd) - OK
     316set_attributes - B38400 8-EVEN-2
     317tcsetattr(TCSASOFT, odd) - OK
     318set_attributes - B38400 8-EVEN-2
    205319Init - close - /dev/test - OK
    206320
     
    214328tcsetattr(TCSADRAIN, 1 bits) - OK
    215329set_attributes - B38400 8-NONE-1
     330tcsetattr(TCSAFLUSH, 1 bits) - OK
     331set_attributes - B38400 8-NONE-1
     332tcsetattr(TCSASOFT, 1 bits) - OK
     333set_attributes - B38400 8-NONE-1
    216334tcsetattr(TCSANOW, 2 bits) - OK
    217335set_attributes - B38400 8-NONE-2
    218336tcsetattr(TCSADRAIN, 2 bits) - OK
     337set_attributes - B38400 8-NONE-2
     338tcsetattr(TCSAFLUSH, 2 bits) - OK
     339set_attributes - B38400 8-NONE-2
     340tcsetattr(TCSASOFT, 2 bits) - OK
    219341set_attributes - B38400 8-NONE-2
    220342cfsetospeed(BAD BAUD) - EINVAL
     
    251373cfsetospeed(B38400) - OK
    252374cfgetospeed(B38400) - OK
     375cfsetospeed(B7200) - OK
     376cfgetospeed(B7200) - OK
     377cfsetospeed(B14400) - OK
     378cfgetospeed(B14400) - OK
     379cfsetospeed(B28800) - OK
     380cfgetospeed(B28800) - OK
    253381cfsetospeed(B57600) - OK
    254382cfgetospeed(B57600) - OK
     383cfsetospeed(B76800) - OK
     384cfgetospeed(B76800) - OK
    255385cfsetospeed(B115200) - OK
    256386cfgetospeed(B115200) - OK
     
    259389cfsetospeed(B460800) - OK
    260390cfgetospeed(B460800) - OK
     391cfsetospeed(B921600) - OK
     392cfgetospeed(B921600) - OK
    261393cfsetispeed(BAD BAUD) - EINVAL
    262394cfsetispeed(B0) - OK
     
    292424cfsetispeed(B38400) - OK
    293425cfgetispeed(B38400) - OK
     426cfsetispeed(B7200) - OK
     427cfgetispeed(B7200) - OK
     428cfsetispeed(B14400) - OK
     429cfgetispeed(B14400) - OK
     430cfsetispeed(B28800) - OK
     431cfgetispeed(B28800) - OK
    294432cfsetispeed(B57600) - OK
    295433cfgetispeed(B57600) - OK
     434cfsetispeed(B76800) - OK
     435cfgetispeed(B76800) - OK
    296436cfsetispeed(B115200) - OK
    297437cfgetispeed(B115200) - OK
     
    300440cfsetispeed(B460800) - OK
    301441cfgetispeed(B460800) - OK
     442cfsetispeed(B921600) - OK
     443cfgetispeed(B921600) - OK
    302444cfsetspeed(BAD BAUD) - EINVAL
    303445cfsetspeed(B0) - OK
     
    333475cfsetspeed(B38400) - OK
    334476cfgetspeed(B38400) - checking both inspeed and outspeed - OK
     477cfsetspeed(B7200) - OK
     478cfgetspeed(B7200) - checking both inspeed and outspeed - OK
     479cfsetspeed(B14400) - OK
     480cfgetspeed(B14400) - checking both inspeed and outspeed - OK
     481cfsetspeed(B28800) - OK
     482cfgetspeed(B28800) - checking both inspeed and outspeed - OK
    335483cfsetspeed(B57600) - OK
    336484cfgetspeed(B57600) - checking both inspeed and outspeed - OK
     485cfsetspeed(B76800) - OK
     486cfgetspeed(B76800) - checking both inspeed and outspeed - OK
    337487cfsetspeed(B115200) - OK
    338488cfgetspeed(B115200) - checking both inspeed and outspeed - OK
     
    341491cfsetspeed(B460800) - OK
    342492cfgetspeed(B460800) - checking both inspeed and outspeed - OK
     493cfsetspeed(B921600) - OK
     494cfgetspeed(B921600) - checking both inspeed and outspeed - OK
    343495Init - close - /dev/test - OK
    344496Multiple open of the device
     
    396548Termios_test_driver - rtems_set_initial_baud - 38400 - OK
    397549
    398 *** END OF TEST TERMIOS 01 ***
     550*** END OF TEST TERMIOS 1 ***
  • testsuites/libtests/termios01/termios_testdriver.c

    rc4b058ca r1c6926c1  
    8686  const char            *stop = "NONE";
    8787
    88   baud_requested = t->c_cflag & CBAUD;
     88  baud_requested = t->c_ispeed;
    8989
    9090  number = rtems_termios_baud_to_number( baud_requested );
     
    165165  rtems_libio_open_close_args_t *args = arg;
    166166  static bool firstCall = true;
    167  
     167
    168168  static const rtems_termios_callbacks Callbacks = {
    169169    NULL,                                    /* firstOpen */
     
    193193
    194194    firstCall = false;
    195    
     195
    196196    for (i = 0; i < sizeof( allocSizes ) / sizeof( allocSizes [0] ); ++i) {
    197197      void *opaque = rtems_heap_greedy_allocate( allocSizes, i );
  • testsuites/libtests/termios02/termios02.scn

    rc4b058ca r1c6926c1  
    1 *** TERMIOS 02 TEST ***
     1*** BEGIN OF TEST TERMIOS 2 ***
    22tcdrain(12) - EBADF
    33tcdrain(stdin) - OK
     
    2525ctermid( term_name ) - OK
    2626ctermid ==> /dev/console
    27 *** END OF TERMIOS 02 TEST ***
     27*** END OF TEST TERMIOS 2 ***
  • testsuites/libtests/termios03/termios03.scn

    rc4b058ca r1c6926c1  
    1 *** TEST TERMIOS03 ***
     1*** BEGIN OF TEST TERMIOS 3 ***
    22open(/dev/test) - OK
    33Writing: This is test output.
     
    696908 20 08 08 20 08 08 20 08 08 20 08 08 20 08 08 |. .. .. .. .. ..|
    707020 08 08 20 08 08 20 08 08 20 08 08 20 08 08 20 | .. .. .. .. .. |
    71 08 08 20 08 2e 0d 0a
     7108 08 20 08 2e 0d 0a                            |.. ....         |
    7272
    7373Reading (expected):
     
    9898
    9999close(/dev/test) - OK
    100 *** END OF TEST TERMIOS03 ***
     100*** END OF TEST TERMIOS 3 ***
  • testsuites/libtests/termios04/termios04.scn

    rc4b058ca r1c6926c1  
    1 *** TEST TERMIOS04 ***
    2 open(/dev/test) - OK 
     1*** BEGIN OF TEST TERMIOS 4 ***
     2open(/dev/test) - OK
    33Writing: This is interrupt driven test output.
    44Transmitted 39 characters
     
    303065 72 72 75 70 74 20 64 72 69 76 65 6e 20 72 65 |errupt driven re|
    313161 64 2e 0d 0a                                  |ad...           |
    32 close(/dev/test) - OK 
    33 *** END OF TEST TERMIOS04 ***
     32close(/dev/test) - OK
     33*** END OF TEST TERMIOS 4 ***
  • testsuites/libtests/termios05/termios05.scn

    rc4b058ca r1c6926c1  
    1 *** TEST TERMIOS05 ***
    2 open(/dev/test) - OK 
     1*** BEGIN OF TEST TERMIOS 5 ***
     2open(/dev/test) - OK
    33Writing: This is test output.
    44Transmitted 20 characters
     
    56560a 61 62 63 64 65 66 67 68 2e 0d 0a             |.abcdefgh...    |
    5757Changing c_iflag to: Disable to lower case mapping on input
    58 close(/dev/test) - OK 
    59 *** END OF TEST TERMIOS05 ***
     58close(/dev/test) - OK
     59*** END OF TEST TERMIOS 5 ***
  • testsuites/libtests/termios06/init.c

    rc4b058ca r1c6926c1  
    199199  read_it();
    200200  close_it();
    201  
     201
    202202  TEST_END();
    203203
  • testsuites/libtests/termios06/termios06.scn

    rc4b058ca r1c6926c1  
    1 
    2 
    3 *** TEST TERMIOS06 ***
    4 open(/dev/test) - OK
     1*** BEGIN OF TEST TERMIOS 6 ***
     2open(/dev/test) - OK
    53ioctl - RTEMS_IO_SNDWAKEUP - OK
    64ioctl - RTEMS_IO_RCVWAKEUP - OK
     
    119pppclose called
    1210pppopen called
    13 write(PPPD TEST) - OK 
     11write(PPPD TEST) - OK
    1412pppwrite called - 10 bytes
    151350 50 50 44 20 54 45 53 54 00                   |PPPD TEST.      |
    16 
    1714pppstart called
    18 ioctl(/dev/test) - OK 
     15ioctl(/dev/test) - OK
    1916pppioctl called
    20 tcgetattr(/dev/test) - OK 
     17tcgetattr(/dev/test) - OK
    2118Turn on flow control on output - OK
    2219Turn off flow control on output - OK
     
    2623Reading (expected):
    272454 68 69 73 20 69 73 20 74 65 73 74 20 50 50 50 |This is test PPP|
    28 
    292520 69 6e 70 75 74                               | input          |
    30 
    3126pppread called
    3227pppinput called - with (T)
     
    5449pppinput called - with (.)
    5550Rx_Wake - invoked
    56 
    5751Read 0 bytes from read(2)
    58 close(/dev/test) - OK
     52Error: length must be greater than zero.close(/dev/test) - OK
    5953pppclose called
    60 *** END OF TEST TERMIOS06 ***
     54*** END OF TEST TERMIOS 6 ***
  • testsuites/libtests/termios07/termios07.scn

    rc4b058ca r1c6926c1  
    1 XXX fill in with test output
     1*** BEGIN OF TEST TERMIOS 7 ***
     2rtems_termios_bufsize( 64, 64, 64 ) - OK
     3open(/dev/test) - OK
     4Changing c_iflag to: Set XON/XOFF
     5Writing: 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789Transmitted 200 characters
     630 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 |0123456789012345|
     736 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 |6789012345678901|
     832 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 |2345678901234567|
     938 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 |8901234567890123|
     1034 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 |4567890123456789|
     1130 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 |0123456789012345|
     1236 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 |6789012345678901|
     1332 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 |2345678901234567|
     1438 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 |8901234567890123|
     1534 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 |4567890123456789|
     1630 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 |0123456789012345|
     1736 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 |6789012345678901|
     1832 33 34 35 36 37 38 39                         |23456789        |
     19close(/dev/test) - OK
     20*** END OF TEST TERMIOS 7 ***
  • testsuites/libtests/termios08/termios08.scn

    rc4b058ca r1c6926c1  
    1 XXX fill in with test output
     1*** BEGIN OF TEST TERMIOS 8 ***
     2open(/dev/test) - OK
     3Changing c_lflag to: non-canonical
     4Changing to polling - VMIN=0 VTIME=0
     5read - 0 expected
     6Changing to half-second timeout - VMIN=0 VTIME=5
     7read - 0 expected
     8Changing to half-second timeout - VMIN=5 VTIME=3
     9Enqueue 2 characters
     10read - 2 expected
     11Changing to half-second timeout - VMIN=5 VTIME=3
     12Enqueue 1 character
     13read - 1 expected
     14Enqueue 7 characters
     15read - 5 expected
     16read - 2 expected
     17close(/dev/test) - OK
     18*** END OF TEST TERMIOS 8 ***
  • tools/cpu/sh/sci.c

    rc4b058ca r1c6926c1  
    4444  19200,
    4545  38400,
     46  7200,
     47  14400,
     48  28800,
    4649  57600,
     50  76800,
    4751  115200,
    4852  230400,
    49   460800
     53  460800,
     54  921600
    5055};
    5156
     
    124129    "  unsigned char n ;\n"
    125130    "  unsigned char N ;\n"
     131    "  speed_t       B ;\n"
    126132    "} _sci_bitrates[] = {\n"
    127     "/*  n    N      error */\n" );
     133    "/*  n    N      B      error */\n" );
    128134
    129135  for ( i = 0 ; i < sizeof(bitrate)/sizeof(int) ; i++ )
     
    133139    if ( i > 0 )
    134140      fprintf( file, ",\n" );
    135     fprintf( file, "  { %1d, %3d } /* %+7.2f%% ; B%d ",
     141      fprintf( file, "  { %1d, %3d, %d } /* %+7.2f%% ; B%d ",
    136142      best->n,
    137143      best->N,
     144      best->B,
    138145      best->err,
    139146      best->B );
     
    147154  fprintf( file,
    148155    "int _sci_get_brparms( \n"
    149     "  tcflag_t      cflag,\n"
     156    "  speed_t        spd,\n"
    150157    "  unsigned char *smr,\n"
    151158    "  unsigned char *brr )\n"
    152159    "{\n"
    153     "  unsigned int offset ;\n\n"
    154     "  offset = ( cflag & ( CBAUD & ~CBAUDEX ) )\n"
    155     "    + ( ( cflag & CBAUDEX ) ? B38400 : 0 );\n"
    156     "  if ( offset == 0 ) return -1 ;\n"
    157     "  offset-- ;\n\n"
     160    "  int offset = -1;\n"
     161    "  int i;\n\n"
     162    "  for(i = 0; i < sizeof(_sci_bitrates)/sizeof(_sci_bitrates[0]); i++) {\n"
     163    "    if( _sci_bitrates[i].B == spd ) {\n"
     164    "      offset = i;\n"
     165    "      break;\n"
     166    "    }\n"
     167    "  }\n"
     168    "  if ( offset == -1 ) return -1 ;\n"
    158169    "  if ( _sci_bitrates[offset].n > 3 )  return -1;\n\n"
    159170    "  *smr &= ~0x03;\n"
Note: See TracChangeset for help on using the changeset viewer.