uart.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /*
  2. * Copyright 2013 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. /* Machine-generated file; do not edit. */
  15. #ifndef __ARCH_UART_H__
  16. #define __ARCH_UART_H__
  17. #include <arch/abi.h>
  18. #include <arch/uart_def.h>
  19. #ifndef __ASSEMBLER__
  20. /* Divisor. */
  21. __extension__
  22. typedef union
  23. {
  24. struct
  25. {
  26. #ifndef __BIG_ENDIAN__
  27. /*
  28. * Baud Rate Divisor. Desired_baud_rate = REF_CLK frequency / (baud *
  29. * 16).
  30. * Note: REF_CLK is always 125 MHz, the default
  31. * divisor = 68, baud rate = 125M/(68*16) = 115200 baud.
  32. */
  33. uint_reg_t divisor : 12;
  34. /* Reserved. */
  35. uint_reg_t __reserved : 52;
  36. #else /* __BIG_ENDIAN__ */
  37. uint_reg_t __reserved : 52;
  38. uint_reg_t divisor : 12;
  39. #endif
  40. };
  41. uint_reg_t word;
  42. } UART_DIVISOR_t;
  43. /* FIFO Count. */
  44. __extension__
  45. typedef union
  46. {
  47. struct
  48. {
  49. #ifndef __BIG_ENDIAN__
  50. /*
  51. * n: n active entries in the receive FIFO (max is 2**8). Each entry has
  52. * 8 bits.
  53. * 0: no active entry in the receive FIFO (that is empty).
  54. */
  55. uint_reg_t rfifo_count : 9;
  56. /* Reserved. */
  57. uint_reg_t __reserved_0 : 7;
  58. /*
  59. * n: n active entries in the transmit FIFO (max is 2**8). Each entry has
  60. * 8 bits.
  61. * 0: no active entry in the transmit FIFO (that is empty).
  62. */
  63. uint_reg_t tfifo_count : 9;
  64. /* Reserved. */
  65. uint_reg_t __reserved_1 : 7;
  66. /*
  67. * n: n active entries in the write FIFO (max is 2**2). Each entry has 8
  68. * bits.
  69. * 0: no active entry in the write FIFO (that is empty).
  70. */
  71. uint_reg_t wfifo_count : 3;
  72. /* Reserved. */
  73. uint_reg_t __reserved_2 : 29;
  74. #else /* __BIG_ENDIAN__ */
  75. uint_reg_t __reserved_2 : 29;
  76. uint_reg_t wfifo_count : 3;
  77. uint_reg_t __reserved_1 : 7;
  78. uint_reg_t tfifo_count : 9;
  79. uint_reg_t __reserved_0 : 7;
  80. uint_reg_t rfifo_count : 9;
  81. #endif
  82. };
  83. uint_reg_t word;
  84. } UART_FIFO_COUNT_t;
  85. /* FLAG. */
  86. __extension__
  87. typedef union
  88. {
  89. struct
  90. {
  91. #ifndef __BIG_ENDIAN__
  92. /* Reserved. */
  93. uint_reg_t __reserved_0 : 1;
  94. /* 1: receive FIFO is empty */
  95. uint_reg_t rfifo_empty : 1;
  96. /* 1: write FIFO is empty. */
  97. uint_reg_t wfifo_empty : 1;
  98. /* 1: transmit FIFO is empty. */
  99. uint_reg_t tfifo_empty : 1;
  100. /* 1: receive FIFO is full. */
  101. uint_reg_t rfifo_full : 1;
  102. /* 1: write FIFO is full. */
  103. uint_reg_t wfifo_full : 1;
  104. /* 1: transmit FIFO is full. */
  105. uint_reg_t tfifo_full : 1;
  106. /* Reserved. */
  107. uint_reg_t __reserved_1 : 57;
  108. #else /* __BIG_ENDIAN__ */
  109. uint_reg_t __reserved_1 : 57;
  110. uint_reg_t tfifo_full : 1;
  111. uint_reg_t wfifo_full : 1;
  112. uint_reg_t rfifo_full : 1;
  113. uint_reg_t tfifo_empty : 1;
  114. uint_reg_t wfifo_empty : 1;
  115. uint_reg_t rfifo_empty : 1;
  116. uint_reg_t __reserved_0 : 1;
  117. #endif
  118. };
  119. uint_reg_t word;
  120. } UART_FLAG_t;
  121. /*
  122. * Interrupt Vector Mask.
  123. * Each bit in this register corresponds to a specific interrupt. When set,
  124. * the associated interrupt will not be dispatched.
  125. */
  126. __extension__
  127. typedef union
  128. {
  129. struct
  130. {
  131. #ifndef __BIG_ENDIAN__
  132. /* Read data FIFO read and no data available */
  133. uint_reg_t rdat_err : 1;
  134. /* Write FIFO was written but it was full */
  135. uint_reg_t wdat_err : 1;
  136. /* Stop bit not found when current data was received */
  137. uint_reg_t frame_err : 1;
  138. /* Parity error was detected when current data was received */
  139. uint_reg_t parity_err : 1;
  140. /* Data was received but the receive FIFO was full */
  141. uint_reg_t rfifo_overflow : 1;
  142. /*
  143. * An almost full event is reached when data is to be written to the
  144. * receive FIFO, and the receive FIFO has more than or equal to
  145. * BUFFER_THRESHOLD.RFIFO_AFULL bytes.
  146. */
  147. uint_reg_t rfifo_afull : 1;
  148. /* Reserved. */
  149. uint_reg_t __reserved_0 : 1;
  150. /* An entry in the transmit FIFO was popped */
  151. uint_reg_t tfifo_re : 1;
  152. /* An entry has been pushed into the receive FIFO */
  153. uint_reg_t rfifo_we : 1;
  154. /* An entry of the write FIFO has been popped */
  155. uint_reg_t wfifo_re : 1;
  156. /* Rshim read receive FIFO in protocol mode */
  157. uint_reg_t rfifo_err : 1;
  158. /*
  159. * An almost empty event is reached when data is to be read from the
  160. * transmit FIFO, and the transmit FIFO has less than or equal to
  161. * BUFFER_THRESHOLD.TFIFO_AEMPTY bytes.
  162. */
  163. uint_reg_t tfifo_aempty : 1;
  164. /* Reserved. */
  165. uint_reg_t __reserved_1 : 52;
  166. #else /* __BIG_ENDIAN__ */
  167. uint_reg_t __reserved_1 : 52;
  168. uint_reg_t tfifo_aempty : 1;
  169. uint_reg_t rfifo_err : 1;
  170. uint_reg_t wfifo_re : 1;
  171. uint_reg_t rfifo_we : 1;
  172. uint_reg_t tfifo_re : 1;
  173. uint_reg_t __reserved_0 : 1;
  174. uint_reg_t rfifo_afull : 1;
  175. uint_reg_t rfifo_overflow : 1;
  176. uint_reg_t parity_err : 1;
  177. uint_reg_t frame_err : 1;
  178. uint_reg_t wdat_err : 1;
  179. uint_reg_t rdat_err : 1;
  180. #endif
  181. };
  182. uint_reg_t word;
  183. } UART_INTERRUPT_MASK_t;
  184. /*
  185. * Interrupt vector, write-one-to-clear.
  186. * Each bit in this register corresponds to a specific interrupt. Hardware
  187. * sets the bit when the associated condition has occurred. Writing a 1
  188. * clears the status bit.
  189. */
  190. __extension__
  191. typedef union
  192. {
  193. struct
  194. {
  195. #ifndef __BIG_ENDIAN__
  196. /* Read data FIFO read and no data available */
  197. uint_reg_t rdat_err : 1;
  198. /* Write FIFO was written but it was full */
  199. uint_reg_t wdat_err : 1;
  200. /* Stop bit not found when current data was received */
  201. uint_reg_t frame_err : 1;
  202. /* Parity error was detected when current data was received */
  203. uint_reg_t parity_err : 1;
  204. /* Data was received but the receive FIFO was full */
  205. uint_reg_t rfifo_overflow : 1;
  206. /*
  207. * Data was received and the receive FIFO is now almost full (more than
  208. * BUFFER_THRESHOLD.RFIFO_AFULL bytes in it)
  209. */
  210. uint_reg_t rfifo_afull : 1;
  211. /* Reserved. */
  212. uint_reg_t __reserved_0 : 1;
  213. /* An entry in the transmit FIFO was popped */
  214. uint_reg_t tfifo_re : 1;
  215. /* An entry has been pushed into the receive FIFO */
  216. uint_reg_t rfifo_we : 1;
  217. /* An entry of the write FIFO has been popped */
  218. uint_reg_t wfifo_re : 1;
  219. /* Rshim read receive FIFO in protocol mode */
  220. uint_reg_t rfifo_err : 1;
  221. /*
  222. * Data was read from the transmit FIFO and now it is almost empty (less
  223. * than or equal to BUFFER_THRESHOLD.TFIFO_AEMPTY bytes in it).
  224. */
  225. uint_reg_t tfifo_aempty : 1;
  226. /* Reserved. */
  227. uint_reg_t __reserved_1 : 52;
  228. #else /* __BIG_ENDIAN__ */
  229. uint_reg_t __reserved_1 : 52;
  230. uint_reg_t tfifo_aempty : 1;
  231. uint_reg_t rfifo_err : 1;
  232. uint_reg_t wfifo_re : 1;
  233. uint_reg_t rfifo_we : 1;
  234. uint_reg_t tfifo_re : 1;
  235. uint_reg_t __reserved_0 : 1;
  236. uint_reg_t rfifo_afull : 1;
  237. uint_reg_t rfifo_overflow : 1;
  238. uint_reg_t parity_err : 1;
  239. uint_reg_t frame_err : 1;
  240. uint_reg_t wdat_err : 1;
  241. uint_reg_t rdat_err : 1;
  242. #endif
  243. };
  244. uint_reg_t word;
  245. } UART_INTERRUPT_STATUS_t;
  246. /* Type. */
  247. __extension__
  248. typedef union
  249. {
  250. struct
  251. {
  252. #ifndef __BIG_ENDIAN__
  253. /* Number of stop bits, rx and tx */
  254. uint_reg_t sbits : 1;
  255. /* Reserved. */
  256. uint_reg_t __reserved_0 : 1;
  257. /* Data word size, rx and tx */
  258. uint_reg_t dbits : 1;
  259. /* Reserved. */
  260. uint_reg_t __reserved_1 : 1;
  261. /* Parity selection, rx and tx */
  262. uint_reg_t ptype : 3;
  263. /* Reserved. */
  264. uint_reg_t __reserved_2 : 57;
  265. #else /* __BIG_ENDIAN__ */
  266. uint_reg_t __reserved_2 : 57;
  267. uint_reg_t ptype : 3;
  268. uint_reg_t __reserved_1 : 1;
  269. uint_reg_t dbits : 1;
  270. uint_reg_t __reserved_0 : 1;
  271. uint_reg_t sbits : 1;
  272. #endif
  273. };
  274. uint_reg_t word;
  275. } UART_TYPE_t;
  276. #endif /* !defined(__ASSEMBLER__) */
  277. #endif /* !defined(__ARCH_UART_H__) */