From d74a92d1fd4c69d98175d42f138fc3a22e622ba8 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 16 Apr 2001 20:02:27 +0000 Subject: 2001-04-16 Joel Sherrill * mongoosev/duart/mg5uart.c, mongoosev/duart/mg5uart.h Modifications made with Gregory Menke as he debugged this BSP using a logic analyzer. In particular, there was a mistake where the index not offset of registers was in the header file and the baud rate calculation was incorrect. --- c/src/lib/libcpu/mips/ChangeLog | 8 ++++++++ c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.c | 13 +++---------- c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.h | 14 +++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) (limited to 'c/src/lib/libcpu') diff --git a/c/src/lib/libcpu/mips/ChangeLog b/c/src/lib/libcpu/mips/ChangeLog index f9c58d92b2..22c6ea1a26 100644 --- a/c/src/lib/libcpu/mips/ChangeLog +++ b/c/src/lib/libcpu/mips/ChangeLog @@ -1,3 +1,11 @@ +2001-04-16 Joel Sherrill + + * mongoosev/duart/mg5uart.c, mongoosev/duart/mg5uart.h + Modifications made with Gregory Menke + as he debugged this BSP using a logic analyzer. In particular, + there was a mistake where the index not offset of registers was + in the header file and the baud rate calculation was incorrect. + 2001-03-13 Joel Sherrill * Added mongoose-v, mongoose-v/include, and mongoose-v/vectorisrs diff --git a/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.c b/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.c index d41bdcdac7..c9355586e3 100644 --- a/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.c +++ b/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.c @@ -262,7 +262,7 @@ MG5UART_STATIC int mg5uart_open( /* XXX default baud rate could be from configuration table */ - (void) mg5uart_baud_rate( minor, B9600, &baudcmd ); + (void) mg5uart_baud_rate( minor, B19200, &baudcmd ); /* * Set the DUART channel to a default useable state @@ -686,7 +686,7 @@ MG5UART_STATIC int mg5uart_baud_rate( if (!baud_requested) baud_requested = B9600; /* default to 9600 baud */ - baud_requested = termios_baud_to_number( B9600 ); + baud_requested = termios_baud_to_number( baud_requested ); clock = (rtems_unsigned32) Console_Port_Tbl[minor].ulClock; if (!clock) @@ -694,16 +694,9 @@ MG5UART_STATIC int mg5uart_baud_rate( /* * Formula is Code = round(ClockFrequency / Baud - 1). - * - * Since this is integer math, we will divide by twice the baud and - * check the remaining odd bit. */ - tmp_code = (clock / (baud_requested * 2)); - if ( tmp_code & 0x01 ) - tmp_code = (tmp_code >> 1) + 1; - else - tmp_code = (tmp_code >> 1); + tmp_code = (clock / baud_requested) - 1; /* * From section 12.7, "Keep C>100 for best receiver operation." diff --git a/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.h b/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.h index 7b1d647b50..11cc7ab686 100644 --- a/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.h +++ b/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.h @@ -34,15 +34,15 @@ extern "C" { */ /* shared registers from peripheral base (i.e. from ulCtrlPort1) */ -#define MG5UART_COMMAND_REGISTER 0 -#define MG5UART_STATUS_REGISTER 1 -#define MG5UART_INTERRUPT_CAUSE_REGISTER 2 -#define MG5UART_INTERRUPT_MASK_REGISTER 3 +#define MG5UART_COMMAND_REGISTER 0x00 +#define MG5UART_STATUS_REGISTER 0x04 +#define MG5UART_INTERRUPT_CAUSE_REGISTER 0x08 +#define MG5UART_INTERRUPT_MASK_REGISTER 0x0c /* port specific registers from uart base (i.e. from ulCtrlPort2) */ -#define MG5UART_RX_BUFFER 0 -#define MG5UART_TX_BUFFER 1 -#define MG5UART_BAUD_RATE 2 +#define MG5UART_RX_BUFFER 0x00 +#define MG5UART_TX_BUFFER 0x04 +#define MG5UART_BAUD_RATE 0x08 /* * Interrupt mask values -- cgit v1.2.3