1 |
581 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// hw_uart.h - Macros and defines used when accessing the UART hardware
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2005,2006 Luminary Micro, Inc. All rights reserved.
|
6 |
|
|
//
|
7 |
|
|
// Software License Agreement
|
8 |
|
|
//
|
9 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
10 |
|
|
// exclusively on LMI's Stellaris Family of microcontroller products.
|
11 |
|
|
//
|
12 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
13 |
|
|
// applicable copyright laws. All rights are reserved. Any use in violation
|
14 |
|
|
// of the foregoing restrictions may subject the user to criminal sanctions
|
15 |
|
|
// under applicable laws, as well as to civil liability for the breach of the
|
16 |
|
|
// terms and conditions of this license.
|
17 |
|
|
//
|
18 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
19 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
20 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
21 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
22 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
23 |
|
|
//
|
24 |
|
|
// This is part of revision 991 of the Stellaris Driver Library.
|
25 |
|
|
//
|
26 |
|
|
//*****************************************************************************
|
27 |
|
|
|
28 |
|
|
#ifndef __HW_UART_H__
|
29 |
|
|
#define __HW_UART_H__
|
30 |
|
|
|
31 |
|
|
//*****************************************************************************
|
32 |
|
|
//
|
33 |
|
|
// UART Register Offsets.
|
34 |
|
|
//
|
35 |
|
|
//*****************************************************************************
|
36 |
|
|
#define UART_O_DR 0x00000000 // Data Register
|
37 |
|
|
#define UART_O_RSR 0x00000004 // Receive Status Register (read)
|
38 |
|
|
#define UART_O_ECR 0x00000004 // Error Clear Register (write)
|
39 |
|
|
#define UART_O_FR 0x00000018 // Flag Register (read only)
|
40 |
|
|
#define UART_O_IBRD 0x00000024 // Integer Baud Rate Divisor Reg
|
41 |
|
|
#define UART_O_FBRD 0x00000028 // Fractional Baud Rate Divisor Reg
|
42 |
|
|
#define UART_O_LCR_H 0x0000002C // Line Control Register, HIGH byte
|
43 |
|
|
#define UART_O_CTL 0x00000030 // Control Register
|
44 |
|
|
#define UART_O_IFLS 0x00000034 // Interrupt FIFO Level Select Reg
|
45 |
|
|
#define UART_O_IM 0x00000038 // Interrupt Mask Set/Clear Reg
|
46 |
|
|
#define UART_O_RIS 0x0000003C // Raw Interrupt Status Register
|
47 |
|
|
#define UART_O_MIS 0x00000040 // Masked Interrupt Status Register
|
48 |
|
|
#define UART_O_ICR 0x00000044 // Interrupt Clear Register
|
49 |
|
|
#define UART_O_PeriphID4 0x00000FD0 //
|
50 |
|
|
#define UART_O_PeriphID5 0x00000FD4 //
|
51 |
|
|
#define UART_O_PeriphID6 0x00000FD8 //
|
52 |
|
|
#define UART_O_PeriphID7 0x00000FDC //
|
53 |
|
|
#define UART_O_PeriphID0 0x00000FE0 //
|
54 |
|
|
#define UART_O_PeriphID1 0x00000FE4 //
|
55 |
|
|
#define UART_O_PeriphID2 0x00000FE8 //
|
56 |
|
|
#define UART_O_PeriphID3 0x00000FEC //
|
57 |
|
|
#define UART_O_PCellID0 0x00000FF0 //
|
58 |
|
|
#define UART_O_PCellID1 0x00000FF4 //
|
59 |
|
|
#define UART_O_PCellID2 0x00000FF8 //
|
60 |
|
|
#define UART_O_PCellID3 0x00000FFC //
|
61 |
|
|
|
62 |
|
|
//*****************************************************************************
|
63 |
|
|
//
|
64 |
|
|
// Data Register bits
|
65 |
|
|
//
|
66 |
|
|
//*****************************************************************************
|
67 |
|
|
#define UART_DR_OE 0x00000800 // Overrun Error
|
68 |
|
|
#define UART_DR_BE 0x00000400 // Break Error
|
69 |
|
|
#define UART_DR_PE 0x00000200 // Parity Error
|
70 |
|
|
#define UART_DR_FE 0x00000100 // Framing Error
|
71 |
|
|
#define UART_DR_DATA_MASK 0x000000FF // UART data
|
72 |
|
|
|
73 |
|
|
//*****************************************************************************
|
74 |
|
|
//
|
75 |
|
|
// Receive Status Register bits
|
76 |
|
|
//
|
77 |
|
|
//*****************************************************************************
|
78 |
|
|
#define UART_RSR_OE 0x00000008 // Overrun Error
|
79 |
|
|
#define UART_RSR_BE 0x00000004 // Break Error
|
80 |
|
|
#define UART_RSR_PE 0x00000002 // Parity Error
|
81 |
|
|
#define UART_RSR_FE 0x00000001 // Framing Error
|
82 |
|
|
|
83 |
|
|
//*****************************************************************************
|
84 |
|
|
//
|
85 |
|
|
// Flag Register bits
|
86 |
|
|
//
|
87 |
|
|
//*****************************************************************************
|
88 |
|
|
#define UART_FR_TXFE 0x00000080 // TX FIFO Empty
|
89 |
|
|
#define UART_FR_RXFF 0x00000040 // RX FIFO Full
|
90 |
|
|
#define UART_FR_TXFF 0x00000020 // TX FIFO Full
|
91 |
|
|
#define UART_FR_RXFE 0x00000010 // RX FIFO Empty
|
92 |
|
|
#define UART_FR_BUSY 0x00000008 // UART Busy
|
93 |
|
|
|
94 |
|
|
//*****************************************************************************
|
95 |
|
|
//
|
96 |
|
|
// Integer baud-rate divisor
|
97 |
|
|
//
|
98 |
|
|
//*****************************************************************************
|
99 |
|
|
#define UART_IBRD_DIVINT_MASK 0x0000FFFF // Integer baud-rate divisor
|
100 |
|
|
|
101 |
|
|
//*****************************************************************************
|
102 |
|
|
//
|
103 |
|
|
// Fractional baud-rate divisor
|
104 |
|
|
//
|
105 |
|
|
//*****************************************************************************
|
106 |
|
|
#define UART_FBRD_DIVFRAC_MASK 0x0000003F // Fractional baud-rate divisor
|
107 |
|
|
|
108 |
|
|
//*****************************************************************************
|
109 |
|
|
//
|
110 |
|
|
// Line Control Register High bits
|
111 |
|
|
//
|
112 |
|
|
//*****************************************************************************
|
113 |
|
|
#define UART_LCR_H_SPS 0x00000080 // Stick Parity Select
|
114 |
|
|
#define UART_LCR_H_WLEN 0x00000060 // Word length
|
115 |
|
|
#define UART_LCR_H_WLEN_8 0x00000060 // 8 bit data
|
116 |
|
|
#define UART_LCR_H_WLEN_7 0x00000040 // 7 bit data
|
117 |
|
|
#define UART_LCR_H_WLEN_6 0x00000020 // 6 bit data
|
118 |
|
|
#define UART_LCR_H_WLEN_5 0x00000000 // 5 bit data
|
119 |
|
|
#define UART_LCR_H_FEN 0x00000010 // Enable FIFO
|
120 |
|
|
#define UART_LCR_H_STP2 0x00000008 // Two Stop Bits Select
|
121 |
|
|
#define UART_LCR_H_EPS 0x00000004 // Even Parity Select
|
122 |
|
|
#define UART_LCR_H_PEN 0x00000002 // Parity Enable
|
123 |
|
|
#define UART_LCR_H_BRK 0x00000001 // Send Break
|
124 |
|
|
|
125 |
|
|
//*****************************************************************************
|
126 |
|
|
//
|
127 |
|
|
// Control Register bits
|
128 |
|
|
//
|
129 |
|
|
//*****************************************************************************
|
130 |
|
|
#define UART_CTL_RXE 0x00000200 // Receive Enable
|
131 |
|
|
#define UART_CTL_TXE 0x00000100 // Transmit Enable
|
132 |
|
|
#define UART_CTL_LBE 0x00000080 // Loopback Enable
|
133 |
|
|
#define UART_CTL_UARTEN 0x00000001 // UART Enable
|
134 |
|
|
|
135 |
|
|
//*****************************************************************************
|
136 |
|
|
//
|
137 |
|
|
// Interrupt FIFO Level Select Register bits
|
138 |
|
|
//
|
139 |
|
|
//*****************************************************************************
|
140 |
|
|
#define UART_IFLS_RX1_8 0x00000000 // 1/8 Full
|
141 |
|
|
#define UART_IFLS_RX2_8 0x00000010 // 1/4 Full
|
142 |
|
|
#define UART_IFLS_RX4_8 0x00000020 // 1/2 Full
|
143 |
|
|
#define UART_IFLS_RX6_8 0x00000030 // 3/4 Full
|
144 |
|
|
#define UART_IFLS_RX7_8 0x00000040 // 7/8 Full
|
145 |
|
|
#define UART_IFLS_TX1_8 0x00000000 // 1/8 Full
|
146 |
|
|
#define UART_IFLS_TX2_8 0x00000001 // 1/4 Full
|
147 |
|
|
#define UART_IFLS_TX4_8 0x00000002 // 1/2 Full
|
148 |
|
|
#define UART_IFLS_TX6_8 0x00000003 // 3/4 Full
|
149 |
|
|
#define UART_IFLS_TX7_8 0x00000004 // 7/8 Full
|
150 |
|
|
|
151 |
|
|
//*****************************************************************************
|
152 |
|
|
//
|
153 |
|
|
// Interrupt Mask Set/Clear Register bits
|
154 |
|
|
//
|
155 |
|
|
//*****************************************************************************
|
156 |
|
|
#define UART_IM_OEIM 0x00000400 // Overrun Error Interrupt Mask
|
157 |
|
|
#define UART_IM_BEIM 0x00000200 // Break Error Interrupt Mask
|
158 |
|
|
#define UART_IM_PEIM 0x00000100 // Parity Error Interrupt Mask
|
159 |
|
|
#define UART_IM_FEIM 0x00000080 // Framing Error Interrupt Mask
|
160 |
|
|
#define UART_IM_RTIM 0x00000040 // Receive Timeout Interrupt Mask
|
161 |
|
|
#define UART_IM_TXIM 0x00000020 // Transmit Interrupt Mask
|
162 |
|
|
#define UART_IM_RXIM 0x00000010 // Receive Interrupt Mask
|
163 |
|
|
|
164 |
|
|
//*****************************************************************************
|
165 |
|
|
//
|
166 |
|
|
// Raw Interrupt Status Register
|
167 |
|
|
//
|
168 |
|
|
//*****************************************************************************
|
169 |
|
|
#define UART_RIS_OERIS 0x00000400 // Overrun Error Interrupt Status
|
170 |
|
|
#define UART_RIS_BERIS 0x00000200 // Break Error Interrupt Status
|
171 |
|
|
#define UART_RIS_PERIS 0x00000100 // Parity Error Interrupt Status
|
172 |
|
|
#define UART_RIS_FERIS 0x00000080 // Framing Error Interrupt Status
|
173 |
|
|
#define UART_RIS_RTRIS 0x00000040 // Receive Timeout Interrupt Status
|
174 |
|
|
#define UART_RIS_TXRIS 0x00000020 // Transmit Interrupt Status
|
175 |
|
|
#define UART_RIS_RXRIS 0x00000010 // Receive Interrupt Status
|
176 |
|
|
|
177 |
|
|
//*****************************************************************************
|
178 |
|
|
//
|
179 |
|
|
// Masked Interrupt Status Register
|
180 |
|
|
//
|
181 |
|
|
//*****************************************************************************
|
182 |
|
|
#define UART_MIS_OEMIS 0x00000400 // Overrun Error Interrupt Status
|
183 |
|
|
#define UART_MIS_BEMIS 0x00000200 // Break Error Interrupt Status
|
184 |
|
|
#define UART_MIS_PEMIS 0x00000100 // Parity Error Interrupt Status
|
185 |
|
|
#define UART_MIS_FEMIS 0x00000080 // Framing Error Interrupt Status
|
186 |
|
|
#define UART_MIS_RTMIS 0x00000040 // Receive Timeout Interrupt Status
|
187 |
|
|
#define UART_MIS_TXMIS 0x00000020 // Transmit Interrupt Status
|
188 |
|
|
#define UART_MIS_RXMIS 0x00000010 // Receive Interrupt Status
|
189 |
|
|
|
190 |
|
|
//*****************************************************************************
|
191 |
|
|
//
|
192 |
|
|
// Interrupt Clear Register bits
|
193 |
|
|
//
|
194 |
|
|
//*****************************************************************************
|
195 |
|
|
#define UART_ICR_OEIC 0x00000400 // Overrun Error Interrupt Clear
|
196 |
|
|
#define UART_ICR_BEIC 0x00000200 // Break Error Interrupt Clear
|
197 |
|
|
#define UART_ICR_PEIC 0x00000100 // Parity Error Interrupt Clear
|
198 |
|
|
#define UART_ICR_FEIC 0x00000080 // Framing Error Interrupt Clear
|
199 |
|
|
#define UART_ICR_RTIC 0x00000040 // Receive Timeout Interrupt Clear
|
200 |
|
|
#define UART_ICR_TXIC 0x00000020 // Transmit Interrupt Clear
|
201 |
|
|
#define UART_ICR_RXIC 0x00000010 // Receive Interrupt Clear
|
202 |
|
|
|
203 |
|
|
#define UART_RSR_ANY (UART_RSR_OE | \
|
204 |
|
|
UART_RSR_BE | \
|
205 |
|
|
UART_RSR_PE | \
|
206 |
|
|
UART_RSR_FE)
|
207 |
|
|
|
208 |
|
|
//*****************************************************************************
|
209 |
|
|
//
|
210 |
|
|
// Reset Values for UART Registers.
|
211 |
|
|
//
|
212 |
|
|
//*****************************************************************************
|
213 |
|
|
#define UART_RV_DR 0x00000000
|
214 |
|
|
#define UART_RV_RSR 0x00000000
|
215 |
|
|
#define UART_RV_ECR 0x00000000
|
216 |
|
|
#define UART_RV_FR 0x00000090
|
217 |
|
|
#define UART_RV_IBRD 0x00000000
|
218 |
|
|
#define UART_RV_FBRD 0x00000000
|
219 |
|
|
#define UART_RV_LCR_H 0x00000000
|
220 |
|
|
#define UART_RV_CTL 0x00000300
|
221 |
|
|
#define UART_RV_IFLS 0x00000012
|
222 |
|
|
#define UART_RV_IM 0x00000000
|
223 |
|
|
#define UART_RV_RIS 0x00000000
|
224 |
|
|
#define UART_RV_MIS 0x00000000
|
225 |
|
|
#define UART_RV_ICR 0x00000000
|
226 |
|
|
#define UART_RV_PeriphID4 0x00000000
|
227 |
|
|
#define UART_RV_PeriphID5 0x00000000
|
228 |
|
|
#define UART_RV_PeriphID6 0x00000000
|
229 |
|
|
#define UART_RV_PeriphID7 0x00000000
|
230 |
|
|
#define UART_RV_PeriphID0 0x00000011
|
231 |
|
|
#define UART_RV_PeriphID1 0x00000000
|
232 |
|
|
#define UART_RV_PeriphID2 0x00000018
|
233 |
|
|
#define UART_RV_PeriphID3 0x00000001
|
234 |
|
|
#define UART_RV_PCellID0 0x0000000D
|
235 |
|
|
#define UART_RV_PCellID1 0x000000F0
|
236 |
|
|
#define UART_RV_PCellID2 0x00000005
|
237 |
|
|
#define UART_RV_PCellID3 0x000000B1
|
238 |
|
|
|
239 |
|
|
#endif // __HW_UART_H__
|