ce_src_desc.h 12 KB

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