OpenCores
URL https://opencores.org/ocsvn/1g_ethernet_dpi/1g_ethernet_dpi/trunk

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [tags/] [v0.0/] [sw/] [dev/] [test_main/] [src/] [_hdl/] [bsp/] [libsrc/] [axidma_v9_0/] [src/] [xaxidma_hw.h] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 kuzmi4
/******************************************************************************
2
*
3
* Copyright (C) 2010 - 2015 Xilinx, Inc.  All rights reserved.
4
*
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:
11
*
12
* The above copyright notice and this permission notice shall be included in
13
* all copies or substantial portions of the Software.
14
*
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.
18
*
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
25
* SOFTWARE.
26
*
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.
30
*
31
******************************************************************************/
32
/*****************************************************************************/
33
/**
34
 *  @file xaxidma_hw.h
35
* @addtogroup axidma_v9_0
36
* @{
37
 *
38
 * Hardware definition file. It defines the register interface and Buffer
39
 * Descriptor (BD) definitions.
40
 *
41
 * <pre>
42
 * MODIFICATION HISTORY:
43
 *
44
 * Ver   Who  Date     Changes
45
 * ----- ---- -------- -------------------------------------------------------
46
 * 1.00a jz   05/18/10 First release
47
 * 2.00a jz   08/10/10 Second release, added in xaxidma_g.c, xaxidma_sinit.c,
48
 *                     updated tcl file, added xaxidma_porting_guide.h
49
 * 3.00a jz   11/22/10 Support IP core parameters change
50
 * 4.00a rkv  02/22/11 Added support for simple DMA mode
51
 * 6.00a srt  01/24/12 Added support for Multi-Channel DMA mode
52
 * 8.0   srt  01/29/14 Added support for Micro DMA Mode and Cyclic mode of
53
 *                     operations.
54
 *
55
 * </pre>
56
 *
57
 *****************************************************************************/
58
 
59
#ifndef XAXIDMA_HW_H_    /* prevent circular inclusions */
60
#define XAXIDMA_HW_H_
61
 
62
#ifdef __cplusplus
63
extern "C" {
64
#endif
65
 
66
#include "xil_types.h"
67
#include "xil_io.h"
68
 
69
/************************** Constant Definitions *****************************/
70
 
71
/** @name DMA Transfer Direction
72
 *  @{
73
 */
74
#define XAXIDMA_DMA_TO_DEVICE           0x00
75
#define XAXIDMA_DEVICE_TO_DMA           0x01
76
 
77
 
78
/** @name Buffer Descriptor Alignment
79
 *  @{
80
 */
81
#define XAXIDMA_BD_MINIMUM_ALIGNMENT    0x40    /**< Minimum byte alignment
82
                                                requirement for descriptors to
83
                                                satisfy both hardware/software
84
                                                needs */
85
/*@}*/
86
 
87
/** @name Micro DMA Buffer Address Alignment
88
 *  @{
89
 */
90
#define XAXIDMA_MICROMODE_MIN_BUF_ALIGN 0xFFF   /**< Minimum byte alignment
91
                                                requirement for buffer address
92
                                                in Micro DMA mode */
93
/*@}*/
94
 
95
/** @name Maximum transfer length
96
 *      This is determined by hardware
97
 * @{
98
 */
99
#define XAXIDMA_MAX_TRANSFER_LEN        0x7FFFFF  /* Max length hw supports */
100
#define XAXIDMA_MCHAN_MAX_TRANSFER_LEN  0x00FFFF  /* Max length MCDMA
101
                                                     hw supports */
102
/*@}*/
103
 
104
/* Register offset definitions. Register accesses are 32-bit.
105
 */
106
/** @name Device registers
107
 *  Register sets on TX and RX channels are identical
108
 *  @{
109
 */
110
#define XAXIDMA_TX_OFFSET       0x00000000 /**< TX channel registers base
111
                                             *  offset */
112
#define XAXIDMA_RX_OFFSET       0x00000030 /**< RX channel registers base
113
                                             * offset */
114
 
115
/* This set of registers are applicable for both channels. Add
116
 * XAXIDMA_TX_OFFSET to get to TX channel, and XAXIDMA_RX_OFFSET to get to RX
117
 * channel
118
 */
119
#define XAXIDMA_CR_OFFSET        0x00000000   /**< Channel control */
120
#define XAXIDMA_SR_OFFSET        0x00000004   /**< Status */
121
#define XAXIDMA_CDESC_OFFSET     0x00000008   /**< Current descriptor pointer */
122
#define XAXIDMA_CDESC_MSB_OFFSET 0x0000000C   /**< Current descriptor pointer */
123
#define XAXIDMA_TDESC_OFFSET     0x00000010   /**< Tail descriptor pointer */
124
#define XAXIDMA_TDESC_MSB_OFFSET 0x00000014   /**< Tail descriptor pointer */
125
#define XAXIDMA_SRCADDR_OFFSET   0x00000018   /**< Simple mode source address
126
                                                pointer */
127
#define XAXIDMA_SRCADDR_MSB_OFFSET      0x0000001C  /**< Simple mode source address
128
                                                pointer */
129
#define XAXIDMA_DESTADDR_OFFSET         0x00000018   /**< Simple mode destination address pointer */
130
#define XAXIDMA_DESTADDR_MSB_OFFSET     0x0000001C   /**< Simple mode destination address pointer */
131
#define XAXIDMA_BUFFLEN_OFFSET          0x00000028   /**< Tail descriptor pointer */
132
#define XAXIDMA_SGCTL_OFFSET            0x0000002c   /**< SG Control Register */
133
 
134
/** Multi-Channel DMA Descriptor Offsets **/
135
#define XAXIDMA_RX_CDESC0_OFFSET        0x00000040   /**< Rx Current Descriptor 0 */
136
#define XAXIDMA_RX_CDESC0_MSB_OFFSET    0x00000044   /**< Rx Current Descriptor 0 */
137
#define XAXIDMA_RX_TDESC0_OFFSET        0x00000048   /**< Rx Tail Descriptor 0 */
138
#define XAXIDMA_RX_TDESC0_MSB_OFFSET    0x0000004C   /**< Rx Tail Descriptor 0 */
139
#define XAXIDMA_RX_NDESC_OFFSET         0x00000020   /**< Rx Next Descriptor Offset */
140
/*@}*/
141
 
142
/** @name Bitmasks of XAXIDMA_CR_OFFSET register
143
 * @{
144
 */
145
#define XAXIDMA_CR_RUNSTOP_MASK 0x00000001 /**< Start/stop DMA channel */
146
#define XAXIDMA_CR_RESET_MASK   0x00000004 /**< Reset DMA engine */
147
#define XAXIDMA_CR_KEYHOLE_MASK 0x00000008 /**< Keyhole feature */
148
#define XAXIDMA_CR_CYCLIC_MASK  0x00000010 /**< Cyclic Mode */
149
/*@}*/
150
 
151
/** @name Bitmasks of XAXIDMA_SR_OFFSET register
152
 *
153
 * This register reports status of a DMA channel, including
154
 * run/stop/idle state, errors, and interrupts (note that interrupt
155
 * masks are shared with XAXIDMA_CR_OFFSET register, and are defined
156
 * in the _IRQ_ section.
157
 *
158
 * The interrupt coalescing threshold value and delay counter value are
159
 * also shared with XAXIDMA_CR_OFFSET register, and are defined in a
160
 * later section.
161
 * @{
162
 */
163
#define XAXIDMA_HALTED_MASK             0x00000001  /**< DMA channel halted */
164
#define XAXIDMA_IDLE_MASK               0x00000002  /**< DMA channel idle */
165
#define XAXIDMA_ERR_INTERNAL_MASK       0x00000010  /**< Datamover internal
166
                                                      *  err */
167
#define XAXIDMA_ERR_SLAVE_MASK          0x00000020  /**< Datamover slave err */
168
#define XAXIDMA_ERR_DECODE_MASK         0x00000040  /**< Datamover decode
169
                                                      *  err */
170
#define XAXIDMA_ERR_SG_INT_MASK         0x00000100  /**< SG internal err */
171
#define XAXIDMA_ERR_SG_SLV_MASK         0x00000200  /**< SG slave err */
172
#define XAXIDMA_ERR_SG_DEC_MASK         0x00000400  /**< SG decode err */
173
#define XAXIDMA_ERR_ALL_MASK            0x00000770  /**< All errors */
174
 
175
/** @name Bitmask for interrupts
176
 * These masks are shared by XAXIDMA_CR_OFFSET register and
177
 * XAXIDMA_SR_OFFSET register
178
 * @{
179
 */
180
#define XAXIDMA_IRQ_IOC_MASK            0x00001000 /**< Completion intr */
181
#define XAXIDMA_IRQ_DELAY_MASK          0x00002000 /**< Delay interrupt */
182
#define XAXIDMA_IRQ_ERROR_MASK          0x00004000 /**< Error interrupt */
183
#define XAXIDMA_IRQ_ALL_MASK            0x00007000 /**< All interrupts */
184
/*@}*/
185
 
186
/** @name Bitmask and shift for delay and coalesce
187
 * These masks are shared by XAXIDMA_CR_OFFSET register and
188
 * XAXIDMA_SR_OFFSET register
189
 * @{
190
 */
191
#define XAXIDMA_DELAY_MASK              0xFF000000 /**< Delay timeout
192
                                                     *  counter */
193
#define XAXIDMA_COALESCE_MASK           0x00FF0000 /**< Coalesce counter */
194
 
195
#define XAXIDMA_DELAY_SHIFT             24
196
#define XAXIDMA_COALESCE_SHIFT          16
197
/*@}*/
198
 
199
 
200
/* Buffer Descriptor (BD) definitions
201
 */
202
 
203
/** @name Buffer Descriptor offsets
204
 *  USR* fields are defined by higher level IP.
205
 *  setup for EMAC type devices. The first 13 words are used by hardware.
206
 *  All words after the 13rd word are for software use only.
207
 *  @{
208
 */
209
#define XAXIDMA_BD_NDESC_OFFSET         0x00  /**< Next descriptor pointer */
210
#define XAXIDMA_BD_NDESC_MSB_OFFSET     0x04  /**< Next descriptor pointer */
211
#define XAXIDMA_BD_BUFA_OFFSET          0x08  /**< Buffer address */
212
#define XAXIDMA_BD_BUFA_MSB_OFFSET      0x0C  /**< Buffer address */
213
#define XAXIDMA_BD_MCCTL_OFFSET         0x10  /**< Multichannel Control Fields */
214
#define XAXIDMA_BD_STRIDE_VSIZE_OFFSET  0x14  /**< 2D Transfer Sizes */
215
#define XAXIDMA_BD_CTRL_LEN_OFFSET      0x18  /**< Control/buffer length */
216
#define XAXIDMA_BD_STS_OFFSET           0x1C  /**< Status */
217
 
218
#define XAXIDMA_BD_USR0_OFFSET          0x20  /**< User IP specific word0 */
219
#define XAXIDMA_BD_USR1_OFFSET          0x24  /**< User IP specific word1 */
220
#define XAXIDMA_BD_USR2_OFFSET          0x28  /**< User IP specific word2 */
221
#define XAXIDMA_BD_USR3_OFFSET          0x2C  /**< User IP specific word3 */
222
#define XAXIDMA_BD_USR4_OFFSET          0x30  /**< User IP specific word4 */
223
 
224
#define XAXIDMA_BD_ID_OFFSET            0x34  /**< Sw ID */
225
#define XAXIDMA_BD_HAS_STSCNTRL_OFFSET  0x38  /**< Whether has stscntrl strm */
226
#define XAXIDMA_BD_HAS_DRE_OFFSET       0x3C  /**< Whether has DRE */
227
#define XAXIDMA_BD_ADDRLEN_OFFSET       0x40  /**< Check for BD Addr */
228
 
229
#define XAXIDMA_BD_HAS_DRE_MASK         0xF00 /**< Whether has DRE mask */
230
#define XAXIDMA_BD_WORDLEN_MASK         0xFF  /**< Whether has DRE mask */
231
 
232
#define XAXIDMA_BD_HAS_DRE_SHIFT        8     /**< Whether has DRE shift */
233
#define XAXIDMA_BD_WORDLEN_SHIFT        0     /**< Whether has DRE shift */
234
 
235
#define XAXIDMA_BD_START_CLEAR          8   /**< Offset to start clear */
236
#define XAXIDMA_BD_BYTES_TO_CLEAR       48  /**< BD specific bytes to be
237
                                              *  cleared */
238
 
239
#define XAXIDMA_BD_NUM_WORDS            20U  /**< Total number of words for
240
                                               * one BD*/
241
#define XAXIDMA_BD_HW_NUM_BYTES         52  /**< Number of bytes hw used */
242
 
243
/* The offset of the last app word.
244
 */
245
#define XAXIDMA_LAST_APPWORD            4
246
 
247
/*@}*/
248
#define XAXIDMA_DESC_LSB_MASK   (0xFFFFFFC0U)   /**< LSB Address mask */
249
 
250
/** @name Bitmasks of XAXIDMA_BD_CTRL_OFFSET register
251
 *  @{
252
 */
253
#define XAXIDMA_BD_CTRL_TXSOF_MASK      0x08000000 /**< First tx packet */
254
#define XAXIDMA_BD_CTRL_TXEOF_MASK      0x04000000 /**< Last tx packet */
255
#define XAXIDMA_BD_CTRL_ALL_MASK        0x0C000000 /**< All control bits */
256
/*@}*/
257
 
258
/** @name Bitmasks of XAXIDMA_BD_STS_OFFSET register
259
 *  @{
260
 */
261
#define XAXIDMA_BD_STS_COMPLETE_MASK    0x80000000 /**< Completed */
262
#define XAXIDMA_BD_STS_DEC_ERR_MASK     0x40000000 /**< Decode error */
263
#define XAXIDMA_BD_STS_SLV_ERR_MASK     0x20000000 /**< Slave error */
264
#define XAXIDMA_BD_STS_INT_ERR_MASK     0x10000000 /**< Internal err */
265
#define XAXIDMA_BD_STS_ALL_ERR_MASK     0x70000000 /**< All errors */
266
#define XAXIDMA_BD_STS_RXSOF_MASK       0x08000000 /**< First rx pkt */
267
#define XAXIDMA_BD_STS_RXEOF_MASK       0x04000000 /**< Last rx pkt */
268
#define XAXIDMA_BD_STS_ALL_MASK         0xFC000000 /**< All status bits */
269
/*@}*/
270
 
271
/** @name Bitmasks and shift values for XAXIDMA_BD_MCCTL_OFFSET register
272
 *  @{
273
 */
274
#define XAXIDMA_BD_TDEST_FIELD_MASK     0x0000000F
275
#define XAXIDMA_BD_TID_FIELD_MASK       0x00000F00
276
#define XAXIDMA_BD_TUSER_FIELD_MASK     0x000F0000
277
#define XAXIDMA_BD_ARCACHE_FIELD_MASK   0x0F000000
278
#define XAXIDMA_BD_ARUSER_FIELD_MASK    0xF0000000
279
 
280
#define XAXIDMA_BD_TDEST_FIELD_SHIFT    0
281
#define XAXIDMA_BD_TID_FIELD_SHIFT      8
282
#define XAXIDMA_BD_TUSER_FIELD_SHIFT    16
283
#define XAXIDMA_BD_ARCACHE_FIELD_SHIFT  24
284
#define XAXIDMA_BD_ARUSER_FIELD_SHIFT   28
285
 
286
/** @name Bitmasks and shift values for XAXIDMA_BD_STRIDE_VSIZE_OFFSET register
287
 *  @{
288
 */
289
#define XAXIDMA_BD_STRIDE_FIELD_MASK    0x0000FFFF
290
#define XAXIDMA_BD_VSIZE_FIELD_MASK     0xFFF80000
291
 
292
#define XAXIDMA_BD_STRIDE_FIELD_SHIFT   0
293
#define XAXIDMA_BD_VSIZE_FIELD_SHIFT    19
294
 
295
/**************************** Type Definitions *******************************/
296
 
297
/***************** Macros (Inline Functions) Definitions *********************/
298
 
299
#define XAxiDma_In32    Xil_In32
300
#define XAxiDma_Out32   Xil_Out32
301
 
302
/*****************************************************************************/
303
/**
304
*
305
* Read the given register.
306
*
307
* @param        BaseAddress is the base address of the device
308
* @param        RegOffset is the register offset to be read
309
*
310
* @return       The 32-bit value of the register
311
*
312
* @note
313
*               C-style signature:
314
*               u32 XAxiDma_ReadReg(u32 BaseAddress, u32 RegOffset)
315
*
316
******************************************************************************/
317
#define XAxiDma_ReadReg(BaseAddress, RegOffset)             \
318
    XAxiDma_In32((BaseAddress) + (RegOffset))
319
 
320
/*****************************************************************************/
321
/**
322
*
323
* Write the given register.
324
*
325
* @param        BaseAddress is the base address of the device
326
* @param        RegOffset is the register offset to be written
327
* @param        Data is the 32-bit value to write to the register
328
*
329
* @return       None.
330
*
331
* @note
332
*               C-style signature:
333
*               void XAxiDma_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
334
*
335
******************************************************************************/
336
#define XAxiDma_WriteReg(BaseAddress, RegOffset, Data)          \
337
    XAxiDma_Out32((BaseAddress) + (RegOffset), (Data))
338
 
339
#ifdef __cplusplus
340
}
341
#endif
342
 
343
#endif
344
/** @} */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.