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 #ifndef L4_CXX_UART_H__
10 #define L4_CXX_UART_H__
25 void *operator new (size_t, void* a)
29 typedef unsigned Transfer_mode;
30 typedef unsigned Baud_rate;
32 Uart(int rx_irq, int tx_irq)
33 : _rx_irq(rx_irq), _tx_irq(tx_irq), _mode(~0U), _rate(~0U)
36 virtual bool startup(unsigned long base) = 0;
39 virtual void shutdown() = 0;
40 virtual bool enable_rx_irq(bool enable = true) = 0;
41 virtual bool enable_tx_irq(bool enable = true) = 0;
42 virtual bool change_mode(Transfer_mode m, Baud_rate r) = 0;
43 virtual int get_char(bool blocking = true) const = 0;
44 virtual int char_avail() const = 0;
45 virtual int write(char const *s, unsigned long count) const = 0;
47 int rx_irq() const { return _rx_irq; }
48 int tx_irq() const { return _tx_irq; }
49 Transfer_mode mode() const { return _mode; }
50 Baud_rate rate() const { return _rate; }