4 * Copyright (c) 2013 Atmel Corporation. All rights reserved.
\r
10 * Redistribution and use in source and binary forms, with or without
\r
11 * modification, are permitted provided that the following conditions are met:
\r
13 * 1. Redistributions of source code must retain the above copyright notice,
\r
14 * this list of conditions and the following disclaimer.
\r
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
17 * this list of conditions and the following disclaimer in the documentation
\r
18 * and/or other materials provided with the distribution.
\r
20 * 3. The name of Atmel may not be used to endorse or promote products derived
\r
21 * from this software without specific prior written permission.
\r
23 * 4. This software may only be redistributed and used in connection with an
\r
24 * Atmel microcontroller product.
\r
26 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
\r
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
29 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
\r
30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\r
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
\r
34 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
\r
35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
36 * POSSIBILITY OF SUCH DAMAGE.
\r
42 #ifndef _SAM4E_UART_COMPONENT_
\r
43 #define _SAM4E_UART_COMPONENT_
\r
45 /* ============================================================================= */
\r
46 /** SOFTWARE API DEFINITION FOR Universal Asynchronous Receiver Transmitter */
\r
47 /* ============================================================================= */
\r
48 /** \addtogroup SAM4E_UART Universal Asynchronous Receiver Transmitter */
\r
51 #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
\r
52 /** \brief Uart hardware registers */
\r
54 WoReg UART_CR; /**< \brief (Uart Offset: 0x0000) Control Register */
\r
55 RwReg UART_MR; /**< \brief (Uart Offset: 0x0004) Mode Register */
\r
56 WoReg UART_IER; /**< \brief (Uart Offset: 0x0008) Interrupt Enable Register */
\r
57 WoReg UART_IDR; /**< \brief (Uart Offset: 0x000C) Interrupt Disable Register */
\r
58 RoReg UART_IMR; /**< \brief (Uart Offset: 0x0010) Interrupt Mask Register */
\r
59 RoReg UART_SR; /**< \brief (Uart Offset: 0x0014) Status Register */
\r
60 RoReg UART_RHR; /**< \brief (Uart Offset: 0x0018) Receive Holding Register */
\r
61 WoReg UART_THR; /**< \brief (Uart Offset: 0x001C) Transmit Holding Register */
\r
62 RwReg UART_BRGR; /**< \brief (Uart Offset: 0x0020) Baud Rate Generator Register */
\r
63 RoReg Reserved1[55];
\r
64 RwReg UART_RPR; /**< \brief (Uart Offset: 0x100) Receive Pointer Register */
\r
65 RwReg UART_RCR; /**< \brief (Uart Offset: 0x104) Receive Counter Register */
\r
66 RwReg UART_TPR; /**< \brief (Uart Offset: 0x108) Transmit Pointer Register */
\r
67 RwReg UART_TCR; /**< \brief (Uart Offset: 0x10C) Transmit Counter Register */
\r
68 RwReg UART_RNPR; /**< \brief (Uart Offset: 0x110) Receive Next Pointer Register */
\r
69 RwReg UART_RNCR; /**< \brief (Uart Offset: 0x114) Receive Next Counter Register */
\r
70 RwReg UART_TNPR; /**< \brief (Uart Offset: 0x118) Transmit Next Pointer Register */
\r
71 RwReg UART_TNCR; /**< \brief (Uart Offset: 0x11C) Transmit Next Counter Register */
\r
72 WoReg UART_PTCR; /**< \brief (Uart Offset: 0x120) Transfer Control Register */
\r
73 RoReg UART_PTSR; /**< \brief (Uart Offset: 0x124) Transfer Status Register */
\r
75 #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
\r
76 /* -------- UART_CR : (UART Offset: 0x0000) Control Register -------- */
\r
77 #define UART_CR_RSTRX (0x1u << 2) /**< \brief (UART_CR) Reset Receiver */
\r
78 #define UART_CR_RSTTX (0x1u << 3) /**< \brief (UART_CR) Reset Transmitter */
\r
79 #define UART_CR_RXEN (0x1u << 4) /**< \brief (UART_CR) Receiver Enable */
\r
80 #define UART_CR_RXDIS (0x1u << 5) /**< \brief (UART_CR) Receiver Disable */
\r
81 #define UART_CR_TXEN (0x1u << 6) /**< \brief (UART_CR) Transmitter Enable */
\r
82 #define UART_CR_TXDIS (0x1u << 7) /**< \brief (UART_CR) Transmitter Disable */
\r
83 #define UART_CR_RSTSTA (0x1u << 8) /**< \brief (UART_CR) Reset Status Bits */
\r
84 /* -------- UART_MR : (UART Offset: 0x0004) Mode Register -------- */
\r
85 #define UART_MR_PAR_Pos 9
\r
86 #define UART_MR_PAR_Msk (0x7u << UART_MR_PAR_Pos) /**< \brief (UART_MR) Parity Type */
\r
87 #define UART_MR_PAR_EVEN (0x0u << 9) /**< \brief (UART_MR) Even Parity */
\r
88 #define UART_MR_PAR_ODD (0x1u << 9) /**< \brief (UART_MR) Odd Parity */
\r
89 #define UART_MR_PAR_SPACE (0x2u << 9) /**< \brief (UART_MR) Space: parity forced to 0 */
\r
90 #define UART_MR_PAR_MARK (0x3u << 9) /**< \brief (UART_MR) Mark: parity forced to 1 */
\r
91 #define UART_MR_PAR_NO (0x4u << 9) /**< \brief (UART_MR) No Parity */
\r
92 #define UART_MR_CHMODE_Pos 14
\r
93 #define UART_MR_CHMODE_Msk (0x3u << UART_MR_CHMODE_Pos) /**< \brief (UART_MR) Channel Mode */
\r
94 #define UART_MR_CHMODE_NORMAL (0x0u << 14) /**< \brief (UART_MR) Normal Mode */
\r
95 #define UART_MR_CHMODE_AUTOMATIC (0x1u << 14) /**< \brief (UART_MR) Automatic Echo */
\r
96 #define UART_MR_CHMODE_LOCAL_LOOPBACK (0x2u << 14) /**< \brief (UART_MR) Local Loopback */
\r
97 #define UART_MR_CHMODE_REMOTE_LOOPBACK (0x3u << 14) /**< \brief (UART_MR) Remote Loopback */
\r
98 /* -------- UART_IER : (UART Offset: 0x0008) Interrupt Enable Register -------- */
\r
99 #define UART_IER_RXRDY (0x1u << 0) /**< \brief (UART_IER) Enable RXRDY Interrupt */
\r
100 #define UART_IER_TXRDY (0x1u << 1) /**< \brief (UART_IER) Enable TXRDY Interrupt */
\r
101 #define UART_IER_ENDRX (0x1u << 3) /**< \brief (UART_IER) Enable End of Receive Transfer Interrupt */
\r
102 #define UART_IER_ENDTX (0x1u << 4) /**< \brief (UART_IER) Enable End of Transmit Interrupt */
\r
103 #define UART_IER_OVRE (0x1u << 5) /**< \brief (UART_IER) Enable Overrun Error Interrupt */
\r
104 #define UART_IER_FRAME (0x1u << 6) /**< \brief (UART_IER) Enable Framing Error Interrupt */
\r
105 #define UART_IER_PARE (0x1u << 7) /**< \brief (UART_IER) Enable Parity Error Interrupt */
\r
106 #define UART_IER_TXEMPTY (0x1u << 9) /**< \brief (UART_IER) Enable TXEMPTY Interrupt */
\r
107 #define UART_IER_TXBUFE (0x1u << 11) /**< \brief (UART_IER) Enable Buffer Empty Interrupt */
\r
108 #define UART_IER_RXBUFF (0x1u << 12) /**< \brief (UART_IER) Enable Buffer Full Interrupt */
\r
109 /* -------- UART_IDR : (UART Offset: 0x000C) Interrupt Disable Register -------- */
\r
110 #define UART_IDR_RXRDY (0x1u << 0) /**< \brief (UART_IDR) Disable RXRDY Interrupt */
\r
111 #define UART_IDR_TXRDY (0x1u << 1) /**< \brief (UART_IDR) Disable TXRDY Interrupt */
\r
112 #define UART_IDR_ENDRX (0x1u << 3) /**< \brief (UART_IDR) Disable End of Receive Transfer Interrupt */
\r
113 #define UART_IDR_ENDTX (0x1u << 4) /**< \brief (UART_IDR) Disable End of Transmit Interrupt */
\r
114 #define UART_IDR_OVRE (0x1u << 5) /**< \brief (UART_IDR) Disable Overrun Error Interrupt */
\r
115 #define UART_IDR_FRAME (0x1u << 6) /**< \brief (UART_IDR) Disable Framing Error Interrupt */
\r
116 #define UART_IDR_PARE (0x1u << 7) /**< \brief (UART_IDR) Disable Parity Error Interrupt */
\r
117 #define UART_IDR_TXEMPTY (0x1u << 9) /**< \brief (UART_IDR) Disable TXEMPTY Interrupt */
\r
118 #define UART_IDR_TXBUFE (0x1u << 11) /**< \brief (UART_IDR) Disable Buffer Empty Interrupt */
\r
119 #define UART_IDR_RXBUFF (0x1u << 12) /**< \brief (UART_IDR) Disable Buffer Full Interrupt */
\r
120 /* -------- UART_IMR : (UART Offset: 0x0010) Interrupt Mask Register -------- */
\r
121 #define UART_IMR_RXRDY (0x1u << 0) /**< \brief (UART_IMR) Mask RXRDY Interrupt */
\r
122 #define UART_IMR_TXRDY (0x1u << 1) /**< \brief (UART_IMR) Disable TXRDY Interrupt */
\r
123 #define UART_IMR_ENDRX (0x1u << 3) /**< \brief (UART_IMR) Mask End of Receive Transfer Interrupt */
\r
124 #define UART_IMR_ENDTX (0x1u << 4) /**< \brief (UART_IMR) Mask End of Transmit Interrupt */
\r
125 #define UART_IMR_OVRE (0x1u << 5) /**< \brief (UART_IMR) Mask Overrun Error Interrupt */
\r
126 #define UART_IMR_FRAME (0x1u << 6) /**< \brief (UART_IMR) Mask Framing Error Interrupt */
\r
127 #define UART_IMR_PARE (0x1u << 7) /**< \brief (UART_IMR) Mask Parity Error Interrupt */
\r
128 #define UART_IMR_TXEMPTY (0x1u << 9) /**< \brief (UART_IMR) Mask TXEMPTY Interrupt */
\r
129 #define UART_IMR_TXBUFE (0x1u << 11) /**< \brief (UART_IMR) Mask TXBUFE Interrupt */
\r
130 #define UART_IMR_RXBUFF (0x1u << 12) /**< \brief (UART_IMR) Mask RXBUFF Interrupt */
\r
131 /* -------- UART_SR : (UART Offset: 0x0014) Status Register -------- */
\r
132 #define UART_SR_RXRDY (0x1u << 0) /**< \brief (UART_SR) Receiver Ready */
\r
133 #define UART_SR_TXRDY (0x1u << 1) /**< \brief (UART_SR) Transmitter Ready */
\r
134 #define UART_SR_ENDRX (0x1u << 3) /**< \brief (UART_SR) End of Receiver Transfer */
\r
135 #define UART_SR_ENDTX (0x1u << 4) /**< \brief (UART_SR) End of Transmitter Transfer */
\r
136 #define UART_SR_OVRE (0x1u << 5) /**< \brief (UART_SR) Overrun Error */
\r
137 #define UART_SR_FRAME (0x1u << 6) /**< \brief (UART_SR) Framing Error */
\r
138 #define UART_SR_PARE (0x1u << 7) /**< \brief (UART_SR) Parity Error */
\r
139 #define UART_SR_TXEMPTY (0x1u << 9) /**< \brief (UART_SR) Transmitter Empty */
\r
140 #define UART_SR_TXBUFE (0x1u << 11) /**< \brief (UART_SR) Transmission Buffer Empty */
\r
141 #define UART_SR_RXBUFF (0x1u << 12) /**< \brief (UART_SR) Receive Buffer Full */
\r
142 /* -------- UART_RHR : (UART Offset: 0x0018) Receive Holding Register -------- */
\r
143 #define UART_RHR_RXCHR_Pos 0
\r
144 #define UART_RHR_RXCHR_Msk (0xffu << UART_RHR_RXCHR_Pos) /**< \brief (UART_RHR) Received Character */
\r
145 /* -------- UART_THR : (UART Offset: 0x001C) Transmit Holding Register -------- */
\r
146 #define UART_THR_TXCHR_Pos 0
\r
147 #define UART_THR_TXCHR_Msk (0xffu << UART_THR_TXCHR_Pos) /**< \brief (UART_THR) Character to be Transmitted */
\r
148 #define UART_THR_TXCHR(value) ((UART_THR_TXCHR_Msk & ((value) << UART_THR_TXCHR_Pos)))
\r
149 /* -------- UART_BRGR : (UART Offset: 0x0020) Baud Rate Generator Register -------- */
\r
150 #define UART_BRGR_CD_Pos 0
\r
151 #define UART_BRGR_CD_Msk (0xffffu << UART_BRGR_CD_Pos) /**< \brief (UART_BRGR) Clock Divisor */
\r
152 #define UART_BRGR_CD(value) ((UART_BRGR_CD_Msk & ((value) << UART_BRGR_CD_Pos)))
\r
153 /* -------- UART_RPR : (UART Offset: 0x100) Receive Pointer Register -------- */
\r
154 #define UART_RPR_RXPTR_Pos 0
\r
155 #define UART_RPR_RXPTR_Msk (0xffffffffu << UART_RPR_RXPTR_Pos) /**< \brief (UART_RPR) Receive Pointer Register */
\r
156 #define UART_RPR_RXPTR(value) ((UART_RPR_RXPTR_Msk & ((value) << UART_RPR_RXPTR_Pos)))
\r
157 /* -------- UART_RCR : (UART Offset: 0x104) Receive Counter Register -------- */
\r
158 #define UART_RCR_RXCTR_Pos 0
\r
159 #define UART_RCR_RXCTR_Msk (0xffffu << UART_RCR_RXCTR_Pos) /**< \brief (UART_RCR) Receive Counter Register */
\r
160 #define UART_RCR_RXCTR(value) ((UART_RCR_RXCTR_Msk & ((value) << UART_RCR_RXCTR_Pos)))
\r
161 /* -------- UART_TPR : (UART Offset: 0x108) Transmit Pointer Register -------- */
\r
162 #define UART_TPR_TXPTR_Pos 0
\r
163 #define UART_TPR_TXPTR_Msk (0xffffffffu << UART_TPR_TXPTR_Pos) /**< \brief (UART_TPR) Transmit Counter Register */
\r
164 #define UART_TPR_TXPTR(value) ((UART_TPR_TXPTR_Msk & ((value) << UART_TPR_TXPTR_Pos)))
\r
165 /* -------- UART_TCR : (UART Offset: 0x10C) Transmit Counter Register -------- */
\r
166 #define UART_TCR_TXCTR_Pos 0
\r
167 #define UART_TCR_TXCTR_Msk (0xffffu << UART_TCR_TXCTR_Pos) /**< \brief (UART_TCR) Transmit Counter Register */
\r
168 #define UART_TCR_TXCTR(value) ((UART_TCR_TXCTR_Msk & ((value) << UART_TCR_TXCTR_Pos)))
\r
169 /* -------- UART_RNPR : (UART Offset: 0x110) Receive Next Pointer Register -------- */
\r
170 #define UART_RNPR_RXNPTR_Pos 0
\r
171 #define UART_RNPR_RXNPTR_Msk (0xffffffffu << UART_RNPR_RXNPTR_Pos) /**< \brief (UART_RNPR) Receive Next Pointer */
\r
172 #define UART_RNPR_RXNPTR(value) ((UART_RNPR_RXNPTR_Msk & ((value) << UART_RNPR_RXNPTR_Pos)))
\r
173 /* -------- UART_RNCR : (UART Offset: 0x114) Receive Next Counter Register -------- */
\r
174 #define UART_RNCR_RXNCTR_Pos 0
\r
175 #define UART_RNCR_RXNCTR_Msk (0xffffu << UART_RNCR_RXNCTR_Pos) /**< \brief (UART_RNCR) Receive Next Counter */
\r
176 #define UART_RNCR_RXNCTR(value) ((UART_RNCR_RXNCTR_Msk & ((value) << UART_RNCR_RXNCTR_Pos)))
\r
177 /* -------- UART_TNPR : (UART Offset: 0x118) Transmit Next Pointer Register -------- */
\r
178 #define UART_TNPR_TXNPTR_Pos 0
\r
179 #define UART_TNPR_TXNPTR_Msk (0xffffffffu << UART_TNPR_TXNPTR_Pos) /**< \brief (UART_TNPR) Transmit Next Pointer */
\r
180 #define UART_TNPR_TXNPTR(value) ((UART_TNPR_TXNPTR_Msk & ((value) << UART_TNPR_TXNPTR_Pos)))
\r
181 /* -------- UART_TNCR : (UART Offset: 0x11C) Transmit Next Counter Register -------- */
\r
182 #define UART_TNCR_TXNCTR_Pos 0
\r
183 #define UART_TNCR_TXNCTR_Msk (0xffffu << UART_TNCR_TXNCTR_Pos) /**< \brief (UART_TNCR) Transmit Counter Next */
\r
184 #define UART_TNCR_TXNCTR(value) ((UART_TNCR_TXNCTR_Msk & ((value) << UART_TNCR_TXNCTR_Pos)))
\r
185 /* -------- UART_PTCR : (UART Offset: 0x120) Transfer Control Register -------- */
\r
186 #define UART_PTCR_RXTEN (0x1u << 0) /**< \brief (UART_PTCR) Receiver Transfer Enable */
\r
187 #define UART_PTCR_RXTDIS (0x1u << 1) /**< \brief (UART_PTCR) Receiver Transfer Disable */
\r
188 #define UART_PTCR_TXTEN (0x1u << 8) /**< \brief (UART_PTCR) Transmitter Transfer Enable */
\r
189 #define UART_PTCR_TXTDIS (0x1u << 9) /**< \brief (UART_PTCR) Transmitter Transfer Disable */
\r
190 /* -------- UART_PTSR : (UART Offset: 0x124) Transfer Status Register -------- */
\r
191 #define UART_PTSR_RXTEN (0x1u << 0) /**< \brief (UART_PTSR) Receiver Transfer Enable */
\r
192 #define UART_PTSR_TXTEN (0x1u << 8) /**< \brief (UART_PTSR) Transmitter Transfer Enable */
\r
197 #endif /* _SAM4E_UART_COMPONENT_ */
\r