ce_src_desc.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. /* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. #ifndef _CE_SRC_DESC_H_
  16. #define _CE_SRC_DESC_H_
  17. #if !defined(__ASSEMBLER__)
  18. #endif
  19. #define NUM_OF_DWORDS_CE_SRC_DESC 4
  20. struct ce_src_desc {
  21. #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
  22. uint32_t src_buffer_low : 32; // [31:0]
  23. uint32_t src_buffer_high : 8, // [7:0]
  24. toeplitz_en : 1, // [8:8]
  25. src_swap : 1, // [9:9]
  26. dest_swap : 1, // [10:10]
  27. gather : 1, // [11:11]
  28. ce_res_0 : 1, // [12:12]
  29. barrier_read : 1, // [13:13]
  30. ce_res_1 : 2, // [15:14]
  31. length : 16; // [31:16]
  32. uint32_t fw_metadata : 16, // [15:0]
  33. ce_res_2 : 16; // [31:16]
  34. uint32_t ce_res_3 : 20, // [19:0]
  35. ring_id : 8, // [27:20]
  36. looping_count : 4; // [31:28]
  37. #else
  38. uint32_t src_buffer_low : 32; // [31:0]
  39. uint32_t length : 16, // [31:16]
  40. ce_res_1 : 2, // [15:14]
  41. barrier_read : 1, // [13:13]
  42. ce_res_0 : 1, // [12:12]
  43. gather : 1, // [11:11]
  44. dest_swap : 1, // [10:10]
  45. src_swap : 1, // [9:9]
  46. toeplitz_en : 1, // [8:8]
  47. src_buffer_high : 8; // [7:0]
  48. uint32_t ce_res_2 : 16, // [31:16]
  49. fw_metadata : 16; // [15:0]
  50. uint32_t looping_count : 4, // [31:28]
  51. ring_id : 8, // [27:20]
  52. ce_res_3 : 20; // [19:0]
  53. #endif
  54. };
  55. /* Description SRC_BUFFER_LOW
  56. LSB 32 bits of the 40 Bit Pointer to the source buffer
  57. <legal all>
  58. */
  59. #define CE_SRC_DESC_SRC_BUFFER_LOW_OFFSET 0x00000000
  60. #define CE_SRC_DESC_SRC_BUFFER_LOW_LSB 0
  61. #define CE_SRC_DESC_SRC_BUFFER_LOW_MSB 31
  62. #define CE_SRC_DESC_SRC_BUFFER_LOW_MASK 0xffffffff
  63. /* Description SRC_BUFFER_HIGH
  64. Bits [6:0] for 40 Bit Pointer to the source buffer
  65. Bit [7] can be programmed with VC bit.
  66. Note: CE Descriptor has 40-bit address. Only 37 bits are
  67. routed as address to NoC. Remaining bits are user bits.
  68. Bit [7] of SRC_BUFFER_HIGH can be used for VC configuration.
  69. 0 indicate VC0 and 1 indicate VC1.
  70. <legal all>
  71. */
  72. #define CE_SRC_DESC_SRC_BUFFER_HIGH_OFFSET 0x00000004
  73. #define CE_SRC_DESC_SRC_BUFFER_HIGH_LSB 0
  74. #define CE_SRC_DESC_SRC_BUFFER_HIGH_MSB 7
  75. #define CE_SRC_DESC_SRC_BUFFER_HIGH_MASK 0x000000ff
  76. /* Description TOEPLITZ_EN
  77. Enable generation of 32-bit Toeplitz-LFSR hash for the data
  78. transfer
  79. In case of gather field in first source ring entry of the
  80. gather copy cycle in taken into account.
  81. <legal all>
  82. */
  83. #define CE_SRC_DESC_TOEPLITZ_EN_OFFSET 0x00000004
  84. #define CE_SRC_DESC_TOEPLITZ_EN_LSB 8
  85. #define CE_SRC_DESC_TOEPLITZ_EN_MSB 8
  86. #define CE_SRC_DESC_TOEPLITZ_EN_MASK 0x00000100
  87. /* Description SRC_SWAP
  88. Treats source memory organization as big-endian. For each
  89. dword read (4 bytes), the byte 0 is swapped with byte 3
  90. and byte 1 is swapped with byte 2.
  91. In case of gather field in first source ring entry of the
  92. gather copy cycle in taken into account.
  93. <legal all>
  94. */
  95. #define CE_SRC_DESC_SRC_SWAP_OFFSET 0x00000004
  96. #define CE_SRC_DESC_SRC_SWAP_LSB 9
  97. #define CE_SRC_DESC_SRC_SWAP_MSB 9
  98. #define CE_SRC_DESC_SRC_SWAP_MASK 0x00000200
  99. /* Description DEST_SWAP
  100. Treats destination memory organization as big-endian. For
  101. each dword write (4 bytes), the byte 0 is swapped with
  102. byte 3 and byte 1 is swapped with byte 2.
  103. In case of gather field in first source ring entry of the
  104. gather copy cycle in taken into account.
  105. <legal all>
  106. */
  107. #define CE_SRC_DESC_DEST_SWAP_OFFSET 0x00000004
  108. #define CE_SRC_DESC_DEST_SWAP_LSB 10
  109. #define CE_SRC_DESC_DEST_SWAP_MSB 10
  110. #define CE_SRC_DESC_DEST_SWAP_MASK 0x00000400
  111. /* Description GATHER
  112. Enables gather of multiple copy engine source descriptors
  113. to one destination.
  114. <legal all>
  115. */
  116. #define CE_SRC_DESC_GATHER_OFFSET 0x00000004
  117. #define CE_SRC_DESC_GATHER_LSB 11
  118. #define CE_SRC_DESC_GATHER_MSB 11
  119. #define CE_SRC_DESC_GATHER_MASK 0x00000800
  120. /* Description CE_RES_0
  121. Reserved
  122. <legal all>
  123. */
  124. #define CE_SRC_DESC_CE_RES_0_OFFSET 0x00000004
  125. #define CE_SRC_DESC_CE_RES_0_LSB 12
  126. #define CE_SRC_DESC_CE_RES_0_MSB 12
  127. #define CE_SRC_DESC_CE_RES_0_MASK 0x00001000
  128. /* Description BARRIER_READ
  129. Barrier Read enable
  130. <legal all>
  131. */
  132. #define CE_SRC_DESC_BARRIER_READ_OFFSET 0x00000004
  133. #define CE_SRC_DESC_BARRIER_READ_LSB 13
  134. #define CE_SRC_DESC_BARRIER_READ_MSB 13
  135. #define CE_SRC_DESC_BARRIER_READ_MASK 0x00002000
  136. /* Description CE_RES_1
  137. Reserved
  138. <legal all>
  139. */
  140. #define CE_SRC_DESC_CE_RES_1_OFFSET 0x00000004
  141. #define CE_SRC_DESC_CE_RES_1_LSB 14
  142. #define CE_SRC_DESC_CE_RES_1_MSB 15
  143. #define CE_SRC_DESC_CE_RES_1_MASK 0x0000c000
  144. /* Description LENGTH
  145. Length of the buffer in units of octets of the current descriptor
  146. <legal all>
  147. */
  148. #define CE_SRC_DESC_LENGTH_OFFSET 0x00000004
  149. #define CE_SRC_DESC_LENGTH_LSB 16
  150. #define CE_SRC_DESC_LENGTH_MSB 31
  151. #define CE_SRC_DESC_LENGTH_MASK 0xffff0000
  152. /* Description FW_METADATA
  153. Meta data used by FW
  154. In case of gather field in first source ring entry of the
  155. gather copy cycle in taken into account.
  156. <legal all>
  157. */
  158. #define CE_SRC_DESC_FW_METADATA_OFFSET 0x00000008
  159. #define CE_SRC_DESC_FW_METADATA_LSB 0
  160. #define CE_SRC_DESC_FW_METADATA_MSB 15
  161. #define CE_SRC_DESC_FW_METADATA_MASK 0x0000ffff
  162. /* Description CE_RES_2
  163. Reserved
  164. <legal all>
  165. */
  166. #define CE_SRC_DESC_CE_RES_2_OFFSET 0x00000008
  167. #define CE_SRC_DESC_CE_RES_2_LSB 16
  168. #define CE_SRC_DESC_CE_RES_2_MSB 31
  169. #define CE_SRC_DESC_CE_RES_2_MASK 0xffff0000
  170. /* Description CE_RES_3
  171. Reserved
  172. <legal all>
  173. */
  174. #define CE_SRC_DESC_CE_RES_3_OFFSET 0x0000000c
  175. #define CE_SRC_DESC_CE_RES_3_LSB 0
  176. #define CE_SRC_DESC_CE_RES_3_MSB 19
  177. #define CE_SRC_DESC_CE_RES_3_MASK 0x000fffff
  178. /* Description RING_ID
  179. The buffer pointer ring ID.
  180. 0 refers to the IDLE ring
  181. 1 - N refers to other rings
  182. Helps with debugging when dumping ring contents.
  183. <legal all>
  184. */
  185. #define CE_SRC_DESC_RING_ID_OFFSET 0x0000000c
  186. #define CE_SRC_DESC_RING_ID_LSB 20
  187. #define CE_SRC_DESC_RING_ID_MSB 27
  188. #define CE_SRC_DESC_RING_ID_MASK 0x0ff00000
  189. /* Description LOOPING_COUNT
  190. A count value that indicates the number of times the producer
  191. of entries into the Ring has looped around the ring.
  192. At initialization time, this value is set to 0. On the first
  193. loop, this value is set to 1. After the max value is reached
  194. allowed by the number of bits for this field, the count
  195. value continues with 0 again.
  196. In case SW is the consumer of the ring entries, it can use
  197. this field to figure out up to where the producer of entries
  198. has created new entries. This eliminates the need to check
  199. where the "head pointer' of the ring is located once the
  200. SW starts processing an interrupt indicating that new entries
  201. have been put into this ring...
  202. Also note that SW if it wants only needs to look at the
  203. LSB bit of this count value.
  204. <legal all>
  205. */
  206. #define CE_SRC_DESC_LOOPING_COUNT_OFFSET 0x0000000c
  207. #define CE_SRC_DESC_LOOPING_COUNT_LSB 28
  208. #define CE_SRC_DESC_LOOPING_COUNT_MSB 31
  209. #define CE_SRC_DESC_LOOPING_COUNT_MASK 0xf0000000
  210. #endif // CE_SRC_DESC