]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/drivers/uart/include/uart_sa1000.h
update
[l4.git] / l4 / pkg / drivers / uart / include / uart_sa1000.h
1 /*!
2  * \file   uart_sa1000.h
3  * \brief  SA1000 uart header
4  *
5  * \date   2008-01-02
6  * \author Adam Lackorznynski <adam@os.inf.tu-dresden.de>
7  *         Alexander Warg <alexander.warg@os.inf.tu-dresden.de>
8  *
9  */
10 /*
11  * (c) 2008-2009 Author(s)
12  *     economic rights: Technische Universität Dresden (Germany)
13  *
14  * This file is part of TUD:OS and distributed under the terms of the
15  * GNU General Public License 2.
16  * Please see the COPYING-GPL-2 file for details.
17  */
18 #ifndef __L4_CXX_UART_SA1000_H__
19 #define __L4_CXX_UART_SA1000_H__
20
21 #include "uart_base.h"
22
23 namespace L4
24 {
25   class Uart_sa1000 : public Uart
26   {
27   private:
28     unsigned long _base;
29
30     inline unsigned long rd(unsigned long reg) const;
31     inline void wr(unsigned long reg, unsigned long val) const;
32
33   public:
34     Uart_sa1000(int rx_irq, int tx_irq)
35        : Uart(rx_irq, tx_irq), _base(~0UL) {}
36     bool startup(unsigned long base);
37     void shutdown();
38     bool enable_rx_irq(bool enable = true);
39     bool enable_tx_irq(bool enable = true);
40     bool change_mode(Transfer_mode m, Baud_rate r);
41     int get_char(bool blocking = true) const;
42     int char_avail() const;
43     inline void out_char(char c) const;
44     int write(char const *s, unsigned long count) const;
45   };
46 };
47
48 #endif