[rtems commit] bsps: Fix baud settings

Sebastian Huber sebh at rtems.org
Mon Apr 3 12:08:41 UTC 2017


Module:    rtems
Branch:    master
Commit:    1301468b5a6e1080ba94ab4ca763c7e8e5c223e4
Changeset: http://git.rtems.org/rtems/commit/?id=1301468b5a6e1080ba94ab4ca763c7e8e5c223e4

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Apr  3 12:51:51 2017 +0200

bsps: Fix baud settings

Update #2897.

---

 c/src/lib/libbsp/arm/atsam/console/console.c                  | 4 ++--
 c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c    | 2 +-
 c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c | 2 +-
 c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c          | 2 +-
 c/src/libchip/serial/ns16550-context.c                        | 2 +-
 c/src/libchip/serial/ns16550.c                                | 2 +-
 cpukit/dev/serial/sc16is752.c                                 | 2 +-
 cpukit/libcsupport/include/rtems/termiostypes.h               | 6 ++----
 8 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/c/src/lib/libbsp/arm/atsam/console/console.c b/c/src/lib/libbsp/arm/atsam/console/console.c
index 84cfea8..d51d2ac 100644
--- a/c/src/lib/libbsp/arm/atsam/console/console.c
+++ b/c/src/lib/libbsp/arm/atsam/console/console.c
@@ -88,7 +88,7 @@ static bool atsam_usart_set_attributes(
   rtems_termios_baud_t baud;
   uint32_t mr;
 
-  baud = rtems_termios_baud_to_number(term->c_cflag);
+  baud = rtems_termios_baud_to_number(term->c_ospeed);
   regs->US_BRGR = (BOARD_MCK / baud) / 16;
 
   if ((term->c_cflag & CREAD) != 0) {
@@ -327,7 +327,7 @@ static bool atsam_uart_set_attributes(
   rtems_termios_baud_t baud;
   uint32_t mr;
 
-  baud = rtems_termios_baud_to_number(term->c_cflag);
+  baud = rtems_termios_baud_to_number(term->c_ospeed);
   regs->UART_BRGR = (BOARD_MCK / baud) / 16;
 
   if ((term->c_cflag & CREAD) != 0) {
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c
index 8ad7edb..9e6646f 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c
@@ -190,7 +190,7 @@ static int mpc55xx_esci_set_attributes(int minor, const struct termios *t)
   volatile struct ESCI_tag *regs = self->regs;
   union ESCI_CR1_tag cr1 = { .R = regs->CR1.R };
   union ESCI_CR2_tag cr2 = MPC55XX_ZERO_FLAGS;
-  rtems_termios_baud_t br = rtems_termios_baud_to_number(t->c_cflag);
+  rtems_termios_baud_t br = rtems_termios_baud_to_number(t->c_ospeed);
 
   /* Enable module */
   cr2.B.MDIS = 0;
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c
index 9aed2a6..02978be 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c
@@ -174,7 +174,7 @@ static int mpc55xx_linflex_set_attributes(int minor, const struct termios *t)
   LINFLEX_UARTCR_32B_tag uartcr = { .R = 0 };
   LINFLEX_GCR_32B_tag gcr = { .R = 0 };
   LINFLEX_LINIER_32B_tag ier = { .R = 0 };
-  rtems_termios_baud_t br = rtems_termios_baud_to_number(t->c_cflag);
+  rtems_termios_baud_t br = rtems_termios_baud_to_number(t->c_ospeed);
   LINFLEX_LINFBRR_32B_tag fbrr = { .R = 0 };
   LINFLEX_LINIBRR_32B_tag ibrr = { .R = 0 };
 
diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c
index 21f2e83..28ece27 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c
@@ -148,7 +148,7 @@ static bool apbuart_set_attributes(
   rtems_termios_device_lock_release(base, &lock_context);
 
   /* Baud rate */
-  baud = rtems_termios_baud_to_number(t->c_cflag);
+  baud = rtems_termios_baud_to_number(t->c_ospeed);
   if (baud > 0) {
     /* Calculate Baud rate generator "scaler" number */
     scaler = (((uart->freq_hz * 10) / (baud * 8)) - 5) / 10;
diff --git a/c/src/libchip/serial/ns16550-context.c b/c/src/libchip/serial/ns16550-context.c
index 087627a..4f0328d 100644
--- a/c/src/libchip/serial/ns16550-context.c
+++ b/c/src/libchip/serial/ns16550-context.c
@@ -596,7 +596,7 @@ static bool ns16550_set_attributes(
    *  Assert ensures there is no division by 0.
    */
 
-  baud_requested = rtems_termios_baud_to_number(t->c_cflag);
+  baud_requested = rtems_termios_baud_to_number(t->c_ospeed);
   _Assert( baud_requested != 0 );
 
   ulBaudDivisor = NS16550_GetBaudDivisor(ctx, baud_requested);
diff --git a/c/src/libchip/serial/ns16550.c b/c/src/libchip/serial/ns16550.c
index 6473028..c8d66de 100644
--- a/c/src/libchip/serial/ns16550.c
+++ b/c/src/libchip/serial/ns16550.c
@@ -535,7 +535,7 @@ int ns16550_set_attributes(
    *  Assert ensures there is no division by 0.
    */
 
-  baud_requested = rtems_termios_baud_to_number(t->c_cflag);
+  baud_requested = rtems_termios_baud_to_number(t->c_ospeed);
   _Assert( baud_requested != 0 );
   ulBaudDivisor = NS16550_GetBaudDivisor(c, baud_requested);
 
diff --git a/cpukit/dev/serial/sc16is752.c b/cpukit/dev/serial/sc16is752.c
index 96fac30..74c3ad3 100644
--- a/cpukit/dev/serial/sc16is752.c
+++ b/cpukit/dev/serial/sc16is752.c
@@ -148,7 +148,7 @@ static bool sc16is752_set_attributes(
 
   ctx->lcr = 0;
 
-  baud = rtems_termios_baud_to_number(term->c_cflag);
+  baud = rtems_termios_baud_to_number(term->c_ospeed);
   baud_successful = set_baud(ctx, baud);
   if (!baud_successful){
     return false;
diff --git a/cpukit/libcsupport/include/rtems/termiostypes.h b/cpukit/libcsupport/include/rtems/termiostypes.h
index f68de0c..1140c61 100644
--- a/cpukit/libcsupport/include/rtems/termiostypes.h
+++ b/cpukit/libcsupport/include/rtems/termiostypes.h
@@ -530,14 +530,12 @@ extern const rtems_assoc_t rtems_termios_baud_table [];
 speed_t rtems_termios_number_to_baud(rtems_termios_baud_t baud);
 
 /**
- *  @brief Convert Baud Part of Termios control flags to an integral Baud Value
- *
- *  There is no need to mask the @a c_cflag with @c CBAUD.
+ *  @brief Converts the baud flags to an integral baud value.
  *
  *  @retval 0 Invalid baud value or a baud value of @c B0.
  *  @retval other Integral baud value.
  */
-rtems_termios_baud_t rtems_termios_baud_to_number(speed_t c_cflag);
+rtems_termios_baud_t rtems_termios_baud_to_number(speed_t baud);
 
 /**
  *  @brief Convert Bxxx Constant to Index




More information about the vc mailing list