summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/csb337
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-19 06:28:01 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 13:08:32 +0200
commitd7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc (patch)
treecaa54b4229e86a68c84ab5961af34e087dce5302 /c/src/lib/libbsp/arm/csb337
parentbsps/powerpc: Move shared btimer support (diff)
downloadrtems-d7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc.tar.bz2
bsps: Move console drivers to bsps
This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'c/src/lib/libbsp/arm/csb337')
-rw-r--r--c/src/lib/libbsp/arm/csb337/Makefile.am10
-rw-r--r--c/src/lib/libbsp/arm/csb337/console/dbgu.c223
-rw-r--r--c/src/lib/libbsp/arm/csb337/console/fbcons.c125
-rw-r--r--c/src/lib/libbsp/arm/csb337/console/sed1356.c461
-rw-r--r--c/src/lib/libbsp/arm/csb337/console/uarts.c243
-rw-r--r--c/src/lib/libbsp/arm/csb337/console/usart.c261
6 files changed, 5 insertions, 1318 deletions
diff --git a/c/src/lib/libbsp/arm/csb337/Makefile.am b/c/src/lib/libbsp/arm/csb337/Makefile.am
index 23a87975bb..523f4a5523 100644
--- a/c/src/lib/libbsp/arm/csb337/Makefile.am
+++ b/c/src/lib/libbsp/arm/csb337/Makefile.am
@@ -43,15 +43,15 @@ librtemsbsp_a_SOURCES += timer/timer.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/legacy-console.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/legacy-console-control.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/legacy-console-select.c
-librtemsbsp_a_SOURCES += console/uarts.c
-librtemsbsp_a_SOURCES += console/dbgu.c
-librtemsbsp_a_SOURCES += console/usart.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb337/console/uarts.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb337/console/dbgu.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb337/console/usart.c
# IRQ
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
librtemsbsp_a_SOURCES += irq/irq.c
if ENABLE_LCD
-librtemsbsp_a_SOURCES += console/sed1356.c
-librtemsbsp_a_SOURCES += console/fbcons.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb337/console/sed1356.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/csb337/console/fbcons.c
endif
# umon
if ENABLE_UMON
diff --git a/c/src/lib/libbsp/arm/csb337/console/dbgu.c b/c/src/lib/libbsp/arm/csb337/console/dbgu.c
deleted file mode 100644
index 1a16762e32..0000000000
--- a/c/src/lib/libbsp/arm/csb337/console/dbgu.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Console driver for AT91RM9200 DBGU port
- *
- * This driver uses the shared console driver in
- * ...../libbsp/shared/console.c
- *
- * Copyright (c) 2003 by Cogent Computer Systems
- * Written by Mike Kelly <mike@cogcomp.com>
- * and Jay Monkman <jtm@lopingdog.com>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-#include <bsp.h>
-#include <rtems/libio.h>
-#include <termios.h>
-
-#include <at91rm9200.h>
-#include <at91rm9200_dbgu.h>
-#include <at91rm9200_pmc.h>
-#include <rtems/bspIo.h>
-#include <libchip/serial.h>
-#include <libchip/sersupp.h>
-
-volatile int dbg_dly;
-
-/* static function prototypes */
-static int dbgu_first_open(int major, int minor, void *arg);
-static int dbgu_last_close(int major, int minor, void *arg);
-static int dbgu_read(int minor);
-static ssize_t dbgu_write(int minor, const char *buf, size_t len);
-static void dbgu_init(int minor);
-static void dbgu_write_polled(int minor, char c);
-static int dbgu_set_attributes(int minor, const struct termios *t);
-
-/* Pointers to functions for handling the UART. */
-const console_fns dbgu_fns =
-{
- libchip_serial_default_probe,
- dbgu_first_open,
- dbgu_last_close,
- dbgu_read,
- dbgu_write,
- dbgu_init,
- dbgu_write_polled, /* not used in this driver */
- dbgu_set_attributes,
- FALSE /* TRUE if interrupt driven, FALSE if not. */
-};
-/*********************************************************************/
-/* Functions called via callbacks (i.e. the ones in uart_fns */
-/*********************************************************************/
-
-/*
- * This is called the first time each device is opened. Since
- * the driver is polled, we don't have to do anything. If the driver
- * were interrupt driven, we'd enable interrupts here.
- */
-static int dbgu_first_open(int major, int minor, void *arg)
-{
- return 0;
-}
-
-
-/*
- * This is called the last time each device is closed. Since
- * the driver is polled, we don't have to do anything. If the driver
- * were interrupt driven, we'd disable interrupts here.
- */
-static int dbgu_last_close(int major, int minor, void *arg)
-{
- return 0;
-}
-
-
-/*
- * Read one character from UART.
- *
- * return -1 if there's no data, otherwise return
- * the character in lowest 8 bits of returned int.
- */
-static int dbgu_read(int minor)
-{
- char c;
- console_tbl *console_entry;
- at91rm9200_dbgu_regs_t *dbgu;
-
- console_entry = BSP_get_uart_from_minor(minor);
-
- if (console_entry == NULL) {
- return -1;
- }
-
- dbgu = (at91rm9200_dbgu_regs_t *)console_entry->ulCtrlPort1;
-
- if (!(dbgu->sr & DBGU_INT_RXRDY)) {
- return -1;
- }
-
- c = dbgu->rhr & 0xff;
-
- return c;
-}
-
-
-/*
- * Write buffer to UART
- *
- * return 1 on success, -1 on error
- */
-static ssize_t dbgu_write(int minor, const char *buf, size_t len)
-{
- int i, x;
- char c;
- console_tbl *console_entry;
- at91rm9200_dbgu_regs_t *dbgu;
-
- console_entry = BSP_get_uart_from_minor(minor);
-
- if (console_entry == NULL) {
- return -1;
- }
-
- dbgu = (at91rm9200_dbgu_regs_t *)console_entry->ulCtrlPort1;
-
- for (i = 0; i < len; i++) {
- /* Wait for fifo to have room */
- while(1) {
- if (dbgu->sr & DBGU_INT_TXRDY) {
- break;
- }
- }
-
- c = (char) buf[i];
- dbgu->thr = c;
-
- /* the TXRDY flag does not seem to update right away (is this true?) */
- /* so we wait a bit before continuing */
- for (x = 0; x < 100; x++) {
- dbg_dly++; /* using a global so this doesn't get optimized out */
- }
- }
-
- return 1;
-}
-
-
-/* Set up the UART. */
-static void dbgu_init(int minor)
-{
- console_tbl *console_entry;
- at91rm9200_dbgu_regs_t *dbgu;
-
- console_entry = BSP_get_uart_from_minor(minor);
-
- if (console_entry == NULL) {
- return;
- }
-
- dbgu = (at91rm9200_dbgu_regs_t *)console_entry->ulCtrlPort1;
-
- /* Clear error bits, and reset */
- dbgu->cr = (DBGU_CR_RSTSTA | DBGU_CR_RSTTX | DBGU_CR_RSTRX);
-
- /* Clear pending interrupts */
- dbgu->idr = DBGU_INT_ALL;
- dbgu->imr = 0;
-
- /* Set port to no parity, no loopback */
- dbgu->mr = DBGU_MR_PAR_NONE | DBGU_MR_CHMODE_NORM;
-
- /* Set the baud rate */
- dbgu->brgr = (at91rm9200_get_mck() / 16) / BSP_get_baud();
-
- /* Enable the DBGU */
- dbgu->cr = (DBGU_CR_TXEN | DBGU_CR_RXEN);
-}
-
-/* This is used for getchark support */
-static void dbgu_write_polled(int minor, char c)
-{
- dbgu_write(minor, &c, 1);
-}
-
-/* This is for setting baud rate, bits, etc. */
-static int dbgu_set_attributes(int minor, const struct termios *t)
-{
- return 0;
-}
-
-/***********************************************************************/
-/*
- * The following functions are not used by TERMIOS, but other RTEMS
- * functions use them instead.
- */
-/***********************************************************************/
-/*
- * Read from UART. This is used in the exit code, and can't
- * rely on interrupts.
- */
-static int dbgu_poll_read(int minor)
-{
- return dbgu_read(minor);
-}
-
-
-/*
- * Write a character to the console. This is used by printk() and
- * maybe other low level functions. It should not use interrupts or any
- * RTEMS system calls. It needs to be very simple
- */
-static void _BSP_put_char( char c ) {
- dbgu_write_polled(0, c);
-}
-
-BSP_output_char_function_type BSP_output_char = _BSP_put_char;
-
-static int _BSP_poll_char(void)
-{
- return dbgu_poll_read(0);
-}
-
-BSP_polling_getchar_function_type BSP_poll_char = _BSP_poll_char;
diff --git a/c/src/lib/libbsp/arm/csb337/console/fbcons.c b/c/src/lib/libbsp/arm/csb337/console/fbcons.c
deleted file mode 100644
index 62e840938d..0000000000
--- a/c/src/lib/libbsp/arm/csb337/console/fbcons.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * LCD Console Output Driver for CSBx37
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * Modified by Fernando Nicodemos <fgnicodemos@terra.com.br>
- * from NCB - Sistemas Embarcados Ltda. (Brazil)
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <bsp.h>
-#include <rtems/libio.h>
-#include <termios.h>
-
-#include <rtems/bspIo.h>
-#include <libchip/serial.h>
-#include <libchip/sersupp.h>
-#include "sed1356.h"
-
-/* static function prototypes */
-static int fbcons_first_open(int major, int minor, void *arg);
-static int fbcons_last_close(int major, int minor, void *arg);
-static int fbcons_read(int minor);
-static ssize_t fbcons_write(int minor, const char *buf, size_t len);
-static void fbcons_init(int minor);
-static void fbcons_write_polled(int minor, char c);
-static int fbcons_set_attributes(int minor, const struct termios *t);
-
-/* Pointers to functions for handling the UART. */
-const console_fns fbcons_fns =
-{
- libchip_serial_default_probe,
- fbcons_first_open,
- fbcons_last_close,
- fbcons_read,
- fbcons_write,
- fbcons_init,
- fbcons_write_polled, /* not used in this driver */
- fbcons_set_attributes,
- FALSE /* TRUE if interrupt driven, FALSE if not. */
-};
-/*********************************************************************/
-/* Functions called via callbacks (i.e. the ones in uart_fns */
-/*********************************************************************/
-
-/*
- * This is called the first time each device is opened. Since
- * the driver is polled, we don't have to do anything. If the driver
- * were interrupt driven, we'd enable interrupts here.
- */
-static int fbcons_first_open(int major, int minor, void *arg)
-{
- /* printk( "Frame buffer -- first open\n" ); */
- return 0;
-}
-
-
-/*
- * This is called the last time each device is closed. Since
- * the driver is polled, we don't have to do anything. If the driver
- * were interrupt driven, we'd disable interrupts here.
- */
-static int fbcons_last_close(int major, int minor, void *arg)
-{
- /* printk( "Frame buffer -- last close\n" ); */
- return 0;
-}
-
-
-/*
- * Read one character from UART.
- *
- * return -1 if there's no data, otherwise return
- * the character in lowest 8 bits of returned int.
- */
-static int fbcons_read(int minor)
-{
- /* printk( "Frame buffer -- read\n" ); */
- return -1;
-}
-
-
-/*
- * Write buffer to LCD
- *
- * return 1 on success, -1 on error
- */
-static ssize_t fbcons_write(int minor, const char *buf, size_t len)
-{
- int i;
-
- /* printk( "Frame buffer -- write\n" ); */
- for ( i=0 ; i<len ; i++ )
- sed_putchar( buf[i] );
-
- return 1;
-}
-
-
-/* Set up the LCD controller. */
-static void fbcons_init(int minor)
-{
- /* printk( "Initializing frame buffer\n" ); */
- sed_init();
-}
-
-/* This is used for putchark support */
-static void fbcons_write_polled(int minor, char c)
-{
- /* printk( "frame buffer -- write polled\n" ); */
- sed_putchar( c );
-}
-
-/* This is for setting baud rate, bits, etc. */
-static int fbcons_set_attributes(int minor, const struct termios *t)
-{
- /* printk( "frame buffer -- set attributes\n" ); */
- return 0;
-}
diff --git a/c/src/lib/libbsp/arm/csb337/console/sed1356.c b/c/src/lib/libbsp/arm/csb337/console/sed1356.c
deleted file mode 100644
index f87a322a01..0000000000
--- a/c/src/lib/libbsp/arm/csb337/console/sed1356.c
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * SED1356 Support for KIT637_V6 (CSB637)
- *
- * Based upon code from MicroMonitor 1.17 from http://www.umonfw.com/
- * which includes this notice:
- */
-
-/*
- **************************************************************************
- * General notice:
- * This code is part of a boot-monitor package developed as a generic base
- * platform for embedded system designs. As such, it is likely to be
- * distributed to various projects beyond the control of the original
- * author. Please notify the author of any enhancements made or bugs found
- * so that all may benefit from the changes. In addition, notification back
- * to the author will allow the new user to pick up changes that may have
- * been made by other users after this version of the code was distributed.
- *
- * Note1: the majority of this code was edited with 4-space tabs.
- * Note2: as more and more contributions are accepted, the term "author"
- * is becoming a mis-representation of credit.
- *
- * Original author: Ed Sutter
- * Email: esutter@alcatel-lucent.com
- * Phone: 908-582-2351
- **************************************************************************
- *
- * Ed Sutter has been informed that this code is being used in RTEMS.
- *
- * This code was reformatted by Joel Sherrill from OAR Corporation and
- * Fernando Nicodemos <fgnicodemos@terra.com.br> from NCB - Sistemas
- * Embarcados Ltda. (Brazil) to be more compliant with RTEMS coding
- * standards and to eliminate C++ style comments.
- */
-
-#include <bsp.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "sed1356.h"
-#include "font8x16.h"
-
-int mode900lq;
-long PIXELS_PER_ROW;
-long PIXELS_PER_COL;
-long COLS_PER_SCREEN;
-long ROWS_PER_SCREEN;
-long SED_HOR_PULSE_WIDTH_LCD;
-long SED_VER_PULSE_START_LCD;
-long SED_HOR_PULSE_START_LCD;
-long SED_HOR_NONDISP_LCD;
-long SED_VER_NONDISP_LCD;
-long SED_VER_PULSE_WIDTH_LCD;
-
-/* globals to keep track of foreground, background colors and x,y position */
-int sed_color_depth; /* 4, 8 or 16 */
-int sed_fg_color; /* 0 to 15, used as lookup into VGA color table */
-int sed_bg_color; /* 0 to 15, used as lookup into VGA color table */
-int sed_col; /* current column, 0 to COLS_PER_SCREEN - 1 */
-int sed_row; /* current row, 0 to (ROWS_PER_SCREEN * 2) - 1 */
-int sed_disp_mode_crt; /* CRT=1, LCD=0 */
-int sed135x_ok;
-int sed135x_tst;
-uint32_t sed_fb_offset; /* current offset into frame buffer for sed_putchar */
-
-void sed_writechar(uint8_t c);
-void sed_scroll(void);
-
-#define SED_REG_BASE 0x30000000 /* *CS2 */
-#define SED_MEM_BASE (SED_REG_BASE + 0x00200000)
-#define SED_STEP 1 /* 16-bit port on 16-bit boundry */
-
-#define SED_REG16(_x_) *(volatile uint16_t *)((uint32_t)SED_REG_BASE + (((uint32_t)_x_ * SED_STEP) ^ 0)) /* Control/Status Registers, 16-bit mode */
-#define RD_FB16(_reg_,_val_) ((_val_) = *((volatile uint16_t *)(((uint32_t)SED_MEM_BASE + ((uint32_t)(_reg_ * SED_STEP) ^ 0)))))
-#define WR_FB16(_reg_,_val_) (*((volatile uint16_t *)(((uint32_t)SED_MEM_BASE + ((uint32_t)(_reg_ * SED_STEP) ^ 0)))) = (_val_))
-
-#if 0
-#define SED1356_REG_LCD_HOR_DISP SED_REG16(0x32)
-#define SED1356_REG_LCD_HOR_NONDISP_and_START SED_REG16(0x34)
-#define SED1356_REG_LCD_HOR_PULSE SED_REG16(0x36)
-#define SED1356_REG_LCD_VER_DISP_HT_LO_and_HI SED_REG16(0x38)
-#define SED1356_REG_LCD_VER_NONDISP_and_START SED_REG16(0x3a)
-#define SED1356_REG_LCD_VER_PULSE SED_REG16(0x3c)
-#define SED1356_REG_LCD_DISP_MODE_and_MISC SED_REG16(0x40)
-#define SED1356_REG_LCD_DISP_START_LO_and_MID SED_REG16(0x42)
-#define SED1356_REG_LCD_DISP_START_HI SED_REG16(0x44)
-#define SED1356_REG_LCD_ADD_OFFSET_LO_and_HI SED_REG16(0x46)
-#define SED1356_REG_LCD_PIXEL_PAN SED_REG16(0x48)
-#define SED1356_REG_LCD_FIFO_THRESH_LO_and_HI SED_REG16(0x4a)
-#endif
-
-
-#define H2SED(_x_) (_x_)
-
-#define FB_SIZE (640 * 480)
-#define SED_ROW_SIZE(_depth_) ((PIXELS_PER_ROW * _depth_) / 8)
-#define SED_FB_SIZE(_depth_) (((PIXELS_PER_COL * PIXELS_PER_ROW) * _depth_) / 8)
-
-#define FONT_WIDTH 8
-#define FONT_HEIGHT 16
-
-#define SED_GET_ADD(_row_, _col_, _depth_) \
- (((((_row_ * PIXELS_PER_ROW) * FONT_HEIGHT) \
- + (_col_ * FONT_WIDTH)) \
- * _depth_) / 8)
-
-
-#define SED_GET_PHYS_ADD(_reg_) \
- (volatile unsigned long)(SED_MEM_BASE + ((_reg_ * SED_STEP) ^ 0))
-
-
-#include "sed1356_16bit.h"
-
-/* #define SED_DBG */
-int sed135x_tst = 0;
-
-void sed_write_frame_buffer(
- uint32_t i,
- uint16_t wr16
-)
-{
- WR_FB16(i, wr16);
-}
-
-int sed_frame_buffer_size(void)
-{
- return SED_FB_SIZE(sed_color_depth);
-}
-
-void sed_clr_row(int char_row)
-{
- unsigned long sed_mem_add;
- int i;
- uint16_t wr16;
-
- /* clear the desired row */
- sed_mem_add = SED_GET_ADD(char_row, 0, sed_color_depth);
-
-#ifdef SED_DBG
- sed135x_tst = 1;
- printf("SED Clear Row %d, FB Add 0x%08lx, CPU Add 0x%08lx.\n ", char_row, sed_mem_add, SED_GET_PHYS_ADD(sed_mem_add));
- sed135x_tst = 0;
-#endif
-
- switch (sed_color_depth)
- {
- case 4:
- wr16 = ((sed_bg_color << 12) | (sed_bg_color << 8) | (sed_bg_color << 4) | (sed_bg_color << 0));
-#ifdef SED_DBG
- sed135x_tst = 1;
- printf("SED Clear Row %d, FB Add 0x%08lx to 0x%08lx.\n ", char_row, sed_mem_add, sed_mem_add + ((PIXELS_PER_ROW * FONT_HEIGHT) / 2));
- sed135x_tst = 0;
-#endif
- for (i = 0; i < ((PIXELS_PER_ROW * FONT_HEIGHT) / 2); i += 2){
- WR_FB16(sed_mem_add, wr16);
- sed_mem_add += 2;
- } /* for font_row */
- break;
- case 8:
- wr16 = ((sed_bg_color << 8) | (sed_bg_color << 0));
- for (i = 0; i < (PIXELS_PER_ROW * FONT_HEIGHT); i += 2){
- WR_FB16(sed_mem_add, wr16);
- sed_mem_add += 2;
- } /* for font_row */
- break;
- case 16:
- wr16 = ((vga_lookup[sed_bg_color]));
- for (i = 0; i < ((PIXELS_PER_ROW * FONT_HEIGHT) * 2); i += 2){
- WR_FB16(sed_mem_add, wr16);
- sed_mem_add += 2;
- } /* for font_row */
- break;
- } /* switch sed_color_depth */
-} /* sed_clr_row */
-
-void sed_init(void)
-{
- mode900lq = 0;
- PIXELS_PER_ROW = 640;
- PIXELS_PER_COL = 480;
- COLS_PER_SCREEN = 80;
- ROWS_PER_SCREEN = 30;
- SED_HOR_PULSE_WIDTH_LCD = 0x0b;
- SED_HOR_NONDISP_LCD = 0x13;
- SED_VER_PULSE_WIDTH_LCD = 0x01;
- SED_VER_PULSE_START_LCD = 0x09;
- SED_VER_NONDISP_LCD = 0x2c;
-
- sed_color_depth = 16; /* 16 => vga lookup */
- sed_fg_color = 14; /* Bright Yellow */
- sed_bg_color = 1; /* Blue */
- sed_disp_mode_crt = 0; /* default to LCD */
- sed_fb_offset = 0x00;
- sed_row = 0;
- sed_col = 0;
-
- sed135x_ok = 1;
- sed135x_tst = 0;
- sed_clearscreen();
-}
-
-/*
- * sed_putchar()
- *
- * This routine parses the character and calls sed_writechar if it is a
- * printable character
- */
-void sed_putchar(char c)
-{
-
- if ((sed135x_ok == 0) || (sed135x_tst == 1)) return;
-
- /* First parse the character to see if it printable or an
- * acceptable control character.
- */
- switch (c) {
- case '\r':
- sed_col = 0;
- return;
- case '\n':
- sed_col = 0;
- sed_scroll();
- return;
- case '\b':
- sed_col--;
- if (sed_col < 0) {
- sed_row--;
- if (sed_row < 0)
- sed_row = 0;
- sed_col = COLS_PER_SCREEN - 1;
- }
- c = 0; /* erase the character */
- sed_writechar(c);
- break;
- default:
- if (((uint8_t)c < FIRST_CHAR) || ((uint8_t)c > LAST_CHAR))
- return; /* drop anything we can't print */
- c -= FIRST_CHAR; /* get aligned to the first printable character */
- sed_writechar(c);
- /* advance to next column */
- sed_col++;
- if (sed_col == COLS_PER_SCREEN) {
- sed_col = 0;
- sed_scroll();
- }
- break;
- }
-
-} /* sed_putchar() */
-
-/*
- * sed_writechar()
- *
- * This routine writes the character to the screen at the current cursor
- * location.
- */
-void sed_writechar(uint8_t c)
-{
- uint32_t sed_mem_add;
- int font_row, font_col;
- uint8_t font_data8;
- uint16_t wr16;
-
- /* Convert the current row,col and color depth values
- * into an address
- */
- sed_mem_add = SED_GET_ADD(sed_row, sed_col, sed_color_depth);
-
-#ifdef SED_DBG
- sed135x_tst = 1;
- printf("SED writechar at row %d, col %d, FB Add 0x%08lx, CPU Add 0x%08lx.\n ", sed_row, sed_col, sed_mem_add, SED_GET_PHYS_ADD(sed_mem_add));
- sed135x_tst = 0;
-#endif
-
- if (FONT_WIDTH == 8) {
- switch (sed_color_depth) {
- case 4:
- /* Now render the font by painting one font row at a time */
- for (font_row = 0; font_row < FONT_HEIGHT; font_row++) {
- /* get the font row of data */
- font_data8 = font8x16[(c * FONT_HEIGHT) + font_row];
-
-
- for (font_col = 0; font_col < 8; font_col += 4)
- {
- /* get a words worth of pixels */
- wr16 = (((font_data8 & 0x80) ? sed_fg_color << 12 : sed_bg_color << 12)
- | ((font_data8 & 0x40) ? sed_fg_color << 8 : sed_bg_color << 8)
- | ((font_data8 & 0x20) ? sed_fg_color << 4 : sed_bg_color << 4)
- | ((font_data8 & 0x10) ? sed_fg_color << 0 : sed_bg_color << 0));
- font_data8 = font_data8 << 4;
- WR_FB16(sed_mem_add, wr16);
- /* if we are in the 2nd frame buffer, write to the 1st
- * frame buffer also
- */
- if (sed_row > (ROWS_PER_SCREEN - 1)) {
- WR_FB16((sed_mem_add - SED_FB_SIZE(sed_color_depth)), wr16);
- }
- sed_mem_add += 2;
- } /* for font_col */
- /* go to the next pixel row */
- sed_mem_add += (SED_ROW_SIZE(sed_color_depth) - ((FONT_WIDTH * sed_color_depth) / 8));
- } /* for font_row */
- break;
-
- case 8:
- /* Now render the font by painting one font row at a time */
- for (font_row = 0; font_row < FONT_HEIGHT; font_row++) {
- /* get the font row of data */
- font_data8 = font8x16[(c * FONT_HEIGHT) + font_row];
- for (font_col = 0; font_col < 8; font_col += 2)
- {
- /* get a words worth of pixels */
- wr16 = (((font_data8 & 0x80) ? sed_fg_color << 8 : sed_bg_color << 8)
- | ((font_data8 & 0x40) ? sed_fg_color << 0 : sed_bg_color << 0));
- font_data8 = font_data8 << 2;
- WR_FB16(sed_mem_add, wr16);
- /* if we are in the 2nd frame buffer, write to the 1st
- * frame buffer also
- */
- if (sed_row > (ROWS_PER_SCREEN - 1)) {
- WR_FB16((sed_mem_add - SED_FB_SIZE(sed_color_depth)), wr16);
- }
- sed_mem_add += 2;
- } /* for font_col */
- /* go to the next pixel row */
- sed_mem_add += (SED_ROW_SIZE(sed_color_depth) - ((FONT_WIDTH * sed_color_depth) / 8));
- } /* for font_row */
- break;
-
- case 16:
- /* Now render the font by painting one font row at a time */
- for (font_row = 0; font_row < FONT_HEIGHT; font_row++) {
- /* get the font row of data */
- font_data8 = font8x16[(c * FONT_HEIGHT) + font_row];
- for (font_col = 0; font_col < 8; font_col++)
- {
- /* get a words worth of pixels */
- wr16 = ((font_data8 & 0x80) ?
- vga_lookup[sed_fg_color] : vga_lookup[sed_bg_color]);
- font_data8 = font_data8 << 1;
- WR_FB16(sed_mem_add, wr16);
- /* if we are in the 2nd frame buffer, write to the 1st
- * frame buffer also.
- */
- if (sed_row > (ROWS_PER_SCREEN - 1)) {
- WR_FB16((sed_mem_add - SED_FB_SIZE(sed_color_depth)), wr16);
- }
- sed_mem_add += 2;
- } /* for font_col */
- /* go to the next pixel row */
- sed_mem_add += (SED_ROW_SIZE(sed_color_depth) - ((FONT_WIDTH * sed_color_depth) / 8));
- } /* for font_row */
- break;
-
- } /* switch sed_color depth */
- } /* FONT_WIDTH == 8 */
- else
- {
- return;
- }
-} /* sed_writechar() */
-
-static void sed_update_fb_offset(void)
-{
- /* write the new sed_fb_offset value */
- if (sed_disp_mode_crt) {
- /* before we change the address offset, wait for the display to
- * go from active to non-active, unless the display is not enabled
- */
- if (SED1356_REG_DISP_MODE & H2SED(SED1356_DISP_MODE_CRT)) { /* CRT is on */
- while ((SED1356_REG_CRT_VER_NONDISP_and_START & H2SED(SED1356_VER_NONDISP)) == 0) {}
- while ((SED1356_REG_CRT_VER_NONDISP_and_START & H2SED(SED1356_VER_NONDISP)) == 1) {}
- }
- SED1356_REG_CRT_DISP_START_LO_and_MID = H2SED(((sed_fb_offset & 0x00ffff) >> 0));
- SED1356_REG_CRT_DISP_START_HI = H2SED(((sed_fb_offset & 0x070000) >> 16));
- }
- else /* LCD */
- {
- if (SED1356_REG_DISP_MODE & H2SED(SED1356_DISP_MODE_LCD)) { /* LCD is on */
- while ((SED1356_REG_LCD_VER_NONDISP_and_START & H2SED(SED1356_VER_NONDISP)) == 0) {}
- while ((SED1356_REG_LCD_VER_NONDISP_and_START & H2SED(SED1356_VER_NONDISP)) == 1) {}
- }
- SED1356_REG_LCD_DISP_START_LO_and_MID = H2SED(((sed_fb_offset & 0x00ffff) >> 0));
- SED1356_REG_LCD_DISP_START_HI = H2SED(((sed_fb_offset & 0x070000) >> 16));
- }
-}
-
-/* sed_scroll()
- *
- * Because we are most likely running out of FLASH and probably also with
- * cache disabled, a brute force memcpy of the whole screen would be very
- * slow, even with reduced color depths. Instead, we define a frame buffer
- * that is twice the size of our actual display. This does limit us to a
- * 1Mbyte active display size, but 640 x 480 @ 16-bits/pixel = 614K so it
- * works just fine. 800 x 600 can be had by reducing the color depth to
- * 8-bits/pixel and using the look up tables.
- *
- * With the double buffering, we always write to the first buffer, even
- * when the second buffer is active. This allows us to scroll by adjusting
- * the starting and ending addresses in the SED135x by one row. When we
- * reach the end of our virtual buffer, we reset the starting and ending
- * addresses to the first buffer. Note that we can not adjust the SED135x
- * registers until it is in vertical retrace. That means we have to wait
- * until it is in active display, then goes to non-display, unless the
- * screen is blanked, in which case we can update immediately.
- */
-void sed_scroll(void)
-{
- sed_row++;
-
- /* clear the new row(s) */
- sed_clr_row(sed_row);
- if (sed_row > (ROWS_PER_SCREEN - 1)) {
- sed_clr_row(sed_row - ROWS_PER_SCREEN);
- }
- /* when sed_y_pos is greater than ROWS_PER_SCREEN we just adjust the
- * start and end addresses in the SED135x. If it is equal to 2 *
- * ROWS_PER_SCREEN, we reset the start and end addresses to SED_MEM_BASE.
- */
- if (sed_row > (ROWS_PER_SCREEN - 1)) {
- if (sed_row > ((ROWS_PER_SCREEN * 2) - 1)) {
- sed_fb_offset = 0x00;
- sed_row = 0;
- sed_clearscreen();
- } else {
- /* calculate the new offset address of the frame buffer in words */
- sed_fb_offset += (SED_GET_ADD(1, 0, sed_color_depth) / 2);
- }
- sed_update_fb_offset();
- } /* if (sed_row > (ROWS_PER_SCREEN - 1)) */
-}
-
-void sed_putstring(char *s)
-{
- char *p = s;
- while (*p)
- sed_putchar(*p++);
-}
-
-void sed_clearscreen(void)
-{
- int i;
- uint16_t wr16;
- int bg = sed_bg_color;
- int fbsize = sed_frame_buffer_size();
-
- /* we double buffer so clear ALL of memory */
- fbsize *= 2;
-
- /* fill the frame buffer with incrementing color values */
- switch (sed_color_depth){
- case 4: wr16 = bg | bg << 4 | bg << 8 | bg << 12; break;
- case 8: wr16 = bg | bg << 8; break;
- /* 16-bits bypasses the lookup table */
- default: wr16 = vga_lookup[bg]; break;
- }
- for (i = 0; i < fbsize; i += 2){
- sed_write_frame_buffer(i, wr16);
- }
-}
diff --git a/c/src/lib/libbsp/arm/csb337/console/uarts.c b/c/src/lib/libbsp/arm/csb337/console/uarts.c
deleted file mode 100644
index b705a477b7..0000000000
--- a/c/src/lib/libbsp/arm/csb337/console/uarts.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Console driver for for KIT637_V6 (CSB637)
- *
- * This driver uses the shared console driver in
- * ...../libbsp/shared/console.c
- *
- * Copyright (c) 2003 by Cogent Computer Systems
- * Written by Jay Monkman <jtm@lopingdog.com>
- *
- * Modified by Fernando Nicodemos <fgnicodemos@terra.com.br>
- * from NCB - Sistemas Embarcados Ltda. (Brazil)
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- *
- * Modified and FrameBuffer Console Device Support added by
- * Joel Sherrill, 2009.
- */
-
-#include <bsp.h>
-#include <rtems/libio.h>
-#include <termios.h>
-#include <rtems/bspIo.h>
-
-#include <at91rm9200.h>
-#include <at91rm9200_dbgu.h>
-#include <libchip/serial.h>
-#include <libchip/sersupp.h>
-#include <bspopts.h>
-
-extern const console_fns dbgu_fns;
-
-#if ENABLE_LCD
- extern const console_fns fbcons_fns;
- #define LCD_DEV 1
-#else
- #define LCD_DEV 0
-#endif
-
-#if (ENABLE_UMON && ENABLE_UMON_CONSOLE)
- extern const console_fns umoncons_fns;
- #define UMON_CONS_DEV 1
-#else
- #define UMON_CONS_DEV 0
-#endif
-
-#if ENABLE_USART0 || ENABLE_USART1 || ENABLE_USART2 || ENABLE_USART3
- extern const console_fns usart_polling_fns;
-#endif
-
-#if ENABLE_USART0
- #define USART0_DEV 1
-#else
- #define USART0_DEV 0
-#endif
-
-#if ENABLE_USART1
- #define USART1_DEV 1
-#else
- #define USART1_DEV 0
-#endif
-
-#if ENABLE_USART2
- #define USART2_DEV 1
-#else
- #define USART2_DEV 0
-#endif
-
-#if ENABLE_USART3
- #define USART3_DEV 1
-#else
- #define USART3_DEV 0
-#endif
-
-#define NUM_DEVS \
- (1 + LCD_DEV + UMON_CONS_DEV + \
- USART0_DEV + USART1_DEV + USART2_DEV + USART3_DEV)
-
-/* These are used by code in console.c */
-unsigned long Console_Configuration_Count = NUM_DEVS;
-
-/*
- * There's one item in array for each UART.
- *
- * Some of these fields are marked "NOT USED". They are not used
- * by console.c, but may be used by drivers in libchip
- *
- * when we add other types of UARTS we will need to move this
- * structure to a generic uart.c file with only this in it
- */
-console_tbl Console_Configuration_Ports[] = {
- {
- "/dev/com0", /* sDeviceName */
- SERIAL_CUSTOM, /* deviceType */
- &dbgu_fns, /* pDeviceFns */
- NULL, /* deviceProbe */
- NULL, /* pDeviceFlow */
- 0, /* ulMargin - NOT USED */
- 0, /* ulHysteresis - NOT USED */
- NULL, /* pDeviceParams */
- DBGU_BASE, /* ulCtrlPort1 - Pointer to DBGU regs */
- 0, /* ulCtrlPort2 - NOT USED */
- 0, /* ulDataPort - NOT USED */
- NULL, /* getRegister - NOT USED */
- NULL, /* setRegister - NOT USED */
- NULL, /* getData - NOT USED */
- NULL, /* setData - NOT USED */
- 0, /* ulClock - NOT USED */
- 0 /* ulIntVector - NOT USED */
- },
-#if ENABLE_LCD
- {
- "/dev/fbcons", /* sDeviceName */
- SERIAL_CUSTOM, /* deviceType */
- &fbcons_fns, /* pDeviceFns */
- NULL, /* deviceProbe */
- NULL, /* pDeviceFlow */
- 0, /* ulMargin - NOT USED */
- 0, /* ulHysteresis - NOT USED */
- NULL, /* pDeviceParams */
- 0, /* ulCtrlPort1 - Pointer to DBGU regs */
- 0, /* ulCtrlPort2 - NOT USED */
- 0, /* ulDataPort - NOT USED */
- NULL, /* getRegister - NOT USED */
- NULL, /* setRegister - NOT USED */
- NULL, /* getData - NOT USED */
- NULL, /* setData - NOT USED */
- 0, /* ulClock - NOT USED */
- 0 /* ulIntVector - NOT USED */
- },
-#endif
-#if (ENABLE_UMON && ENABLE_UMON_CONSOLE)
- {
- "/dev/umon", /* sDeviceName */
- SERIAL_CUSTOM, /* deviceType */
- &umoncons_fns, /* pDeviceFns */
- NULL, /* deviceProbe */
- NULL, /* pDeviceFlow */
- 0, /* ulMargin - NOT USED */
- 0, /* ulHysteresis - NOT USED */
- NULL, /* pDeviceParams */
- 0, /* ulCtrlPort1 - Pointer to UMON regs */
- 0, /* ulCtrlPort2 - NOT USED */
- 0, /* ulDataPort - NOT USED */
- NULL, /* getRegister - NOT USED */
- NULL, /* setRegister - NOT USED */
- NULL, /* getData - NOT USED */
- NULL, /* setData - NOT USED */
- 0, /* ulClock - NOT USED */
- 0 /* ulIntVector - NOT USED */
- },
-#endif
-#if ENABLE_USART0
- {
- "/dev/com1", /* sDeviceName */
- SERIAL_CUSTOM, /* deviceType */
- &usart_polling_fns,/* pDeviceFns */
- NULL, /* deviceProbe */
- NULL, /* pDeviceFlow */
- 0, /* ulMargin - NOT USED */
- 0, /* ulHysteresis - NOT USED */
- NULL, /* pDeviceParams */
- USART0_BASE, /* ulCtrlPort1 - Pointer to USART 0 regs */
- 0, /* ulCtrlPort2 - NOT USED */
- 0, /* ulDataPort - NOT USED */
- NULL, /* getRegister - NOT USED */
- NULL, /* setRegister - NOT USED */
- NULL, /* getData - NOT USED */
- NULL, /* setData - NOT USED */
- 0, /* ulClock - NOT USED */
- 0 /* ulIntVector - NOT USED */
- },
-#endif
-#if ENABLE_USART1
- {
- "/dev/com2", /* sDeviceName */
- SERIAL_CUSTOM, /* deviceType */
- &usart_polling_fns,/* pDeviceFns */
- NULL, /* deviceProbe */
- NULL, /* pDeviceFlow */
- 0, /* ulMargin - NOT USED */
- 0, /* ulHysteresis - NOT USED */
- NULL, /* pDeviceParams */
- USART1_BASE, /* ulCtrlPort1 - Pointer to USART 1 regs */
- 0, /* ulCtrlPort2 - NOT USED */
- 0, /* ulDataPort - NOT USED */
- NULL, /* getRegister - NOT USED */
- NULL, /* setRegister - NOT USED */
- NULL, /* getData - NOT USED */
- NULL, /* setData - NOT USED */
- 0, /* ulClock - NOT USED */
- 0 /* ulIntVector - NOT USED */
- },
-#endif
-#if ENABLE_USART2
- {
- "/dev/com3", /* sDeviceName */
- SERIAL_CUSTOM, /* deviceType */
- &usart_polling_fns,/* pDeviceFns */
- NULL, /* deviceProbe */
- NULL, /* pDeviceFlow */
- 0, /* ulMargin - NOT USED */
- 0, /* ulHysteresis - NOT USED */
- NULL, /* pDeviceParams */
- USART2_BASE, /* ulCtrlPort1 - Pointer to USART 2 regs */
- 0, /* ulCtrlPort2 - NOT USED */
- 0, /* ulDataPort - NOT USED */
- NULL, /* getRegister - NOT USED */
- NULL, /* setRegister - NOT USED */
- NULL, /* getData - NOT USED */
- NULL, /* setData - NOT USED */
- 0, /* ulClock - NOT USED */
- 0 /* ulIntVector - NOT USED */
- },
-#endif
-#if ENABLE_USART3
- {
- "/dev/com4", /* sDeviceName */
- SERIAL_CUSTOM, /* deviceType */
- &usart_polling_fns,/* pDeviceFns */
- NULL, /* deviceProbe */
- NULL, /* pDeviceFlow */
- 0, /* ulMargin - NOT USED */
- 0, /* ulHysteresis - NOT USED */
- NULL, /* pDeviceParams */
- USART3_BASE, /* ulCtrlPort1 - Pointer to USART 3 regs */
- 0, /* ulCtrlPort2 - NOT USED */
- 0, /* ulDataPort - NOT USED */
- NULL, /* getRegister - NOT USED */
- NULL, /* setRegister - NOT USED */
- NULL, /* getData - NOT USED */
- NULL, /* setData - NOT USED */
- 0, /* ulClock - NOT USED */
- 0 /* ulIntVector - NOT USED */
- }
-#endif
-};
-
-console_tbl *BSP_get_uart_from_minor(int minor)
-{
- return Console_Port_Tbl[minor];
-}
diff --git a/c/src/lib/libbsp/arm/csb337/console/usart.c b/c/src/lib/libbsp/arm/csb337/console/usart.c
deleted file mode 100644
index 23b877ce64..0000000000
--- a/c/src/lib/libbsp/arm/csb337/console/usart.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Driver for AT91RM9200 USART ports
- */
-
-/*
- * COPYRIGHT (c) 2006-2009.
- * NCB - Sistemas Embarcados Ltda. (Brazil)
- * Fernando Nicodemos <fgnicodemos@terra.com.br>
- *
- * and
- *
- * COPYRIGHT (c) 1989-2009.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
-*/
-
-#include <bsp.h>
-#include <rtems/libio.h>
-#include <termios.h>
-
-#include <at91rm9200.h>
-#include <at91rm9200_usart.h>
-#include <at91rm9200_pmc.h>
-#include <rtems/bspIo.h>
-#include <libchip/serial.h>
-#include <libchip/sersupp.h>
-
-/* static function prototypes */
-static int usart_first_open(int major, int minor, void *arg);
-static int usart_last_close(int major, int minor, void *arg);
-static int usart_read_polled(int minor);
-static ssize_t usart_write_polled_support(int minor, const char *buf, size_t len);
-static void usart_init(int minor);
-static void usart_write_polled(int minor, char c);
-static int usart_set_attributes(int minor, const struct termios *t);
-at91rm9200_usart_regs_t *usart_get_base(int minor);
-
-/* Pointers to functions for handling the UART polled. */
-const console_fns usart_polling_fns = {
- libchip_serial_default_probe, /* deviceProbe */
- usart_first_open, /* deviceFirstOpen */
- usart_last_close, /* deviceLastClose */
- usart_read_polled, /* deviceRead */
- usart_write_polled_support, /* deviceWrite */
- usart_init, /* deviceInitialize */
- usart_write_polled, /* deviceWritePolled */
- usart_set_attributes, /* deviceSetAttributes */
- FALSE /* TRUE if interrupt driven, FALSE if not. */
-};
-
-at91rm9200_usart_regs_t *usart_get_base(int minor)
-{
- console_tbl *console_entry;
- at91rm9200_usart_regs_t *port;
-
- console_entry = BSP_get_uart_from_minor(minor);
-
- if (console_entry == NULL)
- return 0;
-
- port = (at91rm9200_usart_regs_t *) console_entry->ulCtrlPort1;
- //printk( "minor=%d entry=%p port=%p\n", minor, console_entry, port );
-
- return port;
-}
-
-/*
- * Functions called via callbacks (i.e. the ones in uart_fns
- */
-
-/*
- * This is called the first time each device is opened. Since
- * the driver is polled, we don't have to do anything. If the driver
- * were interrupt driven, we'd enable interrupts here.
- */
-static int usart_first_open(int major, int minor, void *arg)
-{
- at91rm9200_usart_regs_t *usart;
-
- usart = usart_get_base(minor);
- if ( !usart )
- return -1;
-
- /* XXX port isn't being initialized or enabled */
-
- /* XXX I hope this is enough */
- usart->cr = (US_CR_RXEN | US_CR_TXEN);
- return 0;
-}
-
-/*
- * This is called the last time each device is closed. Since
- * the driver is polled, we don't have to do anything. If the driver
- * were interrupt driven, we'd disable interrupts here.
- */
-static int usart_last_close(int major, int minor, void *arg)
-{
- at91rm9200_usart_regs_t *usart;
-
- usart = usart_get_base(minor);
- if ( !usart )
- return -1;
-
- return 0;
-}
-
-/*
- * Read one character from UART.
- *
- * return -1 if there's no data, otherwise return
- * the character in lowest 8 bits of returned int.
- */
-static int usart_read_polled(int minor)
-{
- at91rm9200_usart_regs_t *usart;
-
- usart = usart_get_base(minor);
- if ( !usart )
- return -1;
-
- /* if nothing ready return -1 */
- if ( (usart->sr & US_IER_RXRDY) == 0 )
- return -1;
-
- return usart->rhr;
-}
-
-
-/*
- * Write character out
- */
-static void usart_write_polled(int minor, char c)
-{
- at91rm9200_usart_regs_t *usart;
-
- usart = usart_get_base(minor);
- if ( !usart )
- return;
-
- /* delay until TX empty */
- while ( (usart->sr & US_IER_TXEMPTY) == 0 )
- ;
-
- usart->thr = c;
-}
-
-/*
- * Write buffer to UART
- *
- * return 1 on success, -1 on error
- */
-static ssize_t usart_write_polled_support(int minor, const char *buf, size_t len)
-{
- at91rm9200_usart_regs_t *usart;
- int nwrite=0;
-
- /*
- * Verify the minor number
- */
- usart = usart_get_base(minor);
- if ( !usart )
- return -1;
-
- /*
- * poll each byte in the string out of the port.
- */
- while (nwrite < len) {
- usart_write_polled(minor, *buf++);
- nwrite++;
- }
-
- /*
- * return the number of bytes written.
- */
- return nwrite;
-
- return 1;
-}
-
-
-/* Set up the UART. */
-static void usart_init(int minor)
-{
- at91rm9200_usart_regs_t *usart;
-
- usart = usart_get_base(minor);
- if ( !usart )
- return;
-
-}
-
-
-/* This is for setting baud rate, bits, etc. */
-static int usart_set_attributes(int minor, const struct termios *t)
-{
- uint32_t brgr;
- uint32_t mode, baud, baud_requested;
- at91rm9200_usart_regs_t *usart;
-
- usart = usart_get_base(minor);
- if ( !usart )
- return -1;
-
- /* Get current mode register */
- mode = usart->mr & ~(US_MR_USMODE | US_MR_USCLKS | US_MR_CHRL
- | US_MR_PAR | US_MR_NBSTOP);
-
- /* Byte size */
- switch (t->c_cflag & CSIZE){
- case CS5:
- mode |= US_MR_CHRL_5;
- break;
- case CS6:
- mode |= US_MR_CHRL_6;
- break;
- case CS7:
- mode |= US_MR_CHRL_7;
- break;
- default:
- mode |= US_MR_CHRL_8;
- break;
- }
-
- /* Stop bits */
- if (t->c_cflag & CSTOPB){
- mode |= US_MR_NBSTOP_2; /* 2 stop bits */
- } else
- mode |= US_MR_NBSTOP_1; /* 1 stop bits */
-
- /* Parity */
- if (t->c_cflag & PARENB){
- /* Mark or Space parity */
- if (t->c_cflag & PARODD){
- mode |= US_MR_PAR_ODD;
- } else
- mode |= US_MR_PAR_EVEN;
- } else
- mode |= US_MR_PAR_NONE;
-
- baud_requested = t->c_ospeed;
-
- /* If not, set the dbgu console baud as USART baud default */
- if (!baud_requested)
- baud_requested = BSP_get_baud();
-
- baud = rtems_termios_baud_to_number(baud_requested);
-
- brgr = (at91rm9200_get_mck() / 16) / baud;
-
- if (brgr > 65535){ /* BRGR is 16-bit, so switch to slower clock */
- brgr /= 8;
- mode |= US_MR_USCLKS_MCK_DIV8;
- }
-
- usart->mr = mode;
- usart->brgr = brgr;
- return 0;
-}