[PATCH] Simplify and unify BSP_output_char

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 8 08:41:45 UTC 2017


The BSP_output_char should output a char and not mingle with high level
processing, e.g. '\n' to '\r\n' translation. Move this translation to
rtems_putc(). Remove it from all the BSP_output_char implementations.

Update #3122.
---
 .../lib/libbsp/arm/altera-cyclone-v/console/console-config.c  |  4 ----
 c/src/lib/libbsp/arm/atsam/console/debug-console.c            |  4 ----
 c/src/lib/libbsp/arm/beagle/console/console-config.c          |  3 ---
 c/src/lib/libbsp/arm/csb336/console/uart.c                    |  3 ---
 c/src/lib/libbsp/arm/imx/console/console-config.c             | 10 +---------
 c/src/lib/libbsp/arm/lm3s69xx/console/console-config.c        |  3 ---
 c/src/lib/libbsp/arm/raspberrypi/console/console-config.c     |  3 ---
 c/src/lib/libbsp/arm/realview-pbx-a9/console/console-config.c |  4 ----
 c/src/lib/libbsp/arm/rtl22xx/console/uart.c                   |  3 ---
 c/src/lib/libbsp/arm/shared/comm/uart.c                       |  1 -
 c/src/lib/libbsp/arm/smdk2410/console/uart.c                  |  3 ---
 c/src/lib/libbsp/arm/stm32f4/console/console-config.c         |  5 +----
 c/src/lib/libbsp/arm/tms570/console/printk-support.c          |  4 ----
 c/src/lib/libbsp/arm/xilinx-zynq/console/debug-console.c      |  4 ----
 c/src/lib/libbsp/i386/pc386/console/printk_support.c          |  5 -----
 c/src/lib/libbsp/i386/shared/comm/uart.c                      |  1 -
 c/src/lib/libbsp/m68k/av5282/console/console.c                |  2 --
 c/src/lib/libbsp/m68k/genmcf548x/console/console.c            |  2 --
 c/src/lib/libbsp/m68k/mcf5225x/console/debugio.c              |  3 ---
 c/src/lib/libbsp/m68k/mcf5235/console/console.c               |  2 --
 c/src/lib/libbsp/m68k/mcf5329/console/console.c               |  2 --
 c/src/lib/libbsp/m68k/mvme167/console/console.c               |  2 --
 c/src/lib/libbsp/m68k/uC5282/console/console.c                |  2 --
 c/src/lib/libbsp/mips/csb350/console/console-io.c             |  3 ---
 c/src/lib/libbsp/or1k/generic_or1k/console/console-config.c   |  3 ---
 c/src/lib/libbsp/powerpc/gen5200/console/console.c            |  3 ---
 c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c     |  4 ----
 c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c         |  2 --
 c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c |  4 ----
 c/src/lib/libbsp/powerpc/mpc8260ads/console/console.c         |  5 -----
 c/src/lib/libbsp/powerpc/qoriq/console/console-config.c       |  4 ----
 c/src/lib/libbsp/powerpc/shared/console/polled_io.c           |  4 +---
 c/src/lib/libbsp/powerpc/shared/console/uart.c                |  1 -
 c/src/lib/libbsp/powerpc/t32mppc/console/console.c            | 11 +----------
 c/src/lib/libbsp/powerpc/tqm8xx/console/console.c             |  4 ----
 c/src/lib/libbsp/powerpc/virtex/console/consolelite.c         |  3 ---
 c/src/lib/libbsp/powerpc/virtex4/startup/dummy_console.c      |  2 +-
 c/src/lib/libbsp/powerpc/virtex5/startup/dummy_console.c      |  2 +-
 c/src/lib/libbsp/shared/console-output-char.c                 |  4 ----
 c/src/lib/libbsp/shared/src/uart-output-char.c                |  4 ----
 c/src/lib/libcpu/arm/at91rm9200/dbgu/dbgu.c                   |  2 --
 c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c                  |  3 ---
 cpukit/include/rtems/bspIo.h                                  |  3 +++
 cpukit/libcsupport/src/putk.c                                 |  4 ++--
 cpukit/libmisc/serdbg/termios_printk.c                        |  3 ---
 45 files changed, 11 insertions(+), 142 deletions(-)

diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c b/c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c
index 3249bbdcba..5ee02d0bb5 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/console/console-config.c
@@ -150,10 +150,6 @@ static void output_char(char c)
 {
   rtems_termios_device_context *ctx = console_device_table[0].context;
 
-  if (c == '\n') {
-    ns16550_polled_putchar( ctx, '\r' );
-  }
-
   ns16550_polled_putchar( ctx, c );
 }
 
diff --git a/c/src/lib/libbsp/arm/atsam/console/debug-console.c b/c/src/lib/libbsp/arm/atsam/console/debug-console.c
index aebc60f8ea..4924e88516 100644
--- a/c/src/lib/libbsp/arm/atsam/console/debug-console.c
+++ b/c/src/lib/libbsp/arm/atsam/console/debug-console.c
@@ -20,10 +20,6 @@
 
 static void atsam_debug_console_out(char c)
 {
-  if (c == '\n') {
-    DBG_PutChar('\r');
-  }
-
   DBG_PutChar((uint8_t) c);
 }
 
diff --git a/c/src/lib/libbsp/arm/beagle/console/console-config.c b/c/src/lib/libbsp/arm/beagle/console/console-config.c
index ec50154641..78af5f6a93 100644
--- a/c/src/lib/libbsp/arm/beagle/console/console-config.c
+++ b/c/src/lib/libbsp/arm/beagle/console/console-config.c
@@ -136,9 +136,6 @@ static void uart_write_polled( char c )
 
 static void _BSP_put_char( char c ) {
    uart_write_polled( c );
-   if (c == '\n') {
-       uart_write_polled('\r');
-   }
 }
 
 static int _BSP_get_char(void)
diff --git a/c/src/lib/libbsp/arm/csb336/console/uart.c b/c/src/lib/libbsp/arm/csb336/console/uart.c
index e2e6bc2ab7..7e1bb4d429 100644
--- a/c/src/lib/libbsp/arm/csb336/console/uart.c
+++ b/c/src/lib/libbsp/arm/csb336/console/uart.c
@@ -461,9 +461,6 @@ static void  imx_uart_poll_write_char(int minor, char c)
 static void _BSP_output_char(char c)
 {
     poll_write(c);
-    if (c == '\n') {
-        poll_write('\r');
-    }
 }
 
 BSP_output_char_function_type BSP_output_char = _BSP_output_char;
diff --git a/c/src/lib/libbsp/arm/imx/console/console-config.c b/c/src/lib/libbsp/arm/imx/console/console-config.c
index bc9a3d243e..a5b3682dd7 100644
--- a/c/src/lib/libbsp/arm/imx/console/console-config.c
+++ b/c/src/lib/libbsp/arm/imx/console/console-config.c
@@ -61,15 +61,7 @@ static void imx_uart_write_polled(rtems_termios_device_context *base, char c)
 
 static void imx_output_char(char c)
 {
-  imx_uart_context *ctx;
-
-  ctx = imx_uart_console;
-
-  if (c == '\n') {
-    imx_uart_write_polled(&ctx->base, '\r');
-  }
-
-  imx_uart_write_polled(&ctx->base, c);
+  imx_uart_write_polled(&imx_uart_console->base, c);
 }
 
 static void imx_uart_init_context(
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/console/console-config.c b/c/src/lib/libbsp/arm/lm3s69xx/console/console-config.c
index c6c4900b9e..b702f0cd66 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/console/console-config.c
+++ b/c/src/lib/libbsp/arm/lm3s69xx/console/console-config.c
@@ -70,9 +70,6 @@ static void output_char(char c)
   const console_fns *con =
     Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
 
-  if (c == '\n') {
-    con->deviceWritePolled((int) Console_Port_Minor, '\r');
-  }
   con->deviceWritePolled((int) Console_Port_Minor, c);
 }
 
diff --git a/c/src/lib/libbsp/arm/raspberrypi/console/console-config.c b/c/src/lib/libbsp/arm/raspberrypi/console/console-config.c
index dfb9826307..d2186c918b 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/console/console-config.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/console/console-config.c
@@ -60,9 +60,6 @@ static void output_char(char c)
   const console_fns *con =
     Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
 
-  if (c == '\n') {
-    con->deviceWritePolled((int) Console_Port_Minor, '\r');
-  }
   con->deviceWritePolled((int) Console_Port_Minor, c);
 }
 
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/console/console-config.c b/c/src/lib/libbsp/arm/realview-pbx-a9/console/console-config.c
index 1dc77605fe..66dcfa6803 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/console/console-config.c
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/console/console-config.c
@@ -37,10 +37,6 @@ static arm_pl050_context pl050_context = {
 
 static void output_char(char c)
 {
-  if (c == '\n') {
-    arm_pl011_write_polled(&pl011_context.base, '\r');
-  }
-
   arm_pl011_write_polled(&pl011_context.base, c);
 }
 
diff --git a/c/src/lib/libbsp/arm/rtl22xx/console/uart.c b/c/src/lib/libbsp/arm/rtl22xx/console/uart.c
index 91f7f325c6..2952e74508 100644
--- a/c/src/lib/libbsp/arm/rtl22xx/console/uart.c
+++ b/c/src/lib/libbsp/arm/rtl22xx/console/uart.c
@@ -250,9 +250,6 @@ static int uart_set_attributes(int minor, const struct termios *t)
 static void _BSP_put_char( char c )
 {
   uart_write_polled(0, c);
-  if (c == '\n') {
-    uart_write_polled(0, '\r');
-  }
 }
 
 BSP_output_char_function_type BSP_output_char = _BSP_put_char;
diff --git a/c/src/lib/libbsp/arm/shared/comm/uart.c b/c/src/lib/libbsp/arm/shared/comm/uart.c
index 54f0735545..e9528f1634 100644
--- a/c/src/lib/libbsp/arm/shared/comm/uart.c
+++ b/c/src/lib/libbsp/arm/shared/comm/uart.c
@@ -294,7 +294,6 @@ void
 BSP_output_char_via_serial(int val)
 {
   BSP_uart_polled_write(BSPConsolePort, val);
-  if (val == '\n') BSP_uart_polled_write(BSPConsolePort,'\r');
 }
 
 /*
diff --git a/c/src/lib/libbsp/arm/smdk2410/console/uart.c b/c/src/lib/libbsp/arm/smdk2410/console/uart.c
index 9878c33794..06adecf239 100644
--- a/c/src/lib/libbsp/arm/smdk2410/console/uart.c
+++ b/c/src/lib/libbsp/arm/smdk2410/console/uart.c
@@ -230,9 +230,6 @@ int uart_poll_read(int minor)
  */
 static void _BSP_put_char( char c ) {
     uart_write_polled(0, c);
-    if (c == '\n') {
-        uart_write_polled(0, '\r');
-    }
 }
 
 BSP_output_char_function_type BSP_output_char = _BSP_put_char;
diff --git a/c/src/lib/libbsp/arm/stm32f4/console/console-config.c b/c/src/lib/libbsp/arm/stm32f4/console/console-config.c
index 96b022d4e9..6bf2d7e3b5 100644
--- a/c/src/lib/libbsp/arm/stm32f4/console/console-config.c
+++ b/c/src/lib/libbsp/arm/stm32f4/console/console-config.c
@@ -100,10 +100,7 @@ static void output_char(char c)
 {
   const console_fns *con =
     Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
-  
-  if (c == '\n') {
-    con->deviceWritePolled((int) Console_Port_Minor, '\r');
-  }
+
   con->deviceWritePolled((int) Console_Port_Minor, c);
 }
 
diff --git a/c/src/lib/libbsp/arm/tms570/console/printk-support.c b/c/src/lib/libbsp/arm/tms570/console/printk-support.c
index 31e2c19b69..529c5dba20 100644
--- a/c/src/lib/libbsp/arm/tms570/console/printk-support.c
+++ b/c/src/lib/libbsp/arm/tms570/console/printk-support.c
@@ -65,10 +65,6 @@ static void tms570_debug_console_putc(char ch)
  */
 static void tms570_debug_console_out(char c)
 {
-  if ( c == '\n' ) {
-    tms570_debug_console_putc('\r');
-  }
-
   tms570_debug_console_putc(c);
 }
 
diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/console/debug-console.c b/c/src/lib/libbsp/arm/xilinx-zynq/console/debug-console.c
index 887a7ea46c..38c0050e90 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/console/debug-console.c
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/console/debug-console.c
@@ -24,10 +24,6 @@ static void zynq_debug_console_out(char c)
   rtems_termios_device_context *base =
     &zynq_uart_instances[BSP_CONSOLE_MINOR].base;
 
-  if (c == '\n') {
-    zynq_uart_write_polled(base, '\r');
-  }
-
   zynq_uart_write_polled(base, c);
 }
 
diff --git a/c/src/lib/libbsp/i386/pc386/console/printk_support.c b/c/src/lib/libbsp/i386/pc386/console/printk_support.c
index d6dd569301..d5447adef0 100644
--- a/c/src/lib/libbsp/i386/pc386/console/printk_support.c
+++ b/c/src/lib/libbsp/i386/pc386/console/printk_support.c
@@ -44,11 +44,6 @@ void BSP_outch(char ch)
     console_tbl *port = Console_Port_Tbl[BSPPrintkPort];
     if (port->pDeviceFns && port->pDeviceFns->deviceWritePolled) {
       port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
-      /*
-       * No termios so expand the LF to LF/CR.
-       */
-      if ( ch == '\n')
-        port->pDeviceFns->deviceWritePolled( BSPPrintkPort, '\r' );
     }
     return;
   }
diff --git a/c/src/lib/libbsp/i386/shared/comm/uart.c b/c/src/lib/libbsp/i386/shared/comm/uart.c
index fd64eb2978..5d2dd64854 100644
--- a/c/src/lib/libbsp/i386/shared/comm/uart.c
+++ b/c/src/lib/libbsp/i386/shared/comm/uart.c
@@ -397,7 +397,6 @@ void
 BSP_output_char_via_serial(char val)
 {
   BSP_uart_polled_write(BSPConsolePort, val);
-  if (val == '\n') BSP_uart_polled_write(BSPConsolePort,'\r');
 }
 
 /*
diff --git a/c/src/lib/libbsp/m68k/av5282/console/console.c b/c/src/lib/libbsp/m68k/av5282/console/console.c
index f56305a970..dd557660f8 100644
--- a/c/src/lib/libbsp/m68k/av5282/console/console.c
+++ b/c/src/lib/libbsp/m68k/av5282/console/console.c
@@ -29,8 +29,6 @@ static void _BSP_null_char( char c )
 {
   rtems_interrupt_level level;
 
-  if (c == '\n')
-    _BSP_null_char('\r');
   rtems_interrupt_disable(level);
   while ( (MCF5282_UART_USR(CONSOLE_PORT) & MCF5282_UART_USR_TXRDY) == 0 )
     continue;
diff --git a/c/src/lib/libbsp/m68k/genmcf548x/console/console.c b/c/src/lib/libbsp/m68k/genmcf548x/console/console.c
index 23186fcfdf..d22cfe6af1 100644
--- a/c/src/lib/libbsp/m68k/genmcf548x/console/console.c
+++ b/c/src/lib/libbsp/m68k/genmcf548x/console/console.c
@@ -77,8 +77,6 @@ _BSP_null_char( char c )
 {
 	int level;
 
-    if (c == '\n')
-        _BSP_null_char('\r');
 	rtems_interrupt_disable(level);
     while (!((MCF548X_PSC_SR(CONSOLE_PORT) & MCF548X_PSC_SR_TXRDY)))
         continue;
diff --git a/c/src/lib/libbsp/m68k/mcf5225x/console/debugio.c b/c/src/lib/libbsp/m68k/mcf5225x/console/debugio.c
index cf8069254e..b91048a310 100644
--- a/c/src/lib/libbsp/m68k/mcf5225x/console/debugio.c
+++ b/c/src/lib/libbsp/m68k/mcf5225x/console/debugio.c
@@ -22,9 +22,6 @@ static void _BSP_null_char(char c)
 {
   rtems_interrupt_level level=UART0_IRQ_LEVEL;
 
-  if (c == '\n')
-        _BSP_null_char('\r');
-
   rtems_interrupt_disable(level);
   while ((MCF_UART_USR(CONSOLE_PORT) & MCF_UART_USR_TXRDY) == 0)
     continue;
diff --git a/c/src/lib/libbsp/m68k/mcf5235/console/console.c b/c/src/lib/libbsp/m68k/mcf5235/console/console.c
index 4829de0b0f..38317130cb 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/console/console.c
+++ b/c/src/lib/libbsp/m68k/mcf5235/console/console.c
@@ -30,8 +30,6 @@ _BSP_null_char( char c )
 {
 	int level;
 
-    if (c == '\n')
-        _BSP_null_char('\r');
 	rtems_interrupt_disable(level);
     while ( (MCF5235_UART_USR(CONSOLE_PORT) & MCF5235_UART_USR_TXRDY) == 0 )
         continue;
diff --git a/c/src/lib/libbsp/m68k/mcf5329/console/console.c b/c/src/lib/libbsp/m68k/mcf5329/console/console.c
index ba4a7d981a..797e5b0606 100644
--- a/c/src/lib/libbsp/m68k/mcf5329/console/console.c
+++ b/c/src/lib/libbsp/m68k/mcf5329/console/console.c
@@ -30,8 +30,6 @@ static void _BSP_null_char(char c)
 {
   int level;
 
-  if (c == '\n')
-    _BSP_null_char('\r');
   rtems_interrupt_disable(level);
   while ((MCF_UART_USR(CONSOLE_PORT) & MCF_UART_USR_TXRDY) == 0)
     continue;
diff --git a/c/src/lib/libbsp/m68k/mvme167/console/console.c b/c/src/lib/libbsp/m68k/mvme167/console/console.c
index 3b7aecb541..0499ac46b3 100644
--- a/c/src/lib/libbsp/m68k/mvme167/console/console.c
+++ b/c/src/lib/libbsp/m68k/mvme167/console/console.c
@@ -1426,8 +1426,6 @@ void _BSP_output_char(char c)
     printk_minor = PRINTK_MINOR;
 
   _167Bug_pollWrite(printk_minor, &c, 1);
-  if ( c == '\n' )
-      _167Bug_pollWrite(printk_minor, &cr_char, 1);
 }
 
 /*
diff --git a/c/src/lib/libbsp/m68k/uC5282/console/console.c b/c/src/lib/libbsp/m68k/uC5282/console/console.c
index 485db20ae4..276d0c6f18 100644
--- a/c/src/lib/libbsp/m68k/uC5282/console/console.c
+++ b/c/src/lib/libbsp/m68k/uC5282/console/console.c
@@ -41,8 +41,6 @@ _BSP_null_char( char c )
 {
 	int level;
 
-    if (c == '\n')
-        _BSP_null_char('\r');
 	rtems_interrupt_disable(level);
     while ( (MCF5282_UART_USR(CONSOLE_PORT) & MCF5282_UART_USR_TXRDY) == 0 )
         continue;
diff --git a/c/src/lib/libbsp/mips/csb350/console/console-io.c b/c/src/lib/libbsp/mips/csb350/console/console-io.c
index 18c8be083a..e1beff8460 100644
--- a/c/src/lib/libbsp/mips/csb350/console/console-io.c
+++ b/c/src/lib/libbsp/mips/csb350/console/console-io.c
@@ -73,9 +73,6 @@ int console_inbyte_nonblocking(
 static void csb250_output_char(char c)
 {
     console_outbyte_polled( 0, c );
-    if (c == '\n') {
-        console_outbyte_polled( 0, '\r' );
-    }
 }
 
 static int csb250_get_char(void)
diff --git a/c/src/lib/libbsp/or1k/generic_or1k/console/console-config.c b/c/src/lib/libbsp/or1k/generic_or1k/console/console-config.c
index a5b29a9745..5fc75dcf0c 100644
--- a/c/src/lib/libbsp/or1k/generic_or1k/console/console-config.c
+++ b/c/src/lib/libbsp/or1k/generic_or1k/console/console-config.c
@@ -47,9 +47,6 @@ static void output_char(char c)
   const console_fns *con =
     Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
 
-  if (c == '\n') {
-    con->deviceWritePolled((int) Console_Port_Minor, '\r');
-  }
   con->deviceWritePolled((int) Console_Port_Minor, c);
 }
 
diff --git a/c/src/lib/libbsp/powerpc/gen5200/console/console.c b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
index 754a52789a..705769d639 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/console/console.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
@@ -637,9 +637,6 @@ static void A_BSP_output_char(
 #define PRINTK_WRITE mpc5200_uart_pollWrite
 
     PRINTK_WRITE(PRINTK_MINOR, &c, 1 );
-
-    if( c == '\n' )
-      PRINTK_WRITE( PRINTK_MINOR, &cr, 1 );
 }
 
 static int A_BSP_get_char(void)
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c b/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c
index 8dd7249651..d0071cd220 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c
+++ b/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c
@@ -99,10 +99,6 @@ static void gen83xx_output_char(char c)
 {
   rtems_termios_device_context *ctx = console_device_table[0].context;
 
-  if (c == '\n') {
-    ns16550_polled_putchar(ctx, '\r');
-  }
-
   ns16550_polled_putchar(ctx, c);
 }
 
diff --git a/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
index 00f44c2532..8facb27ffb 100644
--- a/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/haleakala/startup/bspstart.c
@@ -150,8 +150,6 @@ DirectUARTWrite(const char c)
   volatile uint8_t* up = (uint8_t*)(BSP_UART_IOBASE_COM1);
   while ((up[LSR] & THRE) == 0) { ; }
   up[THR] = c;
-  if (c=='\n')
-    DirectUARTWrite('\r');
 }
 
 /* We will provide our own printk output function as it may get used early */
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c
index 2c79545f20..71385adf2b 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c
@@ -37,10 +37,6 @@ static void console_generic_char_out(char c)
   const console_generic_callbacks *cb =
     console_generic_info_table [minor].callbacks;
 
-  if (c == '\n') {
-    (*cb->poll_write)(minor, '\r');
-  }
-
   (*cb->poll_write)(minor, c);
 }
 
diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/console/console.c b/c/src/lib/libbsp/powerpc/mpc8260ads/console/console.c
index f0ce259b4a..873c38dc3e 100644
--- a/c/src/lib/libbsp/powerpc/mpc8260ads/console/console.c
+++ b/c/src/lib/libbsp/powerpc/mpc8260ads/console/console.c
@@ -193,8 +193,6 @@ static rtems_status_code do_poll_write(
 
 static void _BSP_output_char( char c )
 {
-  char cr = '\r';
-
   /*
    *  Can't rely on console_initialize having been called before this function
    *  is used, so it may fail unless output is done through EPPC-Bug.
@@ -202,9 +200,6 @@ static void _BSP_output_char( char c )
 #define PRINTK_WRITE m8xx_uart_pollWrite
 
   PRINTK_WRITE( PRINTK_MINOR, &c, 1 );
-  if( c == '\n' )
-    PRINTK_WRITE( PRINTK_MINOR, &cr, 1 );
-
 }
 
 /*
diff --git a/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c b/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c
index 50327c27e4..fa02e74f46 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/console/console-config.c
@@ -303,10 +303,6 @@ static void qoriq_output_char(char c)
 {
   rtems_termios_device_context *ctx = console_device_table[0].context;
 
-  if (c == '\n') {
-    ns16550_polled_putchar(ctx, '\r');
-  }
-
   ns16550_polled_putchar(ctx, c);
 }
 
diff --git a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
index 2ec68d0f0b..1086e59468 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/polled_io.c
@@ -426,8 +426,6 @@ void debug_putc(const u_char c)
 void
 debug_putc_onlcr(const char c)
 {
-	if ('\n'==c)
-		debug_putc('\r');
 	debug_putc(c);
 }
 
@@ -525,7 +523,7 @@ void my_puts(const u_char *s)
         char c;
 
         while ( ( c = *s++ ) != '\0' ) {
-				debug_putc_onlcr((const char)c);
+				rtems_putc(c);
         }
 }
 
diff --git a/c/src/lib/libbsp/powerpc/shared/console/uart.c b/c/src/lib/libbsp/powerpc/shared/console/uart.c
index cd8657cfda..62212b98db 100644
--- a/c/src/lib/libbsp/powerpc/shared/console/uart.c
+++ b/c/src/lib/libbsp/powerpc/shared/console/uart.c
@@ -417,7 +417,6 @@ void
 BSP_output_char_via_serial(const char val)
 {
   BSP_uart_polled_write(BSPConsolePort, val);
-  if (val == '\n') BSP_uart_polled_write(BSPConsolePort,'\r');
 }
 
 /*
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/console/console.c b/c/src/lib/libbsp/powerpc/t32mppc/console/console.c
index bc94f8537a..5fbd648765 100644
--- a/c/src/lib/libbsp/powerpc/t32mppc/console/console.c
+++ b/c/src/lib/libbsp/powerpc/t32mppc/console/console.c
@@ -123,15 +123,6 @@ rtems_device_driver console_initialize(
   return RTEMS_SUCCESSFUL;
 }
 
-static void t32_output_char(char c)
-{
-  if (c == '\n') {
-    t32_console_write_char_polled('\r');
-  }
-
-  t32_console_write_char_polled(c);
-}
-
-BSP_output_char_function_type BSP_output_char = t32_output_char;
+BSP_output_char_function_type BSP_output_char = t32_console_write_char_polled;
 
 BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c b/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c
index e109303f18..7810bc1bd1 100644
--- a/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c
+++ b/c/src/lib/libbsp/powerpc/tqm8xx/console/console.c
@@ -846,14 +846,10 @@ int BSP_output_chan = CONS_CHN_NONE; /* channel used for printk operation */
 static void console_debug_putc_onlcr(const char c)
 {
   rtems_interrupt_level irq_level;
-  static char cr_chr = '\r';
 
   if (BSP_output_chan != CONS_CHN_NONE) {
     rtems_interrupt_disable(irq_level);
 
-    if (c == '\n') {
-      sccPollWrite (BSP_output_chan,&cr_chr,1);
-    }
     sccPollWrite (BSP_output_chan,&c,1);
     rtems_interrupt_enable(irq_level);
   }
diff --git a/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c b/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c
index 6c8e6e3e7c..4d0b2db17f 100644
--- a/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c
+++ b/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c
@@ -411,9 +411,6 @@ unsigned long Console_Configuration_Count =
 
 static void outputChar(char ch)
 {
-  if (ch == '\n') {
-    xlite_write_char_polled( 0, '\r' );
-  }
    xlite_write_char_polled( 0, ch );
 }
 
diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/dummy_console.c b/c/src/lib/libbsp/powerpc/virtex4/startup/dummy_console.c
index 6ff24b22bd..642fe45618 100644
--- a/c/src/lib/libbsp/powerpc/virtex4/startup/dummy_console.c
+++ b/c/src/lib/libbsp/powerpc/virtex4/startup/dummy_console.c
@@ -18,7 +18,7 @@ ssize_t __bsp_memory_write(int minor, const char* buf, size_t len)
   const char* const last = buf+len;
   while (buf < last)
   {
-    BSP_output_char(*buf++);
+    rtems_putc(*buf++);
   }
   return len;
 }
diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/dummy_console.c b/c/src/lib/libbsp/powerpc/virtex5/startup/dummy_console.c
index 8a35eb9cd3..2cdab33c8c 100644
--- a/c/src/lib/libbsp/powerpc/virtex5/startup/dummy_console.c
+++ b/c/src/lib/libbsp/powerpc/virtex5/startup/dummy_console.c
@@ -15,7 +15,7 @@ ssize_t __bsp_memory_write(int minor, const char* buf, size_t len)
   const char* const last = buf+len;
   while (buf < last)
   {
-    BSP_output_char(*buf++);
+    rtems_putc(*buf++);
   }
   return len;
 }
diff --git a/c/src/lib/libbsp/shared/console-output-char.c b/c/src/lib/libbsp/shared/console-output-char.c
index 40f728d5f4..fec204663a 100644
--- a/c/src/lib/libbsp/shared/console-output-char.c
+++ b/c/src/lib/libbsp/shared/console-output-char.c
@@ -23,10 +23,6 @@ static void output_char(char c)
     Console_Port_Tbl[minor] : &Console_Configuration_Ports[minor];
   const console_fns *cf = ct->pDeviceFns;
 
-  if (c == '\n') {
-    (*cf->deviceWritePolled)(minor, '\r');
-  }
-
   (*cf->deviceWritePolled)(minor, c);
 }
 
diff --git a/c/src/lib/libbsp/shared/src/uart-output-char.c b/c/src/lib/libbsp/shared/src/uart-output-char.c
index a11d41a616..0831b8d3ed 100644
--- a/c/src/lib/libbsp/shared/src/uart-output-char.c
+++ b/c/src/lib/libbsp/shared/src/uart-output-char.c
@@ -35,10 +35,6 @@ static void uart_output_raw(char c)
 
 static void uart_output(char c)
 {
-  if (c == '\n') {
-    uart_output_raw('\r');
-  }
-
   uart_output_raw(c);
 }
 
diff --git a/c/src/lib/libcpu/arm/at91rm9200/dbgu/dbgu.c b/c/src/lib/libcpu/arm/at91rm9200/dbgu/dbgu.c
index fa14a8e02e..1a16762e32 100644
--- a/c/src/lib/libcpu/arm/at91rm9200/dbgu/dbgu.c
+++ b/c/src/lib/libcpu/arm/at91rm9200/dbgu/dbgu.c
@@ -211,8 +211,6 @@ static int dbgu_poll_read(int minor)
  */
 static void _BSP_put_char( char c ) {
   dbgu_write_polled(0, c);
-  if ( c == '\n' )
-    dbgu_write_polled(0, '\r');
 }
 
 BSP_output_char_function_type     BSP_output_char = _BSP_put_char;
diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c b/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c
index a500743bcd..63791b819b 100644
--- a/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c
+++ b/c/src/lib/libcpu/powerpc/mpc55xx/esci/esci.c
@@ -659,9 +659,6 @@ static void mpc55xx_esci_output_char( char c)
 	mpc55xx_esci_driver_entry *e = &mpc55xx_esci_driver_table [MPC55XX_ESCI_CONSOLE_MINOR];
 
 	mpc55xx_esci_interrupts_disable( e);
-	if (c == '\n') {
-		mpc55xx_esci_write_char( e, '\r');
-	}
 	mpc55xx_esci_write_char( e, c);
 	mpc55xx_esci_interrupts_enable( e);
 }
diff --git a/cpukit/include/rtems/bspIo.h b/cpukit/include/rtems/bspIo.h
index d0d8f83dcd..ed67c0ea10 100644
--- a/cpukit/include/rtems/bspIo.h
+++ b/cpukit/include/rtems/bspIo.h
@@ -55,6 +55,9 @@ typedef int 	(*BSP_polling_getchar_function_type) 	(void);
 /**
  * This variable points to the BSP provided method to output a
  * character for the purposes of debug output.
+ *
+ * It must output only the specific character.  It must not perform character
+ * translations, e.g. "\n" to "\r\n".
  */
 extern 	BSP_output_char_function_type 		BSP_output_char;
 
diff --git a/cpukit/libcsupport/src/putk.c b/cpukit/libcsupport/src/putk.c
index 76fa8b0040..5a84a4be0b 100644
--- a/cpukit/libcsupport/src/putk.c
+++ b/cpukit/libcsupport/src/putk.c
@@ -29,7 +29,7 @@ int putk(const char *s)
   int len_out = 0;
 
   for (p=s ; *p ; p++, len_out++ )
-    BSP_output_char(*p);
-  BSP_output_char('\n');
+    rtems_putc(*p);
+  rtems_putc('\n');
   return len_out + 1;
 }
diff --git a/cpukit/libmisc/serdbg/termios_printk.c b/cpukit/libmisc/serdbg/termios_printk.c
index 01ed334563..510753dea7 100644
--- a/cpukit/libmisc/serdbg/termios_printk.c
+++ b/cpukit/libmisc/serdbg/termios_printk.c
@@ -85,9 +85,6 @@ void termios_printk_outputchar
     /*
      * send character to debug serial port
      */
-    if (c == '\n') {
-      termios_printk_tty->device.write(termios_printk_tty->minor,&cr,1);
-    }
     termios_printk_tty->device.write(termios_printk_tty->minor,&c,1);
   }
 }
-- 
2.12.3



More information about the devel mailing list