at91_us.h

Go to the documentation of this file.
00001 
00040 /*
00041  * Copyright (C) 2005-2006 by egnite Software GmbH. All rights reserved.
00042  *
00043  * Redistribution and use in source and binary forms, with or without
00044  * modification, are permitted provided that the following conditions
00045  * are met:
00046  *
00047  * 1. Redistributions of source code must retain the above copyright
00048  *    notice, this list of conditions and the following disclaimer.
00049  * 2. Redistributions in binary form must reproduce the above copyright
00050  *    notice, this list of conditions and the following disclaimer in the
00051  *    documentation and/or other materials provided with the distribution.
00052  * 3. Neither the name of the copyright holders nor the names of
00053  *    contributors may be used to endorse or promote products derived
00054  *    from this software without specific prior written permission.
00055  *
00056  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00057  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00058  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00059  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00060  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00061  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00062  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00063  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00064  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00065  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00066  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00067  * SUCH DAMAGE.
00068  *
00069  * For additional information see http://www.ethernut.de/
00070  */
00071 
00072 #ifndef AT91_US_H
00073 #define AT91_US_H
00074 
00078 /*\{*/
00079 #define US_CR_OFF               0x00000000      
00080 #define US0_CR  (*((reg32_t *)(USART0_BASE + US_CR_OFF)))       
00081 #define US1_CR  (*((reg32_t *)(USART1_BASE + US_CR_OFF)))       
00082 #define US_RSTRX                         2      
00083 #define US_RSTTX                         3      
00084 #define US_RXEN                          4      
00085 #define US_RXDIS                         5      
00086 #define US_TXEN                          6      
00087 #define US_TXDIS                         7      
00088 #define US_RSTSTA                        8      
00089 #define US_STTBRK                        9      
00090 #define US_STPBRK                        10     
00091 #define US_STTTO                         11     
00092 #define US_SENDA                         12     
00093 #define US_RSTIT                         13     
00094 #define US_RSTNAK                        14     
00095 #define US_RETTO                         15     
00096 #define US_DTREN                         16     
00097 #define US_DTRDIS                        17     
00098 #define US_RTSEN                         18     
00099 #define US_RTSDIS                        19     
00100 /*\}*/
00101 
00105 /*\{*/
00106 #define US_MR_OFF               0x00000004      
00107 #define US0_MR  (*((reg32_t *)(USART0_BASE + US_MR_OFF)))       
00108 #define US1_MR  (*((reg32_t *)(USART1_BASE + US_MR_OFF)))       
00109 
00110 #define US_USART_MODE_MASK      0x0000000F      
00111 #define US_USART_MODE_NORMA     0x00000000      
00112 #define US_USART_MODE_RS485     0x00000001      
00113 #define US_USART_MODE_HW_HDSH   0x00000002      
00114 #define US_USART_MODE_MODEM     0x00000003      
00115 #define US_USART_MODE_ISO7816T0 0x00000004      
00116 #define US_USART_MODE_ISO7816T1 0x00000006      
00117 #define US_USART_MODE_IRDA      0x00000008      
00118 
00119 #define US_CLKS_MASK            0x00000030      
00120 #define US_CLKS_MCK             0x00000000      
00121 #define US_CLKS_MCK8            0x00000010      
00122 #define US_CLKS_SCK             0x00000020      
00123 #define US_CLKS_SLCK            0x00000030      
00124 
00125 #define US_CHRL_MASK            0x000000C0      
00126 #define US_CHRL_5               0x00000000      
00127 #define US_CHRL_6               0x00000040      
00128 #define US_CHRL_7               0x00000080      
00129 #define US_CHRL_8               0x000000C0      
00130 
00131 #define US_SYNC                          8      
00132 
00133 #define US_PAR_MASK             0x00000E00      
00134 #define US_PAR_EVEN             0x00000000      
00135 #define US_PAR_ODD              0x00000200      
00136 #define US_PAR_SPACE            0x00000400      
00137 #define US_PAR_MARK             0x00000600      
00138 #define US_PAR_NO               0x00000800      
00139 #define US_PAR_MULTIDROP        0x00000C00      
00140 
00141 #define US_NBSTOP_MASK          0x00003000      
00142 #define US_NBSTOP_1             0x00000000      
00143 #define US_NBSTOP_1_5           0x00001000      
00144 #define US_NBSTOP_2             0x00002000      
00145 
00146 #define US_CHMODE_MASK              0x0000C000  
00147 #define US_CHMODE_NORMAL            0x00000000  
00148 #define US_CHMODE_AUTOMATIC_ECHO    0x00004000  
00149 #define US_CHMODE_LOCAL_LOOPBACK    0x00008000  
00150 #define US_CHMODE_REMOTE_LOOPBACK   0x0000C000  
00151 
00152 #define US_MSBF                         16      
00153 #define US_MODE9                        17      
00154 #define US_CLKO                         18      
00155 #define US_OVER                         19      
00156 #define US_INACK                        20      
00157 #define US_DSNACK                       21      
00158 
00159 #define US_MAX_INTERATION_MASK      0x07000000  
00160 
00161 #define US_FILTER                       28      
00162 
00163 /*\}*/
00164 
00168 /*\{*/
00169 #define US_IER_OFF              0x00000008      
00170 #define US0_IER (*((reg32_t *)(USART0_BASE + US_IER_OFF)))      
00171 #define US1_IER (*((reg32_t *)(USART1_BASE + US_IER_OFF)))      
00172 
00173 #define US_IDR_OFF              0x0000000C      
00174 #define US0_IDR (*((reg32_t *)(USART0_BASE + US_IDR_OFF)))      
00175 #define US1_IDR (*((reg32_t *)(USART1_BASE + US_IDR_OFF)))      
00176 
00177 #define US_IMR_OFF              0x00000010      
00178 #define US0_IMR (*((reg32_t *)(USART0_BASE + US_IMR_OFF)))      
00179 #define US1_IMR (*((reg32_t *)(USART1_BASE + US_IMR_OFF)))      
00180 
00181 #define US_CSR_OFF              0x00000014      
00182 #define US0_CSR (*((reg32_t *)(USART0_BASE + US_CSR_OFF)))      
00183 #define US1_CSR (*((reg32_t *)(USART1_BASE + US_CSR_OFF)))      
00184 #define US_CSR_RI                       20      
00185 #define US_CSR_DSR                      21      
00186 #define US_CSR_DCD                      22      
00187 #define US_CSR_CTS                      23      
00188 
00189 #define US_RXRDY                         0      
00190 #define US_TXRDY                         1      
00191 #define US_RXBRK                         2      
00192 #define US_ENDRX                         3      
00193 #define US_ENDTX                         4      
00194 #define US_OVRE                          5      
00195 #define US_FRAME                         6      
00196 #define US_PARE                          7      
00197 #define US_TIMEOUT                       8      
00198 #define US_TXEMPTY                       9      
00199 #define US_ITERATION                    10      
00200 #define US_TXBUFE                       11      
00201 #define US_RXBUFF                       12      
00202 #define US_NACK                         13      
00203 #define US_RIIC                         16      
00204 #define US_DSRIC                        17      
00205 #define US_DCDIC                        18      
00206 #define US_CTSIC                        19      
00207 
00208 
00211 /*\{*/
00212 #define US_RHR_OFF              0x00000018      
00213 #define US0_RHR (*((reg32_t *)(USART0_BASE + US_RHR_OFF)))      
00214 #define US1_RHR (*((reg32_t *)(USART1_BASE + US_RHR_OFF)))      
00215 #define US_RHR_RXCHR_MASK       0x000001FF      
00216 #define US_RHR_RXSYNH                   15      
00217 /*\}*/
00218 
00222 /*\{*/
00223 #define US_THR_OFF              0x0000001C      
00224 #define US0_THR (*((reg32_t *)(USART0_BASE + US_THR_OFF)))      
00225 #define US1_THR (*((reg32_t *)(USART1_BASE + US_THR_OFF)))      
00226 #define US_THR_TXCHR_MASK       0x000001FF      
00227 #define US_THR_TXSYNH                   15      
00228 /*\}*/
00229 
00233 /*\{*/
00234 #define US_BRGR_OFF             0x00000020      
00235 #define US0_BRGR (*((reg32_t *)(USART0_BASE + US_BRGR_OFF)))    
00236 #define US1_BRGR (*((reg32_t *)(USART1_BASE + US_BRGR_OFF)))    
00237 /*\}*/
00238 
00242 /*\{*/
00243 #define US_RTOR_OFF             0x00000024      
00244 #define US0_RTOR (*((reg32_t *)(USART0_BASE + US_RTOR_OFF)))    
00245 #define US1_RTOR (*((reg32_t *)(USART1_BASE + US_RTOR_OFF)))    
00246 /*\}*/
00247 
00251 /*\{*/
00252 #define US_TTGR_OFF             0x00000028      
00253 #define US0_TTGR (*((reg32_t *)(USART0_BASE + US_TTGR_OFF)))    
00254 #define US1_TTGR (*((reg32_t *)(USART1_BASE + US_TTGR_OFF)))    
00255 /*\}*/
00256 
00260 /*\{*/
00261 #define US_FIDI_OFF             0x00000040      
00262 #define US0_FIDI (*((reg32_t *)(USART0_BASE + US_FIDI_OFF)))    
00263 #define US1_FIDI (*((reg32_t *)(USART1_BASE + US_FIDI_OFF)))    
00264 /*\}*/
00265 
00269 /*\{*/
00270 #define US_NER_OFF              0x00000044      
00271 #define US0_NER  (*((reg32_t *)(USART0_BASE + US_NER_OFF)))     
00272 #define US1_NER  (*((reg32_t *)(USART1_BASE + US_NER_OFF)))     
00273 /*\}*/
00274 
00278 /*\{*/
00279 #define US_IF_OFF               0x0000004C      
00280 #define US0_IF (*((reg32_t *)(USART0_BASE + US_IF_OFF)))        
00281 #define US1_IF (*((reg32_t *)(USART1_BASE + US_IF_OFF)))        
00282 /*\}*/
00283 
00284 #if USART_HAS_PDC
00285 
00289     /*\{*/
00290     #define US0_RPR (*((reg32_t *)(USART0_BASE + PERIPH_RPR_OFF)))      
00291     #define US1_RPR (*((reg32_t *)(USART1_BASE + PERIPH_RPR_OFF)))      
00292     /*\}*/
00293 
00297     /*\{*/
00298     #define US0_RCR (*((reg32_t *)(USART0_BASE + PERIPH_RCR_OFF)))      
00299     #define US1_RCR (*((reg32_t *)(USART1_BASE + PERIPH_RCR_OFF)))      
00300     /*\}*/
00301 
00305     /*\{*/
00306     #define US0_TPR (*((reg32_t *)(USART0_BASE + PERIPH_TPR_OFF)))      
00307     #define US1_TPR (*((reg32_t *)(USART1_BASE + PERIPH_TPR_OFF)))      
00308     /*\}*/
00309 
00313     /*\{*/
00314     #define US0_TCR (*((reg32_t *)(USART0_BASE + PERIPH_TCR_OFF)))      
00315     #define US1_TCR (*((reg32_t *)(USART1_BASE + PERIPH_TCR_OFF)))      
00316     /*\}*/
00317 
00318     #if defined(PERIPH_RNPR_OFF) && defined(PERIPH_RNCR_OFF)
00319     #define US0_RNPR   (*((reg32_t *)(USART0_BASE + PERIPH_RNPR_OFF)))  
00320     #define US1_RNPR   (*((reg32_t *)(USART1_BASE + PERIPH_RNPR_OFF)))  
00321     #define US0_RNCR   (*((reg32_t *)(USART0_BASE + PERIPH_RNCR_OFF)))  
00322     #define US1_RNCR   (*((reg32_t *)(USART1_BASE + PERIPH_RNCR_OFF)))  
00323     #endif
00324 
00325     #if defined(PERIPH_TNPR_OFF) && defined(PERIPH_TNCR_OFF)
00326     #define US0_TNPR   (*((reg32_t *)(USART0_BASE + PERIPH_TNPR_OFF)))  
00327     #define US1_TNPR   (*((reg32_t *)(USART1_BASE + PERIPH_TNPR_OFF)))  
00328     #define US0_TNCR   (*((reg32_t *)(USART0_BASE + PERIPH_TNCR_OFF)))  
00329     #define US1_TNCR   (*((reg32_t *)(USART1_BASE + PERIPH_TNCR_OFF)))  
00330     #endif
00331 
00332     #if defined(PERIPH_PTCR_OFF)
00333     #define US0_PTCR   (*((reg32_t *)(USART0_BASE + PERIPH_PTCR_OFF)))  
00334     #define US1_PTCR   (*((reg32_t *)(USART1_BASE + PERIPH_PTCR_OFF)))  
00335     #endif
00336 
00337     #if defined(PERIPH_PTSR_OFF)
00338     #define US0_PTSR   (*((reg32_t *)(USART0_BASE + PERIPH_PTSR_OFF)))  
00339     #define US1_PTSR   (*((reg32_t *)(USART1_BASE + PERIPH_PTSR_OFF)))  
00340     #endif
00341 
00342 #endif  /* USART_HAS_PDC */
00343 
00344 #endif /* AT91_US_H */