sci.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _SCI_H_
  13. #define _SCI_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_SCI1_BASE (0x14000000)
  17. #define REG_SCI2_BASE (0x14001000)
  18. typedef volatile struct
  19. {
  20. uint32_t sci_config; // 0x00000000
  21. uint32_t status; // 0x00000004
  22. uint32_t data; // 0x00000008
  23. uint32_t clkdiv_reg; // 0x0000000c
  24. uint32_t rxcnt_reg; // 0x00000010
  25. uint32_t times; // 0x00000014
  26. uint32_t ch_filt_reg; // 0x00000018
  27. uint32_t dbg; // 0x0000001c
  28. uint32_t int_cause; // 0x00000020
  29. uint32_t int_clr; // 0x00000024
  30. uint32_t int_mask; // 0x00000028
  31. uint32_t pa_clk_stop_en; // 0x0000002c
  32. uint32_t pa_status; // 0x00000030
  33. } HWP_SCI_T;
  34. #define hwp_sci1 ((HWP_SCI_T *)REG_ACCESS_ADDRESS(REG_SCI1_BASE))
  35. #define hwp_sci2 ((HWP_SCI_T *)REG_ACCESS_ADDRESS(REG_SCI2_BASE))
  36. // sci_config
  37. typedef union {
  38. uint32_t v;
  39. struct
  40. {
  41. uint32_t enable : 1; // [0]
  42. uint32_t parity : 1; // [1]
  43. uint32_t perf : 1; // [2]
  44. uint32_t filter_disable : 1; // [3]
  45. uint32_t clockstop : 1; // [4]
  46. uint32_t autostop_en_h : 1; // [5]
  47. uint32_t msbh_lsbl : 1; // [6]
  48. uint32_t lli : 1; // [7]
  49. uint32_t pegen_len : 1; // [8]
  50. uint32_t parity_en : 1; // [9]
  51. uint32_t stop_level : 1; // [10]
  52. uint32_t __15_11 : 5; // [15:11]
  53. uint32_t arg_h : 1; // [16]
  54. uint32_t afd_en_h : 1; // [17]
  55. uint32_t tx_resend_en_h : 1; // [18]
  56. uint32_t __19_19 : 1; // [19]
  57. uint32_t reset : 1; // [20]
  58. uint32_t dly_sel : 1; // [21]
  59. uint32_t in_avg_en : 1; // [22]
  60. uint32_t __23_23 : 1; // [23]
  61. uint32_t par_chk_offset : 6; // [29:24]
  62. uint32_t __31_30 : 2; // [31:30]
  63. } b;
  64. } REG_SCI_SCI_CONFIG_T;
  65. // status
  66. typedef union {
  67. uint32_t v;
  68. struct
  69. {
  70. uint32_t rxdata_rdy : 1; // [0], read only
  71. uint32_t tx_fifo_rdy : 1; // [1], read only
  72. uint32_t format_det : 1; // [2], read only
  73. uint32_t arg_det : 1; // [3], read only
  74. uint32_t reset_det : 1; // [4], read only
  75. uint32_t clk_rdy_h : 1; // [5], read only
  76. uint32_t clk_off : 1; // [6], read only
  77. uint32_t __7_7 : 1; // [7]
  78. uint32_t rx_err : 1; // [8], read only
  79. uint32_t tx_err : 1; // [9], read only
  80. uint32_t rxoverflow : 1; // [10], read only
  81. uint32_t txoverflow : 1; // [11], read only
  82. uint32_t __29_12 : 18; // [29:12]
  83. uint32_t autostop_state : 2; // [31:30], read only
  84. } b;
  85. } REG_SCI_STATUS_T;
  86. // data
  87. typedef union {
  88. uint32_t v;
  89. struct
  90. {
  91. uint32_t data_in : 8; // [7:0]
  92. uint32_t data_out : 8; // [7:0], read only
  93. uint32_t __31_8 : 24; // [31:8]
  94. } b;
  95. } REG_SCI_DATA_T;
  96. // clkdiv_reg
  97. typedef union {
  98. uint32_t v;
  99. struct
  100. {
  101. uint32_t clkdiv : 9; // [8:0]
  102. uint32_t baud_x8_en : 1; // [9]
  103. uint32_t rx_clk_cnt_limit : 5; // [14:10]
  104. uint32_t clk_tst : 1; // [15]
  105. uint32_t clkdiv_16 : 8; // [23:16]
  106. uint32_t maindiv : 6; // [29:24]
  107. uint32_t clk_out_inv : 1; // [30]
  108. uint32_t clk_inv : 1; // [31]
  109. } b;
  110. } REG_SCI_CLKDIV_REG_T;
  111. // rxcnt_reg
  112. typedef union {
  113. uint32_t v;
  114. struct
  115. {
  116. uint32_t rxcnt : 10; // [9:0]
  117. uint32_t __30_10 : 21; // [30:10]
  118. uint32_t clk_persist : 1; // [31]
  119. } b;
  120. } REG_SCI_RXCNT_REG_T;
  121. // times
  122. typedef union {
  123. uint32_t v;
  124. struct
  125. {
  126. uint32_t chguard : 8; // [7:0]
  127. uint32_t turnaroundguard : 4; // [11:8]
  128. uint32_t __15_12 : 4; // [15:12]
  129. uint32_t wi : 8; // [23:16]
  130. uint32_t tx_pert : 8; // [31:24]
  131. } b;
  132. } REG_SCI_TIMES_T;
  133. // ch_filt_reg
  134. typedef union {
  135. uint32_t v;
  136. struct
  137. {
  138. uint32_t ch_filt : 8; // [7:0]
  139. uint32_t __31_8 : 24; // [31:8]
  140. } b;
  141. } REG_SCI_CH_FILT_REG_T;
  142. // dbg
  143. typedef union {
  144. uint32_t v;
  145. struct
  146. {
  147. uint32_t fifo_rx_clr : 1; // [0]
  148. uint32_t fifo_tx_clr : 1; // [1]
  149. uint32_t __31_2 : 30; // [31:2]
  150. } b;
  151. } REG_SCI_DBG_T;
  152. // int_cause
  153. typedef union {
  154. uint32_t v;
  155. struct
  156. {
  157. uint32_t rx_done : 1; // [0], read only
  158. uint32_t rx_half : 1; // [1], read only
  159. uint32_t wwt_timeout : 1; // [2], read only
  160. uint32_t extra_rx : 1; // [3], read only
  161. uint32_t resend_ovfl : 1; // [4], read only
  162. uint32_t arg_end : 1; // [5], read only
  163. uint32_t sci_dma_tx_done : 1; // [6], read only
  164. uint32_t sci_dma_rx_done : 1; // [7], read only
  165. uint32_t __31_8 : 24; // [31:8]
  166. } b;
  167. } REG_SCI_INT_CAUSE_T;
  168. // int_clr
  169. typedef union {
  170. uint32_t v;
  171. struct
  172. {
  173. uint32_t rx_done : 1; // [0], write clear
  174. uint32_t rx_half : 1; // [1], write clear
  175. uint32_t wwt_timeout : 1; // [2], write clear
  176. uint32_t extra_rx : 1; // [3], write clear
  177. uint32_t resend_ovfl : 1; // [4], write clear
  178. uint32_t arg_end : 1; // [5], write clear
  179. uint32_t sci_dma_tx_done : 1; // [6], write clear
  180. uint32_t sci_dma_rx_done : 1; // [7], write clear
  181. uint32_t __31_8 : 24; // [31:8]
  182. } b;
  183. } REG_SCI_INT_CLR_T;
  184. // int_mask
  185. typedef union {
  186. uint32_t v;
  187. struct
  188. {
  189. uint32_t rx_done : 1; // [0]
  190. uint32_t rx_half : 1; // [1]
  191. uint32_t wwt_timeout : 1; // [2]
  192. uint32_t extra_rx : 1; // [3]
  193. uint32_t resend_ovfl : 1; // [4]
  194. uint32_t arg_end : 1; // [5]
  195. uint32_t sci_dma_tx_done : 1; // [6]
  196. uint32_t sci_dma_rx_done : 1; // [7]
  197. uint32_t __31_8 : 24; // [31:8]
  198. } b;
  199. } REG_SCI_INT_MASK_T;
  200. // sci_config
  201. #define SCI_ENABLE (1 << 0)
  202. #define SCI_PARITY_EVEN_PARITY (0 << 1)
  203. #define SCI_PARITY_ODD_PARITY (1 << 1)
  204. #define SCI_PERF (1 << 2)
  205. #define SCI_FILTER_DISABLE (1 << 3)
  206. #define SCI_CLOCKSTOP (1 << 4)
  207. #define SCI_AUTOSTOP_EN_H (1 << 5)
  208. #define SCI_MSBH_LSBL (1 << 6)
  209. #define SCI_LLI (1 << 7)
  210. #define SCI_PEGEN_LEN (1 << 8)
  211. #define SCI_PARITY_EN (1 << 9)
  212. #define SCI_STOP_LEVEL (1 << 10)
  213. #define SCI_ARG_H (1 << 16)
  214. #define SCI_AFD_EN_H (1 << 17)
  215. #define SCI_TX_RESEND_EN_H (1 << 18)
  216. #define SCI_RESET (1 << 20)
  217. #define SCI_DLY_SEL (1 << 21)
  218. #define SCI_IN_AVG_EN (1 << 22)
  219. #define SCI_PAR_CHK_OFFSET(n) (((n)&0x3f) << 24)
  220. #define SCI_PARITY_V_EVEN_PARITY (0)
  221. #define SCI_PARITY_V_ODD_PARITY (1)
  222. // status
  223. #define SCI_RXDATA_RDY (1 << 0)
  224. #define SCI_TX_FIFO_RDY (1 << 1)
  225. #define SCI_FORMAT_DET (1 << 2)
  226. #define SCI_ARG_DET (1 << 3)
  227. #define SCI_RESET_DET (1 << 4)
  228. #define SCI_CLK_RDY_H (1 << 5)
  229. #define SCI_CLK_OFF (1 << 6)
  230. #define SCI_RX_ERR (1 << 8)
  231. #define SCI_TX_ERR (1 << 9)
  232. #define SCI_RXOVERFLOW (1 << 10)
  233. #define SCI_TXOVERFLOW (1 << 11)
  234. #define SCI_AUTOSTOP_STATE(n) (((n)&0x3) << 30)
  235. #define SCI_AUTOSTOP_STATE_STARTUP_PHASE (0 << 30)
  236. #define SCI_AUTOSTOP_STATE_AUTO_ON (1 << 30)
  237. #define SCI_AUTOSTOP_STATE_SHUTDOWN_PHASE (2 << 30)
  238. #define SCI_AUTOSTOP_STATE_CLOCK_OFF (3 << 30)
  239. #define SCI_AUTOSTOP_STATE_V_STARTUP_PHASE (0)
  240. #define SCI_AUTOSTOP_STATE_V_AUTO_ON (1)
  241. #define SCI_AUTOSTOP_STATE_V_SHUTDOWN_PHASE (2)
  242. #define SCI_AUTOSTOP_STATE_V_CLOCK_OFF (3)
  243. // data
  244. #define SCI_DATA_IN(n) (((n)&0xff) << 0)
  245. #define SCI_DATA_OUT(n) (((n)&0xff) << 0)
  246. // clkdiv_reg
  247. #define SCI_CLKDIV(n) (((n)&0x1ff) << 0)
  248. #define SCI_BAUD_X8_EN (1 << 9)
  249. #define SCI_RX_CLK_CNT_LIMIT(n) (((n)&0x1f) << 10)
  250. #define SCI_CLK_TST (1 << 15)
  251. #define SCI_CLKDIV_16(n) (((n)&0xff) << 16)
  252. #define SCI_MAINDIV(n) (((n)&0x3f) << 24)
  253. #define SCI_CLK_OUT_INV (1 << 30)
  254. #define SCI_CLK_INV (1 << 31)
  255. // rxcnt_reg
  256. #define SCI_RXCNT(n) (((n)&0x3ff) << 0)
  257. #define SCI_CLK_PERSIST (1 << 31)
  258. // times
  259. #define SCI_CHGUARD(n) (((n)&0xff) << 0)
  260. #define SCI_TURNAROUNDGUARD(n) (((n)&0xf) << 8)
  261. #define SCI_WI(n) (((n)&0xff) << 16)
  262. #define SCI_TX_PERT(n) (((n)&0xff) << 24)
  263. // ch_filt_reg
  264. #define SCI_CH_FILT(n) (((n)&0xff) << 0)
  265. // dbg
  266. #define SCI_FIFO_RX_CLR (1 << 0)
  267. #define SCI_FIFO_TX_CLR (1 << 1)
  268. // int_cause
  269. #define SCI_RX_DONE (1 << 0)
  270. #define SCI_RX_HALF (1 << 1)
  271. #define SCI_WWT_TIMEOUT (1 << 2)
  272. #define SCI_EXTRA_RX (1 << 3)
  273. #define SCI_RESEND_OVFL (1 << 4)
  274. #define SCI_ARG_END (1 << 5)
  275. #define SCI_SCI_DMA_TX_DONE (1 << 6)
  276. #define SCI_SCI_DMA_RX_DONE (1 << 7)
  277. // int_clr
  278. #define SCI_RX_DONE (1 << 0)
  279. #define SCI_RX_HALF (1 << 1)
  280. #define SCI_WWT_TIMEOUT (1 << 2)
  281. #define SCI_EXTRA_RX (1 << 3)
  282. #define SCI_RESEND_OVFL (1 << 4)
  283. #define SCI_ARG_END (1 << 5)
  284. #define SCI_SCI_DMA_TX_DONE (1 << 6)
  285. #define SCI_SCI_DMA_RX_DONE (1 << 7)
  286. // int_mask
  287. #define SCI_RX_DONE (1 << 0)
  288. #define SCI_RX_HALF (1 << 1)
  289. #define SCI_WWT_TIMEOUT (1 << 2)
  290. #define SCI_EXTRA_RX (1 << 3)
  291. #define SCI_RESEND_OVFL (1 << 4)
  292. #define SCI_ARG_END (1 << 5)
  293. #define SCI_SCI_DMA_TX_DONE (1 << 6)
  294. #define SCI_SCI_DMA_RX_DONE (1 << 7)
  295. #endif // _SCI_H_