1 /******************************************************************************
3 * Copyright (C) 2014 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
37 * This header file contains identifiers and register-level driver functions (or
38 * macros) that can be used to access the Xilinx CSU_DMA core.
41 * MODIFICATION HISTORY:
43 * Ver Who Date Changes
44 * ----- ------ -------- ------------------------------------------------------
45 * 1.0 vnsld 22/10/14 First release
48 ******************************************************************************/
51 #define XCSUDMA_HW_H_ /**< Prevent circular inclusions
52 * by using protection macros */
58 /***************************** Include Files *********************************/
62 /************************** Constant Definitions *****************************/
64 /** @name Registers offsets
67 #define XCSUDMA_ADDR_OFFSET 0x000 /**< Address Register Offset */
68 #define XCSUDMA_SIZE_OFFSET 0x004 /**< Size Register Offset */
69 #define XCSUDMA_STS_OFFSET 0x008 /**< Status Register Offset */
70 #define XCSUDMA_CTRL_OFFSET 0x00C /**< Control Register Offset */
71 #define XCSUDMA_CRC_OFFSET 0x010 /**< CheckSum Register Offset */
72 #define XCSUDMA_I_STS_OFFSET 0x014 /**< Interrupt Status Register
74 #define XCSUDMA_I_EN_OFFSET 0x018 /**< Interrupt Enable Register
76 #define XCSUDMA_I_DIS_OFFSET 0x01C /**< Interrupt Disable Register
78 #define XCSUDMA_I_MASK_OFFSET 0x020 /**< Interrupt Mask Register Offset */
79 #define XCSUDMA_CTRL2_OFFSET 0x024 /**< Interrupt Control Register 2
81 #define XCSUDMA_ADDR_MSB_OFFSET 0x028 /**< Address's MSB Register Offset */
82 #define XCSUDMA_SAFETY_CHK_OFFSET 0xFF8 /**< Safety Check Field Offset */
83 #define XCSUDMA_FUTURE_ECO_OFFSET 0xFFC /**< Future potential ECO Offset */
86 /** @name CSU Base address and CSU_DMA reset offset
89 #define XCSU_BASEADDRESS 0xFFCA0000
90 /**< CSU Base Address */
91 #define XCSU_DMA_RESET_OFFSET 0x0000000CU /**< CSU_DMA Reset offset */
94 /** @name CSU_DMA Reset register bit masks
97 #define XCSUDMA_RESET_SET_MASK 0x00000001U /**< Reset set mask */
98 #define XCSUDMA_RESET_UNSET_MASK 0x00000000U /**< Reset unset mask*/
101 /** @name Offset difference for Source and destination
104 #define XCSUDMA_OFFSET_DIFF 0x00000800U /**< Offset difference for
106 * destination channels */
109 /** @name Address register bit masks
112 #define XCSUDMA_ADDR_MASK 0xFFFFFFFCU /**< Address mask */
113 #define XCSUDMA_ADDR_LSB_MASK 0x00000003U /**< Address alignment check
117 /** @name Size register bit masks and shifts
120 #define XCSUDMA_SIZE_MASK 0x1FFFFFFCU /**< Mask for size */
121 #define XCSUDMA_LAST_WORD_MASK 0x00000001U /**< Last word check bit mask*/
122 #define XCSUDMA_SIZE_SHIFT 2U /**< Shift for size */
125 /** @name Status register bit masks and shifts
128 #define XCSUDMA_STS_DONE_CNT_MASK 0x0000E000U /**< Count done mask */
129 #define XCSUDMA_STS_FIFO_LEVEL_MASK 0x00001FE0U /**< FIFO level mask */
130 #define XCUSDMA_STS_OUTSTDG_MASK 0x0000001EU /**< No.of outstanding
133 #define XCSUDMA_STS_BUSY_MASK 0x00000001U /**< Busy mask */
134 #define XCSUDMA_STS_DONE_CNT_SHIFT 13U /**< Shift for Count
136 #define XCSUDMA_STS_FIFO_LEVEL_SHIFT 5U /**< Shift for FIFO
138 #define XCUSDMA_STS_OUTSTDG_SHIFT 1U /**< Shift for No.of
144 /** @name Control register bit masks and shifts
147 #define XCSUDMA_CTRL_SSS_FIFOTHRESH_MASK 0xFE000000U /**< SSS FIFO threshold
149 #define XCSUDMA_CTRL_APB_ERR_MASK 0x01000000U /**< APB register
152 #define XCSUDMA_CTRL_ENDIAN_MASK 0x00800000U /**< Endianess mask */
153 #define XCSUDMA_CTRL_BURST_MASK 0x00400000U /**< AXI burst type
155 #define XCSUDMA_CTRL_TIMEOUT_MASK 0x003FFC00U /**< Time out value
157 #define XCSUDMA_CTRL_FIFO_THRESH_MASK 0x000003FCU /**< FIFO threshold
159 #define XCSUDMA_CTRL_PAUSE_MEM_MASK 0x00000001U /**< Memory pause
161 #define XCSUDMA_CTRL_PAUSE_STRM_MASK 0x00000002U /**< Stream pause
163 #define XCSUDMA_CTRL_SSS_FIFOTHRESH_SHIFT 25U /**< SSS FIFO threshold
165 #define XCSUDMA_CTRL_APB_ERR_SHIFT 24U /**< APB error shift */
166 #define XCSUDMA_CTRL_ENDIAN_SHIFT 23U /**< Endianess shift */
167 #define XCSUDMA_CTRL_BURST_SHIFT 22U /**< AXI burst type
169 #define XCSUDMA_CTRL_TIMEOUT_SHIFT 10U /**< Time out value
171 #define XCSUDMA_CTRL_FIFO_THRESH_SHIFT 2U /**< FIFO thresh
175 /** @name CheckSum register bit masks
178 #define XCSUDMA_CRC_RESET_MASK 0x00000000U /**< Mask to reset
183 /** @name Interrupt Enable/Disable/Mask/Status registers bit masks
186 #define XCSUDMA_IXR_FIFO_OVERFLOW_MASK 0x00000001U /**< FIFO overflow
188 * only to Destination
190 #define XCSUDMA_IXR_INVALID_APB_MASK 0x00000040U /**< Invalid APB access
192 #define XCSUDMA_IXR_FIFO_THRESHHIT_MASK 0x00000020U /**< FIFO threshold hit
194 #define XCSUDMA_IXR_TIMEOUT_MEM_MASK 0x00000010U /**< Time out counter
197 #define XCSUDMA_IXR_TIMEOUT_STRM_MASK 0x00000008U /**< Time out counter
200 #define XCSUDMA_IXR_AXI_WRERR_MASK 0x00000004U /**< AXI Read/Write
202 #define XCSUDMA_IXR_DONE_MASK 0x00000002U /**< Done mask */
203 #define XCSUDMA_IXR_MEM_DONE_MASK 0x00000001U /**< Memory done
207 #define XCSUDMA_IXR_SRC_MASK 0x0000007FU
208 /**< ((XCSUDMA_IXR_INVALID_APB_MASK)|
209 (XCSUDMA_IXR_FIFO_THRESHHIT_MASK) |
210 (XCSUDMA_IXR_TIMEOUT_MEM_MASK) |
211 (XCSUDMA_IXR_TIMEOUT_STRM_MASK) |
212 (XCSUDMA_IXR_AXI_WRERR_MASK) |
213 (XCSUDMA_IXR_DONE_MASK) |
214 (XCSUDMA_IXR_MEM_DONE_MASK)) */
215 /**< All interrupt mask
217 #define XCSUDMA_IXR_DST_MASK 0x000000FEU
218 /**< ((XCSUDMA_IXR_FIFO_OVERFLOW_MASK) |
219 (XCSUDMA_IXR_INVALID_APB_MASK) |
220 (XCSUDMA_IXR_FIFO_THRESHHIT_MASK) |
221 (XCSUDMA_IXR_TIMEOUT_MEM_MASK) |
222 (XCSUDMA_IXR_TIMEOUT_STRM_MASK) |
223 (XCSUDMA_IXR_AXI_WRERR_MASK) |
224 (XCSUDMA_IXR_DONE_MASK)) */
225 /**< All interrupt mask
229 /** @name Control register 2 bit masks and shifts
232 #define XCSUDMA_CTRL2_RESERVED_MASK 0x083F0000U /**< Reserved bits
234 #define XCSUDMA_CTRL2_ACACHE_MASK 0X07000000U /**< AXI CACHE mask */
235 #define XCSUDMA_CTRL2_ROUTE_MASK 0x00800000U /**< Route mask */
236 #define XCSUDMA_CTRL2_TIMEOUT_EN_MASK 0x00400000U /**< Time out counters
238 #define XCSUDMA_CTRL2_TIMEOUT_PRE_MASK 0x0000FFF0U /**< Time out pre
240 #define XCSUDMA_CTRL2_MAXCMDS_MASK 0x0000000FU /**< Maximum commands
242 #define XCSUDMA_CTRL2_RESET_MASK 0x0000FFF8U /**< Reset mask */
243 #define XCSUDMA_CTRL2_ACACHE_SHIFT 24U /**< Shift for
245 #define XCSUDMA_CTRL2_ROUTE_SHIFT 23U /**< Shift for route */
246 #define XCSUDMA_CTRL2_TIMEOUT_EN_SHIFT 22U /**< Shift for Timeout
248 #define XCSUDMA_CTRL2_TIMEOUT_PRE_SHIFT 4U /**< Shift for Timeout
252 /** @name MSB Address register bit masks and shifts
255 #define XCSUDMA_MSB_ADDR_MASK 0x0001FFFFU /**< MSB bits of address
257 #define XCSUDMA_MSB_ADDR_SHIFT 32U /**< Shift for MSB bits of
261 /***************** Macros (Inline Functions) Definitions *********************/
263 #define XCsuDma_In32 Xil_In32 /**< Input operation */
264 #define XCsuDma_Out32 Xil_Out32 /**< Output operation */
266 /*****************************************************************************/
269 * This macro reads the given register.
271 * @param BaseAddress is the Xilinx base address of the CSU_DMA core.
272 * @param RegOffset is the register offset of the register.
274 * @return The 32-bit value of the register.
276 * @note C-style signature:
277 * u32 XCsuDma_ReadReg(u32 BaseAddress, u32 RegOffset)
279 ******************************************************************************/
280 #define XCsuDma_ReadReg(BaseAddress, RegOffset) \
281 XCsuDma_In32((BaseAddress) + (u32)(RegOffset))
283 /*****************************************************************************/
286 * This macro writes the value into the given register.
288 * @param BaseAddress is the Xilinx base address of the CSU_DMA core.
289 * @param RegOffset is the register offset of the register.
290 * @param Data is the 32-bit value to write to the register.
294 * @note C-style signature:
295 * void XCsuDma_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
297 ******************************************************************************/
298 #define XCsuDma_WriteReg(BaseAddress, RegOffset, Data) \
299 XCsuDma_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data))
308 #endif /* End of protection macro */