[PATCH 3/5] Updated BSPs to use dedicated input and output baud rates in termios structure

Kevin Kirspel kevin-kirspel at idexx.com
Tue Mar 14 13:23:01 UTC 2017


---
 c/src/lib/libbsp/arm/csb336/console/uart.c         |  2 +-
 c/src/lib/libbsp/arm/lpc32xx/console/hsu.c         |  2 +-
 c/src/lib/libbsp/i386/shared/comm/tty_drv.c        |  2 +-
 .../libbsp/lm32/shared/milkymist_console/console.c |  2 +-
 c/src/lib/libbsp/m68k/av5282/console/console.c     |  6 ++---
 c/src/lib/libbsp/m68k/gen68340/console/console.c   | 18 ++++----------
 c/src/lib/libbsp/m68k/gen68360/console/console.c   |  2 +-
 c/src/lib/libbsp/m68k/genmcf548x/console/console.c |  2 +-
 c/src/lib/libbsp/m68k/mcf52235/console/console.c   |  8 ++++---
 c/src/lib/libbsp/m68k/mcf5225x/console/console.c   | 24 ++++++++++---------
 c/src/lib/libbsp/m68k/mcf5235/console/console.c    |  8 ++++---
 c/src/lib/libbsp/m68k/mcf5329/console/console.c    |  8 ++++---
 c/src/lib/libbsp/m68k/mrm332/console/sci.c         |  2 +-
 c/src/lib/libbsp/m68k/mvme167/console/console.c    |  8 +++----
 c/src/lib/libbsp/m68k/uC5282/console/console.c     |  4 ++--
 c/src/lib/libbsp/powerpc/acinclude.m4              |  4 ++--
 c/src/lib/libbsp/powerpc/gen5200/console/console.c |  2 +-
 c/src/lib/libbsp/powerpc/shared/console/console.c  |  2 +-
 c/src/lib/libbsp/powerpc/tqm8xx/console/console.c  |  2 +-
 c/src/lib/libbsp/shared/console.c                  |  4 ++--
 c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c  |  8 +++----
 c/src/lib/libcpu/arm/at91rm9200/usart/usart.c      |  2 +-
 c/src/lib/libcpu/bfin/serial/uart.c                |  4 ++--
 c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c       |  2 +-
 .../mpc5xx/console-generic/console-generic.c       |  2 +-
 .../mpc8260/console-generic/console-generic.c      |  4 ++--
 .../mpc8xx/console-generic/console-generic.c       |  4 ++--
 c/src/lib/libcpu/powerpc/ppc403/console/console.c  |  2 +-
 .../lib/libcpu/powerpc/ppc403/console/console405.c |  2 +-
 c/src/lib/libcpu/powerpc/ppc403/tty_drv/tty_drv.c  |  2 +-
 c/src/lib/libcpu/sh/sh7032/sci/sci.c               |  8 +++----
 c/src/lib/libcpu/sh/sh7045/sci/sci.c               |  6 ++---
 c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c       |  8 +++----
 c/src/libchip/serial/mc68681.c                     |  2 +-
 c/src/libchip/serial/mc68681_baud.c                | 28 ++++++++++++++++++----
 c/src/libchip/serial/z85c30.c                      |  2 +-
 36 files changed, 108 insertions(+), 90 deletions(-)

diff --git a/c/src/lib/libbsp/arm/csb336/console/uart.c b/c/src/lib/libbsp/arm/csb336/console/uart.c
index 1f3a4a1..e2e6bc2 100644
--- a/c/src/lib/libbsp/arm/csb336/console/uart.c
+++ b/c/src/lib/libbsp/arm/csb336/console/uart.c
@@ -322,7 +322,7 @@ static int imx_uart_set_attrs(int minor, const struct termios *t)
 {
     int baud;
 
-    baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+    baud = rtems_termios_baud_to_number(t->c_ospeed);
     imx_uart_set_baud(minor, baud);
 
     return 0;
diff --git a/c/src/lib/libbsp/arm/lpc32xx/console/hsu.c b/c/src/lib/libbsp/arm/lpc32xx/console/hsu.c
index 8beeeef..b2044e0 100644
--- a/c/src/lib/libbsp/arm/lpc32xx/console/hsu.c
+++ b/c/src/lib/libbsp/arm/lpc32xx/console/hsu.c
@@ -178,7 +178,7 @@ static bool lpc32xx_hsu_set_attributes(
 {
   lpc32xx_hsu_context *ctx = (lpc32xx_hsu_context *) base;
   volatile lpc32xx_hsu *hsu = ctx->hsu;
-  int baud_flags = term->c_cflag & CBAUD;
+  int baud_flags = term->c_ospeed;
 
   if (baud_flags != 0) {
     int32_t baud = rtems_termios_baud_to_number(baud_flags);
diff --git a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
index 2152dec..e15edbd 100644
--- a/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
+++ b/c/src/lib/libbsp/i386/shared/comm/tty_drv.c
@@ -227,7 +227,7 @@ conSetAttr(int port, int minor, const struct termios *t)
 {
   unsigned long baud, databits, parity, stopbits;
 
-  baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+  baud = rtems_termios_baud_to_number(t->c_ospeed);
   if ( baud > 115200 )
     rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
 
diff --git a/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c b/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c
index 3558e33..de87233 100644
--- a/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c
+++ b/c/src/lib/libbsp/lm32/shared/milkymist_console/console.c
@@ -41,7 +41,7 @@ static int mmconsole_set_attributes(int minor, const struct termios *t)
 {
   int baud;
 
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
     case B0:
       baud = 0;
       break;
diff --git a/c/src/lib/libbsp/m68k/av5282/console/console.c b/c/src/lib/libbsp/m68k/av5282/console/console.c
index 07a1569..f56305a 100644
--- a/c/src/lib/libbsp/m68k/av5282/console/console.c
+++ b/c/src/lib/libbsp/m68k/av5282/console/console.c
@@ -179,7 +179,7 @@ static int IntUartSetAttributes(
   /* check to see if input is valid */
   if ( t != (const struct termios *)0 ) {
     /* determine baud rate index */
-    baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+    baud = rtems_termios_baud_to_number(t->c_ospeed);
 
     /* determine data bits */
     switch ( t->c_cflag & CSIZE ) {
@@ -240,7 +240,7 @@ static int IntUartSetAttributes(
  * Description : This is the interrupt handler for the internal uart. It
  * determines which channel caused the interrupt before queueing any received
  * chars and dequeueing chars waiting for transmission.
- */ 
+ */
 static rtems_isr IntUartInterruptHandler(rtems_vector_number v)
 {
   unsigned int                chan = v - UART_INTC0_IRQ_VECTOR(0);
@@ -303,7 +303,7 @@ static rtems_isr IntUartInterruptHandler(rtems_vector_number v)
  * Description : This initialises the internal uart hardware for all
  * internal uarts. If the internal uart is to be interrupt driven then the
  * interrupt vectors are hooked.
- */ 
+ */
 static void IntUartInitialize(void)
 {
   unsigned int              chan;
diff --git a/c/src/lib/libbsp/m68k/gen68340/console/console.c b/c/src/lib/libbsp/m68k/gen68340/console/console.c
index dd38559..d6634b1 100644
--- a/c/src/lib/libbsp/m68k/gen68340/console/console.c
+++ b/c/src/lib/libbsp/m68k/gen68340/console/console.c
@@ -474,20 +474,10 @@ SetAttributes (int minor, const struct termios *t)
 {
  rtems_interrupt_level level;
  float ispeed, ospeed;
- int isp, osp;
-
- /* output speed */
- if (t->c_cflag & CBAUDEX)
-    osp = (t->c_cflag & CBAUD) + CBAUD + 1;
- else
-    osp = t->c_cflag & CBAUD;
-
- /* input speed */
- isp = (t->c_cflag / (CIBAUD / CBAUD)) &  CBAUD;
 
  /* convert it */
- ispeed = rtems_termios_baud_to_number(isp);
- ospeed = rtems_termios_baud_to_number(osp);
+ ispeed = rtems_termios_baud_to_number(t->c_ispeed);
+ ospeed = rtems_termios_baud_to_number(t->c_ospeed);
 
  if (ispeed || ospeed) {
        /* update config table */
@@ -515,7 +505,7 @@ SetAttributes (int minor, const struct termios *t)
  }
 
  /* if serial module configuration has been changed */
- if (t->c_cflag & (CBAUD | CIBAUD | CSIZE | PARENB)) {
+ if (t->c_cflag & (CSIZE | PARENB)) {
     rtems_interrupt_disable(level);
     /* reinit the UART */
     dbugInitialise();
@@ -693,7 +683,7 @@ rtems_device_driver console_control(
 {
  	rtems_libio_ioctl_args_t *args = arg;
 
- 	if (args->command == RTEMS_IO_SET_ATTRIBUTES)
+  if (args->command == TIOCSETA)
  		SetAttributes (minor, (struct termios *)args->buffer);
 
 	return rtems_termios_ioctl (arg);
diff --git a/c/src/lib/libbsp/m68k/gen68360/console/console.c b/c/src/lib/libbsp/m68k/gen68360/console/console.c
index 1a8ed00..36d8470 100644
--- a/c/src/lib/libbsp/m68k/gen68360/console/console.c
+++ b/c/src/lib/libbsp/m68k/gen68360/console/console.c
@@ -86,7 +86,7 @@ smc1SetAttributes (int minor, const struct termios *t)
 {
   int baud;
 
-  baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+  baud = rtems_termios_baud_to_number(t->c_ospeed);
   if (baud > 0)
     m360.brgc1 = smc1BRGC (baud);
   return 0;
diff --git a/c/src/lib/libbsp/m68k/genmcf548x/console/console.c b/c/src/lib/libbsp/m68k/genmcf548x/console/console.c
index 6891e76..23186fc 100644
--- a/c/src/lib/libbsp/m68k/genmcf548x/console/console.c
+++ b/c/src/lib/libbsp/m68k/genmcf548x/console/console.c
@@ -307,7 +307,7 @@ IntUartSetAttributes(int minor, const struct termios *t)
 	if ( t != (const struct termios *)0 )
 	{
 		/* determine baud rate index */
-		baud = GetBaud( t->c_cflag & CBAUD );
+    baud = GetBaud( t->c_ospeed );
 
 		/* determine data bits */
 		switch ( t->c_cflag & CSIZE )
diff --git a/c/src/lib/libbsp/m68k/mcf52235/console/console.c b/c/src/lib/libbsp/m68k/mcf52235/console/console.c
index 50c642a..c2b6e36 100644
--- a/c/src/lib/libbsp/m68k/mcf52235/console/console.c
+++ b/c/src/lib/libbsp/m68k/mcf52235/console/console.c
@@ -152,7 +152,7 @@ static int IntUartSetAttributes(int minor, const struct termios *t)
   /* check to see if input is valid */
   if (t != (const struct termios *) 0) {
     /* determine baud rate index */
-    baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+    baud = rtems_termios_baud_to_number(t->c_ospeed);
 
     /* determine data bits */
     switch (t->c_cflag & CSIZE) {
@@ -598,8 +598,10 @@ rtems_device_driver console_open(rtems_device_major_number major,
     struct termios term;
 
     if (tcgetattr(STDIN_FILENO, &term) >= 0) {
-      term.c_cflag &= ~(CBAUD | CSIZE);
-      term.c_cflag |= CS8 | B19200;
+      term.c_cflag &= ~(CSIZE);
+      term.c_cflag |= CS8;
+      term.c_ispeed = B19200;
+      term.c_ospeed = B19200;
       tcsetattr(STDIN_FILENO, TCSANOW, &term);
     }
   }
diff --git a/c/src/lib/libbsp/m68k/mcf5225x/console/console.c b/c/src/lib/libbsp/m68k/mcf5225x/console/console.c
index 63bb644..9e36e39 100644
--- a/c/src/lib/libbsp/m68k/mcf5225x/console/console.c
+++ b/c/src/lib/libbsp/m68k/mcf5225x/console/console.c
@@ -150,7 +150,7 @@ IntUartSet(int minor, int baud, int databits, int parity, int stopbits,
    Description : This provides the hardware-dependent portion of tcsetattr().
    value and sets it. At the moment this just sets the baud rate.
 
-   Note: The highest baudrate is 115200 as this stays within 
+   Note: The highest baudrate is 115200 as this stays within
    an error of +/- 5% at 25MHz processor clock
  ***************************************************************************/
 static int IntUartSetAttributes(int minor, const struct termios *t)
@@ -166,7 +166,7 @@ static int IntUartSetAttributes(int minor, const struct termios *t)
   /* check to see if input is valid */
   if (t != (const struct termios *) 0) {
     /* determine baud rate index */
-    baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+    baud = rtems_termios_baud_to_number(t->c_ospeed);
 
     /* determine data bits */
     switch (t->c_cflag & CSIZE) {
@@ -243,7 +243,7 @@ static rtems_isr IntUartInterruptHandler(rtems_vector_number v)
 		else
 			MCF_GPIO_PORTTC |= MCF_GPIO_PORTTC_PORTTC0;
 #endif
-		
+
     /* read data and put into the receive buffer */
     while (MCF_UART_USR(chan) & MCF_UART_USR_RXRDY) {
 
@@ -359,9 +359,9 @@ static void IntUartInitialize(void)
 /***************************************************************************
    Function : IntUartInterruptWrite
 
-   Description : This writes a single character to the appropriate uart 
+   Description : This writes a single character to the appropriate uart
    channel. This is either called during an interrupt or in the user's task
-   to initiate a transmit sequence. Calling this routine enables Tx 
+   to initiate a transmit sequence. Calling this routine enables Tx
    interrupts.
  ***************************************************************************/
 static ssize_t IntUartInterruptWrite(int minor, const char *buf, size_t len)
@@ -476,7 +476,7 @@ static int IntUartTaskRead(int minor)
 /***************************************************************************
    Function : IntUartPollRead
 
-   Description : This reads a character from the internal uart. It returns 
+   Description : This reads a character from the internal uart. It returns
    to the caller without blocking if not character is waiting.
  ***************************************************************************/
 static
@@ -491,8 +491,8 @@ int IntUartPollRead(int minor)
 /***************************************************************************
    Function : IntUartPollWrite
 
-   Description : This writes out each character in the buffer to the 
-   appropriate internal uart channel waiting till each one is sucessfully 
+   Description : This writes out each character in the buffer to the
+   appropriate internal uart channel waiting till each one is sucessfully
    transmitted.
  ***************************************************************************/
 static ssize_t IntUartPollWrite(int minor, const char *buf, size_t len)
@@ -562,7 +562,7 @@ rtems_device_driver console_initialize(rtems_device_major_number major,
 /***************************************************************************
    Function : console_open
 
-   Description : This actually opens the device depending on the minor 
+   Description : This actually opens the device depending on the minor
    number set during initialisation. The device specific access routines are
    passed to termios when the devices is opened depending on whether it is
    polled or not.
@@ -631,8 +631,10 @@ rtems_device_driver console_open(rtems_device_major_number major,
     struct termios term;
 
     if (tcgetattr(STDIN_FILENO, &term) >= 0) {
-      term.c_cflag &= ~(CBAUD | CSIZE);
-      term.c_cflag |= CS8 | B115200;
+      term.c_cflag &= ~(CSIZE);
+      term.c_cflag |= CS8;
+      term.c_ispeed = B115200;
+      term.c_ospeed = B115200;
       tcsetattr(STDIN_FILENO, TCSANOW, &term);
     }
   }
diff --git a/c/src/lib/libbsp/m68k/mcf5235/console/console.c b/c/src/lib/libbsp/m68k/mcf5235/console/console.c
index 3f50b6a..6fd92aa 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/console/console.c
+++ b/c/src/lib/libbsp/m68k/mcf5235/console/console.c
@@ -174,7 +174,7 @@ IntUartSetAttributes(int minor, const struct termios *t)
 	if ( t != (const struct termios *)0 )
 	{
 		/* determine baud rate index */
-		baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+    baud = rtems_termios_baud_to_number(t->c_ospeed);
 
 		/* determine data bits */
 		switch ( t->c_cflag & CSIZE )
@@ -681,8 +681,10 @@ rtems_device_driver console_open(
     struct termios term;
     if (tcgetattr (STDIN_FILENO, &term) >= 0)
     {
-      term.c_cflag &= ~(CBAUD | CSIZE);
-      term.c_cflag |= CS8 | B19200;
+      term.c_cflag &= ~(CSIZE);
+      term.c_cflag |= CS8;
+      term.c_ispeed = B19200;
+      term.c_ospeed = B19200;
       tcsetattr (STDIN_FILENO, TCSANOW, &term);
     }
   }
diff --git a/c/src/lib/libbsp/m68k/mcf5329/console/console.c b/c/src/lib/libbsp/m68k/mcf5329/console/console.c
index dfae857..ba4a7d9 100644
--- a/c/src/lib/libbsp/m68k/mcf5329/console/console.c
+++ b/c/src/lib/libbsp/m68k/mcf5329/console/console.c
@@ -170,7 +170,7 @@ static int IntUartSetAttributes(int minor, const struct termios *t)
   /* check to see if input is valid */
   if (t != (const struct termios *) 0) {
     /* determine baud rate index */
-    baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+    baud = rtems_termios_baud_to_number(t->c_ospeed);
 
     /* determine data bits */
     switch (t->c_cflag & CSIZE) {
@@ -613,8 +613,10 @@ rtems_device_driver console_open(rtems_device_major_number major,
     struct termios term;
 
     if (tcgetattr(STDIN_FILENO, &term) >= 0) {
-      term.c_cflag &= ~(CBAUD | CSIZE);
-      term.c_cflag |= CS8 | B19200;
+      term.c_cflag &= ~(CSIZE);
+      term.c_cflag |= CS8;
+      term.c_ispeed = B19200;
+      term.c_ospeed = B19200;
       tcsetattr(STDIN_FILENO, TCSANOW, &term);
     }
   }
diff --git a/c/src/lib/libbsp/m68k/mrm332/console/sci.c b/c/src/lib/libbsp/m68k/mrm332/console/sci.c
index a0f8cc0..1e92d6d 100644
--- a/c/src/lib/libbsp/m68k/mrm332/console/sci.c
+++ b/c/src/lib/libbsp/m68k/mrm332/console/sci.c
@@ -675,7 +675,7 @@ int   SciSetAttributes(
     /* if you look closely you will see this is the only thing we use */
     /* set the baud rate */
 
-    baud_requested = t->c_cflag & CBAUD;        /* baud rate */
+    baud_requested = t->c_ospeed;               /* baud rate */
 
     if (!baud_requested)
     {
diff --git a/c/src/lib/libbsp/m68k/mvme167/console/console.c b/c/src/lib/libbsp/m68k/mvme167/console/console.c
index 9ac8f70..3b7aecb 100644
--- a/c/src/lib/libbsp/m68k/mvme167/console/console.c
+++ b/c/src/lib/libbsp/m68k/mvme167/console/console.c
@@ -725,7 +725,7 @@ int cd2401_firstOpen(
    * We could have made a tcgetattr() call if we had our fd.
    */
   newarg.iop = args->iop;
-  newarg.command = RTEMS_IO_GET_ATTRIBUTES;
+  newarg.command = TIOCGETA;
   newarg.buffer = &termios;
   sc = rtems_termios_ioctl (&newarg);
   if (sc != RTEMS_SUCCESSFUL)
@@ -738,7 +738,7 @@ int cd2401_firstOpen(
    *  on the ttyMutex that it already owns; this is safe in RTEMS.
    */
   termios.c_cflag |= CLOCAL;    /* Ignore modem status lines */
-  newarg.command = RTEMS_IO_SET_ATTRIBUTES;
+  newarg.command = TIOCGETA;
   sc = rtems_termios_ioctl (&newarg);
   if (sc != RTEMS_SUCCESSFUL)
     rtems_fatal_error_occurred (sc);
@@ -844,8 +844,8 @@ int cd2401_setAttributes(
   /* Determine what the line parameters should be */
 
   /* baud rates */
-  out_baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
-  in_baud  = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+  out_baud = rtems_termios_baud_to_number(t->c_ospeed);
+  in_baud  = rtems_termios_baud_to_number(t->c_ispeed);
 
   /* Number of bits per char */
   csize = 0x07; /* to avoid a warning */
diff --git a/c/src/lib/libbsp/m68k/uC5282/console/console.c b/c/src/lib/libbsp/m68k/uC5282/console/console.c
index 0f08cea..e2c29c0 100644
--- a/c/src/lib/libbsp/m68k/uC5282/console/console.c
+++ b/c/src/lib/libbsp/m68k/uC5282/console/console.c
@@ -190,7 +190,7 @@ IntUartSetAttributes(int minor, const struct termios *t)
 	if ( t != (const struct termios *)0 )
 	{
 		/* determine baud rate index */
-  		baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+    baud = rtems_termios_baud_to_number(t->c_ospeed);
 
 		/* determine data bits */
 		switch ( t->c_cflag & CSIZE )
@@ -447,7 +447,7 @@ IntUartInterruptOpen(int major, int minor, void *arg)
 		MCF5282_GPIO_PUAPAR |= MCF5282_GPIO_PUAPAR_PUAPA3|MCF5282_GPIO_PUAPAR_PUAPA2;
 		break;
 	case 2:
-		MCF5282_GPIO_PASPAR = 
+		MCF5282_GPIO_PASPAR =
 		  (MCF5282_GPIO_PASPAR
 		   & ~(MCF5282_GPIO_PASPAR_PASPA3(3)|MCF5282_GPIO_PASPAR_PASPA2(3)))
 		  |  (MCF5282_GPIO_PASPAR_PASPA3(2)|MCF5282_GPIO_PASPAR_PASPA2(2));
diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4 b/c/src/lib/libbsp/powerpc/acinclude.m4
index 4c83475..edc67b5 100644
--- a/c/src/lib/libbsp/powerpc/acinclude.m4
+++ b/c/src/lib/libbsp/powerpc/acinclude.m4
@@ -32,12 +32,12 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
     AC_CONFIG_SUBDIRS([t32mppc]);;
   tqm8xx )
     AC_CONFIG_SUBDIRS([tqm8xx]);;
-  virtex )
-    AC_CONFIG_SUBDIRS([virtex]);;
   virtex4 )
     AC_CONFIG_SUBDIRS([virtex4]);;
   virtex5 )
     AC_CONFIG_SUBDIRS([virtex5]);;
+  virtex )
+    AC_CONFIG_SUBDIRS([virtex]);;
   *)
     AC_MSG_ERROR([Invalid BSP]);;
   esac
diff --git a/c/src/lib/libbsp/powerpc/gen5200/console/console.c b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
index 26f5558..754a527 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/console/console.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
@@ -192,7 +192,7 @@ static int mpc5200_psc_setAttributes(
     (struct mpc5200_psc *)(&mpc5200.psc[psc_minor_to_regset[minor]]);
 
   /* Baud rate */
-  baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+  baud = rtems_termios_baud_to_number(t->c_ospeed);
   if (baud > 0) {
    /*
     * Calculate baud rate
diff --git a/c/src/lib/libbsp/powerpc/shared/console/console.c b/c/src/lib/libbsp/powerpc/shared/console/console.c
index 082cbd9..f275683 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/console.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/console.c
@@ -304,7 +304,7 @@ static int conSetAttr(
 {
   rtems_termios_baud_t baud;
 
-  baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
+  baud = rtems_termios_baud_to_number(t->c_ospeed);
   if ( baud > 115200 )
     rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
 
diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c b/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c
index e0b4c70..e109303 100644
--- a/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c
+++ b/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c
@@ -392,7 +392,7 @@ sccSetAttributes (int minor, const struct termios *t)
 {
   int baud;
 
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:	baud = -1;	break;
   case B50:	baud = 50;	break;
   case B75:	baud = 75;	break;
diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c
index b4af1b3..b8a078f 100644
--- a/c/src/lib/libbsp/shared/console.c
+++ b/c/src/lib/libbsp/shared/console.c
@@ -244,12 +244,12 @@ rtems_device_driver console_open(
        * If this is not the console we do not want ECHO and so forth
        */
       IoctlArgs.iop     = args->iop;
-      IoctlArgs.command = RTEMS_IO_GET_ATTRIBUTES;
+      IoctlArgs.command = TIOCGETA;
       IoctlArgs.buffer  = &Termios;
       rtems_termios_ioctl( &IoctlArgs );
 
       Termios.c_lflag   = ICANON;
-      IoctlArgs.command = RTEMS_IO_SET_ATTRIBUTES;
+      IoctlArgs.command = TIOCSETA;
       rtems_termios_ioctl( &IoctlArgs );
     }
   }
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
index 50805f1..c2beaea 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
@@ -39,7 +39,7 @@
 #ifdef DEBUG
 #define DBG(x...) printk(x)
 #else
-#define DBG(x...) 
+#define DBG(x...)
 #endif
 
 /* LEON3 Low level transmit/receive functions provided by debug-uart code */
@@ -85,7 +85,7 @@ static int apbuart_info(
 #define APBUART_INFO_FUNC NULL
 #endif
 
-struct drvmgr_drv_ops apbuart_ops = 
+struct drvmgr_drv_ops apbuart_ops =
 {
 	.init = {apbuart_init1, NULL, NULL, NULL},
 	.remove = NULL,
@@ -567,7 +567,7 @@ int apbuart_set_attributes(int minor, const struct termios *t)
 	uart->regs->ctrl = ctrl;
 
 	/* Baud rate */
-	baud = apbuart_baud_num2baud(t->c_cflag & CBAUD);
+  baud = apbuart_baud_num2baud(t->c_ospeed);
 	if (baud > 0){
 		/* Get APBUART core frequency */
 		drvmgr_freq_get(uart->dev, DEV_APB_SLV, &core_clk_hz);
@@ -588,7 +588,7 @@ void apbuart_get_attributes(struct console_dev *condev, struct termios *t)
 	unsigned int ctrl;
 	struct apbuart_baud *baud;
 
-	t->c_cflag = t->c_cflag & ~(CSIZE|PARENB|PARODD|CLOCAL|CBAUD);
+  t->c_cflag = t->c_cflag & ~(CSIZE|PARENB|PARODD|CLOCAL);
 
 	/* Hardware support only CS8 */
 	t->c_cflag |= CS8;
diff --git a/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c b/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c
index c552899..23b877c 100644
--- a/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c
+++ b/c/src/lib/libcpu/arm/at91rm9200/usart/usart.c
@@ -240,7 +240,7 @@ static int usart_set_attributes(int minor, const struct termios *t)
    } else
 	mode |= US_MR_PAR_NONE;
 
-  baud_requested = t->c_cflag & CBAUD;
+  baud_requested = t->c_ospeed;
 
   /* If not, set the dbgu console baud as USART baud default */
   if (!baud_requested)
diff --git a/c/src/lib/libcpu/bfin/serial/uart.c b/c/src/lib/libcpu/bfin/serial/uart.c
index 79f0941..617c59d 100644
--- a/c/src/lib/libcpu/bfin/serial/uart.c
+++ b/c/src/lib/libcpu/bfin/serial/uart.c
@@ -9,7 +9,7 @@
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.org/license/LICENSE.
  */
- 
+
 #include <rtems.h>
 #include <rtems/libio.h>
 #include <rtems/termiostypes.h>
@@ -159,7 +159,7 @@ static int setAttributes(int minor, const struct termios *termios)
   uint16_t lcr;
 
   base = uartsConfig->channels[minor].uart_baseAddress;
-  switch (termios->c_cflag & CBAUD) {
+  switch (termios->c_ospeed) {
     case B0:      baud = 0;      break;
     case B50:     baud = 50;     break;
     case B75:     baud = 75;     break;
diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c b/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c
index f8101d7..a500743b 100644
--- a/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c
+++ b/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c
@@ -362,7 +362,7 @@ static int mpc55xx_esci_termios_set_attributes( int minor, const struct termios
 	cr1.B.TE = 1;
 
 	/* Baud rate */
-	switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
 		case B50: br = 50; break;
 		case B75: br = 75; break;
 		case B110: br = 110; break;
diff --git a/c/src/lib/libcpu/powerpc/mpc5xx/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc5xx/console-generic/console-generic.c
index 22fee2d..c1de9c5 100644
--- a/c/src/lib/libcpu/powerpc/mpc5xx/console-generic/console-generic.c
+++ b/c/src/lib/libcpu/powerpc/mpc5xx/console-generic/console-generic.c
@@ -190,7 +190,7 @@ m5xx_uart_setAttributes(
     return RTEMS_INVALID_NUMBER;
 
   /* Baud rate */
-  baud = rtems_termios_baud_to_number( t->c_cflag & CBAUD );
+  baud = rtems_termios_baud_to_number( t->c_ospeed );
   if (baud > 0) {
     sccr0 &= ~QSMCM_SCI_BAUD(-1);
     sccr0 |= QSMCM_SCI_BAUD((bsp_clock_speed + (16 * baud)) / (32 * baud));
diff --git a/c/src/lib/libcpu/powerpc/mpc8260/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc8260/console-generic/console-generic.c
index e325acc..4bfb640 100644
--- a/c/src/lib/libcpu/powerpc/mpc8260/console-generic/console-generic.c
+++ b/c/src/lib/libcpu/powerpc/mpc8260/console-generic/console-generic.c
@@ -108,7 +108,7 @@ m8xx_smc_set_attributes (int minor, const struct termios *t)
   uint16_t   clen=0, cstopb, parenb, parodd, cread;
 
   /* Baud rate */
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:      baud = -1;      break;
   case B50:     baud = 50;      break;
   case B75:     baud = 75;      break;
@@ -221,7 +221,7 @@ m8xx_scc_set_attributes (int minor, const struct termios *t)
   uint16_t   csize=0, cstopb, parenb, parodd;
 
   /* Baud rate */
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:      baud = -1;      break;
   case B50:     baud = 50;      break;
   case B75:     baud = 75;      break;
diff --git a/c/src/lib/libcpu/powerpc/mpc8xx/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc8xx/console-generic/console-generic.c
index d7fd8b4..e015a64 100644
--- a/c/src/lib/libcpu/powerpc/mpc8xx/console-generic/console-generic.c
+++ b/c/src/lib/libcpu/powerpc/mpc8xx/console-generic/console-generic.c
@@ -175,7 +175,7 @@ m8xx_smc_set_attributes (int minor, const struct termios *t)
   uint16_t   clen=0, cstopb, parenb, parodd, cread;
 
   /* Baud rate */
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:      baud = -1;      break;
   case B50:     baud = 50;      break;
   case B75:     baud = 75;      break;
@@ -271,7 +271,7 @@ m8xx_scc_set_attributes (int minor, const struct termios *t)
   uint16_t   csize=0, cstopb, parenb, parodd;
 
   /* Baud rate */
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:      baud = -1;      break;
   case B50:     baud = 50;      break;
   case B75:     baud = 75;      break;
diff --git a/c/src/lib/libcpu/powerpc/ppc403/console/console.c b/c/src/lib/libcpu/powerpc/ppc403/console/console.c
index 0e74879..0e0bbd7 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/console/console.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/console/console.c
@@ -224,7 +224,7 @@ spiSetAttributes (int minor, const struct termios *t)
 
   /* FIXME: check c_cflag & CRTSCTS for hardware flowcontrol */
   /* FIXME: check and IMPLEMENT XON/XOFF                     */
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:	baud = -1;	break;
   case B50:	baud = 50;	break;
   case B75:	baud = 75;	break;
diff --git a/c/src/lib/libcpu/powerpc/ppc403/console/console405.c b/c/src/lib/libcpu/powerpc/ppc403/console/console405.c
index cf93658..96c3534 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/console/console405.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/console/console405.c
@@ -216,7 +216,7 @@ spiSetAttributes (int minor, const struct termios *t)
 
   /* FIXME: check c_cflag & CRTSCTS for hardware flowcontrol */
   /* FIXME: check and IMPLEMENT XON/XOFF                     */
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:	baud = -1;	break;
   case B50:	baud = 50;	break;
   case B75:	baud = 75;	break;
diff --git a/c/src/lib/libcpu/powerpc/ppc403/tty_drv/tty_drv.c b/c/src/lib/libcpu/powerpc/ppc403/tty_drv/tty_drv.c
index 1d7b013..3e79bbf 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/tty_drv/tty_drv.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/tty_drv/tty_drv.c
@@ -181,7 +181,7 @@ tty0SetAttributes (int minor, const struct termios *t)
 
   /* FIXME: check c_cflag & CRTSCTS for hardware flow control */
   /* FIXME: check and IMPLEMENT XON/XOFF                     */
-  switch (t->c_cflag & CBAUD) {
+  switch (t->c_ospeed) {
   default:	baud = -1;	break;
   case B50:	baud = 50;	break;
   case B75:	baud = 75;	break;
diff --git a/c/src/lib/libcpu/sh/sh7032/sci/sci.c b/c/src/lib/libcpu/sh/sh7032/sci/sci.c
index c9db0fe..8a099cf 100644
--- a/c/src/lib/libcpu/sh/sh7032/sci/sci.c
+++ b/c/src/lib/libcpu/sh/sh7032/sci/sci.c
@@ -54,21 +54,21 @@ struct scidev_t {
 
 /*  imported from scitab.rel */
 extern int _sci_get_brparms(
-  tcflag_t      cflag,
+  speed_t       spd,
   unsigned char *smr,
   unsigned char *brr );
 
 /* Translate termios' tcflag_t into sci settings */
 static int _sci_set_cflags(
   struct scidev_t      *sci_dev,
-  tcflag_t      c_cflag )
+  speed_t       spd )
 {
   uint8_t  	smr ;
   uint8_t  	brr ;
 
-  if ( c_cflag & CBAUD )
+  if ( spd )
   {
-    if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 )
+    if ( _sci_get_brparms( spd, &smr, &brr ) != 0 )
       return -1 ;
   }
 
diff --git a/c/src/lib/libcpu/sh/sh7045/sci/sci.c b/c/src/lib/libcpu/sh/sh7045/sci/sci.c
index 690035a..882eb45 100644
--- a/c/src/lib/libcpu/sh/sh7045/sci/sci.c
+++ b/c/src/lib/libcpu/sh/sh7045/sci/sci.c
@@ -96,15 +96,15 @@ static sci_setup_t sio_param[2];
 /* Translate termios' tcflag_t into sci settings */
 static int _sci_set_cflags(
   struct scidev_t  *sci_dev,
-  tcflag_t          c_cflag
+  speed_t           spd
 )
 {
   uint8_t  smr;
   uint8_t  brr;
 
-  if ( c_cflag & CBAUD )
+  if ( spd )
   {
-    if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 )
+    if ( _sci_get_brparms( spd, &smr, &brr ) != 0 )
       return -1;
   }
 
diff --git a/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c b/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c
index db9040e..645a433 100644
--- a/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c
+++ b/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c
@@ -59,7 +59,7 @@
  * Automatically generated function imported from scitab.rel
  */
 extern int _sci_get_brparms(
-  tcflag_t      cflag,
+  speed_t       spd,
   unsigned char *smr,
   unsigned char *brr
 );
@@ -76,10 +76,10 @@ int sh_sci_set_attributes(
     uint8_t  	brr;
     int a;
 
-    tcflag_t c_cflag = t->c_cflag;
+    speed_t spd = t->c_ospeed;
 
-    if ( c_cflag & CBAUD ) {
-        if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 )
+    if ( spd ) {
+        if ( _sci_get_brparms( spd, &smr, &brr ) != 0 )
             return -1 ;
     }
 
diff --git a/c/src/libchip/serial/mc68681.c b/c/src/libchip/serial/mc68681.c
index afa850e..a9ca05d 100644
--- a/c/src/libchip/serial/mc68681.c
+++ b/c/src/libchip/serial/mc68681.c
@@ -581,7 +581,7 @@ MC68681_STATIC int mc68681_baud_rate(
       break;
   }
 
-  baud_requested = baud & CBAUD;
+  baud_requested = baud;
   if (!baud_requested)
     baud_requested = B9600;              /* default to 9600 baud */
 
diff --git a/c/src/libchip/serial/mc68681_baud.c b/c/src/libchip/serial/mc68681_baud.c
index a27e6c9..0f8e87c 100644
--- a/c/src/libchip/serial/mc68681_baud.c
+++ b/c/src/libchip/serial/mc68681_baud.c
@@ -30,10 +30,15 @@ mc68681_baud_t mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = {
     0x0B,                      /* B9600 */
     MC68681_BAUD_NOT_VALID,    /* B19200 */
     0x0C,                      /* B38400 */
+    MC68681_BAUD_NOT_VALID,    /* B7200 */
+    MC68681_BAUD_NOT_VALID,    /* B14400 */
+    MC68681_BAUD_NOT_VALID,    /* B28800 */
     MC68681_BAUD_NOT_VALID,    /* B57600 */
+    MC68681_BAUD_NOT_VALID,    /* B76800 */
     MC68681_BAUD_NOT_VALID,    /* B115200 */
     MC68681_BAUD_NOT_VALID,    /* B230400 */
-    MC68681_BAUD_NOT_VALID     /* B460800 */
+    MC68681_BAUD_NOT_VALID,    /* B460800 */
+    MC68681_BAUD_NOT_VALID     /* B921600 */
   },
   { /* ACR[7] = 1, X = 0 */
     MC68681_BAUD_NOT_VALID,    /* B0 */
@@ -52,10 +57,15 @@ mc68681_baud_t mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = {
     0x0B,                      /* B9600 */
     0x0C,                      /* B19200 */
     MC68681_BAUD_NOT_VALID,    /* B38400 */
+    MC68681_BAUD_NOT_VALID,    /* B7200 */
+    MC68681_BAUD_NOT_VALID,    /* B14400 */
+    MC68681_BAUD_NOT_VALID,    /* B28800 */
     MC68681_BAUD_NOT_VALID,    /* B57600 */
+    MC68681_BAUD_NOT_VALID,    /* B76800 */
     MC68681_BAUD_NOT_VALID,    /* B115200 */
     MC68681_BAUD_NOT_VALID,    /* B230400 */
-    MC68681_BAUD_NOT_VALID     /* B460800 */
+    MC68681_BAUD_NOT_VALID,    /* B460800 */
+    MC68681_BAUD_NOT_VALID     /* B921600 */
   },
   { /* ACR[7] = 0, X = 1 */
     MC68681_BAUD_NOT_VALID,    /* B0 */
@@ -74,10 +84,15 @@ mc68681_baud_t mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = {
     0x0B,                      /* B9600 */
     0x0C,                      /* B19200 */
     MC68681_BAUD_NOT_VALID,    /* B38400 */
+    MC68681_BAUD_NOT_VALID,    /* B7200 */
+    MC68681_BAUD_NOT_VALID,    /* B14400 */
+    MC68681_BAUD_NOT_VALID,    /* B28800 */
     0x07,                      /* B57600 */
+    MC68681_BAUD_NOT_VALID,    /* B76800 */
     0x08,                      /* B115200 */
     MC68681_BAUD_NOT_VALID,    /* B230400 */
-    MC68681_BAUD_NOT_VALID     /* B460800 */
+    MC68681_BAUD_NOT_VALID,    /* B460800 */
+    MC68681_BAUD_NOT_VALID     /* B921600 */
   },
   { /* ACR[7] = 1, X = 1 */
     MC68681_BAUD_NOT_VALID,    /* B0 */
@@ -96,9 +111,14 @@ mc68681_baud_t mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = {
     0x0B,                      /* B9600 */
     MC68681_BAUD_NOT_VALID,    /* B19200 */
     0x0C,                      /* B38400 */
+    MC68681_BAUD_NOT_VALID,    /* B7200 */
+    MC68681_BAUD_NOT_VALID,    /* B14400 */
+    MC68681_BAUD_NOT_VALID,    /* B28800 */
     0x07,                      /* B57600 */
+    MC68681_BAUD_NOT_VALID,    /* B76800 */
     0x08,                      /* B115200 */
     MC68681_BAUD_NOT_VALID,    /* B230400 */
-    MC68681_BAUD_NOT_VALID     /* B460800 */
+    MC68681_BAUD_NOT_VALID,    /* B460800 */
+    MC68681_BAUD_NOT_VALID     /* B921600 */
   },
 };
diff --git a/c/src/libchip/serial/z85c30.c b/c/src/libchip/serial/z85c30.c
index 7c55a51..55df9d3 100644
--- a/c/src/libchip/serial/z85c30.c
+++ b/c/src/libchip/serial/z85c30.c
@@ -449,7 +449,7 @@ Z85C30_STATIC int z85c30_set_attributes(
    *  Assert ensures there is no division by 0.
    */
 
-  baud_requested = t->c_cflag & CBAUD;
+  baud_requested = t->c_ospeed;
   if (!baud_requested)
     baud_requested = B9600;              /* default to 9600 baud */
 
-- 
1.9.1




More information about the devel mailing list