1 //*****************************************************************************
\r
3 // hw_uart.h - Macros and defines used when accessing the UART hardware
\r
5 // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved.
\r
7 // Software License Agreement
\r
9 // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
\r
10 // exclusively on LMI's microcontroller products.
\r
12 // The software is owned by LMI and/or its suppliers, and is protected under
\r
13 // applicable copyright laws. All rights are reserved. You may not combine
\r
14 // this software with "viral" open-source software in order to form a larger
\r
15 // program. Any use in violation of the foregoing restrictions may subject
\r
16 // the user to criminal sanctions under applicable laws, as well as to civil
\r
17 // liability for the breach of the terms and conditions of this license.
\r
19 // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
\r
20 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
\r
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
\r
22 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
\r
23 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
\r
25 // This is part of revision 2523 of the Stellaris Peripheral Driver Library.
\r
27 //*****************************************************************************
\r
29 #ifndef __HW_UART_H__
\r
30 #define __HW_UART_H__
\r
32 //*****************************************************************************
\r
34 // The following are defines for the UART Register offsets.
\r
36 //*****************************************************************************
\r
37 #define UART_O_DR 0x00000000 // Data Register
\r
38 #define UART_O_RSR 0x00000004 // Receive Status Register (read)
\r
39 #define UART_O_ECR 0x00000004 // Error Clear Register (write)
\r
40 #define UART_O_FR 0x00000018 // Flag Register (read only)
\r
41 #define UART_O_ILPR 0x00000020 // UART IrDA Low-Power Register
\r
42 #define UART_O_IBRD 0x00000024 // Integer Baud Rate Divisor Reg
\r
43 #define UART_O_FBRD 0x00000028 // Fractional Baud Rate Divisor Reg
\r
44 #define UART_O_LCRH 0x0000002C // UART Line Control
\r
45 #define UART_O_CTL 0x00000030 // Control Register
\r
46 #define UART_O_IFLS 0x00000034 // Interrupt FIFO Level Select Reg
\r
47 #define UART_O_IM 0x00000038 // Interrupt Mask Set/Clear Reg
\r
48 #define UART_O_RIS 0x0000003C // Raw Interrupt Status Register
\r
49 #define UART_O_MIS 0x00000040 // Masked Interrupt Status Register
\r
50 #define UART_O_ICR 0x00000044 // Interrupt Clear Register
\r
51 #define UART_O_DMACTL 0x00000048 // UART DMA Control
\r
53 //*****************************************************************************
\r
55 // The following are defines for the Data Register bits
\r
57 //*****************************************************************************
\r
58 #define UART_DR_OE 0x00000800 // Overrun Error
\r
59 #define UART_DR_BE 0x00000400 // Break Error
\r
60 #define UART_DR_PE 0x00000200 // Parity Error
\r
61 #define UART_DR_FE 0x00000100 // Framing Error
\r
62 #define UART_DR_DATA_M 0x000000FF // Data Transmitted or Received.
\r
63 #define UART_DR_DATA_S 0
\r
65 //*****************************************************************************
\r
67 // The following are defines for the Receive Status Register bits
\r
69 //*****************************************************************************
\r
70 #define UART_RSR_OE 0x00000008 // Overrun Error
\r
71 #define UART_RSR_BE 0x00000004 // Break Error
\r
72 #define UART_RSR_PE 0x00000002 // Parity Error
\r
73 #define UART_RSR_FE 0x00000001 // Framing Error
\r
75 //*****************************************************************************
\r
77 // The following are defines for the Flag Register bits
\r
79 //*****************************************************************************
\r
80 #define UART_FR_TXFE 0x00000080 // TX FIFO Empty
\r
81 #define UART_FR_RXFF 0x00000040 // RX FIFO Full
\r
82 #define UART_FR_TXFF 0x00000020 // TX FIFO Full
\r
83 #define UART_FR_RXFE 0x00000010 // RX FIFO Empty
\r
84 #define UART_FR_BUSY 0x00000008 // UART Busy
\r
86 //*****************************************************************************
\r
88 // The following are defines for the Integer baud-rate divisor
\r
90 //*****************************************************************************
\r
91 #define UART_IBRD_DIVINT_M 0x0000FFFF // Integer Baud-Rate Divisor.
\r
92 #define UART_IBRD_DIVINT_S 0
\r
94 //*****************************************************************************
\r
96 // The following are defines for the Fractional baud-rate divisor
\r
98 //*****************************************************************************
\r
99 #define UART_FBRD_DIVFRAC_M 0x0000003F // Fractional Baud-Rate Divisor.
\r
100 #define UART_FBRD_DIVFRAC_S 0
\r
102 //*****************************************************************************
\r
104 // The following are defines for the Control Register bits
\r
106 //*****************************************************************************
\r
107 #define UART_CTL_RXE 0x00000200 // Receive Enable
\r
108 #define UART_CTL_TXE 0x00000100 // Transmit Enable
\r
109 #define UART_CTL_LBE 0x00000080 // Loopback Enable
\r
110 #define UART_CTL_SIRLP 0x00000004 // SIR (IrDA) Low Power Enable
\r
111 #define UART_CTL_SIREN 0x00000002 // SIR (IrDA) Enable
\r
112 #define UART_CTL_UARTEN 0x00000001 // UART Enable
\r
114 //*****************************************************************************
\r
116 // The following are defines for the Interrupt FIFO Level Select Register bits
\r
118 //*****************************************************************************
\r
119 #define UART_IFLS_RX_M 0x00000038 // RX FIFO Level Interrupt Mask
\r
120 #define UART_IFLS_RX1_8 0x00000000 // 1/8 Full
\r
121 #define UART_IFLS_RX2_8 0x00000008 // 1/4 Full
\r
122 #define UART_IFLS_RX4_8 0x00000010 // 1/2 Full
\r
123 #define UART_IFLS_RX6_8 0x00000018 // 3/4 Full
\r
124 #define UART_IFLS_RX7_8 0x00000020 // 7/8 Full
\r
125 #define UART_IFLS_TX_M 0x00000007 // TX FIFO Level Interrupt Mask
\r
126 #define UART_IFLS_TX1_8 0x00000000 // 1/8 Full
\r
127 #define UART_IFLS_TX2_8 0x00000001 // 1/4 Full
\r
128 #define UART_IFLS_TX4_8 0x00000002 // 1/2 Full
\r
129 #define UART_IFLS_TX6_8 0x00000003 // 3/4 Full
\r
130 #define UART_IFLS_TX7_8 0x00000004 // 7/8 Full
\r
132 //*****************************************************************************
\r
134 // The following are defines for the Interrupt Mask Set/Clear Register bits
\r
136 //*****************************************************************************
\r
137 #define UART_IM_OEIM 0x00000400 // Overrun Error Interrupt Mask
\r
138 #define UART_IM_BEIM 0x00000200 // Break Error Interrupt Mask
\r
139 #define UART_IM_PEIM 0x00000100 // Parity Error Interrupt Mask
\r
140 #define UART_IM_FEIM 0x00000080 // Framing Error Interrupt Mask
\r
141 #define UART_IM_RTIM 0x00000040 // Receive Timeout Interrupt Mask
\r
142 #define UART_IM_TXIM 0x00000020 // Transmit Interrupt Mask
\r
143 #define UART_IM_RXIM 0x00000010 // Receive Interrupt Mask
\r
145 //*****************************************************************************
\r
147 // The following are defines for the Raw Interrupt Status Register
\r
149 //*****************************************************************************
\r
150 #define UART_RIS_OERIS 0x00000400 // Overrun Error Interrupt Status
\r
151 #define UART_RIS_BERIS 0x00000200 // Break Error Interrupt Status
\r
152 #define UART_RIS_PERIS 0x00000100 // Parity Error Interrupt Status
\r
153 #define UART_RIS_FERIS 0x00000080 // Framing Error Interrupt Status
\r
154 #define UART_RIS_RTRIS 0x00000040 // Receive Timeout Interrupt Status
\r
155 #define UART_RIS_TXRIS 0x00000020 // Transmit Interrupt Status
\r
156 #define UART_RIS_RXRIS 0x00000010 // Receive Interrupt Status
\r
158 //*****************************************************************************
\r
160 // The following are defines for the Masked Interrupt Status Register
\r
162 //*****************************************************************************
\r
163 #define UART_MIS_OEMIS 0x00000400 // Overrun Error Interrupt Status
\r
164 #define UART_MIS_BEMIS 0x00000200 // Break Error Interrupt Status
\r
165 #define UART_MIS_PEMIS 0x00000100 // Parity Error Interrupt Status
\r
166 #define UART_MIS_FEMIS 0x00000080 // Framing Error Interrupt Status
\r
167 #define UART_MIS_RTMIS 0x00000040 // Receive Timeout Interrupt Status
\r
168 #define UART_MIS_TXMIS 0x00000020 // Transmit Interrupt Status
\r
169 #define UART_MIS_RXMIS 0x00000010 // Receive Interrupt Status
\r
171 //*****************************************************************************
\r
173 // The following are defines for the Interrupt Clear Register bits
\r
175 //*****************************************************************************
\r
176 #define UART_ICR_OEIC 0x00000400 // Overrun Error Interrupt Clear
\r
177 #define UART_ICR_BEIC 0x00000200 // Break Error Interrupt Clear
\r
178 #define UART_ICR_PEIC 0x00000100 // Parity Error Interrupt Clear
\r
179 #define UART_ICR_FEIC 0x00000080 // Framing Error Interrupt Clear
\r
180 #define UART_ICR_RTIC 0x00000040 // Receive Timeout Interrupt Clear
\r
181 #define UART_ICR_TXIC 0x00000020 // Transmit Interrupt Clear
\r
182 #define UART_ICR_RXIC 0x00000010 // Receive Interrupt Clear
\r
184 //*****************************************************************************
\r
186 // The following are defines for the bit fields in the UART_O_ECR register.
\r
188 //*****************************************************************************
\r
189 #define UART_ECR_DATA_M 0x000000FF // Error Clear.
\r
190 #define UART_ECR_DATA_S 0
\r
192 //*****************************************************************************
\r
194 // The following are defines for the bit fields in the UART_O_LCRH register.
\r
196 //*****************************************************************************
\r
197 #define UART_LCRH_SPS 0x00000080 // UART Stick Parity Select.
\r
198 #define UART_LCRH_WLEN_M 0x00000060 // UART Word Length.
\r
199 #define UART_LCRH_WLEN_5 0x00000000 // 5 bits (default)
\r
200 #define UART_LCRH_WLEN_6 0x00000020 // 6 bits
\r
201 #define UART_LCRH_WLEN_7 0x00000040 // 7 bits
\r
202 #define UART_LCRH_WLEN_8 0x00000060 // 8 bits
\r
203 #define UART_LCRH_FEN 0x00000010 // UART Enable FIFOs.
\r
204 #define UART_LCRH_STP2 0x00000008 // UART Two Stop Bits Select.
\r
205 #define UART_LCRH_EPS 0x00000004 // UART Even Parity Select.
\r
206 #define UART_LCRH_PEN 0x00000002 // UART Parity Enable.
\r
207 #define UART_LCRH_BRK 0x00000001 // UART Send Break.
\r
209 //*****************************************************************************
\r
211 // The following are defines for the bit fields in the UART_O_ILPR register.
\r
213 //*****************************************************************************
\r
214 #define UART_ILPR_ILPDVSR_M 0x000000FF // IrDA Low-Power Divisor.
\r
215 #define UART_ILPR_ILPDVSR_S 0
\r
217 //*****************************************************************************
\r
219 // The following are defines for the bit fields in the UART_O_DMACTL register.
\r
221 //*****************************************************************************
\r
222 #define UART_DMACTL_DMAERR 0x00000004 // DMA on Error.
\r
223 #define UART_DMACTL_TXDMAE 0x00000002 // Transmit DMA Enable.
\r
224 #define UART_DMACTL_RXDMAE 0x00000001 // Receive DMA Enable.
\r
226 //*****************************************************************************
\r
228 // The following definitions are deprecated.
\r
230 //*****************************************************************************
\r
233 //*****************************************************************************
\r
235 // The following are deprecated defines for the UART Register offsets.
\r
237 //*****************************************************************************
\r
238 #define UART_O_LCR_H 0x0000002C // Line Control Register, HIGH byte
\r
239 #define UART_O_PeriphID4 0x00000FD0
\r
240 #define UART_O_PeriphID5 0x00000FD4
\r
241 #define UART_O_PeriphID6 0x00000FD8
\r
242 #define UART_O_PeriphID7 0x00000FDC
\r
243 #define UART_O_PeriphID0 0x00000FE0
\r
244 #define UART_O_PeriphID1 0x00000FE4
\r
245 #define UART_O_PeriphID2 0x00000FE8
\r
246 #define UART_O_PeriphID3 0x00000FEC
\r
247 #define UART_O_PCellID0 0x00000FF0
\r
248 #define UART_O_PCellID1 0x00000FF4
\r
249 #define UART_O_PCellID2 0x00000FF8
\r
250 #define UART_O_PCellID3 0x00000FFC
\r
252 //*****************************************************************************
\r
254 // The following are deprecated defines for the Data Register bits
\r
256 //*****************************************************************************
\r
257 #define UART_DR_DATA_MASK 0x000000FF // UART data
\r
259 //*****************************************************************************
\r
261 // The following are deprecated defines for the Integer baud-rate divisor
\r
263 //*****************************************************************************
\r
264 #define UART_IBRD_DIVINT_MASK 0x0000FFFF // Integer baud-rate divisor
\r
266 //*****************************************************************************
\r
268 // The following are deprecated defines for the Fractional baud-rate divisor
\r
270 //*****************************************************************************
\r
271 #define UART_FBRD_DIVFRAC_MASK 0x0000003F // Fractional baud-rate divisor
\r
273 //*****************************************************************************
\r
275 // The following are deprecated defines for the Line Control Register High bits
\r
277 //*****************************************************************************
\r
278 #define UART_LCR_H_SPS 0x00000080 // Stick Parity Select
\r
279 #define UART_LCR_H_WLEN 0x00000060 // Word length
\r
280 #define UART_LCR_H_WLEN_5 0x00000000 // 5 bit data
\r
281 #define UART_LCR_H_WLEN_6 0x00000020 // 6 bit data
\r
282 #define UART_LCR_H_WLEN_7 0x00000040 // 7 bit data
\r
283 #define UART_LCR_H_WLEN_8 0x00000060 // 8 bit data
\r
284 #define UART_LCR_H_FEN 0x00000010 // Enable FIFO
\r
285 #define UART_LCR_H_STP2 0x00000008 // Two Stop Bits Select
\r
286 #define UART_LCR_H_EPS 0x00000004 // Even Parity Select
\r
287 #define UART_LCR_H_PEN 0x00000002 // Parity Enable
\r
288 #define UART_LCR_H_BRK 0x00000001 // Send Break
\r
290 //*****************************************************************************
\r
292 // The following are deprecated defines for the Interrupt FIFO Level Select
\r
295 //*****************************************************************************
\r
296 #define UART_IFLS_RX_MASK 0x00000038 // RX FIFO level mask
\r
297 #define UART_IFLS_TX_MASK 0x00000007 // TX FIFO level mask
\r
299 //*****************************************************************************
\r
301 // The following are deprecated defines for the Interrupt Clear Register bits
\r
303 //*****************************************************************************
\r
304 #define UART_RSR_ANY (UART_RSR_OE | UART_RSR_BE | UART_RSR_PE | \
\r
307 //*****************************************************************************
\r
309 // The following are deprecated defines for the Reset Values for UART
\r
312 //*****************************************************************************
\r
313 #define UART_RV_CTL 0x00000300
\r
314 #define UART_RV_PCellID1 0x000000F0
\r
315 #define UART_RV_PCellID3 0x000000B1
\r
316 #define UART_RV_FR 0x00000090
\r
317 #define UART_RV_PeriphID2 0x00000018
\r
318 #define UART_RV_IFLS 0x00000012
\r
319 #define UART_RV_PeriphID0 0x00000011
\r
320 #define UART_RV_PCellID0 0x0000000D
\r
321 #define UART_RV_PCellID2 0x00000005
\r
322 #define UART_RV_PeriphID3 0x00000001
\r
323 #define UART_RV_PeriphID4 0x00000000
\r
324 #define UART_RV_LCR_H 0x00000000
\r
325 #define UART_RV_PeriphID6 0x00000000
\r
326 #define UART_RV_DR 0x00000000
\r
327 #define UART_RV_RSR 0x00000000
\r
328 #define UART_RV_ECR 0x00000000
\r
329 #define UART_RV_PeriphID5 0x00000000
\r
330 #define UART_RV_RIS 0x00000000
\r
331 #define UART_RV_FBRD 0x00000000
\r
332 #define UART_RV_IM 0x00000000
\r
333 #define UART_RV_MIS 0x00000000
\r
334 #define UART_RV_ICR 0x00000000
\r
335 #define UART_RV_PeriphID1 0x00000000
\r
336 #define UART_RV_PeriphID7 0x00000000
\r
337 #define UART_RV_IBRD 0x00000000
\r
341 #endif // __HW_UART_H__
\r