uart_register.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * ESPRSSIF MIT License
  3. *
  4. * Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
  5. *
  6. * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
  7. * it is free of charge, to any person obtaining a copy of this software and associated
  8. * documentation files (the "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
  11. * to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all copies or
  14. * substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. *
  23. */
  24. #ifndef UART_REGISTER_H_
  25. #define UART_REGISTER_H_
  26. #define REG_UART_BASE(i) (0x60000000 + (i)*0xf00)
  27. //version value:32'h062000
  28. #define UART_FIFO(i) (REG_UART_BASE(i) + 0x0)
  29. #define UART_RXFIFO_RD_BYTE 0x000000FF
  30. #define UART_RXFIFO_RD_BYTE_S 0
  31. #define UART_INT_RAW(i) (REG_UART_BASE(i) + 0x4)
  32. #define UART_RXFIFO_TOUT_INT_RAW (BIT(8))
  33. #define UART_BRK_DET_INT_RAW (BIT(7))
  34. #define UART_CTS_CHG_INT_RAW (BIT(6))
  35. #define UART_DSR_CHG_INT_RAW (BIT(5))
  36. #define UART_RXFIFO_OVF_INT_RAW (BIT(4))
  37. #define UART_FRM_ERR_INT_RAW (BIT(3))
  38. #define UART_PARITY_ERR_INT_RAW (BIT(2))
  39. #define UART_TXFIFO_EMPTY_INT_RAW (BIT(1))
  40. #define UART_RXFIFO_FULL_INT_RAW (BIT(0))
  41. #define UART_INT_ST(i) (REG_UART_BASE(i) + 0x8)
  42. #define UART_RXFIFO_TOUT_INT_ST (BIT(8))
  43. #define UART_BRK_DET_INT_ST (BIT(7))
  44. #define UART_CTS_CHG_INT_ST (BIT(6))
  45. #define UART_DSR_CHG_INT_ST (BIT(5))
  46. #define UART_RXFIFO_OVF_INT_ST (BIT(4))
  47. #define UART_FRM_ERR_INT_ST (BIT(3))
  48. #define UART_PARITY_ERR_INT_ST (BIT(2))
  49. #define UART_TXFIFO_EMPTY_INT_ST (BIT(1))
  50. #define UART_RXFIFO_FULL_INT_ST (BIT(0))
  51. #define UART_INT_ENA(i) (REG_UART_BASE(i) + 0xC)
  52. #define UART_RXFIFO_TOUT_INT_ENA (BIT(8))
  53. #define UART_BRK_DET_INT_ENA (BIT(7))
  54. #define UART_CTS_CHG_INT_ENA (BIT(6))
  55. #define UART_DSR_CHG_INT_ENA (BIT(5))
  56. #define UART_RXFIFO_OVF_INT_ENA (BIT(4))
  57. #define UART_FRM_ERR_INT_ENA (BIT(3))
  58. #define UART_PARITY_ERR_INT_ENA (BIT(2))
  59. #define UART_TXFIFO_EMPTY_INT_ENA (BIT(1))
  60. #define UART_RXFIFO_FULL_INT_ENA (BIT(0))
  61. #define UART_INT_CLR(i) (REG_UART_BASE(i) + 0x10)
  62. #define UART_RXFIFO_TOUT_INT_CLR (BIT(8))
  63. #define UART_BRK_DET_INT_CLR (BIT(7))
  64. #define UART_CTS_CHG_INT_CLR (BIT(6))
  65. #define UART_DSR_CHG_INT_CLR (BIT(5))
  66. #define UART_RXFIFO_OVF_INT_CLR (BIT(4))
  67. #define UART_FRM_ERR_INT_CLR (BIT(3))
  68. #define UART_PARITY_ERR_INT_CLR (BIT(2))
  69. #define UART_TXFIFO_EMPTY_INT_CLR (BIT(1))
  70. #define UART_RXFIFO_FULL_INT_CLR (BIT(0))
  71. #define UART_CLKDIV(i) (REG_UART_BASE(i) + 0x14)
  72. #define UART_CLKDIV_CNT 0x000FFFFF
  73. #define UART_CLKDIV_S 0
  74. #define UART_AUTOBAUD(i) (REG_UART_BASE(i) + 0x18)
  75. #define UART_GLITCH_FILT 0x000000FF
  76. #define UART_GLITCH_FILT_S 8
  77. #define UART_AUTOBAUD_EN (BIT(0))
  78. #define UART_STATUS(i) (REG_UART_BASE(i) + 0x1C)
  79. #define UART_TXD (BIT(31))
  80. #define UART_RTSN (BIT(30))
  81. #define UART_DTRN (BIT(29))
  82. #define UART_TXFIFO_CNT 0x000000FF
  83. #define UART_TXFIFO_CNT_S 16
  84. #define UART_RXD (BIT(15))
  85. #define UART_CTSN (BIT(14))
  86. #define UART_DSRN (BIT(13))
  87. #define UART_RXFIFO_CNT 0x000000FF
  88. #define UART_RXFIFO_CNT_S 0
  89. #define UART_CONF0(i) (REG_UART_BASE(i) + 0x20)
  90. #define UART_DTR_INV (BIT(24))
  91. #define UART_RTS_INV (BIT(23))
  92. #define UART_TXD_INV (BIT(22))
  93. #define UART_DSR_INV (BIT(21))
  94. #define UART_CTS_INV (BIT(20))
  95. #define UART_RXD_INV (BIT(19))
  96. #define UART_TXFIFO_RST (BIT(18))
  97. #define UART_RXFIFO_RST (BIT(17))
  98. #define UART_IRDA_EN (BIT(16))
  99. #define UART_TX_FLOW_EN (BIT(15))
  100. #define UART_LOOPBACK (BIT(14))
  101. #define UART_IRDA_RX_INV (BIT(13))
  102. #define UART_IRDA_TX_INV (BIT(12))
  103. #define UART_IRDA_WCTL (BIT(11))
  104. #define UART_IRDA_TX_EN (BIT(10))
  105. #define UART_IRDA_DPLX (BIT(9))
  106. #define UART_TXD_BRK (BIT(8))
  107. #define UART_SW_DTR (BIT(7))
  108. #define UART_SW_RTS (BIT(6))
  109. #define UART_STOP_BIT_NUM 0x00000003
  110. #define UART_STOP_BIT_NUM_S 4
  111. #define UART_BIT_NUM 0x00000003
  112. #define UART_BIT_NUM_S 2
  113. #define UART_PARITY_EN (BIT(1))
  114. #define UART_PARITY_EN_M 0x00000001
  115. #define UART_PARITY_EN_S 1
  116. #define UART_PARITY (BIT(0))
  117. #define UART_PARITY_M 0x00000001
  118. #define UART_PARITY_S 0
  119. #define UART_CONF1(i) (REG_UART_BASE(i) + 0x24)
  120. #define UART_RX_TOUT_EN (BIT(31))
  121. #define UART_RX_TOUT_THRHD 0x0000007F
  122. #define UART_RX_TOUT_THRHD_S 24
  123. #define UART_RX_FLOW_EN (BIT(23))
  124. #define UART_RX_FLOW_THRHD 0x0000007F
  125. #define UART_RX_FLOW_THRHD_S 16
  126. #define UART_TXFIFO_EMPTY_THRHD 0x0000007F
  127. #define UART_TXFIFO_EMPTY_THRHD_S 8
  128. #define UART_RXFIFO_FULL_THRHD 0x0000007F
  129. #define UART_RXFIFO_FULL_THRHD_S 0
  130. #define UART_LOWPULSE(i) (REG_UART_BASE(i) + 0x28)
  131. #define UART_LOWPULSE_MIN_CNT 0x000FFFFF
  132. #define UART_LOWPULSE_MIN_CNT_S 0
  133. #define UART_HIGHPULSE(i) (REG_UART_BASE(i) + 0x2C)
  134. #define UART_HIGHPULSE_MIN_CNT 0x000FFFFF
  135. #define UART_HIGHPULSE_MIN_CNT_S 0
  136. #define UART_PULSE_NUM(i) (REG_UART_BASE(i) + 0x30)
  137. #define UART_PULSE_NUM_CNT 0x0003FF
  138. #define UART_PULSE_NUM_CNT_S 0
  139. #define UART_DATE(i) (REG_UART_BASE(i) + 0x78)
  140. #define UART_ID(i) (REG_UART_BASE(i) + 0x7C)
  141. #endif // UART_REGISTER_H_INCLUDED