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.

215 lines
6.1 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * linux/<file location within the kernel tree>
  3. *
  4. * Copyright (C) 2010 Texas Instruments Incorporated
  5. * Author: jitendra@mistralsolutions.com
  6. *
  7. * Based on <Give reference of old kernel file from which this file is derived from>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation version 2.
  12. *
  13. * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
  14. * whether express or implied; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. */
  18. #ifndef _SUART_PRU_REGS_H_
  19. #define _SUART_PRU_REGS_H_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /*
  24. *====================
  25. * Includes
  26. *====================
  27. */
  28. #include "tistdtypes.h"
  29. /*
  30. *====================
  31. * Defines
  32. *====================
  33. */
  34. #define PRU_DATARAM_BASE_ADDR (0x01C30000u)
  35. #define PRU0_DATARAM0_OFFSET (0x0000u)
  36. /** PRU0 DATA RAM base address */
  37. #define PRU0_DATARAM1_OFFSET (0x2000u)
  38. /** PRU0 DATA RAM base address */
  39. #define PRU_SUART_DATARAM0_BASE (PRU_DATARAM_BASE_ADDR + PRU0_DATARAM0_OFFSET)
  40. /** PRU1 DATA RAM base address */
  41. #define PRU_SUART_DATARAM1_BASE (PRU_DATARAM_BASE_ADDR + PRU0_DATARAM0_OFFSET)
  42. /** PRU1 DATA RAM base address */
  43. #define PRU_SUART_PRU0_CH0_OFFSET (0x0000)
  44. /** Channel 0 */
  45. #define PRU_SUART_PRU0_CH1_OFFSET (0x0010)
  46. /** Channel 1 */
  47. #define PRU_SUART_PRU0_CH2_OFFSET (0x0020)
  48. /** Channel 2 */
  49. #define PRU_SUART_PRU0_CH3_OFFSET (0x0030)
  50. /** Channel 3 */
  51. #define PRU_SUART_PRU0_CH4_OFFSET (0x0040)
  52. /** Channel 4 */
  53. #define PRU_SUART_PRU0_CH5_OFFSET (0x0050)
  54. /** Channel 5 */
  55. #define PRU_SUART_PRU0_CH6_OFFSET (0x0060)
  56. /** Channel 6 */
  57. #define PRU_SUART_PRU0_CH7_OFFSET (0x0070)
  58. /** Channel 7 */
  59. #define PRU_SUART_PRU0_IMR_OFFSET (0x0080)
  60. /** Interrupt Mask Register */
  61. #define PRU_SUART_PRU0_ISR_OFFSET (0x0082)
  62. /** Interrupt Status Register */
  63. #define PRU_SUART_PRU0_ID_ADDR (0x0084)
  64. /** PRU ID Register */
  65. #define PRU_SUART_PRU0_IDLE_TIMEOUT_OFFSET 0x0086
  66. /* ********* PRU 1 Macros ************* */
  67. #define PRU_SUART_PRU1_CH0_OFFSET (0x2000)
  68. /** Channel 0 */
  69. #define PRU_SUART_PRU1_CH1_OFFSET (0x2010)
  70. /** Channel 1 */
  71. #define PRU_SUART_PRU1_CH2_OFFSET (0x2020)
  72. /** Channel 2 */
  73. #define PRU_SUART_PRU1_CH3_OFFSET (0x2030)
  74. /** Channel 3 */
  75. #define PRU_SUART_PRU1_CH4_OFFSET (0x2040)
  76. /** Channel 4 */
  77. #define PRU_SUART_PRU1_CH5_OFFSET (0x2050)
  78. /** Channel 5 */
  79. #define PRU_SUART_PRU1_CH6_OFFSET (0x2060)
  80. /** Channel 6 */
  81. #define PRU_SUART_PRU1_CH7_OFFSET (0x2070)
  82. /** Channel 7 */
  83. #define PRU_SUART_PRU1_IMR_OFFSET (0x2080)
  84. /** Interrupt Mask Register */
  85. #define PRU_SUART_PRU1_ISR_OFFSET (0x2080)
  86. /** Interrupt Status Register */
  87. #define PRU_SUART_PRU1_ID_ADDR (0x2084)
  88. /** PRU ID Register */
  89. #define PRU_SUART_PRU1_IDLE_TIMEOUT_OFFSET 0x2086
  90. /* SUART Channel Control Register bit descriptions */
  91. #define PRU_SUART_CH_CTRL_MODE_SHIFT 0x0000
  92. #define PRU_SUART_CH_CTRL_MODE_MASK 0x0003
  93. #define PRU_SUART_CH_CTRL_TX_MODE 0x0001
  94. #define PRU_SUART_CH_CTRL_RX_MODE 0x0002
  95. /* Service Request */
  96. #define PRU_SUART_CH_CTRL_SREQ_SHIFT 0x0002
  97. #define PRU_SUART_CH_CTRL_SREQ_MASK 0x0004
  98. #define PRU_SUART_CH_CTRL_SREQ 0x0001
  99. /* McASP Instance */
  100. #define PRU_SUART_CH_CTRL_MCASP_SHIFT 0x0003
  101. #define PRU_SUART_CH_CTRL_MCASP_MASK 0x0018
  102. #define PRU_SUART_CH_CTRL_SR_SHIFT 0x0008
  103. #define PRU_SUART_CH_CTRL_SR_MASK 0x0F00
  104. /* SUART channel configuration1 register descriptions */
  105. /* clock divisor - relative baud value */
  106. #define PRU_SUART_CH_CONFIG1_DIVISOR_SHIFT 0x0000
  107. #define PRU_SUART_CH_CONFIG1_DIVISOR_MASK 0x03FF
  108. /* oversampling */
  109. #define PRU_SUART_CH_CONFIG1_OVS_SHIFT 0x000A
  110. #define PRU_SUART_CH_CONFIG1_OVS_MASK 0x0C00
  111. /* SUART channel configuration2 register descriptions */
  112. /* Bits per character */
  113. #define PRU_SUART_CH_CONFIG2_BITPERCHAR_SHIFT 0x0000
  114. #define PRU_SUART_CH_CONFIG2_BITPERCHAR_MASK 0x000F
  115. /* Bits per character */
  116. #define PRU_SUART_CH_CONFIG2_DATALEN_SHIFT 0x0008
  117. #define PRU_SUART_CH_CONFIG2_DATALEN_MASK 0x0F00
  118. /* SUART Channel register offsets */
  119. #define PRU_SUART_CH_CTRL_OFFSET 0x00
  120. #define PRU_SUART_CH_CONFIG1_OFFSET 0x02
  121. #define PRU_SUART_CH_CONFIG2_OFFSET 0x04
  122. #define PRU_SUART_CH_TXRXSTATUS_OFFSET 0x06
  123. #define PRU_SUART_CH_TXRXDATA_OFFSET 0x08
  124. #define PRU_SUART_CH_BYTESDONECNTR_OFFSET 0x0C
  125. /* SUART Event Numbers macros */
  126. #define PRU_SUART0_TX_EVT 34
  127. #define PRU_SUART0_RX_EVT 35
  128. #define PRU_SUART1_TX_EVT 36
  129. #define PRU_SUART1_RX_EVT 37
  130. #define PRU_SUART2_TX_EVT 38
  131. #define PRU_SUART2_RX_EVT 39
  132. #define PRU_SUART3_TX_EVT 40
  133. #define PRU_SUART3_RX_EVT 41
  134. #define PRU_SUART4_TX_EVT 42
  135. #define PRU_SUART4_RX_EVT 43
  136. #define PRU_SUART5_TX_EVT 44
  137. #define PRU_SUART5_RX_EVT 45
  138. #define PRU_SUART6_TX_EVT 46
  139. #define PRU_SUART6_RX_EVT 47
  140. #define PRU_SUART7_TX_EVT 48
  141. #define PRU_SUART7_RX_EVT 49
  142. #define PRU_SUART0_TX_EVT_BIT BIT(2)
  143. #define PRU_SUART0_RX_EVT_BIT BIT(3)
  144. #define PRU_SUART1_TX_EVT_BIT BIT(4)
  145. #define PRU_SUART1_RX_EVT_BIT BIT(5)
  146. #define PRU_SUART2_TX_EVT_BIT BIT(6)
  147. #define PRU_SUART2_RX_EVT_BIT BIT(7)
  148. #define PRU_SUART3_TX_EVT_BIT BIT(8)
  149. #define PRU_SUART3_RX_EVT_BIT BIT(9)
  150. #define PRU_SUART4_TX_EVT_BIT BIT(10)
  151. #define PRU_SUART4_RX_EVT_BIT BIT(11)
  152. #define PRU_SUART5_TX_EVT_BIT BIT(12)
  153. #define PRU_SUART5_RX_EVT_BIT BIT(13)
  154. #define PRU_SUART6_TX_EVT_BIT BIT(14)
  155. #define PRU_SUART6_RX_EVT_BIT BIT(15)
  156. #define PRU_SUART7_TX_EVT_BIT BIT(16)
  157. #define PRU_SUART7_RX_EVT_BIT BIT(17)
  158. /**
  159. * \brief One line description of the structure
  160. *
  161. * Detailed description of the structure
  162. */
  163. typedef struct {
  164. unsigned short CHn_Ctrl;/**< UART number (Range 1 to 16) */
  165. unsigned short CHn_Config1;
  166. /**< Type of the UART i.e., Full UART, Half UART */
  167. unsigned short CHn_Config2;
  168. /**< Soft UART Channel for Transmission */
  169. unsigned short CHn_TXRXStatus;
  170. /**< Soft UART Channel for Reception */
  171. unsigned int CHn_TXRXData;/**< Status of the UART */
  172. } suart_struct_pru_regs;
  173. #ifdef __cplusplus
  174. } /* End of extern C */
  175. #endif /* #ifdef __cplusplus */
  176. #endif