lpc_uart.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. #ifndef _ARCH_CM3_NXP_MACH_LPC_UART_H_
  2. #define _ARCH_CM3_NXP_MACH_LPC_UART_H_
  3. /*
  4. * Copyright 2011 by egnite GmbH
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. */
  34. /*!
  35. * \file arch/cm3/nxp/mach/lpc_uart.h
  36. * \brief LPC UART definitions
  37. *
  38. * \verbatim
  39. * $Id$
  40. * \endverbatim
  41. */
  42. /*!
  43. * \addtogroup xgNutArchArmv7mLpcUart
  44. */
  45. /*@{*/
  46. /*! \name UART Receiver Buffer Registers */
  47. /*@{*/
  48. #define UART_RBR_OFF 0x00000000
  49. /*@}*/
  50. /*! \name UART Transmit Holding Registers */
  51. /*@{*/
  52. #define UART_THR_OFF 0x00000000
  53. /*@}*/
  54. /*! \name UART Divisor Latch LSB Registers */
  55. /*@{*/
  56. #define UART_DLL_OFF 0x00000000
  57. /*@}*/
  58. /*! \name UART Divisor Latch MSB Registers */
  59. /*@{*/
  60. #define UART_DLM_OFF 0x00000004
  61. /*@}*/
  62. /*! \name UART Interrupt Enable Registers */
  63. /*@{*/
  64. #define UART_IER_OFF 0x00000004
  65. #define UART_INT_RDA (1 << 0)
  66. #define UART_INT_THRE (1 << 1)
  67. #define UART_INT_RLS (1 << 2)
  68. #define UART_INT_ABEO (1 << 8)
  69. #define UART_INT_ABTO (1 << 9)
  70. /*@}*/
  71. /*! \name UART Interrupt Identification Registers */
  72. /*@{*/
  73. #define UART_IIR_OFF 0x00000008
  74. #define UART_INT_STATUS (1 << 0)
  75. #define UART_INT_ID 0x0000000E
  76. #define UART_INT_ID_RLS 0x00000006
  77. #define UART_INT_ID_RDA 0x00000004
  78. #define UART_INT_ID_CTI 0x0000000C
  79. #define UART_INT_ID_THRE 0x00000002
  80. #define UART_INT_FIFO 0x000000C0
  81. /*@}*/
  82. /*! \name UART FIFO Control Registers */
  83. /*@{*/
  84. #define UART_FCR_OFF 0x00000008
  85. #define UART_FIFO_EN (1 << 0)
  86. #define UART_FIFO_RXRST (1 << 1)
  87. #define UART_FIFO_TXRST (1 << 2)
  88. #define UART_FIFO_DMA (1 << 3)
  89. #define UART_FIFO_RXTRIG 0x000000C0
  90. #define UART_FIFO_RXTRIG_LSB 6
  91. /*@}*/
  92. /*! \name UART Line Control Registers */
  93. /*@{*/
  94. #define UART_LCR_OFF 0x0000000C
  95. #define UART_WLEN 0x00000003
  96. #define UART_WLEN_5 0x00000000
  97. #define UART_WLEN_6 0x00000001
  98. #define UART_WLEN_7 0x00000002
  99. #define UART_WLEN_8 0x00000003
  100. #define UART_STOP_2 (1 << 2)
  101. #define UART_PAR 0x00000038
  102. #define UART_PAR_NONE 0x00000000
  103. #define UART_PAR_ODD 0x00000008 /*!< \brief Odd parity */
  104. #define UART_PAR_EVEN 0x00000018 /*!< \brief Even parity */
  105. #define UART_PAR_MARK 0x00000028 /*!< \brief Marked parity. */
  106. #define UART_PAR_SPACE 0x00000038 /*!< \brief Space parity. */
  107. #define UART_BREAK (1 << 6)
  108. #define UART_DLAB (1 << 7)
  109. /*@}*/
  110. /*! \name UART Line Status Registers */
  111. /*@{*/
  112. #define UART_LSR_OFF 0x00000014
  113. #define UART_RDR (1 << 0)
  114. #define UART_OE (1 << 1)
  115. #define UART_PE (1 << 2)
  116. #define UART_FE (1 << 3)
  117. #define UART_BI (1 << 4)
  118. #define UART_THRE (1 << 5)
  119. #define UART_TEMT (1 << 6)
  120. #define UART_RXFE (1 << 7)
  121. /*@}*/
  122. /*! \name UART Scratch Pad Registers */
  123. /*@{*/
  124. #define UART_SCR_OFF 0x0000001C
  125. /*@}*/
  126. /*! \name UART Auto-Baud Control Registers */
  127. /*@{*/
  128. #define UART_ACR_OFF 0x00000020
  129. #define UART_AB_START (1 << 0)
  130. #define UART_AB_MODE (1 << 1)
  131. #define UART_AB_AUTORESTART (1 << 2)
  132. /*@}*/
  133. /*! \name UART IrDA Control Registers */
  134. /*@{*/
  135. #define UART_ICR_OFF 0x00000024
  136. #define UART_IRDA_EN (1 << 0)
  137. #define UART_IRDA_INV (1 << 1)
  138. #define UART_PULSE 0x0000003C
  139. #define UART_PULSE_VAR 0x00000000
  140. #define UART_PULSE_2PCLK 0x00000004
  141. #define UART_PULSE_4PCLK 0x0000000C
  142. #define UART_PULSE_8PCLK 0x00000014
  143. #define UART_PULSE_16PCLK 0x0000001C
  144. #define UART_PULSE_32PCLK 0x00000024
  145. #define UART_PULSE_64PCLK 0x0000002C
  146. #define UART_PULSE_128PCLK 0x00000034
  147. #define UART_PULSE_256PCLK 0x0000003C
  148. /*@}*/
  149. /*! \name UART Fractional Divider Registers */
  150. /*@{*/
  151. #define UART_FDR_OFF 0x00000028
  152. #define UART_DIVADDVAL 0x0000000F
  153. #define UART_DIVADDVAL_LSB 0
  154. #define UART_MULVAL 0x000000F0
  155. #define UART_MULVAL_LSB 4
  156. /*@}*/
  157. /*! \name UART Transmit Enable Registers */
  158. /*@{*/
  159. #define UART_TER_OFF 0x00000030
  160. #define UART_TXEN (1 << 7)
  161. /*@}*/
  162. /*! \name UART0 Register Addresses */
  163. /*@{*/
  164. #ifdef LPC_UART0_BASE
  165. #define UART0_RBR (LPC_UART0_BASE + UART_RBR_OFF)
  166. #define UART0_THR (LPC_UART0_BASE + UART_THR_OFF)
  167. #define UART0_DLL (LPC_UART0_BASE + UART_DLL_OFF)
  168. #define UART0_DLM (LPC_UART0_BASE + UART_DLM_OFF)
  169. #define UART0_IER (LPC_UART0_BASE + UART_IER_OFF)
  170. #define UART0_IIR (LPC_UART0_BASE + UART_IIR_OFF)
  171. #define UART0_FCR (LPC_UART0_BASE + UART_FCR_OFF)
  172. #define UART0_LCR (LPC_UART0_BASE + UART_LCR_OFF)
  173. #define UART0_LSR (LPC_UART0_BASE + UART_LSR_OFF)
  174. #define UART0_SCR (LPC_UART0_BASE + UART_SCR_OFF)
  175. #define UART0_ACR (LPC_UART0_BASE + UART_ACR_OFF)
  176. #define UART0_ICR (LPC_UART0_BASE + UART_ICR_OFF)
  177. #define UART0_FDR (LPC_UART0_BASE + UART_FDR_OFF)
  178. #define UART0_TER (LPC_UART0_BASE + UART_TER_OFF)
  179. #ifdef LPC_UART0_EXTENDED
  180. #define UART0_MCR (LPC_UART0_BASE + UART_MCR_OFF)
  181. #define UART0_MSR (LPC_UART0_BASE + UART_MSR_OFF)
  182. #define UART0_RS485CTRL (LPC_UART0_BASE + UART_RS485CTRL_OFF)
  183. #define UART0_ADRMATCH (LPC_UART0_BASE + UART_ADRMATCH_OFF)
  184. #define UART0_RS485DLY (LPC_UART0_BASE + UART_RS485DLY_OFF)
  185. #endif
  186. #endif
  187. /*! \name UART1 Register Addresses */
  188. /*@{*/
  189. #ifdef LPC_UART1_BASE
  190. #define UART1_RBR (LPC_UART1_BASE + UART_RBR_OFF)
  191. #define UART1_THR (LPC_UART1_BASE + UART_THR_OFF)
  192. #define UART1_DLL (LPC_UART1_BASE + UART_DLL_OFF)
  193. #define UART1_DLM (LPC_UART1_BASE + UART_DLM_OFF)
  194. #define UART1_IER (LPC_UART1_BASE + UART_IER_OFF)
  195. #define UART1_IIR (LPC_UART1_BASE + UART_IIR_OFF)
  196. #define UART1_FCR (LPC_UART1_BASE + UART_FCR_OFF)
  197. #define UART1_LCR (LPC_UART1_BASE + UART_LCR_OFF)
  198. #define UART1_LSR (LPC_UART1_BASE + UART_LSR_OFF)
  199. #define UART1_SCR (LPC_UART1_BASE + UART_SCR_OFF)
  200. #define UART1_ACR (LPC_UART1_BASE + UART_ACR_OFF)
  201. #define UART1_ICR (LPC_UART1_BASE + UART_ICR_OFF)
  202. #define UART1_FDR (LPC_UART1_BASE + UART_FDR_OFF)
  203. #define UART1_TER (LPC_UART1_BASE + UART_TER_OFF)
  204. #ifdef LPC_UART1_EXTENDED
  205. #define UART1_MCR (LPC_UART1_BASE + UART_MCR_OFF)
  206. #define UART1_MSR (LPC_UART1_BASE + UART_MSR_OFF)
  207. #define UART1_RS485CTRL (LPC_UART1_BASE + UART_RS485CTRL_OFF)
  208. #define UART1_ADRMATCH (LPC_UART1_BASE + UART_ADRMATCH_OFF)
  209. #define UART1_RS485DLY (LPC_UART1_BASE + UART_RS485DLY_OFF)
  210. #endif
  211. #endif
  212. /*@}*/
  213. /*! \name UART2 Register Addresses */
  214. /*@{*/
  215. #ifdef LPC_UART2_BASE
  216. #define UART2_RBR (LPC_UART2_BASE + UART_RBR_OFF)
  217. #define UART2_THR (LPC_UART2_BASE + UART_THR_OFF)
  218. #define UART2_DLL (LPC_UART2_BASE + UART_DLL_OFF)
  219. #define UART2_DLM (LPC_UART2_BASE + UART_DLM_OFF)
  220. #define UART2_IER (LPC_UART2_BASE + UART_IER_OFF)
  221. #define UART2_IIR (LPC_UART2_BASE + UART_IIR_OFF)
  222. #define UART2_FCR (LPC_UART2_BASE + UART_FCR_OFF)
  223. #define UART2_LCR (LPC_UART2_BASE + UART_LCR_OFF)
  224. #define UART2_LSR (LPC_UART2_BASE + UART_LSR_OFF)
  225. #define UART2_SCR (LPC_UART2_BASE + UART_SCR_OFF)
  226. #define UART2_ACR (LPC_UART2_BASE + UART_ACR_OFF)
  227. #define UART2_ICR (LPC_UART2_BASE + UART_ICR_OFF)
  228. #define UART2_FDR (LPC_UART2_BASE + UART_FDR_OFF)
  229. #define UART2_TER (LPC_UART2_BASE + UART_TER_OFF)
  230. #ifdef LPC_UART2_EXTENDED
  231. #define UART2_MCR (LPC_UART2_BASE + UART_MCR_OFF)
  232. #define UART2_MSR (LPC_UART2_BASE + UART_MSR_OFF)
  233. #define UART2_RS485CTRL (LPC_UART2_BASE + UART_RS485CTRL_OFF)
  234. #define UART2_ADRMATCH (LPC_UART2_BASE + UART_ADRMATCH_OFF)
  235. #define UART2_RS485DLY (LPC_UART2_BASE + UART_RS485DLY_OFF)
  236. #endif
  237. #endif
  238. /*@}*/
  239. /*! \name UART3 Register Addresses */
  240. /*@{*/
  241. #ifdef LPC_UART3_BASE
  242. #define UART3_RBR (LPC_UART3_BASE + UART_RBR_OFF)
  243. #define UART3_THR (LPC_UART3_BASE + UART_THR_OFF)
  244. #define UART3_DLL (LPC_UART3_BASE + UART_DLL_OFF)
  245. #define UART3_DLM (LPC_UART3_BASE + UART_DLM_OFF)
  246. #define UART3_IER (LPC_UART3_BASE + UART_IER_OFF)
  247. #define UART3_IIR (LPC_UART3_BASE + UART_IIR_OFF)
  248. #define UART3_FCR (LPC_UART3_BASE + UART_FCR_OFF)
  249. #define UART3_LCR (LPC_UART3_BASE + UART_LCR_OFF)
  250. #define UART3_LSR (LPC_UART3_BASE + UART_LSR_OFF)
  251. #define UART3_SCR (LPC_UART3_BASE + UART_SCR_OFF)
  252. #define UART3_ACR (LPC_UART3_BASE + UART_ACR_OFF)
  253. #define UART3_ICR (LPC_UART3_BASE + UART_ICR_OFF)
  254. #define UART3_FDR (LPC_UART3_BASE + UART_FDR_OFF)
  255. #define UART3_TER (LPC_UART3_BASE + UART_TER_OFF)
  256. #ifdef LPC_UART3_EXTENDED
  257. #define UART3_MCR (LPC_UART3_BASE + UART_MCR_OFF)
  258. #define UART3_MSR (LPC_UART3_BASE + UART_MSR_OFF)
  259. #define UART3_RS485CTRL (LPC_UART3_BASE + UART_RS485CTRL_OFF)
  260. #define UART3_ADRMATCH (LPC_UART3_BASE + UART_ADRMATCH_OFF)
  261. #define UART3_RS485DLY (LPC_UART3_BASE + UART_RS485DLY_OFF)
  262. #endif
  263. #endif
  264. /*@}*/
  265. /*@}*/
  266. #endif