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 #define BLOCK_SIZE 0x200000
33 #define PAGE_SIZE 4096
34 #define UART_DEVS 4
35 
36 /*
37  * PL011 definitions
38  *
39  */
40 #define UART_PL011_IBRD 0x24
41 #define UART_PL011_FBRD 0x28
42 #define UART_PL011_LCRH 0x2C
43 #define UART_PL011_CR 0x30
44 #define UART_PL011_IMSC 0x38
45 #define UART_PL011_MIS 0x40
46 #define UART_PL011_ICR 0x44
47 #define UART_PL011_PERIPH_ID0 0xFE0
48 
49 #define UART_PL011_LCRH_SPS (1 << 7)
50 #define UART_PL011_LCRH_WLEN_8 (3 << 5)
51 #define UART_PL011_LCRH_WLEN_7 (2 << 5)
52 #define UART_PL011_LCRH_WLEN_6 (1 << 5)
53 #define UART_PL011_LCRH_WLEN_5 (0 << 5)
54 #define UART_PL011_LCRH_FEN (1 << 4)
55 #define UART_PL011_LCRH_STP2 (1 << 3)
56 #define UART_PL011_LCRH_EPS (1 << 2)
57 #define UART_PL011_LCRH_PEN (1 << 1)
58 #define UART_PL011_LCRH_BRK (1 << 0)
59 
60 #define UART_PL011_CR_CTSEN (1 << 15)
61 #define UART_PL011_CR_RTSEN (1 << 14)
62 #define UART_PL011_CR_OUT2 (1 << 13)
63 #define UART_PL011_CR_OUT1 (1 << 12)
64 #define UART_PL011_CR_RTS (1 << 11)
65 #define UART_PL011_CR_DTR (1 << 10)
66 #define UART_PL011_CR_RXE (1 << 9)
67 #define UART_PL011_CR_TXE (1 << 8)
68 #define UART_PL011_CR_LPE (1 << 7)
69 #define UART_PL011_CR_IIRLP (1 << 2)
70 #define UART_PL011_CR_SIREN (1 << 1)
71 #define UART_PL011_CR_UARTEN (1 << 0)
72 
73 #define UART_PL011_IMSC_OEIM (1 << 10)
74 #define UART_PL011_IMSC_BEIM (1 << 9)
75 #define UART_PL011_IMSC_PEIM (1 << 8)
76 #define UART_PL011_IMSC_FEIM (1 << 7)
77 #define UART_PL011_IMSC_RTIM (1 << 6)
78 #define UART_PL011_IMSC_TXIM (1 << 5)
79 #define UART_PL011_IMSC_RXIM (1 << 4)
80 #define UART_PL011_IMSC_DSRMIM (1 << 3)
81 #define UART_PL011_IMSC_DCDMIM (1 << 2)
82 #define UART_PL011_IMSC_CTSMIM (1 << 1)
83 #define UART_PL011_IMSC_RIMIM (1 << 0)
84 
85 #define UART_PL011_MIS_OEMIS (1 << 10)
86 #define UART_PL011_MIS_BEMIS (1 << 9)
87 #define UART_PL011_MIS_PEMIS (1 << 8)
88 #define UART_PL011_MIS_FEMIS (1 << 7)
89 #define UART_PL011_MIS_RTMIS (1 << 6)
90 #define UART_PL011_MIS_TXMIS (1 << 5)
91 #define UART_PL011_MIS_RXMIS (1 << 4)
92 #define UART_PL011_MIS_DSRMMIS (1 << 3)
93 #define UART_PL011_MIS_DCDMMIS (1 << 2)
94 #define UART_PL011_MIS_CTSMMIS (1 << 1)
95 #define UART_PL011_MIS_RIMMIS (1 << 0)
96 
97 #define UART_PL011_ICR_OEIC (1 << 10)
98 #define UART_PL011_ICR_BEIC (1 << 9)
99 #define UART_PL011_ICR_PEIC (1 << 8)
100 #define UART_PL011_ICR_FEIC (1 << 7)
101 #define UART_PL011_ICR_RTIC (1 << 6)
102 #define UART_PL011_ICR_TXIC (1 << 5)
103 #define UART_PL011_ICR_RXIC (1 << 4)
104 #define UART_PL011_ICR_DSRMIC (1 << 3)
105 #define UART_PL011_ICR_DCDMIC (1 << 2)
106 #define UART_PL011_ICR_CTSMIC (1 << 1)
107 #define UART_PL011_ICR_RIMIC (1 << 0)
108 
109 #define UART_PL01x_DR 0x00 /* Data read or written from the interface. */
110 #define UART_PL01x_RSR 0x04 /* Receive status register (Read). */
111 #define UART_PL01x_ECR 0x04 /* Error clear register (Write). */
112 #define UART_PL01x_FR 0x18 /* Flag register (Read only). */
113 
114 #define UART_PL01x_RSR_OE 0x08
115 #define UART_PL01x_RSR_BE 0x04
116 #define UART_PL01x_RSR_PE 0x02
117 #define UART_PL01x_RSR_FE 0x01
118 
119 #define UART_PL01x_FR_TXFE 0x80
120 #define UART_PL01x_FR_RXFF 0x40
121 #define UART_PL01x_FR_TXFF 0x20
122 #define UART_PL01x_FR_RXFE 0x10
123 #define UART_PL01x_FR_BUSY 0x08
124 #define UART_PL01x_FR_TMSK (UART_PL01x_FR_TXFF + UART_PL01x_FR_BUSY)
125 #endif
126