csl_idma.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. /* ============================================================================
  2. * Copyright (c) Texas Instruments Incorporated 2008, 2009
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the
  14. * distribution.
  15. *
  16. * Neither the name of Texas Instruments Incorporated nor the names of
  17. * its contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. */
  33. /**
  34. * @file csl_idma.h
  35. *
  36. * @brief IDMA CSL Implementation on DSP side
  37. *
  38. * \par
  39. * ============================================================================
  40. * @n (C) Copyright 2008, 2009, Texas Instruments, Inc.
  41. * @n Use of this software is controlled by the terms and conditions found
  42. * @n in the license agreement under which this software has been supplied.
  43. * ===========================================================================
  44. * \par
  45. */
  46. /** @defgroup CSL_IDMA_API IDMA
  47. *
  48. * @section Introduction
  49. *
  50. * @subsection xxx Overview
  51. *
  52. * The iDMA is a simple DMA engine that can be used to perform block transfers
  53. * between any two memory locations local to the GEM. A "local" memory is simply
  54. * one whose controller is inside the GEM, which can be L1P, L1D, L2 (port A and
  55. * port B), or peripheral configuration port (CFG). The iDMA controller allows
  56. * rapid data paging between all local memories. To fully support this, the iDMA
  57. * consists of two orthogonal channels caoable of working concurrently. The two
  58. * channels are:
  59. * a) IDMA Channel 0:- Intended for quick programming of configuration
  60. * registers through external CFG port of GEM.
  61. * b) IDMA Channel 1:- Intended for data paging between local memories.
  62. *
  63. * @subsection References
  64. * -# GEM Internal DMA (IDMA) Specification.
  65. *
  66. * @subsection Assumptions
  67. * The abbreviations IDMA, idma and Idma have been used throughout this
  68. * document to refer to iDMA Controller.
  69. */
  70. #ifndef CSL_IDMA_H_
  71. #define CSL_IDMA_H_
  72. #ifdef __cplusplus
  73. extern "C" {
  74. #endif
  75. #include <ti/csl/soc.h>
  76. #include <ti/csl/csl.h>
  77. #include <ti/csl/cslr_cgem.h>
  78. /**
  79. @defgroup CSL_IDMA_SYMBOL IDMA Symbols Defined
  80. @ingroup CSL_IDMA_API
  81. */
  82. /**
  83. @defgroup CSL_IDMA_DATASTRUCT IDMA Data Structures
  84. @ingroup CSL_IDMA_API
  85. */
  86. /**
  87. @defgroup CSL_IDMA_FUNCTION IDMA Functions
  88. @ingroup CSL_IDMA_API
  89. */
  90. /**
  91. @defgroup CSL_IDMA_ENUM IDMA Enumerated Data Types
  92. @ingroup CSL_IDMA_API
  93. */
  94. /**
  95. @addtogroup CSL_IDMA_SYMBOL
  96. @{
  97. */
  98. #define ZERO 0
  99. #define ONE 1
  100. /**
  101. @}
  102. */
  103. /** @addtogroup CSL_IDMA_ENUM
  104. @{ */
  105. /** Specifies what priority level the IDMA channel is set to.
  106. * Used to specify what priority level the IDMA channel is set to.
  107. */
  108. typedef enum {
  109. /** Set Priority level 0 */
  110. IDMA_PRI_0 = 0,
  111. /** Set Priority level 1 */
  112. IDMA_PRI_1,
  113. /** Set Priority level 2 */
  114. IDMA_PRI_2,
  115. /** Set Priority level 3 */
  116. IDMA_PRI_3,
  117. /** Set Priority level 4 */
  118. IDMA_PRI_4,
  119. /** Set Priority level 5 */
  120. IDMA_PRI_5,
  121. /** Set Priority level 6 */
  122. IDMA_PRI_6,
  123. /** Set Priority level 7 */
  124. IDMA_PRI_7,
  125. /** NoPriority level */
  126. IDMA_PRI_NULL = -1
  127. }IDMA_priSet;
  128. /**
  129. @}
  130. */
  131. /** @addtogroup CSL_IDMA_DATASTRUCT
  132. @{ */
  133. /** @brief This structure holds the information required
  134. * to initiate a iDMA Channel 1 Block Fill/Transfer
  135. * request in the GEM.
  136. */
  137. typedef struct {
  138. /** @brief IDMA channel 1 Source Address.
  139. *
  140. * @details
  141. * The source address must point to a word-aligned
  142. * memory location local to GEM. When performing a
  143. * block fill, all 32 bits of the address specified
  144. * are considered; While, for block transfers, the
  145. * 2 LSBs are ignored and the higher order 30 bits
  146. * are read as the valid Source Address for transfer.
  147. */
  148. Uint32* source;
  149. /** @brief IDMA channel 1 Destination Address.
  150. *
  151. * @details
  152. * The destination address must point to a 32 bit
  153. * word-aligned memory location local to GEM.
  154. * This address must be local to GEM, either in L1P,
  155. * L1D, L2 or CFG and also must be different port
  156. * than the source address to obtain full throughput.
  157. */
  158. Uint32* destn;
  159. /** @brief Number of bytes to be transfered
  160. *
  161. * @details
  162. * The count signifies the number of bytes to be
  163. * transferred using iDMA channel 1. This must be
  164. * a multiple of 4 bytes. A count of zero will not
  165. * transfer any data, but will generate an interrupt
  166. * if requested.
  167. */
  168. Uint16 count;
  169. /** @brief Transfer Priority.
  170. *
  171. * @details
  172. * The transfer priority is used for arbitration between
  173. * the CPU and DMA accesses when there are conflicts.
  174. * Valid values for the priority range between 0 and 7.
  175. */
  176. Uint32 priority:3;
  177. /** @brief Boolean Flag to enable/disable CPU interrupt.
  178. *
  179. * @details
  180. * When this interrupt flag is set, a CPU Interrupt IDMA_INT1
  181. * is raised on completion of the block transfer/fill request.
  182. */
  183. Uint32 intEnable:1;
  184. }CSL_IDMA_IDMA1CONFIG;
  185. /** @brief This structure holds the information required
  186. * to initiate a iDMA Channel 0 Configuration(CFG) space
  187. * Transfer request from the GEM.
  188. */
  189. typedef struct {
  190. /** @brief IDMA channel 0 Mask.
  191. *
  192. * @details
  193. * The mask allows unwanted registers within the window
  194. * to be blocked from access, facilitating multiple read/write
  195. * transactions to be completed with a single transfer command
  196. * by the CPU. Each of the 32 bits of the mask correspond to
  197. * a single register in the CFG space identified by the source/
  198. * destination address registers.
  199. */
  200. Uint32 mask;
  201. /** @brief IDMA channel 0 Source Address.
  202. *
  203. * @details
  204. * The source address must point to a 32-byte-aligned
  205. * memory location local to GEM or to a valid configuration
  206. * register space.
  207. */
  208. Uint32* source;
  209. /** @brief IDMA channel 0 Destination Address.
  210. *
  211. * @details
  212. * The destination address must point to a 32-byte
  213. * -aligned memory location local to GEM or to a valid
  214. * configuration register space.
  215. */
  216. Uint32* destn;
  217. /** @brief Number of 32-word windows to be transfered
  218. *
  219. * @details
  220. * The count signifies the number of windows to be accessed
  221. * during data transfer. Upto 16 contiguous 32-word regions
  222. * can be specified using this field.
  223. */
  224. Uint32 count:4;
  225. /** @brief Boolean Flag to enable/disable CPU interrupt.
  226. *
  227. * @details
  228. * When this interrupt flag is set, a CPU Interrupt IDMA_INT0
  229. * is raised on completion of the block transfer/fill request.
  230. */
  231. Uint32 intEnable:1;
  232. }CSL_IDMA_IDMA0CONFIG;
  233. /** @brief This structure holds the information required
  234. * to interpret the IDMA Channel 0/1 Transfer
  235. * Status.
  236. */
  237. typedef struct {
  238. /** @brief Boolean Flag that indicates if any pending transfers
  239. * exist on the iDMA channel 1/channel 0.
  240. *
  241. * @details
  242. * Set when control registers are written to by the CPU and there
  243. * is already an active transfer in progress (ACTV=1) and cleared
  244. * when the pending transfer becomes active.
  245. */
  246. Uint32 isPending:1;
  247. /** @brief Boolean Flag that indicates if any active transfers
  248. * exist on the iDMA channel 1/channel 0.
  249. *
  250. * @details
  251. * Set when channel 0/1 begins reading data from the source address
  252. * and cleared following the write to the destination address.
  253. */
  254. Uint32 isActive:1;
  255. }CSL_IDMA_STATUS;
  256. /**
  257. * Handle to access IDMA registers.
  258. */
  259. #define hIdma ((CSL_CgemRegs *) CSL_C66X_COREPAC_REG_BASE_ADDRESS_REGS)
  260. /* @} */
  261. #ifdef __cplusplus
  262. }
  263. #endif
  264. #endif /*CSL_IDMA_H_*/