My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pl011_uart.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * PL011 UART declarations
25  */
26 
27 #ifndef _PL011_BOARD_H__
28 #define _PL011_BOARD_H__
29 
30 #define UART_SIZE 0x00010000
31 
32 /*
33  * PL011 definitions
34  *
35  */
36 #define UART_PL011_IBRD 0x24
37 #define UART_PL011_FBRD 0x28
38 #define UART_PL011_LCRH 0x2C
39 #define UART_PL011_CR 0x30
40 #define UART_PL011_IMSC 0x38
41 #define UART_PL011_MIS 0x40
42 #define UART_PL011_ICR 0x44
43 #define UART_PL011_PERIPH_ID0 0xFE0
44 
45 #define UART_PL011_LCRH_SPS (1 << 7)
46 #define UART_PL011_LCRH_WLEN_8 (3 << 5)
47 #define UART_PL011_LCRH_WLEN_7 (2 << 5)
48 #define UART_PL011_LCRH_WLEN_6 (1 << 5)
49 #define UART_PL011_LCRH_WLEN_5 (0 << 5)
50 #define UART_PL011_LCRH_FEN (1 << 4)
51 #define UART_PL011_LCRH_STP2 (1 << 3)
52 #define UART_PL011_LCRH_EPS (1 << 2)
53 #define UART_PL011_LCRH_PEN (1 << 1)
54 #define UART_PL011_LCRH_BRK (1 << 0)
55 
56 #define UART_PL011_CR_CTSEN (1 << 15)
57 #define UART_PL011_CR_RTSEN (1 << 14)
58 #define UART_PL011_CR_OUT2 (1 << 13)
59 #define UART_PL011_CR_OUT1 (1 << 12)
60 #define UART_PL011_CR_RTS (1 << 11)
61 #define UART_PL011_CR_DTR (1 << 10)
62 #define UART_PL011_CR_RXE (1 << 9)
63 #define UART_PL011_CR_TXE (1 << 8)
64 #define UART_PL011_CR_LPE (1 << 7)
65 #define UART_PL011_CR_IIRLP (1 << 2)
66 #define UART_PL011_CR_SIREN (1 << 1)
67 #define UART_PL011_CR_UARTEN (1 << 0)
68 
69 #define UART_PL011_IMSC_OEIM (1 << 10)
70 #define UART_PL011_IMSC_BEIM (1 << 9)
71 #define UART_PL011_IMSC_PEIM (1 << 8)
72 #define UART_PL011_IMSC_FEIM (1 << 7)
73 #define UART_PL011_IMSC_RTIM (1 << 6)
74 #define UART_PL011_IMSC_TXIM (1 << 5)
75 #define UART_PL011_IMSC_RXIM (1 << 4)
76 #define UART_PL011_IMSC_DSRMIM (1 << 3)
77 #define UART_PL011_IMSC_DCDMIM (1 << 2)
78 #define UART_PL011_IMSC_CTSMIM (1 << 1)
79 #define UART_PL011_IMSC_RIMIM (1 << 0)
80 
81 #define UART_PL011_MIS_OEMIS (1 << 10)
82 #define UART_PL011_MIS_BEMIS (1 << 9)
83 #define UART_PL011_MIS_PEMIS (1 << 8)
84 #define UART_PL011_MIS_FEMIS (1 << 7)
85 #define UART_PL011_MIS_RTMIS (1 << 6)
86 #define UART_PL011_MIS_TXMIS (1 << 5)
87 #define UART_PL011_MIS_RXMIS (1 << 4)
88 #define UART_PL011_MIS_DSRMMIS (1 << 3)
89 #define UART_PL011_MIS_DCDMMIS (1 << 2)
90 #define UART_PL011_MIS_CTSMMIS (1 << 1)
91 #define UART_PL011_MIS_RIMMIS (1 << 0)
92 
93 #define UART_PL011_ICR_OEIC (1 << 10)
94 #define UART_PL011_ICR_BEIC (1 << 9)
95 #define UART_PL011_ICR_PEIC (1 << 8)
96 #define UART_PL011_ICR_FEIC (1 << 7)
97 #define UART_PL011_ICR_RTIC (1 << 6)
98 #define UART_PL011_ICR_TXIC (1 << 5)
99 #define UART_PL011_ICR_RXIC (1 << 4)
100 #define UART_PL011_ICR_DSRMIC (1 << 3)
101 #define UART_PL011_ICR_DCDMIC (1 << 2)
102 #define UART_PL011_ICR_CTSMIC (1 << 1)
103 #define UART_PL011_ICR_RIMIC (1 << 0)
104 
105 #define UART_PL01x_DR 0x00 /* Data read or written from the interface. */
106 #define UART_PL01x_RSR 0x04 /* Receive status register (Read). */
107 #define UART_PL01x_ECR 0x04 /* Error clear register (Write). */
108 #define UART_PL01x_FR 0x18 /* Flag register (Read only). */
109 
110 #define UART_PL01x_RSR_OE 0x08
111 #define UART_PL01x_RSR_BE 0x04
112 #define UART_PL01x_RSR_PE 0x02
113 #define UART_PL01x_RSR_FE 0x01
114 
115 #define UART_PL01x_FR_TXFE 0x80
116 #define UART_PL01x_FR_RXFF 0x40
117 #define UART_PL01x_FR_TXFF 0x20
118 #define UART_PL01x_FR_RXFE 0x10
119 #define UART_PL01x_FR_BUSY 0x08
120 #define UART_PL01x_FR_TMSK (UART_PL01x_FR_TXFF + UART_PL01x_FR_BUSY)
121 #endif
122