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 ZDMA core.
41 * MODIFICATION HISTORY:
43 * Ver Who Date Changes
44 * ----- ------ -------- ------------------------------------------------------
45 * 1.0 vns 2/27/15 First release
48 ******************************************************************************/
50 #define XZDMA_HW_H_ /**< Prevent circular inclusions
51 * by using protection macros */
56 /***************************** Include Files *********************************/
60 /************************** Constant Definitions *****************************/
62 /** @name Registers offsets
65 #define XZDMA_ERR_CTRL (0x000U)
66 #define XZDMA_CH_ECO (0x004U)
67 #define XZDMA_CH_ISR_OFFSET (0x100U)
68 #define XZDMA_CH_IMR_OFFSET (0x104U)
69 #define XZDMA_CH_IEN_OFFSET (0x108U)
70 #define XZDMA_CH_IDS_OFFSET (0x10CU)
71 #define XZDMA_CH_CTRL0_OFFSET (0x110U)
72 #define XZDMA_CH_CTRL1_OFFSET (0x114U)
73 #define XZDMA_CH_PERIF_OFFSET (0x118U)
74 #define XZDMA_CH_STS_OFFSET (0x11CU)
75 #define XZDMA_CH_DATA_ATTR_OFFSET (0x120U)
76 #define XZDMA_CH_DSCR_ATTR_OFFSET (0x124U)
77 #define XZDMA_CH_SRC_DSCR_WORD0_OFFSET (0x128U)
78 #define XZDMA_CH_SRC_DSCR_WORD1_OFFSET (0x12CU)
79 #define XZDMA_CH_SRC_DSCR_WORD2_OFFSET (0x130U)
80 #define XZDMA_CH_SRC_DSCR_WORD3_OFFSET (0x134U)
81 #define XZDMA_CH_DST_DSCR_WORD0_OFFSET (0x138U)
82 #define XZDMA_CH_DST_DSCR_WORD1_OFFSET (0x13CU)
83 #define XZDMA_CH_DST_DSCR_WORD2_OFFSET (0x140U)
84 #define XZDMA_CH_DST_DSCR_WORD3_OFFSET (0x144U)
85 #define XZDMA_CH_WR_ONLY_WORD0_OFFSET (0x148U)
86 #define XZDMA_CH_WR_ONLY_WORD1_OFFSET (0x14CU)
87 #define XZDMA_CH_WR_ONLY_WORD2_OFFSET (0x150U)
88 #define XZDMA_CH_WR_ONLY_WORD3_OFFSET (0x154U)
89 #define XZDMA_CH_SRC_START_LSB_OFFSET (0x158U)
90 #define XZDMA_CH_SRC_START_MSB_OFFSET (0x15CU)
91 #define XZDMA_CH_DST_START_LSB_OFFSET (0x160U)
92 #define XZDMA_CH_DST_START_MSB_OFFSET (0x164U)
93 #define XZDMA_CH_SRC_CUR_PYLD_LSB_OFFSET (0x168U)
94 #define XZDMA_CH_SRC_CUR_PYLD_MSB_OFFSET (0x16CU)
95 #define XZDMA_CH_DST_CUR_PYLD_LSB_OFFSET (0x170U)
96 #define XZDMA_CH_DST_CUR_PYLD_MSB_OFFSET (0x174U)
97 #define XZDMA_CH_SRC_CUR_DSCR_LSB_OFFSET (0x178U)
98 #define XZDMA_CH_SRC_CUR_DSCR_MSB_OFFSET (0x17CU)
99 #define XZDMA_CH_DST_CUR_DSCR_LSB_OFFSET (0x180U)
100 #define XZDMA_CH_DST_CUR_DSCR_MSB_OFFSET (0x184U)
101 #define XZDMA_CH_TOTAL_BYTE_OFFSET (0x188U)
102 #define XZDMA_CH_RATE_CNTL_OFFSET (0x18CU)
103 #define XZDMA_CH_IRQ_SRC_ACCT_OFFSET (0x190U)
104 #define XZDMA_CH_IRQ_DST_ACCT_OFFSET (0x194U)
105 #define XZDMA_CH_CTRL2_OFFSET (0x200U)
108 /** @name Interrupt Enable/Disable/Mask/Status registers bit masks and shifts
111 #define XZDMA_IXR_DMA_PAUSE_MASK (0x00000800U) /**< IXR pause mask */
112 #define XZDMA_IXR_DMA_DONE_MASK (0x00000400U) /**< IXR done mask */
113 #define XZDMA_IXR_AXI_WR_DATA_MASK (0x00000200U) /**< IXR AXI write data
115 #define XZDMA_IXR_AXI_RD_DATA_MASK (0x00000100U) /**< IXR AXI read data
117 #define XZDMA_IXR_AXI_RD_DST_DSCR_MASK (0x00000080U) /**< IXR AXI read
120 #define XZDMA_IXR_AXI_RD_SRC_DSCR_MASK (0x00000040U) /**< IXR AXI write
123 #define XZDMA_IXR_DST_ACCT_ERR_MASK (0x00000020U) /**< IXR DST interrupt
126 #define XZDMA_IXR_SRC_ACCT_ERR_MASK (0x00000010U) /**< IXR SRC interrupt
129 #define XZDMA_IXR_BYTE_CNT_OVRFL_MASK (0x00000008U) /**< IXR byte count over
131 #define XZDMA_IXR_DST_DSCR_DONE_MASK (0x00000004U) /**< IXR destination
134 #define XZDMA_IXR_SRC_DSCR_DONE_MASK (0x00000002U) /**< IXR source
137 #define XZDMA_IXR_INV_APB_MASK (0x00000001U) /**< IXR invalid APB
139 #define XZDMA_IXR_ALL_INTR_MASK (0x00000FFFU) /**< IXR OR of all the
141 #define XZDMA_IXR_DONE_MASK (0x00000400U) /**< IXR All done mask */
143 #define XZDMA_IXR_ERR_MASK (0x00000BF9U) /**< IXR all Error mask*/
144 /**< Or of XZDMA_IXR_AXI_WR_DATA_MASK,
145 * XZDMA_IXR_AXI_RD_DATA_MASK,
146 * XZDMA_IXR_AXI_RD_DST_DSCR_MASK,
147 * XZDMA_IXR_AXI_RD_SRC_DSCR_MASK,
148 * XZDMA_IXR_INV_APB_MASK,
149 * XZDMA_IXR_DMA_PAUSE_MASK,
150 * XZDMA_IXR_BYTE_CNT_OVRFL_MASK,
151 * XZDMA_IXR_SRC_ACCT_ERR_MASK,
152 * XZDMA_IXR_DST_ACCT_ERR_MASK */
155 /** @name Channel Control0 register bit masks and shifts
158 #define XZDMA_CTRL0_OVR_FETCH_MASK (0x00000080U) /**< Over fetch mask */
159 #define XZDMA_CTRL0_POINT_TYPE_MASK (0x00000040U) /**< Pointer type mask */
160 #define XZDMA_CTRL0_MODE_MASK (0x00000030U) /**< Mode mask */
161 #define XZDMA_CTRL0_WRONLY_MASK (0x00000010U) /**< Write only mask */
162 #define XZDMA_CTRL0_RDONLY_MASK (0x00000020U) /**< Read only mask */
163 #define XZDMA_CTRL0_RATE_CNTL_MASK (0x00000008U) /**< Rate control mask */
164 #define XZDMA_CTRL0_CONT_ADDR_MASK (0x00000004U) /**< Continue address
166 #define XZDMA_CTRL0_CONT_MASK (0x00000002U) /**< Continue mask */
168 #define XZDMA_CTRL0_OVR_FETCH_SHIFT (7U) /**< Over fetch shift */
169 #define XZDMA_CTRL0_POINT_TYPE_SHIFT (6U) /**< Pointer type shift */
170 #define XZDMA_CTRL0_MODE_SHIFT (4U) /**< Mode type shift */
171 #define XZDMA_CTRL0_RESET_VALUE (0x00000080U) /**< CTRL0 reset value */
175 /** @name Channel Control1 register bit masks and shifts
178 #define XZDMA_CTRL1_SRC_ISSUE_MASK (0x0000001FU) /**< Source issue mask */
179 #define XZDMA_CTRL1_RESET_VALUE (0x000003FFU) /**< CTRL1 reset value */
182 /** @name Channel Peripheral register bit masks and shifts
185 #define XZDMA_PERIF_PROG_CELL_CNT_MASK (0x0000003EU) /**< Peripheral program
187 #define XZDMA_PERIF_SIDE_MASK (0x00000002U) /**< Interface attached
189 #define XZDMA_PERIF_EN_MASK (0x00000001U) /**< Peripheral flow
193 /** @name Channel Status register bit masks and shifts
196 #define XZDMA_STS_DONE_ERR_MASK (0x00000003U) /**< Done with errors mask */
197 #define XZDMA_STS_BUSY_MASK (0x00000002U) /**< ZDMA is busy in transfer
199 #define XZDMA_STS_PAUSE_MASK (0x00000001U) /**< ZDMA is in Pause state
201 #define XZDMA_STS_DONE_MASK (0x00000000U) /**< ZDMA done mask */
202 #define XZDMA_STS_ALL_MASK (0x00000003U) /**< ZDMA status mask */
206 /** @name Channel Data Attribute register bit masks and shifts
209 #define XZDMA_DATA_ATTR_ARBURST_MASK (0x0C000000U) /**< Data ArBurst mask */
210 #define XZDMA_DATA_ATTR_ARCACHE_MASK (0x03C00000U) /**< Data ArCache mask */
211 #define XZDMA_DATA_ATTR_ARQOS_MASK (0x003C0000U) /**< Data ARQos masks */
212 #define XZDMA_DATA_ATTR_ARLEN_MASK (0x0003C000U) /**< Data Arlen mask */
213 #define XZDMA_DATA_ATTR_AWBURST_MASK (0x00003000U) /**< Data Awburst mask */
214 #define XZDMA_DATA_ATTR_AWCACHE_MASK (0x00000F00U) /**< Data AwCache mask */
215 #define XZDMA_DATA_ATTR_AWQOS_MASK (0x000000F0U) /**< Data AwQos mask */
216 #define XZDMA_DATA_ATTR_AWLEN_MASK (0x0000000FU) /**< Data Awlen mask */
218 #define XZDMA_DATA_ATTR_ARBURST_SHIFT (26U) /**< Data Arburst shift */
219 #define XZDMA_DATA_ATTR_ARCACHE_SHIFT (22U) /**< Data ArCache shift */
220 #define XZDMA_DATA_ATTR_ARQOS_SHIFT (18U) /**< Data ARQos shift */
221 #define XZDMA_DATA_ATTR_ARLEN_SHIFT (14U) /**< Data Arlen shift */
222 #define XZDMA_DATA_ATTR_AWBURST_SHIFT (12U) /**< Data Awburst shift */
223 #define XZDMA_DATA_ATTR_AWCACHE_SHIFT (8U) /**< Data Awcache shift */
224 #define XZDMA_DATA_ATTR_AWQOS_SHIFT (4U) /**< Data Awqos shift */
225 #define XZDMA_DATA_ATTR_RESET_VALUE (0x0483D20FU) /**< Data Attributes
230 /** @name Channel DSCR Attribute register bit masks and shifts
233 #define XZDMA_DSCR_ATTR_AXCOHRNT_MASK (0x00000100U) /**< Descriptor coherent
235 #define XZDMA_DSCR_ATTR_AXCACHE_MASK (0x000000F0U) /**< Descriptor cache
237 #define XZDMA_DSCR_ATTR_AXQOS_MASK (0x0000000FU) /**< Descriptor AxQos
240 #define XZDMA_DSCR_ATTR_AXCOHRNT_SHIFT (8U) /**< Descriptor coherent shift */
241 #define XZDMA_DSCR_ATTR_AXCACHE_SHIFT (7U) /**< Descriptor cache shift */
242 #define XZDMA_DSCR_ATTR_RESET_VALUE (0x00000000U) /**< Dscr Attributes
247 /** @name Channel Source/Destination Word0 register bit mask
250 #define XZDMA_WORD0_LSB_MASK (0xFFFFFFFFU) /**< LSB Address mask */
253 /** @name Channel Source/Destination Word1 register bit mask
256 #define XZDMA_WORD1_MSB_MASK (0x0001FFFFU) /**< MSB Address mask */
257 #define XZDMA_WORD1_MSB_SHIFT (32U) /**< MSB Address shift */
260 /** @name Channel Source/Destination Word2 register bit mask
263 #define XZDMA_WORD2_SIZE_MASK (0x3FFFFFFFU) /**< Size mask */
266 /** @name Channel Source/Destination Word3 register bit masks and shifts
269 #define XZDMA_WORD3_CMD_MASK (0x00000018U) /**< Cmd mask */
270 #define XZDMA_WORD3_CMD_SHIFT (3U) /**< Cmd shift */
271 #define XZDMA_WORD3_CMD_NXTVALID_MASK (0x00000000U) /**< Next Dscr is valid
273 #define XZDMA_WORD3_CMD_PAUSE_MASK (0x00000008U) /**< Pause after this
275 #define XZDMA_WORD3_CMD_STOP_MASK (0x00000010U) /**< Stop after this
277 #define XZDMA_WORD3_INTR_MASK (0x00000004U) /**< Interrupt
280 #define XZDMA_WORD3_INTR_SHIFT (2U) /**< Interrupt enable
283 #define XZDMA_WORD3_TYPE_MASK (0x00000002U) /**< Type of Descriptor
285 #define XZDMA_WORD3_TYPE_SHIFT (1U) /**< Type of Descriptor
287 #define XZDMA_WORD3_COHRNT_MASK (0x00000001U) /**< Coherence mask */
290 /** @name Channel Source/Destination start address or current payload
291 * MSB register bit mask
294 #define XZDMA_START_MSB_ADDR_MASK (0x0001FFFFU) /**< Start msb address
298 /** @name Channel Rate control count register bit mask
301 #define XZDMA_CH_RATE_CNTL_MASK (0x00000FFFU) /**< Channel rate control
305 /** @name Channel Source/Destination Interrupt account count register bit mask
308 #define XZDMA_CH_IRQ_ACCT_MASK (0x000000FFU) /**< Interrupt count
312 /** @name Channel debug register 0/1 bit mask
315 #define XZDMA_CH_DBG_CMN_BUF_MASK (0x000001FFU) /**< Common buffer count
319 /** @name Channel control2 register bit mask
322 #define XZDMA_CH_CTRL2_EN_MASK (0x00000001U) /**< Channel enable
324 #define XZDMA_CH_CTRL2_DIS_MASK (0x00000000U) /**< Channel disable
328 /** @name Channel control2 register bit mask
331 #define XZDMA_WRITE_TO_CLEAR_MASK (0x00000000U) /**< Write to clear
335 /***************** Macros (Inline Functions) Definitions *********************/
337 #define XZDma_In32 Xil_In32 /**< Input operation */
338 #define XZDma_Out32 Xil_Out32 /**< Output operation */
340 /*****************************************************************************/
343 * This macro reads the given register.
345 * @param BaseAddress is the Xilinx base address of the ZDMA core.
346 * @param RegOffset is the register offset of the register.
348 * @return The 32-bit value of the register.
350 * @note C-style signature:
351 * u32 XZDma_ReadReg(u32 BaseAddress, u32 RegOffset)
353 ******************************************************************************/
354 #define XZDma_ReadReg(BaseAddress, RegOffset) \
355 XZDma_In32((BaseAddress) + (u32)(RegOffset))
357 /*****************************************************************************/
360 * This macro writes the value into the given register.
362 * @param BaseAddress is the Xilinx base address of the ZDMA core.
363 * @param RegOffset is the register offset of the register.
364 * @param Data is the 32-bit value to write to the register.
368 * @note C-style signature:
369 * void XZDma_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
371 ******************************************************************************/
372 #define XZDma_WriteReg(BaseAddress, RegOffset, Data) \
373 XZDma_Out32(((BaseAddress) + (u32)(RegOffset)), (u32)(Data))
380 #endif /* XZDMA_HW_H_ */