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 /*****************************************************************************/
36 * @addtogroup csudma_v1_0
39 * This header file contains identifiers and register-level driver functions (or
40 * macros) that can be used to access the Xilinx CSU_DMA core.
43 * MODIFICATION HISTORY:
45 * Ver Who Date Changes
46 * ----- ------ -------- ------------------------------------------------------
47 * 1.0 vnsld 22/10/14 First release
50 ******************************************************************************/
53 #define XCSUDMA_HW_H_ /**< Prevent circular inclusions
54 * by using protection macros */
60 /***************************** Include Files *********************************/
64 /************************** Constant Definitions *****************************/
66 /** @name Registers offsets
69 #define XCSUDMA_ADDR_OFFSET 0x000 /**< Address Register Offset */
70 #define XCSUDMA_SIZE_OFFSET 0x004 /**< Size Register Offset */
71 #define XCSUDMA_STS_OFFSET 0x008 /**< Status Register Offset */
72 #define XCSUDMA_CTRL_OFFSET 0x00C /**< Control Register Offset */
73 #define XCSUDMA_CRC_OFFSET 0x010 /**< CheckSum Register Offset */
74 #define XCSUDMA_I_STS_OFFSET 0x014 /**< Interrupt Status Register
76 #define XCSUDMA_I_EN_OFFSET 0x018 /**< Interrupt Enable Register
78 #define XCSUDMA_I_DIS_OFFSET 0x01C /**< Interrupt Disable Register
80 #define XCSUDMA_I_MASK_OFFSET 0x020 /**< Interrupt Mask Register Offset */
81 #define XCSUDMA_CTRL2_OFFSET 0x024 /**< Interrupt Control Register 2
83 #define XCSUDMA_ADDR_MSB_OFFSET 0x028 /**< Address's MSB Register Offset */
84 #define XCSUDMA_SAFETY_CHK_OFFSET 0xFF8 /**< Safety Check Field Offset */
85 #define XCSUDMA_FUTURE_ECO_OFFSET 0xFFC /**< Future potential ECO Offset */
88 /** @name CSU Base address and CSU_DMA reset offset
91 #define XCSU_BASEADDRESS 0xFFCA0000
92 /**< CSU Base Address */
93 #define XCSU_DMA_RESET_OFFSET 0x0000000CU /**< CSU_DMA Reset offset */
96 /** @name CSU_DMA Reset register bit masks
99 #define XCSUDMA_RESET_SET_MASK 0x00000001U /**< Reset set mask */
100 #define XCSUDMA_RESET_UNSET_MASK 0x00000000U /**< Reset unset mask*/
103 /** @name Offset difference for Source and destination
106 #define XCSUDMA_OFFSET_DIFF 0x00000800U /**< Offset difference for
108 * destination channels */
111 /** @name Address register bit masks
114 #define XCSUDMA_ADDR_MASK 0xFFFFFFFCU /**< Address mask */
115 #define XCSUDMA_ADDR_LSB_MASK 0x00000003U /**< Address alignment check
119 /** @name Size register bit masks and shifts
122 #define XCSUDMA_SIZE_MASK 0x1FFFFFFCU /**< Mask for size */
123 #define XCSUDMA_LAST_WORD_MASK 0x00000001U /**< Last word check bit mask*/
124 #define XCSUDMA_SIZE_SHIFT 2U /**< Shift for size */
127 /** @name Status register bit masks and shifts
130 #define XCSUDMA_STS_DONE_CNT_MASK 0x0000E000U /**< Count done mask */
131 #define XCSUDMA_STS_FIFO_LEVEL_MASK 0x00001FE0U /**< FIFO level mask */
132 #define XCUSDMA_STS_OUTSTDG_MASK 0x0000001EU /**< No.of outstanding
135 #define XCSUDMA_STS_BUSY_MASK 0x00000001U /**< Busy mask */
136 #define XCSUDMA_STS_DONE_CNT_SHIFT 13U /**< Shift for Count
138 #define XCSUDMA_STS_FIFO_LEVEL_SHIFT 5U /**< Shift for FIFO
140 #define XCUSDMA_STS_OUTSTDG_SHIFT 1U /**< Shift for No.of
146 /** @name Control register bit masks and shifts
149 #define XCSUDMA_CTRL_SSS_FIFOTHRESH_MASK 0xFE000000U /**< SSS FIFO threshold
151 #define XCSUDMA_CTRL_APB_ERR_MASK 0x01000000U /**< APB register
154 #define XCSUDMA_CTRL_ENDIAN_MASK 0x00800000U /**< Endianess mask */
155 #define XCSUDMA_CTRL_BURST_MASK 0x00400000U /**< AXI burst type
157 #define XCSUDMA_CTRL_TIMEOUT_MASK 0x003FFC00U /**< Time out value
159 #define XCSUDMA_CTRL_FIFO_THRESH_MASK 0x000003FCU /**< FIFO threshold
161 #define XCSUDMA_CTRL_PAUSE_MEM_MASK 0x00000001U /**< Memory pause
163 #define XCSUDMA_CTRL_PAUSE_STRM_MASK 0x00000002U /**< Stream pause
165 #define XCSUDMA_CTRL_SSS_FIFOTHRESH_SHIFT 25U /**< SSS FIFO threshold
167 #define XCSUDMA_CTRL_APB_ERR_SHIFT 24U /**< APB error shift */
168 #define XCSUDMA_CTRL_ENDIAN_SHIFT 23U /**< Endianess shift */
169 #define XCSUDMA_CTRL_BURST_SHIFT 22U /**< AXI burst type
171 #define XCSUDMA_CTRL_TIMEOUT_SHIFT 10U /**< Time out value
173 #define XCSUDMA_CTRL_FIFO_THRESH_SHIFT 2U /**< FIFO thresh
177 /** @name CheckSum register bit masks
180 #define XCSUDMA_CRC_RESET_MASK 0x00000000U /**< Mask to reset
185 /** @name Interrupt Enable/Disable/Mask/Status registers bit masks
188 #define XCSUDMA_IXR_FIFO_OVERFLOW_MASK 0x00000001U /**< FIFO overflow
190 * only to Destination
192 #define XCSUDMA_IXR_INVALID_APB_MASK 0x00000040U /**< Invalid APB access
194 #define XCSUDMA_IXR_FIFO_THRESHHIT_MASK 0x00000020U /**< FIFO threshold hit
196 #define XCSUDMA_IXR_TIMEOUT_MEM_MASK 0x00000010U /**< Time out counter
199 #define XCSUDMA_IXR_TIMEOUT_STRM_MASK 0x00000008U /**< Time out counter
202 #define XCSUDMA_IXR_AXI_WRERR_MASK 0x00000004U /**< AXI Read/Write
204 #define XCSUDMA_IXR_DONE_MASK 0x00000002U /**< Done mask */
205 #define XCSUDMA_IXR_MEM_DONE_MASK 0x00000001U /**< Memory done
209 #define XCSUDMA_IXR_SRC_MASK 0x0000007FU
210 /**< ((XCSUDMA_IXR_INVALID_APB_MASK)|
211 (XCSUDMA_IXR_FIFO_THRESHHIT_MASK) |
212 (XCSUDMA_IXR_TIMEOUT_MEM_MASK) |
213 (XCSUDMA_IXR_TIMEOUT_STRM_MASK) |
214 (XCSUDMA_IXR_AXI_WRERR_MASK) |
215 (XCSUDMA_IXR_DONE_MASK) |
216 (XCSUDMA_IXR_MEM_DONE_MASK)) */
217 /**< All interrupt mask
219 #define XCSUDMA_IXR_DST_MASK 0x000000FEU
220 /**< ((XCSUDMA_IXR_FIFO_OVERFLOW_MASK) |
221 (XCSUDMA_IXR_INVALID_APB_MASK) |
222 (XCSUDMA_IXR_FIFO_THRESHHIT_MASK) |
223 (XCSUDMA_IXR_TIMEOUT_MEM_MASK) |
224 (XCSUDMA_IXR_TIMEOUT_STRM_MASK) |
225 (XCSUDMA_IXR_AXI_WRERR_MASK) |
226 (XCSUDMA_IXR_DONE_MASK)) */
227 /**< All interrupt mask
231 /** @name Control register 2 bit masks and shifts
234 #define XCSUDMA_CTRL2_RESERVED_MASK 0x083F0000U /**< Reserved bits
236 #define XCSUDMA_CTRL2_ACACHE_MASK 0X07000000U /**< AXI CACHE mask */
237 #define XCSUDMA_CTRL2_ROUTE_MASK 0x00800000U /**< Route mask */
238 #define XCSUDMA_CTRL2_TIMEOUT_EN_MASK 0x00400000U /**< Time out counters
240 #define XCSUDMA_CTRL2_TIMEOUT_PRE_MASK 0x0000FFF0U /**< Time out pre
242 #define XCSUDMA_CTRL2_MAXCMDS_MASK 0x0000000FU /**< Maximum commands
244 #define XCSUDMA_CTRL2_RESET_MASK 0x0000FFF8U /**< Reset mask */
245 #define XCSUDMA_CTRL2_ACACHE_SHIFT 24U /**< Shift for
247 #define XCSUDMA_CTRL2_ROUTE_SHIFT 23U /**< Shift for route */
248 #define XCSUDMA_CTRL2_TIMEOUT_EN_SHIFT 22U /**< Shift for Timeout
250 #define XCSUDMA_CTRL2_TIMEOUT_PRE_SHIFT 4U /**< Shift for Timeout
254 /** @name MSB Address register bit masks and shifts
257 #define XCSUDMA_MSB_ADDR_MASK 0x0001FFFFU /**< MSB bits of address
259 #define XCSUDMA_MSB_ADDR_SHIFT 32U /**< Shift for MSB bits of
263 /***************** Macros (Inline Functions) Definitions *********************/
265 #define XCsuDma_In32 Xil_In32 /**< Input operation */
266 #define XCsuDma_Out32 Xil_Out32 /**< Output operation */
268 /*****************************************************************************/
271 * This macro reads the given register.
273 * @param BaseAddress is the Xilinx base address of the CSU_DMA core.
274 * @param RegOffset is the register offset of the register.
276 * @return The 32-bit value of the register.
278 * @note C-style signature:
279 * u32 XCsuDma_ReadReg(u32 BaseAddress, u32 RegOffset)
281 ******************************************************************************/
282 #define XCsuDma_ReadReg(BaseAddress, RegOffset) \
283 XCsuDma_In32((BaseAddress) + (u32)(RegOffset))
285 /*****************************************************************************/
288 * This macro writes the value into the given register.
290 * @param BaseAddress is the Xilinx base address of the CSU_DMA core.
291 * @param RegOffset is the register offset of the register.
292 * @param Data is the 32-bit value to write to the register.
296 * @note C-style signature:
297 * void XCsuDma_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
299 ******************************************************************************/
300 #define XCsuDma_WriteReg(BaseAddress, RegOffset, Data) \
301 XCsuDma_Out32((BaseAddress) + (u32)(RegOffset), (u32)(Data))
310 #endif /* End of protection macro */