You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
6.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
  3. *
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. *
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the
  15. * distribution.
  16. *
  17. * * Neither the name of Texas Instruments Incorporated nor the names of
  18. * its contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. #ifndef _PRU_UART_H_
  34. #define _PRU_UART_H_
  35. /* UART Register set */
  36. typedef struct {
  37. /*
  38. * RBR and THR register pair
  39. * This is a unique register pair in that RBR and THR
  40. * share the same address. RBR is read-only while THR is
  41. * write-only.
  42. *
  43. * Additionally, RBR and THR share an address with DLL. To
  44. * read/write RBR/THR write 0 to the DLAB bit in the LCR
  45. * register. To modify DLL write a 1.
  46. *
  47. * DLL also has a dedicated
  48. * address which does not require toggling the DLAB bit.
  49. */
  50. union {
  51. /* PRU_UART_RBR register bit field */
  52. union {
  53. volatile uint32_t RBR;
  54. volatile struct {
  55. unsigned DATA : 8; // 7:0
  56. unsigned rsvd8 : 24; // 31:8
  57. } RBR_bit;
  58. };
  59. /* PRU_UART_THR register bit field */
  60. union {
  61. volatile uint32_t THR;
  62. volatile struct {
  63. unsigned DATA : 8; // 7:0
  64. unsigned rsvd8 : 24; // 31:8
  65. } THR_bit;
  66. };
  67. }; // 0x0
  68. /* PRU_UART_IER register bit field */
  69. /*
  70. * IER shares an address with DLH. To modify IER write 0
  71. * to the DLAB bit in the LCR register. To modify DLH write a 1.
  72. *
  73. * DLH also has a dedicated address which does not require
  74. * toggling the DLAB bit.
  75. */
  76. union {
  77. volatile uint32_t IER;
  78. volatile struct {
  79. unsigned ERBI : 1; // 0
  80. unsigned ETBEI : 1; // 1
  81. unsigned ELSI : 1; // 2
  82. unsigned EDSSI : 1; // 3
  83. unsigned rsvd4 : 28; // 31:4
  84. } IER_bit;
  85. }; // 0x4
  86. /*
  87. * IIR and FCR register pair
  88. * This is a unique register pair in that IIR and FCR
  89. * share the same address. IIR is read-only while FCR is
  90. * write-only.
  91. */
  92. union {
  93. /* PRU_UART_IIR register bit field */
  94. union {
  95. volatile uint32_t IIR;
  96. volatile struct {
  97. unsigned IPEND : 1; // 0
  98. unsigned INTID : 3; // 3:1
  99. unsigned rsvd4 : 2; // 5:4
  100. unsigned FIFOEN : 2; // 7:6
  101. unsigned rsvd8 : 24; // 31:8
  102. } IIR_bit;
  103. };
  104. /* PRU_UART_FCR register bit field */
  105. union {
  106. volatile uint32_t FCR;
  107. volatile struct {
  108. unsigned FIFOEN : 1; // 0
  109. unsigned RXCLR : 1; // 1
  110. unsigned TXCLR : 1; // 2
  111. unsigned DMAMODE1 : 1; // 3
  112. unsigned rsvd4 : 2; // 5:4
  113. unsigned RXFIFTL : 2; // 7:6
  114. unsigned rsvd8 : 24; // 31:8
  115. } FCR_bit;
  116. };
  117. }; // 0x8
  118. /* PRU_UART_LCR register bit field */
  119. union {
  120. volatile uint32_t LCR;
  121. volatile struct {
  122. unsigned WLS : 2; // 1:0
  123. unsigned STB : 1; // 2
  124. unsigned PEN : 1; // 3
  125. unsigned EPS : 1; // 4
  126. unsigned SP : 1; // 5
  127. unsigned BC : 1; // 6
  128. unsigned DLAB : 1; // 7
  129. unsigned rsvd8 : 24; // 31:8
  130. } LCR_bit;
  131. }; // 0xC
  132. /* PRU_UART_MCR register bit field */
  133. union {
  134. volatile uint32_t MCR;
  135. volatile struct {
  136. unsigned rsvd0 : 1; // 0
  137. unsigned RTS : 1; // 1
  138. unsigned OUT1 : 1; // 2
  139. unsigned OUT2 : 1; // 3
  140. unsigned LOOP : 1; // 4
  141. unsigned AFE : 1; // 5
  142. unsigned rsvd8 : 26; // 31:6
  143. } MCR_bit;
  144. }; // 0x10
  145. /* PRU_UART_LSR register bit field */
  146. union {
  147. volatile uint32_t LSR;
  148. volatile struct {
  149. unsigned DR : 1; // 0
  150. unsigned OE : 1; // 1
  151. unsigned PE : 1; // 2
  152. unsigned FE : 1; // 3
  153. unsigned BI : 1; // 4
  154. unsigned THRE : 1; // 5
  155. unsigned TEMT : 1; // 6
  156. unsigned RXFIFOE : 1; // 7
  157. unsigned rsvd8 : 24; // 31:8
  158. } LSR_bit;
  159. }; // 0x14
  160. /* PRU_UART_MSR register bit field */
  161. union {
  162. volatile uint32_t MSR;
  163. volatile struct {
  164. unsigned DCTS : 1; // 0
  165. unsigned DDSR : 1; // 1
  166. unsigned TERI : 1; // 2
  167. unsigned DCD : 1; // 3
  168. unsigned CTS : 1; // 4
  169. unsigned DSR : 1; // 5
  170. unsigned RI : 1; // 6
  171. unsigned CD : 1; // 7
  172. unsigned rsvd8 : 24; // 31:8
  173. } MSR_bit;
  174. }; // 0x18
  175. /* PRU_UART_SCR register bit field */
  176. union {
  177. volatile uint32_t SCR;
  178. volatile struct {
  179. unsigned SCR : 8; // 7:0
  180. unsigned rsvd8 : 24; // 31:8
  181. } SCR_bit;
  182. }; // 0x1C
  183. /* PRU_UART_DLL register bit field */
  184. union {
  185. volatile uint32_t DLL;
  186. volatile struct {
  187. unsigned DLL : 8; // 7:0
  188. unsigned rsvd8 : 24; // 31:8
  189. } DLL_bit;
  190. }; // 0x20
  191. /* PRU_UART_DLH register bit field */
  192. union {
  193. volatile uint32_t DLH;
  194. volatile struct {
  195. unsigned DLH : 8; // 7:0
  196. unsigned rsvd8 : 24; // 31:8
  197. } DLH_bit;
  198. }; // 0x24
  199. /* PRU_UART_REVID1 register bit field */
  200. union {
  201. volatile uint32_t REVID1;
  202. volatile struct {
  203. unsigned REVID1 : 32; // 31:0
  204. } REVID1_bit;
  205. }; // 0x28
  206. /* PRU_UART_REVID2 register bit field */
  207. union {
  208. volatile uint32_t REVID2;
  209. volatile struct {
  210. unsigned REVID2 : 8; // 7:0
  211. unsigned rsvd8 : 24; // 31:8
  212. } REVID2_bit;
  213. }; // 0x2C
  214. /* PRU_UART_PWREMU_MGMT register bit field */
  215. union {
  216. volatile uint32_t PWREMU_MGMT;
  217. volatile struct {
  218. unsigned FREE : 1; // 0
  219. unsigned rsvd1 : 12; // 12:1
  220. unsigned URRST : 1; // 13
  221. unsigned UTRST : 1; // 14
  222. unsigned rsvd15 : 17; // 31:15
  223. } PWREMU_MGMT_bit;
  224. }; // 0x30
  225. /* PRU_UART_MDR register bit field */
  226. union {
  227. volatile uint32_t MDR;
  228. volatile struct {
  229. unsigned OSM_SEL : 1; // 0
  230. unsigned rsvd1 : 31; // 31:1
  231. } MDR_bit;
  232. }; // 0x34
  233. } pruUart;
  234. volatile __far pruUart CT_UART __attribute__((cregister("PRU_UART", near), peripheral));
  235. #endif /* _PRU_UART_H_ */