]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/drivers-frst/uart/include/uart_pxa.h
update
[l4.git] / l4 / pkg / drivers-frst / uart / include / uart_pxa.h
1 /*
2  * (c) 2008-2012 Adam Lackorznynski <adam@os.inf.tu-dresden.de>
3  *               Alexander Warg <alexander.warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  */
10 #pragma once
11
12 #include "uart_base.h"
13
14 namespace L4
15 {
16   class Uart_16550 : public Uart
17   {
18   public:
19     enum
20       {
21         PAR_NONE = 0x00,
22         PAR_EVEN = 0x18,
23         PAR_ODD  = 0x08,
24         DAT_5    = 0x00,
25         DAT_6    = 0x01,
26         DAT_7    = 0x02,
27         DAT_8    = 0x03,
28         STOP_1   = 0x00,
29         STOP_2   = 0x04,
30
31         MODE_8N1 = PAR_NONE | DAT_8 | STOP_1,
32         MODE_7E1 = PAR_EVEN | DAT_7 | STOP_1,
33
34         // these two values are to leave either mode
35         // or baud rate unchanged on a call to change_mode
36         MODE_NC  = 0x1000000,
37         BAUD_NC  = 0x1000000,
38
39         Base_rate_x86 = 115200,
40         Base_rate_pxa = 921600,
41       };
42
43     explicit Uart_16550(unsigned long base_rate)
44     : _base_rate(base_rate)
45     {}
46
47     bool startup(Io_register_block const *regs);
48     void shutdown();
49     bool change_mode(Transfer_mode m, Baud_rate r);
50     int get_char(bool blocking = true) const;
51     int char_avail() const;
52     inline void out_char(char c) const;
53     int write(char const *s, unsigned long count) const;
54
55   private:
56     unsigned long _base_rate;
57   };
58 }