Nut/OS  5.0.5
API Reference
lpc_uart.h
Go to the documentation of this file.
00001 #ifndef _ARCH_CM3_NXP_MACH_LPC_UART_H_
00002 #define _ARCH_CM3_NXP_MACH_LPC_UART_H_
00003 
00004 /*
00005  * Copyright 2011 by egnite GmbH
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00024  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  */
00035 
00049 
00050 
00053 #define UART_RBR_OFF        0x00000000
00054 
00058 #define UART_THR_OFF        0x00000000
00059 
00063 #define UART_DLL_OFF        0x00000000
00064 
00068 #define UART_DLM_OFF        0x00000004
00069 
00073 #define UART_IER_OFF        0x00000004
00074 #define UART_INT_RDA        (1 << 0)
00075 #define UART_INT_THRE       (1 << 1)
00076 #define UART_INT_RLS        (1 << 2)
00077 #define UART_INT_ABEO       (1 << 8)
00078 #define UART_INT_ABTO       (1 << 9)
00079 
00083 #define UART_IIR_OFF        0x00000008
00084 #define UART_INT_STATUS     (1 << 0)
00085 #define UART_INT_ID         0x0000000E
00086 #define UART_INT_ID_RLS     0x00000006
00087 #define UART_INT_ID_RDA     0x00000004
00088 #define UART_INT_ID_CTI     0x0000000C
00089 #define UART_INT_ID_THRE    0x00000002
00090 #define UART_INT_FIFO       0x000000C0
00091 
00095 #define UART_FCR_OFF        0x00000008
00096 #define UART_FIFO_EN        (1 << 0)
00097 #define UART_FIFO_RXRST     (1 << 1)
00098 #define UART_FIFO_TXRST     (1 << 2)
00099 #define UART_FIFO_DMA       (1 << 3)
00100 #define UART_FIFO_RXTRIG    0x000000C0
00101 #define UART_FIFO_RXTRIG_LSB 6
00102 
00106 #define UART_LCR_OFF        0x0000000C
00107 #define UART_WLEN           0x00000003
00108 #define UART_WLEN_5         0x00000000
00109 #define UART_WLEN_6         0x00000001
00110 #define UART_WLEN_7         0x00000002
00111 #define UART_WLEN_8         0x00000003
00112 #define UART_STOP_2         (1 << 2)
00113 #define UART_PAR            0x00000038
00114 #define UART_PAR_NONE       0x00000000
00115 #define UART_PAR_ODD        0x00000008      
00116 #define UART_PAR_EVEN       0x00000018      
00117 #define UART_PAR_MARK       0x00000028      
00118 #define UART_PAR_SPACE      0x00000038      
00119 #define UART_BREAK          (1 << 6)
00120 #define UART_DLAB           (1 << 7)
00121 
00125 #define UART_LSR_OFF        0x00000014
00126 #define UART_RDR            (1 << 0)
00127 #define UART_OE             (1 << 1)
00128 #define UART_PE             (1 << 2)
00129 #define UART_FE             (1 << 3)
00130 #define UART_BI             (1 << 4)
00131 #define UART_THRE           (1 << 5)
00132 #define UART_TEMT           (1 << 6)
00133 #define UART_RXFE           (1 << 7)
00134 
00138 #define UART_SCR_OFF        0x0000001C
00139 
00143 #define UART_ACR_OFF        0x00000020
00144 #define UART_AB_START       (1 << 0)
00145 #define UART_AB_MODE        (1 << 1)
00146 #define UART_AB_AUTORESTART (1 << 2)
00147 
00151 #define UART_ICR_OFF        0x00000024
00152 #define UART_IRDA_EN        (1 << 0)
00153 #define UART_IRDA_INV       (1 << 1)
00154 #define UART_PULSE          0x0000003C
00155 #define UART_PULSE_VAR      0x00000000
00156 #define UART_PULSE_2PCLK    0x00000004
00157 #define UART_PULSE_4PCLK    0x0000000C
00158 #define UART_PULSE_8PCLK    0x00000014
00159 #define UART_PULSE_16PCLK   0x0000001C
00160 #define UART_PULSE_32PCLK   0x00000024
00161 #define UART_PULSE_64PCLK   0x0000002C
00162 #define UART_PULSE_128PCLK  0x00000034
00163 #define UART_PULSE_256PCLK  0x0000003C
00164 
00168 #define UART_FDR_OFF        0x00000028
00169 #define UART_DIVADDVAL      0x0000000F
00170 #define UART_DIVADDVAL_LSB  0
00171 #define UART_MULVAL         0x000000F0
00172 #define UART_MULVAL_LSB     4
00173 
00177 #define UART_TER_OFF        0x00000030
00178 #define UART_TXEN           (1 << 7)
00179 
00183 #ifdef LPC_UART0_BASE
00184 #define UART0_RBR           (LPC_UART0_BASE + UART_RBR_OFF)
00185 #define UART0_THR           (LPC_UART0_BASE + UART_THR_OFF)
00186 #define UART0_DLL           (LPC_UART0_BASE + UART_DLL_OFF)
00187 #define UART0_DLM           (LPC_UART0_BASE + UART_DLM_OFF)
00188 #define UART0_IER           (LPC_UART0_BASE + UART_IER_OFF)
00189 #define UART0_IIR           (LPC_UART0_BASE + UART_IIR_OFF)
00190 #define UART0_FCR           (LPC_UART0_BASE + UART_FCR_OFF)
00191 #define UART0_LCR           (LPC_UART0_BASE + UART_LCR_OFF)
00192 #define UART0_LSR           (LPC_UART0_BASE + UART_LSR_OFF)
00193 #define UART0_SCR           (LPC_UART0_BASE + UART_SCR_OFF)
00194 #define UART0_ACR           (LPC_UART0_BASE + UART_ACR_OFF)
00195 #define UART0_ICR           (LPC_UART0_BASE + UART_ICR_OFF)
00196 #define UART0_FDR           (LPC_UART0_BASE + UART_FDR_OFF)
00197 #define UART0_TER           (LPC_UART0_BASE + UART_TER_OFF)
00198 #ifdef LPC_UART0_EXTENDED
00199 #define UART0_MCR           (LPC_UART0_BASE + UART_MCR_OFF)
00200 #define UART0_MSR           (LPC_UART0_BASE + UART_MSR_OFF)
00201 #define UART0_RS485CTRL     (LPC_UART0_BASE + UART_RS485CTRL_OFF)
00202 #define UART0_ADRMATCH      (LPC_UART0_BASE + UART_ADRMATCH_OFF)
00203 #define UART0_RS485DLY      (LPC_UART0_BASE + UART_RS485DLY_OFF)
00204 #endif
00205 #endif
00206 
00209 #ifdef LPC_UART1_BASE
00210 #define UART1_RBR           (LPC_UART1_BASE + UART_RBR_OFF)
00211 #define UART1_THR           (LPC_UART1_BASE + UART_THR_OFF)
00212 #define UART1_DLL           (LPC_UART1_BASE + UART_DLL_OFF)
00213 #define UART1_DLM           (LPC_UART1_BASE + UART_DLM_OFF)
00214 #define UART1_IER           (LPC_UART1_BASE + UART_IER_OFF)
00215 #define UART1_IIR           (LPC_UART1_BASE + UART_IIR_OFF)
00216 #define UART1_FCR           (LPC_UART1_BASE + UART_FCR_OFF)
00217 #define UART1_LCR           (LPC_UART1_BASE + UART_LCR_OFF)
00218 #define UART1_LSR           (LPC_UART1_BASE + UART_LSR_OFF)
00219 #define UART1_SCR           (LPC_UART1_BASE + UART_SCR_OFF)
00220 #define UART1_ACR           (LPC_UART1_BASE + UART_ACR_OFF)
00221 #define UART1_ICR           (LPC_UART1_BASE + UART_ICR_OFF)
00222 #define UART1_FDR           (LPC_UART1_BASE + UART_FDR_OFF)
00223 #define UART1_TER           (LPC_UART1_BASE + UART_TER_OFF)
00224 #ifdef LPC_UART1_EXTENDED
00225 #define UART1_MCR           (LPC_UART1_BASE + UART_MCR_OFF)
00226 #define UART1_MSR           (LPC_UART1_BASE + UART_MSR_OFF)
00227 #define UART1_RS485CTRL     (LPC_UART1_BASE + UART_RS485CTRL_OFF)
00228 #define UART1_ADRMATCH      (LPC_UART1_BASE + UART_ADRMATCH_OFF)
00229 #define UART1_RS485DLY      (LPC_UART1_BASE + UART_RS485DLY_OFF)
00230 #endif
00231 #endif
00232 
00236 #ifdef LPC_UART2_BASE
00237 #define UART2_RBR           (LPC_UART2_BASE + UART_RBR_OFF)
00238 #define UART2_THR           (LPC_UART2_BASE + UART_THR_OFF)
00239 #define UART2_DLL           (LPC_UART2_BASE + UART_DLL_OFF)
00240 #define UART2_DLM           (LPC_UART2_BASE + UART_DLM_OFF)
00241 #define UART2_IER           (LPC_UART2_BASE + UART_IER_OFF)
00242 #define UART2_IIR           (LPC_UART2_BASE + UART_IIR_OFF)
00243 #define UART2_FCR           (LPC_UART2_BASE + UART_FCR_OFF)
00244 #define UART2_LCR           (LPC_UART2_BASE + UART_LCR_OFF)
00245 #define UART2_LSR           (LPC_UART2_BASE + UART_LSR_OFF)
00246 #define UART2_SCR           (LPC_UART2_BASE + UART_SCR_OFF)
00247 #define UART2_ACR           (LPC_UART2_BASE + UART_ACR_OFF)
00248 #define UART2_ICR           (LPC_UART2_BASE + UART_ICR_OFF)
00249 #define UART2_FDR           (LPC_UART2_BASE + UART_FDR_OFF)
00250 #define UART2_TER           (LPC_UART2_BASE + UART_TER_OFF)
00251 #ifdef LPC_UART2_EXTENDED
00252 #define UART2_MCR           (LPC_UART2_BASE + UART_MCR_OFF)
00253 #define UART2_MSR           (LPC_UART2_BASE + UART_MSR_OFF)
00254 #define UART2_RS485CTRL     (LPC_UART2_BASE + UART_RS485CTRL_OFF)
00255 #define UART2_ADRMATCH      (LPC_UART2_BASE + UART_ADRMATCH_OFF)
00256 #define UART2_RS485DLY      (LPC_UART2_BASE + UART_RS485DLY_OFF)
00257 #endif
00258 #endif
00259 
00263 #ifdef LPC_UART3_BASE
00264 #define UART3_RBR           (LPC_UART3_BASE + UART_RBR_OFF)
00265 #define UART3_THR           (LPC_UART3_BASE + UART_THR_OFF)
00266 #define UART3_DLL           (LPC_UART3_BASE + UART_DLL_OFF)
00267 #define UART3_DLM           (LPC_UART3_BASE + UART_DLM_OFF)
00268 #define UART3_IER           (LPC_UART3_BASE + UART_IER_OFF)
00269 #define UART3_IIR           (LPC_UART3_BASE + UART_IIR_OFF)
00270 #define UART3_FCR           (LPC_UART3_BASE + UART_FCR_OFF)
00271 #define UART3_LCR           (LPC_UART3_BASE + UART_LCR_OFF)
00272 #define UART3_LSR           (LPC_UART3_BASE + UART_LSR_OFF)
00273 #define UART3_SCR           (LPC_UART3_BASE + UART_SCR_OFF)
00274 #define UART3_ACR           (LPC_UART3_BASE + UART_ACR_OFF)
00275 #define UART3_ICR           (LPC_UART3_BASE + UART_ICR_OFF)
00276 #define UART3_FDR           (LPC_UART3_BASE + UART_FDR_OFF)
00277 #define UART3_TER           (LPC_UART3_BASE + UART_TER_OFF)
00278 #ifdef LPC_UART3_EXTENDED
00279 #define UART3_MCR           (LPC_UART3_BASE + UART_MCR_OFF)
00280 #define UART3_MSR           (LPC_UART3_BASE + UART_MSR_OFF)
00281 #define UART3_RS485CTRL     (LPC_UART3_BASE + UART_RS485CTRL_OFF)
00282 #define UART3_ADRMATCH      (LPC_UART3_BASE + UART_ADRMATCH_OFF)
00283 #define UART3_RS485DLY      (LPC_UART3_BASE + UART_RS485DLY_OFF)
00284 #endif
00285 #endif
00286 
00290 
00291 #endif