From 658d387ad5baa72dee3c775e6bef8215c9fe6ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 8 Aug 2009 02:23:22 +0000 Subject: [PATCH] [ARM] - cleanup, - add an uart_debug_port() to avoid using the #define in serial.cpp, - use board_config defines in uart.c. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32201 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/u-boot/serial.cpp | 10 +++++----- src/system/boot/platform/u-boot/uart.c | 18 ++++++++++-------- src/system/boot/platform/u-boot/uart.h | 1 + 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/system/boot/platform/u-boot/serial.cpp b/src/system/boot/platform/u-boot/serial.cpp index b00ece639d..afe84e890f 100644 --- a/src/system/boot/platform/u-boot/serial.cpp +++ b/src/system/boot/platform/u-boot/serial.cpp @@ -25,7 +25,7 @@ static uint32 sBufferPosition; static void serial_putc(char c) { - uart_putc(0,c); + uart_putc(uart_debug_port(),c); } @@ -68,12 +68,12 @@ serial_disable(void) extern "C" void serial_enable(void) { + /* should already be initialized by U-Boot */ + /* uart_init_early(); uart_init();//todo - uart_init_port(0,9600); - //uart_init_port(1,9600); - //uart_init_port(2,9600); - + uart_init_port(uart_debug_port(),9600); + */ sSerialEnabled++; } diff --git a/src/system/boot/platform/u-boot/uart.c b/src/system/boot/platform/u-boot/uart.c index 3f3ef7696f..732fb884de 100644 --- a/src/system/boot/platform/u-boot/uart.c +++ b/src/system/boot/platform/u-boot/uart.c @@ -23,13 +23,10 @@ #include #include #include -#include +#include //#include -//TODO: beaglespecific ?... -#define DEBUG_UART 2 - - +#define DEBUG_UART BOARD_DEBUG_UART struct uart_stat { addr_t base; @@ -37,9 +34,9 @@ struct uart_stat { }; static struct uart_stat uart[3] = { - { FFUART_BASE, 2 }, - { BTUART_BASE, 2 }, - { STUART_BASE, 2 }, + { BOARD_UART1_BASE, 2 }, + { BOARD_UART2_BASE, 2 }, + { BOARD_UART3_BASE, 2 }, }; static inline void write_uart_reg(int port, uint reg, unsigned char data) @@ -90,6 +87,11 @@ static inline unsigned char read_uart_reg(int port, uint reg) #define V_NS16550_CLK (48000000) /* 48MHz (APLL96/2) */ +int uart_debug_port(void) +{ + return DEBUG_UART; +} + void uart_init_port(int port, uint baud) { /* clear the tx & rx fifo and disable */ diff --git a/src/system/boot/platform/u-boot/uart.h b/src/system/boot/platform/u-boot/uart.h index a3edc7f825..3c3826649e 100644 --- a/src/system/boot/platform/u-boot/uart.h +++ b/src/system/boot/platform/u-boot/uart.h @@ -31,6 +31,7 @@ extern "C" { void uart_init(void); void uart_init_early(void); +int uart_debug_port(void); int uart_putc(int port, char c); int uart_getc(int port, bool wait);