From 240f1e334f25065eccdb21977a4d379e36e01132 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 13 Nov 2012 09:51:32 +0100 Subject: [PATCH] base: Don't complete line breaks in UART drivers. --- base-hw/src/base/console.cc | 15 ++++++++++++++- base/include/drivers/uart/pl011_base.h | 10 +--------- base/include/drivers/uart/tl16c750_base.h | 9 --------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/base-hw/src/base/console.cc b/base-hw/src/base/console.cc index 74072cebf..cb7b92a0f 100644 --- a/base-hw/src/base/console.cc +++ b/base-hw/src/base/console.cc @@ -31,7 +31,20 @@ namespace Genode /** * Print a char to the console */ - void _out_char(char c) { Serial_log::put_char(c); } + void _out_char(char c) + { + enum { + ASCII_LINE_FEED = 10, + ASCII_CARRIAGE_RETURN = 13, + }; + + /* auto complete new line commands */ + if (c == ASCII_LINE_FEED) + Serial_log::put_char(ASCII_CARRIAGE_RETURN); + + /* print char */ + Serial_log::put_char(c); + } public: diff --git a/base/include/drivers/uart/pl011_base.h b/base/include/drivers/uart/pl011_base.h index 9aa0b040f..85b061bd9 100644 --- a/base/include/drivers/uart/pl011_base.h +++ b/base/include/drivers/uart/pl011_base.h @@ -26,12 +26,7 @@ namespace Genode { protected: - enum { - MAX_BAUD_RATE = 0xfffffff, - - ASCII_LINE_FEED = 10, - ASCII_CARRIAGE_RETURN = 13, - }; + enum { MAX_BAUD_RATE = 0xfffffff }; /** * Data register @@ -175,9 +170,6 @@ void Genode::Pl011_base::put_char(char const c) /* wait as long as the transmission buffer is full */ while (read()) ; - /* auto complete new line commands */ - if (c == ASCII_LINE_FEED) write(ASCII_CARRIAGE_RETURN); - /* transmit character */ write(c); _wait_until_ready(); diff --git a/base/include/drivers/uart/tl16c750_base.h b/base/include/drivers/uart/tl16c750_base.h index 493de9752..c96ac1eb1 100644 --- a/base/include/drivers/uart/tl16c750_base.h +++ b/base/include/drivers/uart/tl16c750_base.h @@ -19,11 +19,6 @@ namespace Genode { - enum { - ASCII_LINE_FEED = 10, - ASCII_CARRIAGE_RETURN = 13, - }; - /** * Base driver Texas instruments TL16C750 UART module * @@ -219,10 +214,6 @@ namespace Genode /* wait as long as the transmission buffer is full */ while (!read()) ; - /* auto complete new line commands */ - if (c == ASCII_LINE_FEED) - write(ASCII_CARRIAGE_RETURN); - /* transmit character */ write(c); }