1 /******************************************************************************
2 *                                                                             *
3 * License Agreement                                                           *
4 *                                                                             *
5 * Copyright (c) 2003 Altera Corporation, San Jose, California, USA.           *
6 * All rights reserved.                                                        *
7 *                                                                             *
8 * Permission is hereby granted, free of charge, to any person obtaining a     *
9 * copy of this software and associated documentation files (the "Software"),  *
10 * to deal in the Software without restriction, including without limitation   *
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,    *
12 * and/or sell copies of the Software, and to permit persons to whom the       *
13 * Software is furnished to do so, subject to the following conditions:        *
14 *                                                                             *
15 * The above copyright notice and this permission notice shall be included in  *
16 * all copies or substantial portions of the Software.                         *
17 *                                                                             *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  *
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    *
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      *
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     *
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         *
24 * DEALINGS IN THE SOFTWARE.                                                   *
25 *                                                                             *
26 *                                                                             *
27 ******************************************************************************/
28 
29 #ifndef __ALTERA_AVALON_UART_REGS_H__
30 #define __ALTERA_AVALON_UART_REGS_H__
31 
32 #include <io.h>
33 
34 #define ALTERA_AVALON_UART_RXDATA_REG                 0
35 #define IOADDR_ALTERA_AVALON_UART_RXDATA(base)        \
36         __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_UART_RXDATA_REG)
37 #define IORD_ALTERA_AVALON_UART_RXDATA(base)          \
38         IORD(base, ALTERA_AVALON_UART_RXDATA_REG)
39 #define IOWR_ALTERA_AVALON_UART_RXDATA(base, data)    \
40         IOWR(base, ALTERA_AVALON_UART_RXDATA_REG, data)
41 
42 #define ALTERA_AVALON_UART_TXDATA_REG                 1
43 #define IOADDR_ALTERA_AVALON_UART_TXDATA(base)        \
44         __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_UART_TXDATA_REG)
45 #define IORD_ALTERA_AVALON_UART_TXDATA(base)          \
46         IORD(base, ALTERA_AVALON_UART_TXDATA_REG)
47 #define IOWR_ALTERA_AVALON_UART_TXDATA(base, data)    \
48         IOWR(base, ALTERA_AVALON_UART_TXDATA_REG, data)
49 
50 #define ALTERA_AVALON_UART_STATUS_REG                 2
51 #define IOADDR_ALTERA_AVALON_UART_STATUS(base)        \
52         __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_UART_STATUS_REG)
53 #define IORD_ALTERA_AVALON_UART_STATUS(base)          \
54         IORD(base, ALTERA_AVALON_UART_STATUS_REG)
55 #define IOWR_ALTERA_AVALON_UART_STATUS(base, data)    \
56         IOWR(base, ALTERA_AVALON_UART_STATUS_REG, data)
57 
58 #define ALTERA_AVALON_UART_STATUS_PE_MSK              (0x1)
59 #define ALTERA_AVALON_UART_STATUS_PE_OFST             (0)
60 #define ALTERA_AVALON_UART_STATUS_FE_MSK              (0x2)
61 #define ALTERA_AVALON_UART_STATUS_FE_OFST             (1)
62 #define ALTERA_AVALON_UART_STATUS_BRK_MSK             (0x4)
63 #define ALTERA_AVALON_UART_STATUS_BRK_OFST            (2)
64 #define ALTERA_AVALON_UART_STATUS_ROE_MSK             (0x8)
65 #define ALTERA_AVALON_UART_STATUS_ROE_OFST            (3)
66 #define ALTERA_AVALON_UART_STATUS_TOE_MSK             (0x10)
67 #define ALTERA_AVALON_UART_STATUS_TOE_OFST            (4)
68 #define ALTERA_AVALON_UART_STATUS_TMT_MSK             (0x20)
69 #define ALTERA_AVALON_UART_STATUS_TMT_OFST            (5)
70 #define ALTERA_AVALON_UART_STATUS_TRDY_MSK            (0x40)
71 #define ALTERA_AVALON_UART_STATUS_TRDY_OFST           (6)
72 #define ALTERA_AVALON_UART_STATUS_RRDY_MSK            (0x80)
73 #define ALTERA_AVALON_UART_STATUS_RRDY_OFST           (7)
74 #define ALTERA_AVALON_UART_STATUS_E_MSK               (0x100)
75 #define ALTERA_AVALON_UART_STATUS_E_OFST              (8)
76 #define ALTERA_AVALON_UART_STATUS_DCTS_MSK            (0x400)
77 #define ALTERA_AVALON_UART_STATUS_DCTS_OFST           (10)
78 #define ALTERA_AVALON_UART_STATUS_CTS_MSK             (0x800)
79 #define ALTERA_AVALON_UART_STATUS_CTS_OFST            (11)
80 #define ALTERA_AVALON_UART_STATUS_EOP_MSK             (0x1000)
81 #define ALTERA_AVALON_UART_STATUS_EOP_OFST            (12)
82 
83 #define ALTERA_AVALON_UART_CONTROL_REG                3
84 #define IOADDR_ALTERA_AVALON_UART_CONTROL(base)       \
85         __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_UART_CONTROL_REG)
86 #define IORD_ALTERA_AVALON_UART_CONTROL(base)         \
87         IORD(base, ALTERA_AVALON_UART_CONTROL_REG)
88 #define IOWR_ALTERA_AVALON_UART_CONTROL(base, data)   \
89         IOWR(base, ALTERA_AVALON_UART_CONTROL_REG, data)
90 
91 #define ALTERA_AVALON_UART_CONTROL_PE_MSK             (0x1)
92 #define ALTERA_AVALON_UART_CONTROL_PE_OFST            (0)
93 #define ALTERA_AVALON_UART_CONTROL_FE_MSK             (0x2)
94 #define ALTERA_AVALON_UART_CONTROL_FE_OFST            (1)
95 #define ALTERA_AVALON_UART_CONTROL_BRK_MSK            (0x4)
96 #define ALTERA_AVALON_UART_CONTROL_BRK_OFST           (2)
97 #define ALTERA_AVALON_UART_CONTROL_ROE_MSK            (0x8)
98 #define ALTERA_AVALON_UART_CONTROL_ROE_OFST           (3)
99 #define ALTERA_AVALON_UART_CONTROL_TOE_MSK            (0x10)
100 #define ALTERA_AVALON_UART_CONTROL_TOE_OFST           (4)
101 #define ALTERA_AVALON_UART_CONTROL_TMT_MSK            (0x20)
102 #define ALTERA_AVALON_UART_CONTROL_TMT_OFST           (5)
103 #define ALTERA_AVALON_UART_CONTROL_TRDY_MSK           (0x40)
104 #define ALTERA_AVALON_UART_CONTROL_TRDY_OFST          (6)
105 #define ALTERA_AVALON_UART_CONTROL_RRDY_MSK           (0x80)
106 #define ALTERA_AVALON_UART_CONTROL_RRDY_OFST          (7)
107 #define ALTERA_AVALON_UART_CONTROL_E_MSK              (0x100)
108 #define ALTERA_AVALON_UART_CONTROL_E_OFST             (8)
109 #define ALTERA_AVALON_UART_CONTROL_DCTS_MSK           (0x400)
110 #define ALTERA_AVALON_UART_CONTROL_DCTS_OFST          (10)
111 #define ALTERA_AVALON_UART_CONTROL_RTS_MSK            (0x800)
112 #define ALTERA_AVALON_UART_CONTROL_RTS_OFST           (11)
113 #define ALTERA_AVALON_UART_CONTROL_EOP_MSK            (0x1000)
114 #define ALTERA_AVALON_UART_CONTROL_EOP_OFST           (12)
115 
116 #define ALTERA_AVALON_UART_DIVISOR_REG                4
117 #define IOADDR_ALTERA_AVALON_UART_DIVISOR(base)       \
118         __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_UART_DIVISOR_REG)
119 #define IORD_ALTERA_AVALON_UART_DIVISOR(base)         \
120         IORD(base, ALTERA_AVALON_UART_DIVISOR_REG)
121 #define IOWR_ALTERA_AVALON_UART_DIVISOR(base, data)   \
122         IOWR(base, ALTERA_AVALON_UART_DIVISOR_REG, data)
123 
124 #define ALTERA_AVALON_UART_EOP_REG                    5
125 #define IOADDR_ALTERA_AVALON_UART_EOP(base)           \
126         __IO_CALC_ADDRESS_NATIVE(base, ALTERA_AVALON_UART_EOP_REG)
127 #define IORD_ALTERA_AVALON_UART_EOP(base)             \
128         IORD(base, ALTERA_AVALON_UART_EOP_REG)
129 #define IOWR_ALTERA_AVALON_UART_EOP(base, data)       \
130         IOWR(base, ALTERA_AVALON_UART_EOP_REG, data)
131 
132 #define ALTERA_AVALON_UART_EOP_MSK                    (0xFF)
133 #define ALTERA_AVALON_UART_EOP_OFST                   (0)
134 
135 #endif /* __ALTERA_AVALON_UART_REGS_H__ */
136