gh_uart2.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_uart2.h
  5. **
  6. ** \brief UART2.
  7. **
  8. ** Copyright: 2012 - 2016 (C) GoKe Microelectronics
  9. **
  10. ** \attention THIS SAMPLE CODE IS PROVIDED AS IS. GOKE MICROELECTRONICS
  11. ** ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR
  12. ** OMMISSIONS.
  13. **
  14. ** \note Do not modify this file as it is generated automatically.
  15. **
  16. ******************************************************************************/
  17. #ifndef _GH_UART2_H
  18. #define _GH_UART2_H
  19. #ifdef __LINUX__
  20. #include "reg4linux.h"
  21. #else
  22. #define FIO_ADDRESS(block,address) (address)
  23. #define FIO_MOFFSET(block,moffset) (moffset)
  24. #endif
  25. #ifndef __LINUX__
  26. #include "gtypes.h" /* global type definitions */
  27. #include "gh_lib_cfg.h" /* configuration */
  28. #endif
  29. #define GH_UART2_ENABLE_DEBUG_PRINT 0
  30. #ifdef __LINUX__
  31. #define GH_UART2_DEBUG_PRINT_FUNCTION printk
  32. #else
  33. #define GH_UART2_DEBUG_PRINT_FUNCTION printf
  34. #endif
  35. #ifndef __LINUX__
  36. #if GH_UART2_ENABLE_DEBUG_PRINT
  37. #include <stdio.h>
  38. #endif
  39. #endif
  40. /*----------------------------------------------------------------------------*/
  41. /* registers */
  42. /*----------------------------------------------------------------------------*/
  43. #define REG_UART2_RBR FIO_ADDRESS(UART2,0xa001E000) /* read */
  44. #define REG_UART2_THR FIO_ADDRESS(UART2,0xa001E000) /* write */
  45. #define REG_UART2_DLL FIO_ADDRESS(UART2,0xa001E000) /* read/write */
  46. #define REG_UART2_IER FIO_ADDRESS(UART2,0xa001E004) /* read/write */
  47. #define REG_UART2_DLH FIO_ADDRESS(UART2,0xa001E004) /* read/write */
  48. #define REG_UART2_IIR FIO_ADDRESS(UART2,0xa001E008) /* read */
  49. #define REG_UART2_FCR FIO_ADDRESS(UART2,0xa001E008) /* write */
  50. #define REG_UART2_LCR FIO_ADDRESS(UART2,0xa001E00C) /* read/write */
  51. #define REG_UART2_MCR FIO_ADDRESS(UART2,0xa001E010) /* read/write */
  52. #define REG_UART2_LSR FIO_ADDRESS(UART2,0xa001E014) /* read */
  53. #define REG_UART2_MSR FIO_ADDRESS(UART2,0xa001E018) /* read */
  54. #define REG_UART2_SCR FIO_ADDRESS(UART2,0xa001E01C) /* read/write */
  55. /*----------------------------------------------------------------------------*/
  56. /* bit group structures */
  57. /*----------------------------------------------------------------------------*/
  58. typedef union { /* UART2_RBR */
  59. U32 all;
  60. struct {
  61. U32 data : 8;
  62. U32 : 24;
  63. } bitc;
  64. } GH_UART2_RBR_S;
  65. typedef union { /* UART2_THR */
  66. U32 all;
  67. struct {
  68. U32 data : 8;
  69. U32 : 24;
  70. } bitc;
  71. } GH_UART2_THR_S;
  72. typedef union { /* UART2_DLL */
  73. U32 all;
  74. struct {
  75. U32 bauddivint_l : 8;
  76. U32 : 24;
  77. } bitc;
  78. } GH_UART2_DLL_S;
  79. typedef union { /* UART2_IER */
  80. U32 all;
  81. struct {
  82. U32 erbfi : 1;
  83. U32 etbei : 1;
  84. U32 elsi : 1;
  85. U32 edssi : 1;
  86. U32 : 28;
  87. } bitc;
  88. } GH_UART2_IER_S;
  89. typedef union { /* UART2_DLH */
  90. U32 all;
  91. struct {
  92. U32 bauddivint_h : 8;
  93. U32 : 24;
  94. } bitc;
  95. } GH_UART2_DLH_S;
  96. typedef union { /* UART2_IIR */
  97. U32 all;
  98. struct {
  99. U32 interrupt_id : 4;
  100. U32 : 2;
  101. U32 fifos_enabled : 2;
  102. U32 : 24;
  103. } bitc;
  104. } GH_UART2_IIR_S;
  105. typedef union { /* UART2_FCR */
  106. U32 all;
  107. struct {
  108. U32 fifo_enable : 1;
  109. U32 rcvr_fifo_reset : 1;
  110. U32 xmit_fifo_reset : 1;
  111. U32 dma_mode : 1;
  112. U32 tx_empty_trigger : 2;
  113. U32 rcvr_trigger : 2;
  114. U32 : 24;
  115. } bitc;
  116. } GH_UART2_FCR_S;
  117. typedef union { /* UART2_LCR */
  118. U32 all;
  119. struct {
  120. U32 cls : 2;
  121. U32 stop : 1;
  122. U32 pen : 1;
  123. U32 eps : 1;
  124. U32 sticky_parity : 1;
  125. U32 breaks : 1;
  126. U32 dlab : 1;
  127. U32 : 24;
  128. } bitc;
  129. } GH_UART2_LCR_S;
  130. typedef union { /* UART2_MCR */
  131. U32 all;
  132. struct {
  133. U32 dtr : 1;
  134. U32 rts : 1;
  135. U32 out1 : 1;
  136. U32 out2 : 1;
  137. U32 loopback : 1;
  138. U32 afce : 1;
  139. U32 sire : 1;
  140. U32 : 25;
  141. } bitc;
  142. } GH_UART2_MCR_S;
  143. typedef union { /* UART2_LSR */
  144. U32 all;
  145. struct {
  146. U32 dr : 1;
  147. U32 oe : 1;
  148. U32 pe : 1;
  149. U32 fe : 1;
  150. U32 bi : 1;
  151. U32 : 1;
  152. U32 temt : 1;
  153. U32 : 25;
  154. } bitc;
  155. } GH_UART2_LSR_S;
  156. typedef union { /* UART2_MSR */
  157. U32 all;
  158. struct {
  159. U32 dcts : 1;
  160. U32 ddsr : 1;
  161. U32 teri : 1;
  162. U32 ddcd : 1;
  163. U32 cts : 1;
  164. U32 dsr : 1;
  165. U32 ri : 1;
  166. U32 dcd : 1;
  167. U32 : 24;
  168. } bitc;
  169. } GH_UART2_MSR_S;
  170. typedef union { /* UART2_SCR */
  171. U32 all;
  172. struct {
  173. U32 scr : 8;
  174. U32 : 24;
  175. } bitc;
  176. } GH_UART2_SCR_S;
  177. /*----------------------------------------------------------------------------*/
  178. /* mirror variables */
  179. /*----------------------------------------------------------------------------*/
  180. extern GH_UART2_THR_S m_uart2_thr;
  181. extern GH_UART2_FCR_S m_uart2_fcr;
  182. #ifdef __cplusplus
  183. extern "C" {
  184. #endif
  185. /*----------------------------------------------------------------------------*/
  186. /* register UART2_RBR (read) */
  187. /*----------------------------------------------------------------------------*/
  188. /*! \brief Reads the register 'UART2_RBR'. */
  189. U32 GH_UART2_get_RBR(void);
  190. /*! \brief Reads the bit group 'Data' of register 'UART2_RBR'. */
  191. U8 GH_UART2_get_RBR_Data(void);
  192. /*----------------------------------------------------------------------------*/
  193. /* register UART2_THR (write) */
  194. /*----------------------------------------------------------------------------*/
  195. /*! \brief Writes the register 'UART2_THR'. */
  196. void GH_UART2_set_THR(U32 data);
  197. /*! \brief Reads the mirror variable of the register 'UART2_THR'. */
  198. U32 GH_UART2_getm_THR(void);
  199. /*! \brief Writes the bit group 'Data' of register 'UART2_THR'. */
  200. void GH_UART2_set_THR_Data(U8 data);
  201. /*! \brief Reads the bit group 'Data' from the mirror variable of register 'UART2_THR'. */
  202. U8 GH_UART2_getm_THR_Data(void);
  203. /*----------------------------------------------------------------------------*/
  204. /* register UART2_DLL (read/write) */
  205. /*----------------------------------------------------------------------------*/
  206. /*! \brief Writes the register 'UART2_DLL'. */
  207. void GH_UART2_set_DLL(U32 data);
  208. /*! \brief Reads the register 'UART2_DLL'. */
  209. U32 GH_UART2_get_DLL(void);
  210. /*! \brief Writes the bit group 'BaudDivint_L' of register 'UART2_DLL'. */
  211. void GH_UART2_set_DLL_BaudDivint_L(U8 data);
  212. /*! \brief Reads the bit group 'BaudDivint_L' of register 'UART2_DLL'. */
  213. U8 GH_UART2_get_DLL_BaudDivint_L(void);
  214. /*----------------------------------------------------------------------------*/
  215. /* register UART2_IER (read/write) */
  216. /*----------------------------------------------------------------------------*/
  217. /*! \brief Writes the register 'UART2_IER'. */
  218. void GH_UART2_set_IER(U32 data);
  219. /*! \brief Reads the register 'UART2_IER'. */
  220. U32 GH_UART2_get_IER(void);
  221. /*! \brief Writes the bit group 'erbfi' of register 'UART2_IER'. */
  222. void GH_UART2_set_IER_erbfi(U8 data);
  223. /*! \brief Reads the bit group 'erbfi' of register 'UART2_IER'. */
  224. U8 GH_UART2_get_IER_erbfi(void);
  225. /*! \brief Writes the bit group 'etbei' of register 'UART2_IER'. */
  226. void GH_UART2_set_IER_etbei(U8 data);
  227. /*! \brief Reads the bit group 'etbei' of register 'UART2_IER'. */
  228. U8 GH_UART2_get_IER_etbei(void);
  229. /*! \brief Writes the bit group 'elsi' of register 'UART2_IER'. */
  230. void GH_UART2_set_IER_elsi(U8 data);
  231. /*! \brief Reads the bit group 'elsi' of register 'UART2_IER'. */
  232. U8 GH_UART2_get_IER_elsi(void);
  233. /*! \brief Writes the bit group 'edssi' of register 'UART2_IER'. */
  234. void GH_UART2_set_IER_edssi(U8 data);
  235. /*! \brief Reads the bit group 'edssi' of register 'UART2_IER'. */
  236. U8 GH_UART2_get_IER_edssi(void);
  237. /*----------------------------------------------------------------------------*/
  238. /* register UART2_DLH (read/write) */
  239. /*----------------------------------------------------------------------------*/
  240. /*! \brief Writes the register 'UART2_DLH'. */
  241. void GH_UART2_set_DLH(U32 data);
  242. /*! \brief Reads the register 'UART2_DLH'. */
  243. U32 GH_UART2_get_DLH(void);
  244. /*! \brief Writes the bit group 'BaudDivint_H' of register 'UART2_DLH'. */
  245. void GH_UART2_set_DLH_BaudDivint_H(U8 data);
  246. /*! \brief Reads the bit group 'BaudDivint_H' of register 'UART2_DLH'. */
  247. U8 GH_UART2_get_DLH_BaudDivint_H(void);
  248. /*----------------------------------------------------------------------------*/
  249. /* register UART2_IIR (read) */
  250. /*----------------------------------------------------------------------------*/
  251. /*! \brief Reads the register 'UART2_IIR'. */
  252. U32 GH_UART2_get_IIR(void);
  253. /*! \brief Reads the bit group 'interrupt_id' of register 'UART2_IIR'. */
  254. U8 GH_UART2_get_IIR_interrupt_id(void);
  255. /*! \brief Reads the bit group 'fifos_enabled' of register 'UART2_IIR'. */
  256. U8 GH_UART2_get_IIR_fifos_enabled(void);
  257. /*----------------------------------------------------------------------------*/
  258. /* register UART2_FCR (write) */
  259. /*----------------------------------------------------------------------------*/
  260. /*! \brief Writes the register 'UART2_FCR'. */
  261. void GH_UART2_set_FCR(U32 data);
  262. /*! \brief Reads the mirror variable of the register 'UART2_FCR'. */
  263. U32 GH_UART2_getm_FCR(void);
  264. /*! \brief Writes the bit group 'FIFO_Enable' of register 'UART2_FCR'. */
  265. void GH_UART2_set_FCR_FIFO_Enable(U8 data);
  266. /*! \brief Reads the bit group 'FIFO_Enable' from the mirror variable of register 'UART2_FCR'. */
  267. U8 GH_UART2_getm_FCR_FIFO_Enable(void);
  268. /*! \brief Writes the bit group 'RCVR_FIFO_Reset' of register 'UART2_FCR'. */
  269. void GH_UART2_set_FCR_RCVR_FIFO_Reset(U8 data);
  270. /*! \brief Reads the bit group 'RCVR_FIFO_Reset' from the mirror variable of register 'UART2_FCR'. */
  271. U8 GH_UART2_getm_FCR_RCVR_FIFO_Reset(void);
  272. /*! \brief Writes the bit group 'XMIT_FIFO_Reset' of register 'UART2_FCR'. */
  273. void GH_UART2_set_FCR_XMIT_FIFO_Reset(U8 data);
  274. /*! \brief Reads the bit group 'XMIT_FIFO_Reset' from the mirror variable of register 'UART2_FCR'. */
  275. U8 GH_UART2_getm_FCR_XMIT_FIFO_Reset(void);
  276. /*! \brief Writes the bit group 'DMA_Mode' of register 'UART2_FCR'. */
  277. void GH_UART2_set_FCR_DMA_Mode(U8 data);
  278. /*! \brief Reads the bit group 'DMA_Mode' from the mirror variable of register 'UART2_FCR'. */
  279. U8 GH_UART2_getm_FCR_DMA_Mode(void);
  280. /*! \brief Writes the bit group 'TX_Empty_Trigger' of register 'UART2_FCR'. */
  281. void GH_UART2_set_FCR_TX_Empty_Trigger(U8 data);
  282. /*! \brief Reads the bit group 'TX_Empty_Trigger' from the mirror variable of register 'UART2_FCR'. */
  283. U8 GH_UART2_getm_FCR_TX_Empty_Trigger(void);
  284. /*! \brief Writes the bit group 'RCVR_Trigger' of register 'UART2_FCR'. */
  285. void GH_UART2_set_FCR_RCVR_Trigger(U8 data);
  286. /*! \brief Reads the bit group 'RCVR_Trigger' from the mirror variable of register 'UART2_FCR'. */
  287. U8 GH_UART2_getm_FCR_RCVR_Trigger(void);
  288. /*----------------------------------------------------------------------------*/
  289. /* register UART2_LCR (read/write) */
  290. /*----------------------------------------------------------------------------*/
  291. /*! \brief Writes the register 'UART2_LCR'. */
  292. void GH_UART2_set_LCR(U32 data);
  293. /*! \brief Reads the register 'UART2_LCR'. */
  294. U32 GH_UART2_get_LCR(void);
  295. /*! \brief Writes the bit group 'cls' of register 'UART2_LCR'. */
  296. void GH_UART2_set_LCR_cls(U8 data);
  297. /*! \brief Reads the bit group 'cls' of register 'UART2_LCR'. */
  298. U8 GH_UART2_get_LCR_cls(void);
  299. /*! \brief Writes the bit group 'stop' of register 'UART2_LCR'. */
  300. void GH_UART2_set_LCR_stop(U8 data);
  301. /*! \brief Reads the bit group 'stop' of register 'UART2_LCR'. */
  302. U8 GH_UART2_get_LCR_stop(void);
  303. /*! \brief Writes the bit group 'pen' of register 'UART2_LCR'. */
  304. void GH_UART2_set_LCR_pen(U8 data);
  305. /*! \brief Reads the bit group 'pen' of register 'UART2_LCR'. */
  306. U8 GH_UART2_get_LCR_pen(void);
  307. /*! \brief Writes the bit group 'eps' of register 'UART2_LCR'. */
  308. void GH_UART2_set_LCR_eps(U8 data);
  309. /*! \brief Reads the bit group 'eps' of register 'UART2_LCR'. */
  310. U8 GH_UART2_get_LCR_eps(void);
  311. /*! \brief Writes the bit group 'sticky_parity' of register 'UART2_LCR'. */
  312. void GH_UART2_set_LCR_sticky_parity(U8 data);
  313. /*! \brief Reads the bit group 'sticky_parity' of register 'UART2_LCR'. */
  314. U8 GH_UART2_get_LCR_sticky_parity(void);
  315. /*! \brief Writes the bit group 'breaks' of register 'UART2_LCR'. */
  316. void GH_UART2_set_LCR_breaks(U8 data);
  317. /*! \brief Reads the bit group 'breaks' of register 'UART2_LCR'. */
  318. U8 GH_UART2_get_LCR_breaks(void);
  319. /*! \brief Writes the bit group 'dlab' of register 'UART2_LCR'. */
  320. void GH_UART2_set_LCR_dlab(U8 data);
  321. /*! \brief Reads the bit group 'dlab' of register 'UART2_LCR'. */
  322. U8 GH_UART2_get_LCR_dlab(void);
  323. /*----------------------------------------------------------------------------*/
  324. /* register UART2_MCR (read/write) */
  325. /*----------------------------------------------------------------------------*/
  326. /*! \brief Writes the register 'UART2_MCR'. */
  327. void GH_UART2_set_MCR(U32 data);
  328. /*! \brief Reads the register 'UART2_MCR'. */
  329. U32 GH_UART2_get_MCR(void);
  330. /*! \brief Writes the bit group 'dtr' of register 'UART2_MCR'. */
  331. void GH_UART2_set_MCR_dtr(U8 data);
  332. /*! \brief Reads the bit group 'dtr' of register 'UART2_MCR'. */
  333. U8 GH_UART2_get_MCR_dtr(void);
  334. /*! \brief Writes the bit group 'rts' of register 'UART2_MCR'. */
  335. void GH_UART2_set_MCR_rts(U8 data);
  336. /*! \brief Reads the bit group 'rts' of register 'UART2_MCR'. */
  337. U8 GH_UART2_get_MCR_rts(void);
  338. /*! \brief Writes the bit group 'out1' of register 'UART2_MCR'. */
  339. void GH_UART2_set_MCR_out1(U8 data);
  340. /*! \brief Reads the bit group 'out1' of register 'UART2_MCR'. */
  341. U8 GH_UART2_get_MCR_out1(void);
  342. /*! \brief Writes the bit group 'out2' of register 'UART2_MCR'. */
  343. void GH_UART2_set_MCR_out2(U8 data);
  344. /*! \brief Reads the bit group 'out2' of register 'UART2_MCR'. */
  345. U8 GH_UART2_get_MCR_out2(void);
  346. /*! \brief Writes the bit group 'loopback' of register 'UART2_MCR'. */
  347. void GH_UART2_set_MCR_loopback(U8 data);
  348. /*! \brief Reads the bit group 'loopback' of register 'UART2_MCR'. */
  349. U8 GH_UART2_get_MCR_loopback(void);
  350. /*! \brief Writes the bit group 'afce' of register 'UART2_MCR'. */
  351. void GH_UART2_set_MCR_afce(U8 data);
  352. /*! \brief Reads the bit group 'afce' of register 'UART2_MCR'. */
  353. U8 GH_UART2_get_MCR_afce(void);
  354. /*! \brief Writes the bit group 'sire' of register 'UART2_MCR'. */
  355. void GH_UART2_set_MCR_sire(U8 data);
  356. /*! \brief Reads the bit group 'sire' of register 'UART2_MCR'. */
  357. U8 GH_UART2_get_MCR_sire(void);
  358. /*----------------------------------------------------------------------------*/
  359. /* register UART2_LSR (read) */
  360. /*----------------------------------------------------------------------------*/
  361. /*! \brief Reads the register 'UART2_LSR'. */
  362. U32 GH_UART2_get_LSR(void);
  363. /*! \brief Reads the bit group 'dr' of register 'UART2_LSR'. */
  364. U8 GH_UART2_get_LSR_dr(void);
  365. /*! \brief Reads the bit group 'oe' of register 'UART2_LSR'. */
  366. U8 GH_UART2_get_LSR_oe(void);
  367. /*! \brief Reads the bit group 'pe' of register 'UART2_LSR'. */
  368. U8 GH_UART2_get_LSR_pe(void);
  369. /*! \brief Reads the bit group 'fe' of register 'UART2_LSR'. */
  370. U8 GH_UART2_get_LSR_fe(void);
  371. /*! \brief Reads the bit group 'bi' of register 'UART2_LSR'. */
  372. U8 GH_UART2_get_LSR_bi(void);
  373. /*! \brief Reads the bit group 'temt' of register 'UART2_LSR'. */
  374. U8 GH_UART2_get_LSR_temt(void);
  375. /*----------------------------------------------------------------------------*/
  376. /* register UART2_MSR (read) */
  377. /*----------------------------------------------------------------------------*/
  378. /*! \brief Reads the register 'UART2_MSR'. */
  379. U32 GH_UART2_get_MSR(void);
  380. /*! \brief Reads the bit group 'dcts' of register 'UART2_MSR'. */
  381. U8 GH_UART2_get_MSR_dcts(void);
  382. /*! \brief Reads the bit group 'ddsr' of register 'UART2_MSR'. */
  383. U8 GH_UART2_get_MSR_ddsr(void);
  384. /*! \brief Reads the bit group 'teri' of register 'UART2_MSR'. */
  385. U8 GH_UART2_get_MSR_teri(void);
  386. /*! \brief Reads the bit group 'ddcd' of register 'UART2_MSR'. */
  387. U8 GH_UART2_get_MSR_ddcd(void);
  388. /*! \brief Reads the bit group 'cts' of register 'UART2_MSR'. */
  389. U8 GH_UART2_get_MSR_cts(void);
  390. /*! \brief Reads the bit group 'dsr' of register 'UART2_MSR'. */
  391. U8 GH_UART2_get_MSR_dsr(void);
  392. /*! \brief Reads the bit group 'ri' of register 'UART2_MSR'. */
  393. U8 GH_UART2_get_MSR_ri(void);
  394. /*! \brief Reads the bit group 'dcd' of register 'UART2_MSR'. */
  395. U8 GH_UART2_get_MSR_dcd(void);
  396. /*----------------------------------------------------------------------------*/
  397. /* register UART2_SCR (read/write) */
  398. /*----------------------------------------------------------------------------*/
  399. /*! \brief Writes the register 'UART2_SCR'. */
  400. void GH_UART2_set_SCR(U32 data);
  401. /*! \brief Reads the register 'UART2_SCR'. */
  402. U32 GH_UART2_get_SCR(void);
  403. /*! \brief Writes the bit group 'scr' of register 'UART2_SCR'. */
  404. void GH_UART2_set_SCR_scr(U8 data);
  405. /*! \brief Reads the bit group 'scr' of register 'UART2_SCR'. */
  406. U8 GH_UART2_get_SCR_scr(void);
  407. /*----------------------------------------------------------------------------*/
  408. /* init function */
  409. /*----------------------------------------------------------------------------*/
  410. /*! \brief Initialises the registers and mirror variables. */
  411. void GH_UART2_init(void);
  412. #ifdef SRC_INLINE
  413. #define SRC_INC 1
  414. #include "gh_uart2.c"
  415. #undef SRC_INC
  416. #endif
  417. #ifdef __cplusplus
  418. }
  419. #endif
  420. #endif /* _GH_UART2_H */
  421. /*----------------------------------------------------------------------------*/
  422. /* end of file */
  423. /*----------------------------------------------------------------------------*/