ap_ifc.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _AP_IFC_H_
  13. #define _AP_IFC_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define AP_NB_BITS_ADDR (32)
  17. #define AP_IFC_ADDR_ALIGN (0)
  18. #define AP_IFC_TC_LEN (23)
  19. #define AP_IFC_STD_CHAN_NB (10)
  20. #define AP_IFC_RFSPI_CHAN (0)
  21. #define AP_IFC_AIF_CHAN (0)
  22. #define AP_IFC_DBG_CHAN (0)
  23. typedef enum
  24. {
  25. DMA_ID_TX_UART4 = 0,
  26. DMA_ID_RX_UART4 = 1,
  27. DMA_ID_TX_UART5 = 2,
  28. DMA_ID_RX_UART5 = 3,
  29. DMA_ID_TX_UART6 = 4,
  30. DMA_ID_RX_UART6 = 5,
  31. DMA_ID_TX_SDMMC = 6,
  32. DMA_ID_RX_SDMMC = 7,
  33. DMA_ID_RSVD = 8,
  34. DMA_ID_RX_CAMERA = 9,
  35. } AP_IFC_REQUEST_IDS_T;
  36. #define REG_AP_IFC_BASE (0x04405000)
  37. typedef volatile struct
  38. {
  39. uint32_t get_ch; // 0x00000000
  40. uint32_t dma_status; // 0x00000004
  41. uint32_t debug_status; // 0x00000008
  42. uint32_t ifc_sec; // 0x0000000c
  43. struct // 0x00000010
  44. { //
  45. uint32_t control; // 0x00000000
  46. uint32_t status; // 0x00000004
  47. uint32_t start_addr; // 0x00000008
  48. uint32_t tc; // 0x0000000c
  49. uint32_t tc_threshold; // 0x00000010
  50. } std_ch[10]; //
  51. } HWP_AP_IFC_T;
  52. #define hwp_apIfc ((HWP_AP_IFC_T *)REG_ACCESS_ADDRESS(REG_AP_IFC_BASE))
  53. // get_ch
  54. typedef union {
  55. uint32_t v;
  56. struct
  57. {
  58. uint32_t ch_to_use : 5; // [4:0], read only
  59. uint32_t __31_5 : 27; // [31:5]
  60. } b;
  61. } REG_AP_IFC_GET_CH_T;
  62. // dma_status
  63. typedef union {
  64. uint32_t v;
  65. struct
  66. {
  67. uint32_t ch_enable : 10; // [9:0], read only
  68. uint32_t __15_10 : 6; // [15:10]
  69. uint32_t ch_busy : 10; // [25:16], read only
  70. uint32_t __31_26 : 6; // [31:26]
  71. } b;
  72. } REG_AP_IFC_DMA_STATUS_T;
  73. // debug_status
  74. typedef union {
  75. uint32_t v;
  76. struct
  77. {
  78. uint32_t dbg_status : 1; // [0], read only
  79. uint32_t __31_1 : 31; // [31:1]
  80. } b;
  81. } REG_AP_IFC_DEBUG_STATUS_T;
  82. // ifc_sec
  83. typedef union {
  84. uint32_t v;
  85. struct
  86. {
  87. uint32_t std_ch_reg_sec : 10; // [9:0]
  88. uint32_t __15_10 : 6; // [15:10]
  89. uint32_t std_ch_dma_sec : 10; // [25:16]
  90. uint32_t __31_26 : 6; // [31:26]
  91. } b;
  92. } REG_AP_IFC_IFC_SEC_T;
  93. // control
  94. typedef union {
  95. uint32_t v;
  96. struct
  97. {
  98. uint32_t enable : 1; // [0]
  99. uint32_t disable : 1; // [1]
  100. uint32_t ch_rd_hw_exch : 1; // [2]
  101. uint32_t ch_wr_hw_exch : 1; // [3]
  102. uint32_t autodisable : 1; // [4]
  103. uint32_t size : 1; // [5]
  104. uint32_t __7_6 : 2; // [7:6]
  105. uint32_t req_src : 5; // [12:8]
  106. uint32_t __15_13 : 3; // [15:13]
  107. uint32_t flush : 1; // [16]
  108. uint32_t max_burst_length : 2; // [18:17]
  109. uint32_t __31_19 : 13; // [31:19]
  110. } b;
  111. } REG_AP_IFC_CONTROL_T;
  112. // status
  113. typedef union {
  114. uint32_t v;
  115. struct
  116. {
  117. uint32_t enable : 1; // [0], read only
  118. uint32_t __3_1 : 3; // [3:1]
  119. uint32_t fifo_empty : 1; // [4], read only
  120. uint32_t __31_5 : 27; // [31:5]
  121. } b;
  122. } REG_AP_IFC_STATUS_T;
  123. // tc
  124. typedef union {
  125. uint32_t v;
  126. struct
  127. {
  128. uint32_t tc : 23; // [22:0]
  129. uint32_t __31_23 : 9; // [31:23]
  130. } b;
  131. } REG_AP_IFC_TC_T;
  132. // tc_threshold
  133. typedef union {
  134. uint32_t v;
  135. struct
  136. {
  137. uint32_t tc_threshold : 23; // [22:0]
  138. uint32_t __31_23 : 9; // [31:23]
  139. } b;
  140. } REG_AP_IFC_TC_THRESHOLD_T;
  141. // get_ch
  142. #define AP_IFC_CH_TO_USE(n) (((n)&0x1f) << 0)
  143. // dma_status
  144. #define AP_IFC_CH_ENABLE(n) (((n)&0x3ff) << 0)
  145. #define AP_IFC_CH_BUSY(n) (((n)&0x3ff) << 16)
  146. // debug_status
  147. #define AP_IFC_DBG_STATUS (1 << 0)
  148. // ifc_sec
  149. #define AP_IFC_STD_CH_REG_SEC(n) (((n)&0x3ff) << 0)
  150. #define AP_IFC_STD_CH_DMA_SEC(n) (((n)&0x3ff) << 16)
  151. // control
  152. #define AP_IFC_ENABLE (1 << 0)
  153. #define AP_IFC_DISABLE (1 << 1)
  154. #define AP_IFC_CH_RD_HW_EXCH (1 << 2)
  155. #define AP_IFC_CH_WR_HW_EXCH (1 << 3)
  156. #define AP_IFC_AUTODISABLE (1 << 4)
  157. #define AP_IFC_SIZE (1 << 5)
  158. #define AP_IFC_REQ_SRC(n) (((n)&0x1f) << 8)
  159. #define AP_IFC_REQ_SRC_DMA_ID_TX_UART4 (0 << 8)
  160. #define AP_IFC_REQ_SRC_DMA_ID_RX_UART4 (1 << 8)
  161. #define AP_IFC_REQ_SRC_DMA_ID_TX_UART5 (2 << 8)
  162. #define AP_IFC_REQ_SRC_DMA_ID_RX_UART5 (3 << 8)
  163. #define AP_IFC_REQ_SRC_DMA_ID_TX_UART6 (4 << 8)
  164. #define AP_IFC_REQ_SRC_DMA_ID_RX_UART6 (5 << 8)
  165. #define AP_IFC_REQ_SRC_DMA_ID_TX_SDMMC (6 << 8)
  166. #define AP_IFC_REQ_SRC_DMA_ID_RX_SDMMC (7 << 8)
  167. #define AP_IFC_REQ_SRC_DMA_ID_RSVD (8 << 8)
  168. #define AP_IFC_REQ_SRC_DMA_ID_RX_CAMERA (9 << 8)
  169. #define AP_IFC_FLUSH (1 << 16)
  170. #define AP_IFC_MAX_BURST_LENGTH(n) (((n)&0x3) << 17)
  171. #define AP_IFC_REQ_SRC_V_DMA_ID_TX_UART4 (0)
  172. #define AP_IFC_REQ_SRC_V_DMA_ID_RX_UART4 (1)
  173. #define AP_IFC_REQ_SRC_V_DMA_ID_TX_UART5 (2)
  174. #define AP_IFC_REQ_SRC_V_DMA_ID_RX_UART5 (3)
  175. #define AP_IFC_REQ_SRC_V_DMA_ID_TX_UART6 (4)
  176. #define AP_IFC_REQ_SRC_V_DMA_ID_RX_UART6 (5)
  177. #define AP_IFC_REQ_SRC_V_DMA_ID_TX_SDMMC (6)
  178. #define AP_IFC_REQ_SRC_V_DMA_ID_RX_SDMMC (7)
  179. #define AP_IFC_REQ_SRC_V_DMA_ID_RSVD (8)
  180. #define AP_IFC_REQ_SRC_V_DMA_ID_RX_CAMERA (9)
  181. // status
  182. #define AP_IFC_ENABLE (1 << 0)
  183. #define AP_IFC_FIFO_EMPTY (1 << 4)
  184. // start_addr
  185. #define AP_IFC_START_ADDR(n) (((n)&0xffffffff) << 0)
  186. // tc
  187. #define AP_IFC_TC(n) (((n)&0x7fffff) << 0)
  188. // tc_threshold
  189. #define AP_IFC_TC_THRESHOLD(n) (((n)&0x7fffff) << 0)
  190. #endif // _AP_IFC_H_