dw_uart_hal.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /* ------------------------------------------
  2. * Copyright (c) 2016, Synopsys, Inc. All rights reserved.
  3. * Redistribution and use in source and binary forms, with or without modification,
  4. * are permitted provided that the following conditions are met:
  5. * 1) Redistributions of source code must retain the above copyright notice, this
  6. * list of conditions and the following disclaimer.
  7. * 2) Redistributions in binary form must reproduce the above copyright notice,
  8. * this list of conditions and the following disclaimer in the documentation and/or
  9. * other materials provided with the distribution.
  10. * 3) Neither the name of the Synopsys, Inc., nor the names of its contributors may
  11. * be used to endorse or promote products derived from this software without
  12. * specific prior written permission.
  13. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  14. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  15. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  16. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  17. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  18. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  19. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  20. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  22. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. *
  24. * \version 2016.05
  25. * \date 2014-06-20
  26. * \author Huaqi Fang(Huaqi.Fang@synopsys.com)
  27. --------------------------------------------- */
  28. /**
  29. * \file
  30. * \ingroup DEVICE_DW_IIC
  31. * \brief DesignWare UART driver hardware description related header file
  32. * \details detailed hardware related definitions of DesignWare UART driver
  33. */
  34. #ifndef _DEVICE_DW_UART_HAL_H_
  35. #define _DEVICE_DW_UART_HAL_H_
  36. /* DW APB UART bit definitions */
  37. /**
  38. * \name DesignWare UART HAL IER Marcos
  39. * \brief DesignWare UART hal IER related macros
  40. * @{
  41. */
  42. /* IER */
  43. #define DW_UART_IER_DATA_AVAIL (0x01)
  44. #define DW_UART_IER_XMIT_EMPTY (0x02)
  45. #define DW_UART_IER_LINE_STATUS (0x04)
  46. #define DW_UART_IER_MDM_STATUS (0x08)
  47. #define DW_UART_IER_PTIME (0x80)
  48. /** @} */
  49. /**
  50. * \name DesignWare UART HAL IIR Marcos
  51. * \brief DesignWare UART hal IIR related macros
  52. * @{
  53. */
  54. /* IIR */
  55. /* IIR READ */
  56. #define DW_UART_IIR_IP (0x01)
  57. #define DW_UART_IIR_MASK (0x0E)
  58. #define DW_UART_IIR_READ_FIFO_ENABLE (0xC0)
  59. /* Possible interrupt IIR_MASK values */
  60. #define DW_UART_IIR_MDM_STATUS (0x00)
  61. #define DW_UART_IIR_XMIT_EMPTY (0x02)
  62. #define DW_UART_IIR_DATA_AVAIL (0x04)
  63. #define DW_UART_IIR_LINE_STATUS (0x06)
  64. #define DW_UART_IIR_RX_TIMEOUT (0x0C)
  65. #define DW_UART_IIR_INT_ID_MASK (0x0f)
  66. /* IIR WRITE */
  67. #define DW_UART_IIR_FIFO_ENABLE (0x01)
  68. #define DW_UART_IIR_RCVR_FIFO_RESET (0x02)
  69. #define DW_UART_IIR_XMIT_FIFO_RESET (0x04)
  70. #define DW_UART_IIR_DMA_MODE_SELECT (0x08)
  71. #define DW_UART_IIR_RCV_TRIGGER_MASK (0xC0)
  72. /* Values for IIR receive trigger */
  73. #define DW_UART_IIR_TRIGGER_LEVEL_1_CHAR (0x00)
  74. #define DW_UART_IIR_TRIGGER_LEVEL_1_4_FULL (0x40)
  75. #define DW_UART_IIR_TRIGGER_LEVEL_1_2_FULL (0x80)
  76. #define DW_UART_IIR_TRIGGER_LEVEL_2_LESS_FULL (0xC0)
  77. /** @} */
  78. /**
  79. * \name DesignWare UART HAL LCR Marcos
  80. * \brief DesignWare UART hal LCR related macros
  81. * @{
  82. */
  83. /* LCR */
  84. #define DW_UART_LCR_WORD_LEN_MASK (0x03)
  85. #define DW_UART_LCR_STOP_BIT_MASK (0x04)
  86. #define DW_UART_LCR_PARITY_MASK (0x38)
  87. #define DW_UART_LCR_DPS_MASK (0x3F)
  88. #define DW_UART_LCR_STICK_PARITY (0x20)
  89. #define DW_UART_LCR_BREAK (0x40)
  90. #define DW_UART_LCR_DLAB (0x80)
  91. /* Word length values */
  92. #define DW_UART_LCR_WORD_LEN5 (0x00)
  93. #define DW_UART_LCR_WORD_LEN6 (0x01)
  94. #define DW_UART_LCR_WORD_LEN7 (0x02)
  95. #define DW_UART_LCR_WORD_LEN8 (0x03)
  96. /* stop bit values */
  97. #define DW_UART_LCR_1_STOP_BIT (0x00)
  98. #define DW_UART_LCR_1D5_STOP_BIT (0x04)
  99. #define DW_UART_LCR_2_STOP_BIT (0x04)
  100. /* Parity bit values */
  101. #define DW_UART_LCR_PARITY_NONE (0x00)
  102. #define DW_UART_LCR_PARITY_ODD (0x08)
  103. #define DW_UART_LCR_PARITY_EVEN (0x18)
  104. #define DW_UART_LCR_PARITY_MARK (0x28)
  105. #define DW_UART_LCR_PARITY_SPACE (0x38)
  106. /** @} */
  107. /**
  108. * \name DesignWare UART HAL MCR Marcos
  109. * \brief DesignWare UART hal MCR related macros
  110. * @{
  111. */
  112. /* MCR */
  113. #define DW_UART_MCR_DTR (0x01)
  114. #define DW_UART_MCR_RTS (0x02)
  115. #define DW_UART_MCR_LOOPBACK (0x10)
  116. #define DW_UART_MCR_AFCE (0x20)
  117. #define DW_UART_MCR_SIRE (0x40)
  118. /** @} */
  119. /**
  120. * \name DesignWare UART HAL LSR Marcos
  121. * \brief DesignWare UART hal LSR related macros
  122. * @{
  123. */
  124. /* LSR */
  125. #define DW_UART_LSR_DR (0x01)
  126. #define DW_UART_LSR_OVERRUN (0x02)
  127. #define DW_UART_LSR_PARITYERR (0x04)
  128. #define DW_UART_LSR_FRAMEERR (0x08)
  129. #define DW_UART_LSR_BREAKRCVD (0x10)
  130. #define DW_UART_LSR_TXD_EMPTY (0x20)
  131. #define DW_UART_LSR_TX_STATUS (0x40)
  132. #define DW_UART_LSR_RX_FIFOERR (0x80)
  133. /** @} */
  134. /**
  135. * \name DesignWare UART HAL MSR Marcos
  136. * \brief DesignWare UART hal MSR related macros
  137. * @{
  138. */
  139. /* MSR */
  140. #define DW_UART_MSR_DCTS (0x01)
  141. #define DW_UART_MSR_DDSR (0x02)
  142. #define DW_UART_MSR_TERI (0x04)
  143. #define DW_UART_MSR_DDCD (0x08)
  144. #define DW_UART_MSR_CTS (0x10)
  145. #define DW_UART_MSR_DSR (0x20)
  146. #define DW_UART_MSR_RIC (0x40)
  147. #define DW_UART_MSR_DCD (0x80)
  148. /** @} */
  149. /**
  150. * \name DesignWare UART HAL FCR Marcos
  151. * \brief DesignWare UART hal FCR related macros
  152. * @{
  153. */
  154. /* FCR */
  155. #define DW_UART_FCR_FEN (0x01)
  156. #define DW_UART_FCR_RFR (0x02)
  157. #define DW_UART_FCR_TFR (0x04)
  158. #define DW_UART_FCR_DMS (0x08)
  159. #define DW_UART_FCR_RTL (0xC0)
  160. /** @} */
  161. /**
  162. * \name DesignWare UART HAL USR Marcos
  163. * \brief DesignWare UART hal USR related macros
  164. * @{
  165. */
  166. /* USR */
  167. #define DW_UART_USR_BUSY (0x01)
  168. #define DW_UART_USR_TFNF (0x02)
  169. #define DW_UART_USR_TFE (0x04)
  170. #define DW_UART_USR_RFNE (0x08)
  171. #define DW_UART_USR_RFF (0x10)
  172. /** @} */
  173. /**
  174. * \name DesignWare UART HAL SFE Marcos
  175. * \brief DesignWare UART hal SFE related macros
  176. * @{
  177. */
  178. /* SFE */
  179. #define DW_UART_SFE_SHADOW_FIFO_ENABLE (0x01)
  180. /** @} */
  181. /**
  182. * \name DesignWare UART HAL SRR Marcos
  183. * \brief DesignWare UART hal SRR related macros
  184. * @{
  185. */
  186. /* SRR */
  187. #define DW_UART_SRR_UR (0x01)
  188. #define DW_UART_SRR_RFR (0x02)
  189. #define DW_UART_SRR_XFR (0x04)
  190. /** @} */
  191. /**
  192. * \name DesignWare UART HAL SRT Marcos
  193. * \brief DesignWare UART hal SRT related macros
  194. * @{
  195. */
  196. /* SRT */
  197. #define DW_UART_SRT_TRIGGER_LEVEL_1_CHAR (0x00)
  198. #define DW_UART_SRT_TRIGGER_LEVEL_1_4_FULL (0x01)
  199. #define DW_UART_SRT_TRIGGER_LEVEL_1_2_FULL (0x02)
  200. #define DW_UART_SRT_TRIGGER_LEVEL_2_LESS_FULL (0x03)
  201. /** @} */
  202. /**
  203. * \name DesignWare UART HAL STET Marcos
  204. * \brief DesignWare UART hal STET related macros
  205. * @{
  206. */
  207. /* STET*/
  208. #define DW_UART_STET_FIFO_EMPTY (0x00)
  209. #define DW_UART_STET_2_CHARS_IN_FIFO (0x01)
  210. #define DW_UART_STET_1_4_FULL (0x02)
  211. #define DW_UART_STET_1_2_FULL (0x03)
  212. /** @} */
  213. /**
  214. * \name DesignWare UART HAL CPR Marcos
  215. * \brief DesignWare UART hal CPR related macros
  216. * @{
  217. */
  218. /* CPR*/
  219. #define DW_UART_CPR_FIFO_STAT (1<<10)
  220. #define DW_UART_CPR_FIFO_MODE_OFS (16)
  221. #define DW_UART_CPR_FIFO_MODE_MASK (0xFF)
  222. #define DW_UART_CPR_FIFO_MODE (0xFF0000)
  223. /** @} */
  224. #endif /* _DEVICE_DW_UART_HAL_H_ */