2 * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU General Public License 2.
7 * Please see the COPYING-GPL-2 file for details.
9 #include "uart_omap35x.h"
25 LCD_REG_CHAR_LENGTH_5BIT = 0 << 0,
26 LCD_REG_CHAR_LENGTH_6BIT = 1 << 0,
27 LCD_REG_CHAR_LENGTH_7BIT = 2 << 0,
28 LCD_REG_CHAR_LENGTH_8BIT = 3 << 0,
29 LCD_REG_CHAR_NB_STOP_2 = 1 << 2,
30 LCD_REG_CHAR_PARITY_EN = 1 << 3,
31 LCD_REG_CHAR_PARITY_TYPE1_EVEN = 1 << 4,
33 LSR_REG_RX_FIFO_E_AVAIL = 1 << 0,
34 LSR_REG_TX_FIFO_E_EMPTY = 1 << 5,
36 SSR_REG_TX_FIFO_FULL = 1 << 0,
38 SYSC_REG_SOFTRESET = 1 << 1,
40 SYSC_REG_RESETDONE = 1 << 0,
44 unsigned long Uart_omap35x::rd(unsigned long reg) const
46 volatile unsigned long *r = (unsigned long*)(_base + reg);
50 void Uart_omap35x::wr(unsigned long reg, unsigned long val) const
52 volatile unsigned long *r = (unsigned long*)(_base + reg);
56 bool Uart_omap35x::startup(unsigned long base)
61 //wr(SYSC_REG, rd(SYSC_REG) | SYSC_REG_SOFTRESET);
62 //while (!(rd(SYSS_REG) & SYSC_REG_RESETDONE))
68 void Uart_omap35x::shutdown()
72 bool Uart_omap35x::enable_rx_irq(bool enable)
74 wr(IER_REG, enable ? 1 : 0);
77 bool Uart_omap35x::enable_tx_irq(bool /*enable*/) { return false; }
78 bool Uart_omap35x::change_mode(Transfer_mode, Baud_rate r)
86 int Uart_omap35x::get_char(bool blocking) const
95 int Uart_omap35x::char_avail() const
97 return rd(LSR_REG) & LSR_REG_RX_FIFO_E_AVAIL;
100 void Uart_omap35x::out_char(char c) const
103 while (!(rd(LSR_REG) & LSR_REG_TX_FIFO_E_EMPTY))
107 int Uart_omap35x::write(char const *s, unsigned long count) const
109 unsigned long c = count;
117 // while (rd(UART01x_FR) & UART01x_FR_BUSY)