- 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
This commit is contained in:
François Revol 2009-08-08 02:23:22 +00:00
parent a4d5e47408
commit 658d387ad5
3 changed files with 16 additions and 13 deletions

View File

@ -25,7 +25,7 @@ static uint32 sBufferPosition;
static void static void
serial_putc(char c) serial_putc(char c)
{ {
uart_putc(0,c); uart_putc(uart_debug_port(),c);
} }
@ -68,12 +68,12 @@ serial_disable(void)
extern "C" void extern "C" void
serial_enable(void) serial_enable(void)
{ {
/* should already be initialized by U-Boot */
/*
uart_init_early(); uart_init_early();
uart_init();//todo uart_init();//todo
uart_init_port(0,9600); uart_init_port(uart_debug_port(),9600);
//uart_init_port(1,9600); */
//uart_init_port(2,9600);
sSerialEnabled++; sSerialEnabled++;
} }

View File

@ -23,13 +23,10 @@
#include <debug.h> #include <debug.h>
#include <arch/arm/reg.h> #include <arch/arm/reg.h>
#include <arch/arm/uart.h> #include <arch/arm/uart.h>
#include <arch/arm/pxa270.h> #include <board_config.h>
//#include <target/debugconfig.h> //#include <target/debugconfig.h>
//TODO: beaglespecific ?... #define DEBUG_UART BOARD_DEBUG_UART
#define DEBUG_UART 2
struct uart_stat { struct uart_stat {
addr_t base; addr_t base;
@ -37,9 +34,9 @@ struct uart_stat {
}; };
static struct uart_stat uart[3] = { static struct uart_stat uart[3] = {
{ FFUART_BASE, 2 }, { BOARD_UART1_BASE, 2 },
{ BTUART_BASE, 2 }, { BOARD_UART2_BASE, 2 },
{ STUART_BASE, 2 }, { BOARD_UART3_BASE, 2 },
}; };
static inline void write_uart_reg(int port, uint reg, unsigned char data) 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) */ #define V_NS16550_CLK (48000000) /* 48MHz (APLL96/2) */
int uart_debug_port(void)
{
return DEBUG_UART;
}
void uart_init_port(int port, uint baud) void uart_init_port(int port, uint baud)
{ {
/* clear the tx & rx fifo and disable */ /* clear the tx & rx fifo and disable */

View File

@ -31,6 +31,7 @@ extern "C" {
void uart_init(void); void uart_init(void);
void uart_init_early(void); void uart_init_early(void);
int uart_debug_port(void);
int uart_putc(int port, char c); int uart_putc(int port, char c);
int uart_getc(int port, bool wait); int uart_getc(int port, bool wait);