IxDmaAcc.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /**
  2. * @file IxDmaAcc.h
  3. *
  4. * @date 15 October 2002
  5. *
  6. * @brief API of the IXP400 DMA Access Driver Component (IxDma)
  7. *
  8. *
  9. * @par
  10. * IXP400 SW Release version 2.0
  11. *
  12. * -- Copyright Notice --
  13. *
  14. * @par
  15. * Copyright 2001-2005, Intel Corporation.
  16. * All rights reserved.
  17. *
  18. * @par
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions
  21. * are met:
  22. * 1. Redistributions of source code must retain the above copyright
  23. * notice, this list of conditions and the following disclaimer.
  24. * 2. Redistributions in binary form must reproduce the above copyright
  25. * notice, this list of conditions and the following disclaimer in the
  26. * documentation and/or other materials provided with the distribution.
  27. * 3. Neither the name of the Intel Corporation nor the names of its contributors
  28. * may be used to endorse or promote products derived from this software
  29. * without specific prior written permission.
  30. *
  31. * @par
  32. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  33. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  34. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  35. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  36. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  38. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  39. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  40. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  41. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  42. * SUCH DAMAGE.
  43. *
  44. * @par
  45. * -- End of Copyright Notice --
  46. */
  47. /*---------------------------------------------------------------------
  48. Doxygen group definitions
  49. ---------------------------------------------------------------------*/
  50. #ifndef IXDMAACC_H
  51. #define IXDMAACC_H
  52. #include "IxOsal.h"
  53. #include "IxNpeDl.h"
  54. /**
  55. * @defgroup IxDmaTypes IXP400 DMA Types (IxDmaTypes)
  56. * @brief The common set of types used in the DMA component
  57. * @{
  58. */
  59. /**
  60. * @ingroup IxDmaTypes
  61. * @enum IxDmaReturnStatus
  62. * @brief Dma return status definitions
  63. */
  64. typedef enum
  65. {
  66. IX_DMA_SUCCESS = IX_SUCCESS, /**< DMA Transfer Success */
  67. IX_DMA_FAIL = IX_FAIL, /**< DMA Transfer Fail */
  68. IX_DMA_INVALID_TRANSFER_WIDTH, /**< Invalid transfer width */
  69. IX_DMA_INVALID_TRANSFER_LENGTH, /**< Invalid transfer length */
  70. IX_DMA_INVALID_TRANSFER_MODE, /**< Invalid transfer mode */
  71. IX_DMA_INVALID_ADDRESS_MODE, /**< Invalid address mode */
  72. IX_DMA_REQUEST_FIFO_FULL /**< DMA request queue is full */
  73. } IxDmaReturnStatus;
  74. /**
  75. * @ingroup IxDmaTypes
  76. * @enum IxDmaTransferMode
  77. * @brief Dma transfer mode definitions
  78. * @note Copy and byte swap, and copy and reverse modes only support multiples of word data length.
  79. */
  80. typedef enum
  81. {
  82. IX_DMA_COPY_CLEAR = 0, /**< copy and clear source*/
  83. IX_DMA_COPY, /**< copy */
  84. IX_DMA_COPY_BYTE_SWAP, /**< copy and byte swap (endian) */
  85. IX_DMA_COPY_REVERSE, /**< copy and reverse */
  86. IX_DMA_TRANSFER_MODE_INVALID /**< Invalid transfer mode */
  87. } IxDmaTransferMode;
  88. /**
  89. * @ingroup IxDmaTypes
  90. * @enum IxDmaAddressingMode
  91. * @brief Dma addressing mode definitions
  92. * @note Fixed source address to fixed destination address addressing mode is not supported.
  93. */
  94. typedef enum
  95. {
  96. IX_DMA_INC_SRC_INC_DST = 0, /**< Incremental source address to incremental destination address */
  97. IX_DMA_INC_SRC_FIX_DST, /**< Incremental source address to incremental destination address */
  98. IX_DMA_FIX_SRC_INC_DST, /**< Incremental source address to incremental destination address */
  99. IX_DMA_FIX_SRC_FIX_DST, /**< Incremental source address to incremental destination address */
  100. IX_DMA_ADDRESSING_MODE_INVALID /**< Invalid Addressing Mode */
  101. } IxDmaAddressingMode;
  102. /**
  103. * @ingroup IxDmaTypes
  104. * @enum IxDmaTransferWidth
  105. * @brief Dma transfer width definitions
  106. * @Note Fixed addresses (either source or destination) do not support burst transfer width.
  107. */
  108. typedef enum
  109. {
  110. IX_DMA_32_SRC_32_DST = 0, /**< 32-bit src to 32-bit dst */
  111. IX_DMA_32_SRC_16_DST, /**< 32-bit src to 16-bit dst */
  112. IX_DMA_32_SRC_8_DST, /**< 32-bit src to 8-bit dst */
  113. IX_DMA_16_SRC_32_DST, /**< 16-bit src to 32-bit dst */
  114. IX_DMA_16_SRC_16_DST, /**< 16-bit src to 16-bit dst */
  115. IX_DMA_16_SRC_8_DST, /**< 16-bit src to 8-bit dst */
  116. IX_DMA_8_SRC_32_DST, /**< 8-bit src to 32-bit dst */
  117. IX_DMA_8_SRC_16_DST, /**< 8-bit src to 16-bit dst */
  118. IX_DMA_8_SRC_8_DST, /**< 8-bit src to 8-bit dst */
  119. IX_DMA_8_SRC_BURST_DST, /**< 8-bit src to burst dst - Not supported for fixed destination address */
  120. IX_DMA_16_SRC_BURST_DST, /**< 16-bit src to burst dst - Not supported for fixed destination address */
  121. IX_DMA_32_SRC_BURST_DST, /**< 32-bit src to burst dst - Not supported for fixed destination address */
  122. IX_DMA_BURST_SRC_8_DST, /**< burst src to 8-bit dst - Not supported for fixed source address */
  123. IX_DMA_BURST_SRC_16_DST, /**< burst src to 16-bit dst - Not supported for fixed source address */
  124. IX_DMA_BURST_SRC_32_DST, /**< burst src to 32-bit dst - Not supported for fixed source address*/
  125. IX_DMA_BURST_SRC_BURST_DST, /**< burst src to burst dst - Not supported for fixed source and destination address
  126. */
  127. IX_DMA_TRANSFER_WIDTH_INVALID /**< Invalid transfer width */
  128. } IxDmaTransferWidth;
  129. /**
  130. * @ingroup IxDmaTypes
  131. * @enum IxDmaNpeId
  132. * @brief NpeId numbers to identify NPE A, B or C
  133. */
  134. typedef enum
  135. {
  136. IX_DMA_NPEID_NPEA = 0, /**< Identifies NPE A */
  137. IX_DMA_NPEID_NPEB, /**< Identifies NPE B */
  138. IX_DMA_NPEID_NPEC, /**< Identifies NPE C */
  139. IX_DMA_NPEID_MAX /**< Total Number of NPEs */
  140. } IxDmaNpeId;
  141. /* @} */
  142. /**
  143. * @defgroup IxDmaAcc IXP400 DMA Access Driver (IxDmaAcc) API
  144. *
  145. * @brief The public API for the IXP400 IxDmaAcc component
  146. *
  147. * @{
  148. */
  149. /**
  150. * @ingroup IxDmaAcc
  151. * @brief DMA Request Id type
  152. */
  153. typedef UINT32 IxDmaAccRequestId;
  154. /**
  155. * @ingroup IxDmaAcc
  156. * @def IX_DMA_REQUEST_FULL
  157. * @brief DMA request queue is full
  158. * This constant is a return value used to tell the user that the IxDmaAcc
  159. * queue is full.
  160. *
  161. */
  162. #define IX_DMA_REQUEST_FULL 16
  163. /**
  164. * @ingroup IxDmaAcc
  165. * @brief DMA completion notification
  166. * This function is called to notify a client that the DMA has been completed
  167. * @param status @ref IxDmaReturnStatus [out] - reporting to client
  168. *
  169. */
  170. typedef void (*IxDmaAccDmaCompleteCallback) (IxDmaReturnStatus status);
  171. /**
  172. * @ingroup IxDmaAcc
  173. *
  174. * @fn ixDmaAccInit(IxNpeDlNpeId npeId)
  175. *
  176. * @brief Initialise the DMA Access component
  177. * This function will initialise the DMA Access component internals
  178. * @param npeId @ref IxNpeDlNpeId [in] - NPE to use for Dma Transfer
  179. * @return @li IX_SUCCESS succesfully initialised the component
  180. * @return @li IX_FAIL Initialisation failed for some unspecified
  181. * internal reason.
  182. */
  183. PUBLIC IX_STATUS
  184. ixDmaAccInit(IxNpeDlNpeId npeId);
  185. /**
  186. * @ingroup IxDmaAcc
  187. *
  188. * @fn ixDmaAccDmaTransfer(
  189. IxDmaAccDmaCompleteCallback callback,
  190. UINT32 SourceAddr,
  191. UINT32 DestinationAddr,
  192. UINT16 TransferLength,
  193. IxDmaTransferMode TransferMode,
  194. IxDmaAddressingMode AddressingMode,
  195. IxDmaTransferWidth TransferWidth)
  196. *
  197. * @brief Perform DMA transfer
  198. * This function will perform DMA transfer between devices within the
  199. * IXP400 memory map.
  200. * @note The following are restrictions for IxDmaAccDmaTransfer:
  201. * @li The function is non re-entrant.
  202. * @li The function assumes host devices are operating in big-endian mode.
  203. * @li Fixed address does not suport burst transfer width
  204. * @li Fixed source address to fixed destinatiom address mode is not suported
  205. * @li The incrementing source address for expansion bus will not support a burst transfer width and copy and clear mode
  206. *
  207. * @param callback @ref IxDmaAccDmaCompleteCallback [in] - function pointer to be stored and called when the DMA transfer is completed. This cannot be NULL.
  208. * @param SourceAddr UINT32 [in] - Starting address of DMA source. Must be a valid IXP400 memory map address.
  209. * @param DestinationAddr UINT32 [in] - Starting address of DMA destination. Must be a valid IXP400 memory map address.
  210. * @param TransferLength UINT16 [in] - The size of DMA data transfer. The range must be from 1-64Kbyte
  211. * @param TransferMode @ref IxDmaTransferMode [in] - The DMA transfer mode
  212. * @param AddressingMode @ref IxDmaAddressingMode [in] - The DMA addressing mode
  213. * @param TransferWidth @ref IxDmaTransferWidth [in] - The DMA transfer width
  214. *
  215. * @return @li IX_DMA_SUCCESS Notification that the DMA request is succesful
  216. * @return @li IX_DMA_FAIL IxDmaAcc not yet initialised or some internal error has occured
  217. * @return @li IX_DMA_INVALID_TRANSFER_WIDTH Transfer width is nit valid
  218. * @return @li IX_DMA_INVALID_TRANSFER_LENGTH Transfer length outside of valid range
  219. * @return @li IX_DMA_INVALID_TRANSFER_MODE Transfer Mode not valid
  220. * @return @li IX_DMA_REQUEST_FIFO_FULL IxDmaAcc request queue is full
  221. */
  222. PUBLIC IxDmaReturnStatus
  223. ixDmaAccDmaTransfer(
  224. IxDmaAccDmaCompleteCallback callback,
  225. UINT32 SourceAddr,
  226. UINT32 DestinationAddr,
  227. UINT16 TransferLength,
  228. IxDmaTransferMode TransferMode,
  229. IxDmaAddressingMode AddressingMode,
  230. IxDmaTransferWidth TransferWidth);
  231. /**
  232. * @ingroup IxDmaAcc
  233. *
  234. * @fn ixDmaAccShow(void)
  235. *
  236. * @brief Display some component information for debug purposes
  237. * Show some internal operation information relating to the DMA service.
  238. * At a minimum the following will show.
  239. * - the number of the DMA pend (in queue)
  240. * @param None
  241. * @return @li None
  242. */
  243. PUBLIC IX_STATUS
  244. ixDmaAccShow(void);
  245. #endif /* IXDMAACC_H */