uart_struct.h 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294
  1. /**
  2. * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. /** Group: FIFO Configuration */
  12. /** Type of fifo register
  13. * FIFO data register
  14. */
  15. typedef union {
  16. struct {
  17. /** rxfifo_rd_byte : RO; bitpos: [31:0]; default: 0;
  18. * UART $n accesses FIFO via this register.
  19. */
  20. uint32_t rxfifo_rd_byte:32;
  21. };
  22. uint32_t val;
  23. } uart_fifo_reg_t;
  24. /** Type of mem_conf register
  25. * UART memory power configuration
  26. */
  27. typedef union {
  28. struct {
  29. uint32_t reserved_0:25;
  30. /** mem_force_pd : R/W; bitpos: [25]; default: 0;
  31. * Set this bit to force power down UART memory.
  32. */
  33. uint32_t mem_force_pd:1;
  34. /** mem_force_pu : R/W; bitpos: [26]; default: 0;
  35. * Set this bit to force power up UART memory.
  36. */
  37. uint32_t mem_force_pu:1;
  38. uint32_t reserved_27:5;
  39. };
  40. uint32_t val;
  41. } uart_mem_conf_reg_t;
  42. /** Type of tout_conf_sync register
  43. * UART threshold and allocation configuration
  44. */
  45. typedef union {
  46. struct {
  47. /** rx_tout_en : R/W; bitpos: [0]; default: 0;
  48. * This is the enble bit for uart receiver's timeout function.
  49. */
  50. uint32_t rx_tout_en:1;
  51. /** rx_tout_flow_dis : R/W; bitpos: [1]; default: 0;
  52. * Set this bit to stop accumulating idle_cnt when hardware flow control works.
  53. */
  54. uint32_t rx_tout_flow_dis:1;
  55. /** rx_tout_thrhd : R/W; bitpos: [11:2]; default: 10;
  56. * This register is used to configure the threshold time that receiver takes to
  57. * receive one byte. The rxfifo_tout_int interrupt will be trigger when the receiver
  58. * takes more time to receive one byte with rx_tout_en set to 1.
  59. */
  60. uint32_t rx_tout_thrhd:10;
  61. uint32_t reserved_12:20;
  62. };
  63. uint32_t val;
  64. } uart_tout_conf_sync_reg_t;
  65. /** Group: Interrupt Register */
  66. /** Type of int_raw register
  67. * Raw interrupt status
  68. */
  69. typedef union {
  70. struct {
  71. /** rxfifo_full : R/WTC/SS; bitpos: [0]; default: 0;
  72. * This interrupt raw bit turns to high level when receiver receives more data than
  73. * what rxfifo_full_thrhd specifies.
  74. */
  75. uint32_t rxfifo_full:1;
  76. /** txfifo_empty : R/WTC/SS; bitpos: [1]; default: 1;
  77. * This interrupt raw bit turns to high level when the amount of data in Tx-FIFO is
  78. * less than what txfifo_empty_thrhd specifies .
  79. */
  80. uint32_t txfifo_empty:1;
  81. /** parity_err : R/WTC/SS; bitpos: [2]; default: 0;
  82. * This interrupt raw bit turns to high level when receiver detects a parity error in
  83. * the data.
  84. */
  85. uint32_t parity_err:1;
  86. /** frm_err : R/WTC/SS; bitpos: [3]; default: 0;
  87. * This interrupt raw bit turns to high level when receiver detects a data frame error
  88. * .
  89. */
  90. uint32_t frm_err:1;
  91. /** rxfifo_ovf : R/WTC/SS; bitpos: [4]; default: 0;
  92. * This interrupt raw bit turns to high level when receiver receives more data than
  93. * the FIFO can store.
  94. */
  95. uint32_t rxfifo_ovf:1;
  96. /** dsr_chg : R/WTC/SS; bitpos: [5]; default: 0;
  97. * This interrupt raw bit turns to high level when receiver detects the edge change of
  98. * DSRn signal.
  99. */
  100. uint32_t dsr_chg:1;
  101. /** cts_chg : R/WTC/SS; bitpos: [6]; default: 0;
  102. * This interrupt raw bit turns to high level when receiver detects the edge change of
  103. * CTSn signal.
  104. */
  105. uint32_t cts_chg:1;
  106. /** brk_det : R/WTC/SS; bitpos: [7]; default: 0;
  107. * This interrupt raw bit turns to high level when receiver detects a 0 after the stop
  108. * bit.
  109. */
  110. uint32_t brk_det:1;
  111. /** rxfifo_tout : R/WTC/SS; bitpos: [8]; default: 0;
  112. * This interrupt raw bit turns to high level when receiver takes more time than
  113. * rx_tout_thrhd to receive a byte.
  114. */
  115. uint32_t rxfifo_tout:1;
  116. /** sw_xon : R/WTC/SS; bitpos: [9]; default: 0;
  117. * This interrupt raw bit turns to high level when receiver recevies Xon char when
  118. * uart_sw_flow_con_en is set to 1.
  119. */
  120. uint32_t sw_xon:1;
  121. /** sw_xoff : R/WTC/SS; bitpos: [10]; default: 0;
  122. * This interrupt raw bit turns to high level when receiver receives Xoff char when
  123. * uart_sw_flow_con_en is set to 1.
  124. */
  125. uint32_t sw_xoff:1;
  126. /** glitch_det : R/WTC/SS; bitpos: [11]; default: 0;
  127. * This interrupt raw bit turns to high level when receiver detects a glitch in the
  128. * middle of a start bit.
  129. */
  130. uint32_t glitch_det:1;
  131. /** tx_brk_done : R/WTC/SS; bitpos: [12]; default: 0;
  132. * This interrupt raw bit turns to high level when transmitter completes sending
  133. * NULL characters after all data in Tx-FIFO are sent.
  134. */
  135. uint32_t tx_brk_done:1;
  136. /** tx_brk_idle_done : R/WTC/SS; bitpos: [13]; default: 0;
  137. * This interrupt raw bit turns to high level when transmitter has kept the shortest
  138. * duration after sending the last data.
  139. */
  140. uint32_t tx_brk_idle_done:1;
  141. /** tx_done : R/WTC/SS; bitpos: [14]; default: 0;
  142. * This interrupt raw bit turns to high level when transmitter has send out all data
  143. * in FIFO.
  144. */
  145. uint32_t tx_done:1;
  146. /** rs485_parity_err : R/WTC/SS; bitpos: [15]; default: 0;
  147. * This interrupt raw bit turns to high level when receiver detects a parity error
  148. * from the echo of transmitter in rs485 mode.
  149. */
  150. uint32_t rs485_parity_err:1;
  151. /** rs485_frm_err : R/WTC/SS; bitpos: [16]; default: 0;
  152. * This interrupt raw bit turns to high level when receiver detects a data frame error
  153. * from the echo of transmitter in rs485 mode.
  154. */
  155. uint32_t rs485_frm_err:1;
  156. /** rs485_clash : R/WTC/SS; bitpos: [17]; default: 0;
  157. * This interrupt raw bit turns to high level when detects a clash between transmitter
  158. * and receiver in rs485 mode.
  159. */
  160. uint32_t rs485_clash:1;
  161. /** at_cmd_char_det : R/WTC/SS; bitpos: [18]; default: 0;
  162. * This interrupt raw bit turns to high level when receiver detects the configured
  163. * at_cmd char.
  164. */
  165. uint32_t at_cmd_char_det:1;
  166. /** wakeup : R/WTC/SS; bitpos: [19]; default: 0;
  167. * This interrupt raw bit turns to high level when input rxd edge changes more times
  168. * than what reg_active_threshold specifies in light sleeping mode.
  169. */
  170. uint32_t wakeup:1;
  171. uint32_t reserved_20:12;
  172. };
  173. uint32_t val;
  174. } uart_int_raw_reg_t;
  175. /** Type of int_st register
  176. * Masked interrupt status
  177. */
  178. typedef union {
  179. struct {
  180. /** rxfifo_full : RO; bitpos: [0]; default: 0;
  181. * This is the status bit for rxfifo_full_int_raw when rxfifo_full_int_ena is set to 1.
  182. */
  183. uint32_t rxfifo_full:1;
  184. /** txfifo_empty : RO; bitpos: [1]; default: 0;
  185. * This is the status bit for txfifo_empty_int_raw when txfifo_empty_int_ena is set
  186. * to 1.
  187. */
  188. uint32_t txfifo_empty:1;
  189. /** parity_err : RO; bitpos: [2]; default: 0;
  190. * This is the status bit for parity_err_int_raw when parity_err_int_ena is set to 1.
  191. */
  192. uint32_t parity_err:1;
  193. /** frm_err : RO; bitpos: [3]; default: 0;
  194. * This is the status bit for frm_err_int_raw when frm_err_int_ena is set to 1.
  195. */
  196. uint32_t frm_err:1;
  197. /** rxfifo_ovf : RO; bitpos: [4]; default: 0;
  198. * This is the status bit for rxfifo_ovf_int_raw when rxfifo_ovf_int_ena is set to 1.
  199. */
  200. uint32_t rxfifo_ovf:1;
  201. /** dsr_chg : RO; bitpos: [5]; default: 0;
  202. * This is the status bit for dsr_chg_int_raw when dsr_chg_int_ena is set to 1.
  203. */
  204. uint32_t dsr_chg:1;
  205. /** cts_chg : RO; bitpos: [6]; default: 0;
  206. * This is the status bit for cts_chg_int_raw when cts_chg_int_ena is set to 1.
  207. */
  208. uint32_t cts_chg:1;
  209. /** brk_det : RO; bitpos: [7]; default: 0;
  210. * This is the status bit for brk_det_int_raw when brk_det_int_ena is set to 1.
  211. */
  212. uint32_t brk_det:1;
  213. /** rxfifo_tout : RO; bitpos: [8]; default: 0;
  214. * This is the status bit for rxfifo_tout_int_raw when rxfifo_tout_int_ena is set to 1.
  215. */
  216. uint32_t rxfifo_tout:1;
  217. /** sw_xon : RO; bitpos: [9]; default: 0;
  218. * This is the status bit for sw_xon_int_raw when sw_xon_int_ena is set to 1.
  219. */
  220. uint32_t sw_xon:1;
  221. /** sw_xoff : RO; bitpos: [10]; default: 0;
  222. * This is the status bit for sw_xoff_int_raw when sw_xoff_int_ena is set to 1.
  223. */
  224. uint32_t sw_xoff:1;
  225. /** glitch_det : RO; bitpos: [11]; default: 0;
  226. * This is the status bit for glitch_det_int_raw when glitch_det_int_ena is set to 1.
  227. */
  228. uint32_t glitch_det:1;
  229. /** tx_brk_done : RO; bitpos: [12]; default: 0;
  230. * This is the status bit for tx_brk_done_int_raw when tx_brk_done_int_ena is set to 1.
  231. */
  232. uint32_t tx_brk_done:1;
  233. /** tx_brk_idle_done : RO; bitpos: [13]; default: 0;
  234. * This is the stauts bit for tx_brk_idle_done_int_raw when tx_brk_idle_done_int_ena
  235. * is set to 1.
  236. */
  237. uint32_t tx_brk_idle_done:1;
  238. /** tx_done : RO; bitpos: [14]; default: 0;
  239. * This is the status bit for tx_done_int_raw when tx_done_int_ena is set to 1.
  240. */
  241. uint32_t tx_done:1;
  242. /** rs485_parity_err : RO; bitpos: [15]; default: 0;
  243. * This is the status bit for rs485_parity_err_int_raw when rs485_parity_int_ena is
  244. * set to 1.
  245. */
  246. uint32_t rs485_parity_err:1;
  247. /** rs485_frm_err : RO; bitpos: [16]; default: 0;
  248. * This is the status bit for rs485_frm_err_int_raw when rs485_fm_err_int_ena is set
  249. * to 1.
  250. */
  251. uint32_t rs485_frm_err:1;
  252. /** rs485_clash : RO; bitpos: [17]; default: 0;
  253. * This is the status bit for rs485_clash_int_raw when rs485_clash_int_ena is set to 1.
  254. */
  255. uint32_t rs485_clash:1;
  256. /** at_cmd_char_det : RO; bitpos: [18]; default: 0;
  257. * This is the status bit for at_cmd_det_int_raw when at_cmd_char_det_int_ena is set
  258. * to 1.
  259. */
  260. uint32_t at_cmd_char_det:1;
  261. /** wakeup : RO; bitpos: [19]; default: 0;
  262. * This is the status bit for uart_wakeup_int_raw when uart_wakeup_int_ena is set to 1.
  263. */
  264. uint32_t wakeup:1;
  265. uint32_t reserved_20:12;
  266. };
  267. uint32_t val;
  268. } uart_int_st_reg_t;
  269. /** Type of int_ena register
  270. * Interrupt enable bits
  271. */
  272. typedef union {
  273. struct {
  274. /** rxfifo_full: R/W; bitpos: [0]; default: 0;
  275. * This is the enable bit for rxfifo_full_int_st register.
  276. */
  277. uint32_t rxfifo_full:1;
  278. /** txfifo_empty: R/W; bitpos: [1]; default: 0;
  279. * This is the enable bit for txfifo_empty_int_st register.
  280. */
  281. uint32_t txfifo_empty:1;
  282. /** parity_err: R/W; bitpos: [2]; default: 0;
  283. * This is the enable bit for parity_err_int_st register.
  284. */
  285. uint32_t parity_err:1;
  286. /** frm_err: R/W; bitpos: [3]; default: 0;
  287. * This is the enable bit for frm_err_int_st register.
  288. */
  289. uint32_t frm_err:1;
  290. /** rxfifo_ovf: R/W; bitpos: [4]; default: 0;
  291. * This is the enable bit for rxfifo_ovf_int_st register.
  292. */
  293. uint32_t rxfifo_ovf:1;
  294. /** dsr_chg: R/W; bitpos: [5]; default: 0;
  295. * This is the enable bit for dsr_chg_int_st register.
  296. */
  297. uint32_t dsr_chg:1;
  298. /** cts_chg: R/W; bitpos: [6]; default: 0;
  299. * This is the enable bit for cts_chg_int_st register.
  300. */
  301. uint32_t cts_chg:1;
  302. /** brk_det: R/W; bitpos: [7]; default: 0;
  303. * This is the enable bit for brk_det_int_st register.
  304. */
  305. uint32_t brk_det:1;
  306. /** rxfifo_tout: R/W; bitpos: [8]; default: 0;
  307. * This is the enable bit for rxfifo_tout_int_st register.
  308. */
  309. uint32_t rxfifo_tout:1;
  310. /** sw_xon: R/W; bitpos: [9]; default: 0;
  311. * This is the enable bit for sw_xon_int_st register.
  312. */
  313. uint32_t sw_xon:1;
  314. /** sw_xoff: R/W; bitpos: [10]; default: 0;
  315. * This is the enable bit for sw_xoff_int_st register.
  316. */
  317. uint32_t sw_xoff:1;
  318. /** glitch_det: R/W; bitpos: [11]; default: 0;
  319. * This is the enable bit for glitch_det_int_st register.
  320. */
  321. uint32_t glitch_det:1;
  322. /** tx_brk_done: R/W; bitpos: [12]; default: 0;
  323. * This is the enable bit for tx_brk_done_int_st register.
  324. */
  325. uint32_t tx_brk_done:1;
  326. /** tx_brk_idle_done: R/W; bitpos: [13]; default: 0;
  327. * This is the enable bit for tx_brk_idle_done_int_st register.
  328. */
  329. uint32_t tx_brk_idle_done:1;
  330. /** tx_done: R/W; bitpos: [14]; default: 0;
  331. * This is the enable bit for tx_done_int_st register.
  332. */
  333. uint32_t tx_done:1;
  334. /** rs485_parity_err: R/W; bitpos: [15]; default: 0;
  335. * This is the enable bit for rs485_parity_err_int_st register.
  336. */
  337. uint32_t rs485_parity_err:1;
  338. /** rs485_frm_err: R/W; bitpos: [16]; default: 0;
  339. * This is the enable bit for rs485_parity_err_int_st register.
  340. */
  341. uint32_t rs485_frm_err:1;
  342. /** rs485_clash: R/W; bitpos: [17]; default: 0;
  343. * This is the enable bit for rs485_clash_int_st register.
  344. */
  345. uint32_t rs485_clash:1;
  346. /** at_cmd_char_det: R/W; bitpos: [18]; default: 0;
  347. * This is the enable bit for at_cmd_char_det_int_st register.
  348. */
  349. uint32_t at_cmd_char_det:1;
  350. /** wakeup: R/W; bitpos: [19]; default: 0;
  351. * This is the enable bit for uart_wakeup_int_st register.
  352. */
  353. uint32_t wakeup:1;
  354. uint32_t reserved_20:12;
  355. };
  356. uint32_t val;
  357. } uart_int_ena_reg_t;
  358. /** Type of int_clr register
  359. * Interrupt clear bits
  360. */
  361. typedef union {
  362. struct {
  363. /** rxfifo_full: WT; bitpos: [0]; default: 0;
  364. * Set this bit to clear the rxfifo_full_int_raw interrupt.
  365. */
  366. uint32_t rxfifo_full:1;
  367. /** txfifo_empty: WT; bitpos: [1]; default: 0;
  368. * Set this bit to clear txfifo_empty_int_raw interrupt.
  369. */
  370. uint32_t txfifo_empty:1;
  371. /** parity_err: WT; bitpos: [2]; default: 0;
  372. * Set this bit to clear parity_err_int_raw interrupt.
  373. */
  374. uint32_t parity_err:1;
  375. /** frm_err: WT; bitpos: [3]; default: 0;
  376. * Set this bit to clear frm_err_int_raw interrupt.
  377. */
  378. uint32_t frm_err:1;
  379. /** rxfifo_ovf: WT; bitpos: [4]; default: 0;
  380. * Set this bit to clear rxfifo_ovf_int_raw interrupt.
  381. */
  382. uint32_t rxfifo_ovf:1;
  383. /** dsr_chg: WT; bitpos: [5]; default: 0;
  384. * Set this bit to clear the dsr_chg_int_raw interrupt.
  385. */
  386. uint32_t dsr_chg:1;
  387. /** cts_chg: WT; bitpos: [6]; default: 0;
  388. * Set this bit to clear the cts_chg_int_raw interrupt.
  389. */
  390. uint32_t cts_chg:1;
  391. /** brk_det: WT; bitpos: [7]; default: 0;
  392. * Set this bit to clear the brk_det_int_raw interrupt.
  393. */
  394. uint32_t brk_det:1;
  395. /** rxfifo_tout: WT; bitpos: [8]; default: 0;
  396. * Set this bit to clear the rxfifo_tout_int_raw interrupt.
  397. */
  398. uint32_t rxfifo_tout:1;
  399. /** sw_xon: WT; bitpos: [9]; default: 0;
  400. * Set this bit to clear the sw_xon_int_raw interrupt.
  401. */
  402. uint32_t sw_xon:1;
  403. /** sw_xoff: WT; bitpos: [10]; default: 0;
  404. * Set this bit to clear the sw_xoff_int_raw interrupt.
  405. */
  406. uint32_t sw_xoff:1;
  407. /** glitch_det: WT; bitpos: [11]; default: 0;
  408. * Set this bit to clear the glitch_det_int_raw interrupt.
  409. */
  410. uint32_t glitch_det:1;
  411. /** tx_brk_done: WT; bitpos: [12]; default: 0;
  412. * Set this bit to clear the tx_brk_done_int_raw interrupt..
  413. */
  414. uint32_t tx_brk_done:1;
  415. /** tx_brk_idle_done: WT; bitpos: [13]; default: 0;
  416. * Set this bit to clear the tx_brk_idle_done_int_raw interrupt.
  417. */
  418. uint32_t tx_brk_idle_done:1;
  419. /** tx_done: WT; bitpos: [14]; default: 0;
  420. * Set this bit to clear the tx_done_int_raw interrupt.
  421. */
  422. uint32_t tx_done:1;
  423. /** rs485_parity_err: WT; bitpos: [15]; default: 0;
  424. * Set this bit to clear the rs485_parity_err_int_raw interrupt.
  425. */
  426. uint32_t rs485_parity_err:1;
  427. /** rs485_frm_err: WT; bitpos: [16]; default: 0;
  428. * Set this bit to clear the rs485_frm_err_int_raw interrupt.
  429. */
  430. uint32_t rs485_frm_err:1;
  431. /** rs485_clash: WT; bitpos: [17]; default: 0;
  432. * Set this bit to clear the rs485_clash_int_raw interrupt.
  433. */
  434. uint32_t rs485_clash:1;
  435. /** at_cmd_char_det: WT; bitpos: [18]; default: 0;
  436. * Set this bit to clear the at_cmd_char_det_int_raw interrupt.
  437. */
  438. uint32_t at_cmd_char_det:1;
  439. /** wakeup: WT; bitpos: [19]; default: 0;
  440. * Set this bit to clear the uart_wakeup_int_raw interrupt.
  441. */
  442. uint32_t wakeup:1;
  443. uint32_t reserved_20:12;
  444. };
  445. uint32_t val;
  446. } uart_int_clr_reg_t;
  447. /** Group: Configuration Register */
  448. /** Type of clkdiv_sync register
  449. * Clock divider configuration
  450. */
  451. typedef union {
  452. struct {
  453. /** clkdiv_int : R/W; bitpos: [11:0]; default: 694;
  454. * The integral part of the frequency divider factor.
  455. */
  456. uint32_t clkdiv_int:12;
  457. uint32_t reserved_12:8;
  458. /** clkdiv_frag : R/W; bitpos: [23:20]; default: 0;
  459. * The decimal part of the frequency divider factor.
  460. */
  461. uint32_t clkdiv_frag:4;
  462. uint32_t reserved_24:8;
  463. };
  464. uint32_t val;
  465. } uart_clkdiv_sync_reg_t;
  466. /** Type of rx_filt register
  467. * Rx Filter configuration
  468. */
  469. typedef union {
  470. struct {
  471. /** glitch_filt : R/W; bitpos: [7:0]; default: 8;
  472. * when input pulse width is lower than this value the pulse is ignored.
  473. */
  474. uint32_t glitch_filt:8;
  475. /** glitch_filt_en : R/W; bitpos: [8]; default: 0;
  476. * Set this bit to enable Rx signal filter.
  477. */
  478. uint32_t glitch_filt_en:1;
  479. uint32_t reserved_9:23;
  480. };
  481. uint32_t val;
  482. } uart_rx_filt_reg_t;
  483. /** Type of conf0_sync register
  484. * a
  485. */
  486. typedef union {
  487. struct {
  488. /** parity : R/W; bitpos: [0]; default: 0;
  489. * This register is used to configure the parity check mode.
  490. */
  491. uint32_t parity:1;
  492. /** parity_en : R/W; bitpos: [1]; default: 0;
  493. * Set this bit to enable uart parity check.
  494. */
  495. uint32_t parity_en:1;
  496. /** bit_num : R/W; bitpos: [3:2]; default: 3;
  497. * This register is used to set the length of data.
  498. */
  499. uint32_t bit_num:2;
  500. /** stop_bit_num : R/W; bitpos: [5:4]; default: 1;
  501. * This register is used to set the length of stop bit.
  502. */
  503. uint32_t stop_bit_num:2;
  504. /** txd_brk : R/W; bitpos: [6]; default: 0;
  505. * Set this bit to enbale transmitter to send NULL when the process of sending data
  506. * is done.
  507. */
  508. uint32_t txd_brk:1;
  509. /** irda_dplx : R/W; bitpos: [7]; default: 0;
  510. * Set this bit to enable IrDA loopback mode.
  511. */
  512. uint32_t irda_dplx:1;
  513. /** irda_tx_en : R/W; bitpos: [8]; default: 0;
  514. * This is the start enable bit for IrDA transmitter.
  515. */
  516. uint32_t irda_tx_en:1;
  517. /** irda_wctl : R/W; bitpos: [9]; default: 0;
  518. * 1'h1: The IrDA transmitter's 11th bit is the same as 10th bit. 1'h0: Set IrDA
  519. * transmitter's 11th bit to 0.
  520. */
  521. uint32_t irda_wctl:1;
  522. /** irda_tx_inv : R/W; bitpos: [10]; default: 0;
  523. * Set this bit to invert the level of IrDA transmitter.
  524. */
  525. uint32_t irda_tx_inv:1;
  526. /** irda_rx_inv : R/W; bitpos: [11]; default: 0;
  527. * Set this bit to invert the level of IrDA receiver.
  528. */
  529. uint32_t irda_rx_inv:1;
  530. /** loopback : R/W; bitpos: [12]; default: 0;
  531. * Set this bit to enable uart loopback test mode.
  532. */
  533. uint32_t loopback:1;
  534. /** tx_flow_en : R/W; bitpos: [13]; default: 0;
  535. * Set this bit to enable flow control function for transmitter.
  536. */
  537. uint32_t tx_flow_en:1;
  538. /** irda_en : R/W; bitpos: [14]; default: 0;
  539. * Set this bit to enable IrDA protocol.
  540. */
  541. uint32_t irda_en:1;
  542. /** rxd_inv : R/W; bitpos: [15]; default: 0;
  543. * Set this bit to inverse the level value of uart rxd signal.
  544. */
  545. uint32_t rxd_inv:1;
  546. /** txd_inv : R/W; bitpos: [16]; default: 0;
  547. * Set this bit to inverse the level value of uart txd signal.
  548. */
  549. uint32_t txd_inv:1;
  550. /** dis_rx_dat_ovf : R/W; bitpos: [17]; default: 0;
  551. * Disable UART Rx data overflow detect.
  552. */
  553. uint32_t dis_rx_dat_ovf:1;
  554. /** err_wr_mask : R/W; bitpos: [18]; default: 0;
  555. * 1'h1: Receiver stops storing data into FIFO when data is wrong. 1'h0: Receiver
  556. * stores the data even if the received data is wrong.
  557. */
  558. uint32_t err_wr_mask:1;
  559. /** autobaud_en : R/W; bitpos: [19]; default: 0;
  560. * This is the enable bit for detecting baudrate.
  561. */
  562. uint32_t autobaud_en:1;
  563. /** mem_clk_en : R/W; bitpos: [20]; default: 1;
  564. * UART memory clock gate enable signal.
  565. */
  566. uint32_t mem_clk_en:1;
  567. /** sw_rts : R/W; bitpos: [21]; default: 0;
  568. * This register is used to configure the software rts signal which is used in
  569. * software flow control.
  570. */
  571. uint32_t sw_rts:1;
  572. /** rxfifo_rst : R/W; bitpos: [22]; default: 0;
  573. * Set this bit to reset the uart receive-FIFO.
  574. */
  575. uint32_t rxfifo_rst:1;
  576. /** txfifo_rst : R/W; bitpos: [23]; default: 0;
  577. * Set this bit to reset the uart transmit-FIFO.
  578. */
  579. uint32_t txfifo_rst:1;
  580. uint32_t reserved_24:8;
  581. };
  582. uint32_t val;
  583. } uart_conf0_sync_reg_t;
  584. /** Type of conf1 register
  585. * Configuration register 1
  586. */
  587. typedef union {
  588. struct {
  589. /** rxfifo_full_thrhd : R/W; bitpos: [7:0]; default: 96;
  590. * It will produce rxfifo_full_int interrupt when receiver receives more data than
  591. * this register value.
  592. */
  593. uint32_t rxfifo_full_thrhd:8;
  594. /** txfifo_empty_thrhd : R/W; bitpos: [15:8]; default: 96;
  595. * It will produce txfifo_empty_int interrupt when the data amount in Tx-FIFO is less
  596. * than this register value.
  597. */
  598. uint32_t txfifo_empty_thrhd:8;
  599. /** cts_inv : R/W; bitpos: [16]; default: 0;
  600. * Set this bit to inverse the level value of uart cts signal.
  601. */
  602. uint32_t cts_inv:1;
  603. /** dsr_inv : R/W; bitpos: [17]; default: 0;
  604. * Set this bit to inverse the level value of uart dsr signal.
  605. */
  606. uint32_t dsr_inv:1;
  607. /** rts_inv : R/W; bitpos: [18]; default: 0;
  608. * Set this bit to inverse the level value of uart rts signal.
  609. */
  610. uint32_t rts_inv:1;
  611. /** dtr_inv : R/W; bitpos: [19]; default: 0;
  612. * Set this bit to inverse the level value of uart dtr signal.
  613. */
  614. uint32_t dtr_inv:1;
  615. /** sw_dtr : R/W; bitpos: [20]; default: 0;
  616. * This register is used to configure the software dtr signal which is used in
  617. * software flow control.
  618. */
  619. uint32_t sw_dtr:1;
  620. /** clk_en : R/W; bitpos: [21]; default: 0;
  621. * 1'h1: Force clock on for register. 1'h0: Support clock only when application writes
  622. * registers.
  623. */
  624. uint32_t clk_en:1;
  625. uint32_t reserved_22:10;
  626. };
  627. uint32_t val;
  628. } uart_conf1_reg_t;
  629. /** Type of hwfc_conf_sync register
  630. * Hardware flow-control configuration
  631. */
  632. typedef union {
  633. struct {
  634. /** rx_flow_thrhd : R/W; bitpos: [7:0]; default: 0;
  635. * This register is used to configure the maximum amount of data that can be received
  636. * when hardware flow control works.
  637. */
  638. uint32_t rx_flow_thrhd:8;
  639. /** rx_flow_en : R/W; bitpos: [8]; default: 0;
  640. * This is the flow enable bit for UART receiver.
  641. */
  642. uint32_t rx_flow_en:1;
  643. uint32_t reserved_9:23;
  644. };
  645. uint32_t val;
  646. } uart_hwfc_conf_sync_reg_t;
  647. /** Type of sleep_conf0 register
  648. * UART sleep configure register 0
  649. */
  650. typedef union {
  651. struct {
  652. /** wk_char1 : R/W; bitpos: [7:0]; default: 0;
  653. * This register restores the specified wake up char1 to wake up
  654. */
  655. uint32_t wk_char1:8;
  656. /** wk_char2 : R/W; bitpos: [15:8]; default: 0;
  657. * This register restores the specified wake up char2 to wake up
  658. */
  659. uint32_t wk_char2:8;
  660. /** wk_char3 : R/W; bitpos: [23:16]; default: 0;
  661. * This register restores the specified wake up char3 to wake up
  662. */
  663. uint32_t wk_char3:8;
  664. /** wk_char4 : R/W; bitpos: [31:24]; default: 0;
  665. * This register restores the specified wake up char4 to wake up
  666. */
  667. uint32_t wk_char4:8;
  668. };
  669. uint32_t val;
  670. } uart_sleep_conf0_reg_t;
  671. /** Type of sleep_conf1 register
  672. * UART sleep configure register 1
  673. */
  674. typedef union {
  675. struct {
  676. /** wk_char0 : R/W; bitpos: [7:0]; default: 0;
  677. * This register restores the specified char0 to wake up
  678. */
  679. uint32_t wk_char0:8;
  680. uint32_t reserved_8:24;
  681. };
  682. uint32_t val;
  683. } uart_sleep_conf1_reg_t;
  684. /** Type of sleep_conf2 register
  685. * UART sleep configure register 2
  686. */
  687. typedef union {
  688. struct {
  689. /** active_threshold : R/W; bitpos: [9:0]; default: 240;
  690. * The uart is activated from light sleeping mode when the input rxd edge changes more
  691. * times than this register value.
  692. */
  693. uint32_t active_threshold:10;
  694. /** rx_wake_up_thrhd : R/W; bitpos: [17:10]; default: 1;
  695. * In wake up mode 1 this field is used to set the received data number threshold to
  696. * wake up chip.
  697. */
  698. uint32_t rx_wake_up_thrhd:8;
  699. /** wk_char_num : R/W; bitpos: [20:18]; default: 5;
  700. * This register is used to select number of wake up char.
  701. */
  702. uint32_t wk_char_num:3;
  703. /** wk_char_mask : R/W; bitpos: [25:21]; default: 0;
  704. * This register is used to mask wake up char.
  705. */
  706. uint32_t wk_char_mask:5;
  707. /** wk_mode_sel : R/W; bitpos: [27:26]; default: 0;
  708. * This register is used to select wake up mode. 0: RXD toggling to wake up. 1:
  709. * received data number larger than
  710. */
  711. uint32_t wk_mode_sel:2;
  712. uint32_t reserved_28:4;
  713. };
  714. uint32_t val;
  715. } uart_sleep_conf2_reg_t;
  716. /** Type of swfc_conf0_sync register
  717. * Software flow-control character configuration
  718. */
  719. typedef union {
  720. struct {
  721. /** xon_char : R/W; bitpos: [7:0]; default: 17;
  722. * This register stores the Xon flow control char.
  723. */
  724. uint32_t xon_char:8;
  725. /** xoff_char : R/W; bitpos: [15:8]; default: 19;
  726. * This register stores the Xoff flow control char.
  727. */
  728. uint32_t xoff_char:8;
  729. /** xon_xoff_still_send : R/W; bitpos: [16]; default: 0;
  730. * In software flow control mode, UART Tx is disabled once UART Rx receives XOFF. In
  731. * this status, UART Tx can not transmit XOFF even the received data number is larger
  732. * than UART_XOFF_THRESHOLD. Set this bit to enable UART Tx can transmit XON/XOFF when
  733. * UART Tx is disabled.
  734. */
  735. uint32_t xon_xoff_still_send:1;
  736. /** sw_flow_con_en : R/W; bitpos: [17]; default: 0;
  737. * Set this bit to enable software flow control. It is used with register sw_xon or
  738. * sw_xoff.
  739. */
  740. uint32_t sw_flow_con_en:1;
  741. /** xonoff_del : R/W; bitpos: [18]; default: 0;
  742. * Set this bit to remove flow control char from the received data.
  743. */
  744. uint32_t xonoff_del:1;
  745. /** force_xon : R/W; bitpos: [19]; default: 0;
  746. * Set this bit to enable the transmitter to go on sending data.
  747. */
  748. uint32_t force_xon:1;
  749. /** force_xoff : R/W; bitpos: [20]; default: 0;
  750. * Set this bit to stop the transmitter from sending data.
  751. */
  752. uint32_t force_xoff:1;
  753. /** send_xon : R/W/SS/SC; bitpos: [21]; default: 0;
  754. * Set this bit to send Xon char. It is cleared by hardware automatically.
  755. */
  756. uint32_t send_xon:1;
  757. /** send_xoff : R/W/SS/SC; bitpos: [22]; default: 0;
  758. * Set this bit to send Xoff char. It is cleared by hardware automatically.
  759. */
  760. uint32_t send_xoff:1;
  761. uint32_t reserved_23:9;
  762. };
  763. uint32_t val;
  764. } uart_swfc_conf0_sync_reg_t;
  765. /** Type of swfc_conf1 register
  766. * Software flow-control character configuration
  767. */
  768. typedef union {
  769. struct {
  770. /** xon_threshold : R/W; bitpos: [7:0]; default: 0;
  771. * When the data amount in Rx-FIFO is less than this register value with
  772. * uart_sw_flow_con_en set to 1 it will send a Xon char.
  773. */
  774. uint32_t xon_threshold:8;
  775. /** xoff_threshold : R/W; bitpos: [15:8]; default: 224;
  776. * When the data amount in Rx-FIFO is more than this register value with
  777. * uart_sw_flow_con_en set to 1 it will send a Xoff char.
  778. */
  779. uint32_t xoff_threshold:8;
  780. uint32_t reserved_16:16;
  781. };
  782. uint32_t val;
  783. } uart_swfc_conf1_reg_t;
  784. /** Type of txbrk_conf_sync register
  785. * Tx Break character configuration
  786. */
  787. typedef union {
  788. struct {
  789. /** tx_brk_num : R/W; bitpos: [7:0]; default: 10;
  790. * This register is used to configure the number of 0 to be sent after the process of
  791. * sending data is done. It is active when txd_brk is set to 1.
  792. */
  793. uint32_t tx_brk_num:8;
  794. uint32_t reserved_8:24;
  795. };
  796. uint32_t val;
  797. } uart_txbrk_conf_sync_reg_t;
  798. /** Type of idle_conf_sync register
  799. * Frame-end idle configuration
  800. */
  801. typedef union {
  802. struct {
  803. /** rx_idle_thrhd : R/W; bitpos: [9:0]; default: 256;
  804. * It will produce frame end signal when receiver takes more time to receive one byte
  805. * data than this register value.
  806. */
  807. uint32_t rx_idle_thrhd:10;
  808. /** tx_idle_num : R/W; bitpos: [19:10]; default: 256;
  809. * This register is used to configure the duration time between transfers.
  810. */
  811. uint32_t tx_idle_num:10;
  812. uint32_t reserved_20:12;
  813. };
  814. uint32_t val;
  815. } uart_idle_conf_sync_reg_t;
  816. /** Type of rs485_conf_sync register
  817. * RS485 mode configuration
  818. */
  819. typedef union {
  820. struct {
  821. /** rs485_en : R/W; bitpos: [0]; default: 0;
  822. * Set this bit to choose the rs485 mode.
  823. */
  824. uint32_t rs485_en:1;
  825. /** dl0_en : R/W; bitpos: [1]; default: 0;
  826. * Set this bit to delay the stop bit by 1 bit.
  827. */
  828. uint32_t dl0_en:1;
  829. /** dl1_en : R/W; bitpos: [2]; default: 0;
  830. * Set this bit to delay the stop bit by 1 bit.
  831. */
  832. uint32_t dl1_en:1;
  833. /** rs485tx_rx_en : R/W; bitpos: [3]; default: 0;
  834. * Set this bit to enable receiver could receive data when the transmitter is
  835. * transmitting data in rs485 mode.
  836. */
  837. uint32_t rs485tx_rx_en:1;
  838. /** rs485rxby_tx_en : R/W; bitpos: [4]; default: 0;
  839. * 1'h1: enable rs485 transmitter to send data when rs485 receiver line is busy.
  840. */
  841. uint32_t rs485rxby_tx_en:1;
  842. /** rs485_rx_dly_num : R/W; bitpos: [5]; default: 0;
  843. * This register is used to delay the receiver's internal data signal.
  844. */
  845. uint32_t rs485_rx_dly_num:1;
  846. /** rs485_tx_dly_num : R/W; bitpos: [9:6]; default: 0;
  847. * This register is used to delay the transmitter's internal data signal.
  848. */
  849. uint32_t rs485_tx_dly_num:4;
  850. uint32_t reserved_10:22;
  851. };
  852. uint32_t val;
  853. } uart_rs485_conf_sync_reg_t;
  854. /** Type of clk_conf register
  855. * UART core clock configuration
  856. */
  857. typedef union {
  858. struct {
  859. /** sclk_div_b : R/W; bitpos: [5:0]; default: 0;
  860. * The denominator of the frequency divider factor.
  861. */
  862. uint32_t sclk_div_b:6;
  863. /** sclk_div_a : R/W; bitpos: [11:6]; default: 0;
  864. * The numerator of the frequency divider factor.
  865. */
  866. uint32_t sclk_div_a:6;
  867. /** sclk_div_num : R/W; bitpos: [19:12]; default: 1;
  868. * The integral part of the frequency divider factor.
  869. */
  870. uint32_t sclk_div_num:8;
  871. /** sclk_sel : R/W; bitpos: [21:20]; default: 3;
  872. * UART clock source select. 1: 80Mhz. 2: 8Mhz. 3: XTAL.
  873. */
  874. uint32_t sclk_sel:2;
  875. /** sclk_en : R/W; bitpos: [22]; default: 1;
  876. * Set this bit to enable UART Tx/Rx clock.
  877. */
  878. uint32_t sclk_en:1;
  879. /** rst_core : R/W; bitpos: [23]; default: 0;
  880. * Write 1 then write 0 to this bit to reset UART Tx/Rx.
  881. */
  882. uint32_t rst_core:1;
  883. /** tx_sclk_en : R/W; bitpos: [24]; default: 1;
  884. * Set this bit to enable UART Tx clock.
  885. */
  886. uint32_t tx_sclk_en:1;
  887. /** rx_sclk_en : R/W; bitpos: [25]; default: 1;
  888. * Set this bit to enable UART Rx clock.
  889. */
  890. uint32_t rx_sclk_en:1;
  891. /** tx_rst_core : R/W; bitpos: [26]; default: 0;
  892. * Write 1 then write 0 to this bit to reset UART Tx.
  893. */
  894. uint32_t tx_rst_core:1;
  895. /** rx_rst_core : R/W; bitpos: [27]; default: 0;
  896. * Write 1 then write 0 to this bit to reset UART Rx.
  897. */
  898. uint32_t rx_rst_core:1;
  899. uint32_t reserved_28:4;
  900. };
  901. uint32_t val;
  902. } uart_clk_conf_reg_t;
  903. /** Group: Status Register */
  904. /** Type of status register
  905. * UART status register
  906. */
  907. typedef union {
  908. struct {
  909. /** rxfifo_cnt : RO; bitpos: [7:0]; default: 0;
  910. * Stores the byte number of valid data in Rx-FIFO.
  911. */
  912. uint32_t rxfifo_cnt:8;
  913. uint32_t reserved_8:5;
  914. /** dsrn : RO; bitpos: [13]; default: 0;
  915. * The register represent the level value of the internal uart dsr signal.
  916. */
  917. uint32_t dsrn:1;
  918. /** ctsn : RO; bitpos: [14]; default: 1;
  919. * This register represent the level value of the internal uart cts signal.
  920. */
  921. uint32_t ctsn:1;
  922. /** rxd : RO; bitpos: [15]; default: 1;
  923. * This register represent the level value of the internal uart rxd signal.
  924. */
  925. uint32_t rxd:1;
  926. /** txfifo_cnt : RO; bitpos: [23:16]; default: 0;
  927. * Stores the byte number of data in Tx-FIFO.
  928. */
  929. uint32_t txfifo_cnt:8;
  930. uint32_t reserved_24:5;
  931. /** dtrn : RO; bitpos: [29]; default: 1;
  932. * This bit represents the level of the internal uart dtr signal.
  933. */
  934. uint32_t dtrn:1;
  935. /** rtsn : RO; bitpos: [30]; default: 1;
  936. * This bit represents the level of the internal uart rts signal.
  937. */
  938. uint32_t rtsn:1;
  939. /** txd : RO; bitpos: [31]; default: 1;
  940. * This bit represents the level of the internal uart txd signal.
  941. */
  942. uint32_t txd:1;
  943. };
  944. uint32_t val;
  945. } uart_status_reg_t;
  946. /** Type of mem_tx_status register
  947. * Tx-SRAM write and read offset address.
  948. */
  949. typedef union {
  950. struct {
  951. /** tx_sram_waddr : RO; bitpos: [7:0]; default: 0;
  952. * This register stores the offset write address in Tx-SRAM.
  953. */
  954. uint32_t tx_sram_waddr:8;
  955. uint32_t reserved_8:1;
  956. /** tx_sram_raddr : RO; bitpos: [16:9]; default: 0;
  957. * This register stores the offset read address in Tx-SRAM.
  958. */
  959. uint32_t tx_sram_raddr:8;
  960. uint32_t reserved_17:15;
  961. };
  962. uint32_t val;
  963. } uart_mem_tx_status_reg_t;
  964. /** Type of mem_rx_status register
  965. * Rx-SRAM write and read offset address.
  966. */
  967. typedef union {
  968. struct {
  969. /** rx_sram_raddr : RO; bitpos: [7:0]; default: 128;
  970. * This register stores the offset read address in RX-SRAM.
  971. */
  972. uint32_t rx_sram_raddr:8;
  973. uint32_t reserved_8:1;
  974. /** rx_sram_waddr : RO; bitpos: [16:9]; default: 128;
  975. * This register stores the offset write address in Rx-SRAM.
  976. */
  977. uint32_t rx_sram_waddr:8;
  978. uint32_t reserved_17:15;
  979. };
  980. uint32_t val;
  981. } uart_mem_rx_status_reg_t;
  982. /** Type of fsm_status register
  983. * UART transmit and receive status.
  984. */
  985. typedef union {
  986. struct {
  987. /** st_urx_out : RO; bitpos: [3:0]; default: 0;
  988. * This is the status register of receiver.
  989. */
  990. uint32_t st_urx_out:4;
  991. /** st_utx_out : RO; bitpos: [7:4]; default: 0;
  992. * This is the status register of transmitter.
  993. */
  994. uint32_t st_utx_out:4;
  995. uint32_t reserved_8:24;
  996. };
  997. uint32_t val;
  998. } uart_fsm_status_reg_t;
  999. /** Type of afifo_status register
  1000. * UART AFIFO Status
  1001. */
  1002. typedef union {
  1003. struct {
  1004. /** tx_afifo_full : RO; bitpos: [0]; default: 0;
  1005. * Full signal of APB TX AFIFO.
  1006. */
  1007. uint32_t tx_afifo_full:1;
  1008. /** tx_afifo_empty : RO; bitpos: [1]; default: 1;
  1009. * Empty signal of APB TX AFIFO.
  1010. */
  1011. uint32_t tx_afifo_empty:1;
  1012. /** rx_afifo_full : RO; bitpos: [2]; default: 0;
  1013. * Full signal of APB RX AFIFO.
  1014. */
  1015. uint32_t rx_afifo_full:1;
  1016. /** rx_afifo_empty : RO; bitpos: [3]; default: 1;
  1017. * Empty signal of APB RX AFIFO.
  1018. */
  1019. uint32_t rx_afifo_empty:1;
  1020. uint32_t reserved_4:28;
  1021. };
  1022. uint32_t val;
  1023. } uart_afifo_status_reg_t;
  1024. /** Group: AT Escape Sequence Selection Configuration */
  1025. /** Type of at_cmd_precnt_sync register
  1026. * Pre-sequence timing configuration
  1027. */
  1028. typedef union {
  1029. struct {
  1030. /** pre_idle_num : R/W; bitpos: [15:0]; default: 2305;
  1031. * This register is used to configure the idle duration time before the first at_cmd
  1032. * is received by receiver.
  1033. */
  1034. uint32_t pre_idle_num:16;
  1035. uint32_t reserved_16:16;
  1036. };
  1037. uint32_t val;
  1038. } uart_at_cmd_precnt_sync_reg_t;
  1039. /** Type of at_cmd_postcnt_sync register
  1040. * Post-sequence timing configuration
  1041. */
  1042. typedef union {
  1043. struct {
  1044. /** post_idle_num : R/W; bitpos: [15:0]; default: 2305;
  1045. * This register is used to configure the duration time between the last at_cmd and
  1046. * the next data.
  1047. */
  1048. uint32_t post_idle_num:16;
  1049. uint32_t reserved_16:16;
  1050. };
  1051. uint32_t val;
  1052. } uart_at_cmd_postcnt_sync_reg_t;
  1053. /** Type of at_cmd_gaptout_sync register
  1054. * Timeout configuration
  1055. */
  1056. typedef union {
  1057. struct {
  1058. /** rx_gap_tout : R/W; bitpos: [15:0]; default: 11;
  1059. * This register is used to configure the duration time between the at_cmd chars.
  1060. */
  1061. uint32_t rx_gap_tout:16;
  1062. uint32_t reserved_16:16;
  1063. };
  1064. uint32_t val;
  1065. } uart_at_cmd_gaptout_sync_reg_t;
  1066. /** Type of at_cmd_char_sync register
  1067. * AT escape sequence detection configuration
  1068. */
  1069. typedef union {
  1070. struct {
  1071. /** data : R/W; bitpos: [7:0]; default: 43;
  1072. * This register is used to configure the content of at_cmd char.
  1073. */
  1074. uint32_t data:8;
  1075. /** char_num : R/W; bitpos: [15:8]; default: 3;
  1076. * This register is used to configure the num of continuous at_cmd chars received by
  1077. * receiver.
  1078. */
  1079. uint32_t char_num:8;
  1080. uint32_t reserved_16:16;
  1081. };
  1082. uint32_t val;
  1083. } uart_at_cmd_char_sync_reg_t;
  1084. /** Group: Autobaud Register */
  1085. /** Type of pospulse register
  1086. * Autobaud high pulse register
  1087. */
  1088. typedef union {
  1089. struct {
  1090. /** posedge_min_cnt : RO; bitpos: [11:0]; default: 4095;
  1091. * This register stores the minimal input clock count between two positive edges. It
  1092. * is used in boudrate-detect process.
  1093. */
  1094. uint32_t posedge_min_cnt:12;
  1095. uint32_t reserved_12:20;
  1096. };
  1097. uint32_t val;
  1098. } uart_pospulse_reg_t;
  1099. /** Type of negpulse register
  1100. * Autobaud low pulse register
  1101. */
  1102. typedef union {
  1103. struct {
  1104. /** negedge_min_cnt : RO; bitpos: [11:0]; default: 4095;
  1105. * This register stores the minimal input clock count between two negative edges. It
  1106. * is used in boudrate-detect process.
  1107. */
  1108. uint32_t negedge_min_cnt:12;
  1109. uint32_t reserved_12:20;
  1110. };
  1111. uint32_t val;
  1112. } uart_negpulse_reg_t;
  1113. /** Type of lowpulse register
  1114. * Autobaud minimum low pulse duration register
  1115. */
  1116. typedef union {
  1117. struct {
  1118. /** lowpulse_min_cnt : RO; bitpos: [11:0]; default: 4095;
  1119. * This register stores the value of the minimum duration time of the low level pulse.
  1120. * It is used in baud rate-detect process.
  1121. */
  1122. uint32_t lowpulse_min_cnt:12;
  1123. uint32_t reserved_12:20;
  1124. };
  1125. uint32_t val;
  1126. } uart_lowpulse_reg_t;
  1127. /** Type of highpulse register
  1128. * Autobaud minimum high pulse duration register
  1129. */
  1130. typedef union {
  1131. struct {
  1132. /** highpulse_min_cnt : RO; bitpos: [11:0]; default: 4095;
  1133. * This register stores the value of the maxinum duration time for the high level
  1134. * pulse. It is used in baud rate-detect process.
  1135. */
  1136. uint32_t highpulse_min_cnt:12;
  1137. uint32_t reserved_12:20;
  1138. };
  1139. uint32_t val;
  1140. } uart_highpulse_reg_t;
  1141. /** Type of rxd_cnt register
  1142. * Autobaud edge change count register
  1143. */
  1144. typedef union {
  1145. struct {
  1146. /** rxd_edge_cnt : RO; bitpos: [9:0]; default: 0;
  1147. * This register stores the count of rxd edge change. It is used in baud rate-detect
  1148. * process.
  1149. */
  1150. uint32_t rxd_edge_cnt:10;
  1151. uint32_t reserved_10:22;
  1152. };
  1153. uint32_t val;
  1154. } uart_rxd_cnt_reg_t;
  1155. /** Group: Version Register */
  1156. /** Type of date register
  1157. * UART Version register
  1158. */
  1159. typedef union {
  1160. struct {
  1161. /** date : R/W; bitpos: [31:0]; default: 35656288;
  1162. * This is the version register.
  1163. */
  1164. uint32_t date:32;
  1165. };
  1166. uint32_t val;
  1167. } uart_date_reg_t;
  1168. /** Type of reg_update register
  1169. * UART Registers Configuration Update register
  1170. */
  1171. typedef union {
  1172. struct {
  1173. /** reg_update : R/W/SC; bitpos: [0]; default: 0;
  1174. * Software write 1 would synchronize registers into UART Core clock domain and would
  1175. * be cleared by hardware after synchronization is done.
  1176. */
  1177. uint32_t reg_update:1;
  1178. uint32_t reserved_1:31;
  1179. };
  1180. uint32_t val;
  1181. } uart_reg_update_reg_t;
  1182. /** Type of id register
  1183. * UART ID register
  1184. */
  1185. typedef union {
  1186. struct {
  1187. /** id : R/W; bitpos: [31:0]; default: 1280;
  1188. * This register is used to configure the uart_id.
  1189. */
  1190. uint32_t id:32;
  1191. };
  1192. uint32_t val;
  1193. } uart_id_reg_t;
  1194. typedef struct uart_dev_s {
  1195. volatile uart_fifo_reg_t fifo;
  1196. volatile uart_int_raw_reg_t int_raw;
  1197. volatile uart_int_st_reg_t int_st;
  1198. volatile uart_int_ena_reg_t int_ena;
  1199. volatile uart_int_clr_reg_t int_clr;
  1200. volatile uart_clkdiv_sync_reg_t clkdiv_sync;
  1201. volatile uart_rx_filt_reg_t rx_filt;
  1202. volatile uart_status_reg_t status;
  1203. volatile uart_conf0_sync_reg_t conf0_sync;
  1204. volatile uart_conf1_reg_t conf1;
  1205. uint32_t reserved_028;
  1206. volatile uart_hwfc_conf_sync_reg_t hwfc_conf_sync;
  1207. volatile uart_sleep_conf0_reg_t sleep_conf0;
  1208. volatile uart_sleep_conf1_reg_t sleep_conf1;
  1209. volatile uart_sleep_conf2_reg_t sleep_conf2;
  1210. volatile uart_swfc_conf0_sync_reg_t swfc_conf0_sync;
  1211. volatile uart_swfc_conf1_reg_t swfc_conf1;
  1212. volatile uart_txbrk_conf_sync_reg_t txbrk_conf_sync;
  1213. volatile uart_idle_conf_sync_reg_t idle_conf_sync;
  1214. volatile uart_rs485_conf_sync_reg_t rs485_conf_sync;
  1215. volatile uart_at_cmd_precnt_sync_reg_t at_cmd_precnt_sync;
  1216. volatile uart_at_cmd_postcnt_sync_reg_t at_cmd_postcnt_sync;
  1217. volatile uart_at_cmd_gaptout_sync_reg_t at_cmd_gaptout_sync;
  1218. volatile uart_at_cmd_char_sync_reg_t at_cmd_char_sync;
  1219. volatile uart_mem_conf_reg_t mem_conf;
  1220. volatile uart_tout_conf_sync_reg_t tout_conf_sync;
  1221. volatile uart_mem_tx_status_reg_t mem_tx_status;
  1222. volatile uart_mem_rx_status_reg_t mem_rx_status;
  1223. volatile uart_fsm_status_reg_t fsm_status;
  1224. volatile uart_pospulse_reg_t pospulse; /* LP_UART instance has this register reserved */
  1225. volatile uart_negpulse_reg_t negpulse; /* LP_UART instance has this register reserved */
  1226. volatile uart_lowpulse_reg_t lowpulse; /* LP_UART instance has this register reserved */
  1227. volatile uart_highpulse_reg_t highpulse; /* LP_UART instance has this register reserved */
  1228. volatile uart_rxd_cnt_reg_t rxd_cnt; /* LP_UART instance has this register reserved */
  1229. volatile uart_clk_conf_reg_t clk_conf; /* UART0/1 instance have this register reserved, configure in corresponding PCR registers */
  1230. volatile uart_date_reg_t date;
  1231. volatile uart_afifo_status_reg_t afifo_status;
  1232. uint32_t reserved_094;
  1233. volatile uart_reg_update_reg_t reg_update;
  1234. volatile uart_id_reg_t id;
  1235. } uart_dev_t;
  1236. extern uart_dev_t UART0;
  1237. extern uart_dev_t UART1;
  1238. extern uart_dev_t LP_UART;
  1239. #ifndef __cplusplus
  1240. _Static_assert(sizeof(uart_dev_t) == 0xa0, "Invalid size of uart_dev_t structure");
  1241. #endif
  1242. #ifdef __cplusplus
  1243. }
  1244. #endif