1 | ////////////////////////////////////////////////////////////////////////////// |
---|
2 | // |
---|
3 | // *************************************************************************** |
---|
4 | // ** ** |
---|
5 | // ** Copyright (c) 1995-2005 Xilinx, Inc. All rights reserved. ** |
---|
6 | // ** ** |
---|
7 | // ** You may copy and modify these files for your own internal use solely ** |
---|
8 | // ** with Xilinx programmable logic devices and Xilinx EDK system or ** |
---|
9 | // ** create IP modules solely for Xilinx programmable logic devices and ** |
---|
10 | // ** Xilinx EDK system. No rights are granted to distribute any files ** |
---|
11 | // ** unless they are distributed in Xilinx programmable logic devices. ** |
---|
12 | // ** ** |
---|
13 | // *************************************************************************** |
---|
14 | // |
---|
15 | ////////////////////////////////////////////////////////////////////////////// |
---|
16 | // Filename: C:\edk_user_repository\MyProcessorIPLib\drivers\mgt_fifo1_v1_00_a\src\mgt_fifo1.h |
---|
17 | // Version: 1.00.a |
---|
18 | // Description: mgt_fifo1 Driver Header File |
---|
19 | // Date: Tue Jul 05 10:18:48 2005 (by Create and Import Peripheral Wizard) |
---|
20 | ////////////////////////////////////////////////////////////////////////////// |
---|
21 | |
---|
22 | #ifndef mgt_fifo1_H |
---|
23 | #define mgt_fifo1_H |
---|
24 | |
---|
25 | /***************************** Include Files *******************************/ |
---|
26 | |
---|
27 | #include "xbasic_types.h" |
---|
28 | #include "xstatus.h" |
---|
29 | #include "xio.h" |
---|
30 | |
---|
31 | /************************** Constant Definitions ***************************/ |
---|
32 | |
---|
33 | |
---|
34 | /** |
---|
35 | * User Logic Slave Space Offsets |
---|
36 | * -- SLAVE_REG0 : user logic slave module register 0 |
---|
37 | * -- SLAVE_REG1 : user logic slave module register 1 |
---|
38 | */ |
---|
39 | #define mgt_fifo1_USER_SLAVE_SPACE_OFFSET (0x00000000) |
---|
40 | #define mgt_fifo1_SLAVE_REG0_OFFSET (mgt_fifo1_USER_SLAVE_SPACE_OFFSET + 0x00000000) |
---|
41 | #define mgt_fifo1_SLAVE_REG1_OFFSET (mgt_fifo1_USER_SLAVE_SPACE_OFFSET + 0x00000004) |
---|
42 | |
---|
43 | /** |
---|
44 | * IPIF Reset Mask |
---|
45 | * -- IPIF_RESET : software reset |
---|
46 | */ |
---|
47 | #define IPIF_RESET (0x0000000A) |
---|
48 | |
---|
49 | /** |
---|
50 | * IPIF Read Packet FIFO Register/Data Space Offsets |
---|
51 | * -- RDFIFO_RST : read packet fifo reset register |
---|
52 | * -- RDFIFO_MIR : read packet fifo module identification register |
---|
53 | * -- RDFIFO_SR : read packet fifo status register |
---|
54 | * -- RDFIFO_DATA : read packet fifo data |
---|
55 | */ |
---|
56 | #define mgt_fifo1_IPIF_RDFIFO_REG_SPACE_OFFSET (0x00000100) |
---|
57 | #define mgt_fifo1_RDFIFO_RST_OFFSET (mgt_fifo1_IPIF_RDFIFO_REG_SPACE_OFFSET + 0x00000000) |
---|
58 | #define mgt_fifo1_RDFIFO_MIR_OFFSET (mgt_fifo1_IPIF_RDFIFO_REG_SPACE_OFFSET + 0x00000000) |
---|
59 | #define mgt_fifo1_RDFIFO_SR_OFFSET (mgt_fifo1_IPIF_RDFIFO_REG_SPACE_OFFSET + 0x00000004) |
---|
60 | #define mgt_fifo1_IPIF_RDFIFO_DATA_SPACE_OFFSET (0x00000200) |
---|
61 | #define mgt_fifo1_RDFIFO_DATA_OFFSET (mgt_fifo1_IPIF_RDFIFO_DATA_SPACE_OFFSET + 0x00000000) |
---|
62 | |
---|
63 | /** |
---|
64 | * IPIF Read Packet FIFO Masks |
---|
65 | * -- RDFIFO_EMPTY_MASK : read packet fifo empty condition |
---|
66 | * -- RDFIFO_AE_MASK : read packet fifo almost empty condition |
---|
67 | * -- RDFIFO_DL_MASK : read packet fifo deadlock condition |
---|
68 | * -- RDFIFO_SCL_MASK : read packet fifo occupancy scaling enabled |
---|
69 | * -- RDFIFO_WIDTH_MASK : read packet fifo encoded data port width |
---|
70 | * -- RDFIFO_OCC_MASK : read packet fifo occupancy |
---|
71 | */ |
---|
72 | #define RDFIFO_EMPTY_MASK (0x80000000UL) |
---|
73 | #define RDFIFO_AE_MASK (0x40000000UL) |
---|
74 | #define RDFIFO_DL_MASK (0x20000000UL) |
---|
75 | #define RDFIFO_SCL_MASK (0x10000000UL) |
---|
76 | #define RDFIFO_WIDTH_MASK (0x0E000000UL) |
---|
77 | #define RDFIFO_OCC_MASK (0x01FFFFFFUL) |
---|
78 | |
---|
79 | /** |
---|
80 | * IPIF Write Packet FIFO Register/Data Space Offsets |
---|
81 | * -- WRFIFO_RST : write packet fifo reset register |
---|
82 | * -- WRFIFO_MIR : write packet fifo module identification register |
---|
83 | * -- WRFIFO_SR : write packet fifo status register |
---|
84 | * -- WRFIFO_DATA : write packet fifo data |
---|
85 | */ |
---|
86 | #define mgt_fifo1_IPIF_WRFIFO_REG_SPACE_OFFSET (0x00000300) |
---|
87 | #define mgt_fifo1_WRFIFO_RST_OFFSET (mgt_fifo1_IPIF_WRFIFO_REG_SPACE_OFFSET + 0x00000000) |
---|
88 | #define mgt_fifo1_WRFIFO_MIR_OFFSET (mgt_fifo1_IPIF_WRFIFO_REG_SPACE_OFFSET + 0x00000000) |
---|
89 | #define mgt_fifo1_WRFIFO_SR_OFFSET (mgt_fifo1_IPIF_WRFIFO_REG_SPACE_OFFSET + 0x00000004) |
---|
90 | #define mgt_fifo1_IPIF_WRFIFO_DATA_SPACE_OFFSET (0x00000400) |
---|
91 | #define mgt_fifo1_WRFIFO_DATA_OFFSET (mgt_fifo1_IPIF_WRFIFO_DATA_SPACE_OFFSET + 0x00000000) |
---|
92 | |
---|
93 | /** |
---|
94 | * IPIF Write Packet FIFO Masks |
---|
95 | * -- WRFIFO_FULL_MASK : write packet fifo full condition |
---|
96 | * -- WRFIFO_AF_MASK : write packet fifo almost full condition |
---|
97 | * -- WRFIFO_DL_MASK : write packet fifo deadlock condition |
---|
98 | * -- WRFIFO_SCL_MASK : write packet fifo vacancy scaling enabled |
---|
99 | * -- WRFIFO_WIDTH_MASK : write packet fifo encoded data port width |
---|
100 | * -- WRFIFO_VAC_MASK : write packet fifo vacancy |
---|
101 | */ |
---|
102 | #define WRFIFO_FULL_MASK (0x80000000UL) |
---|
103 | #define WRFIFO_AF_MASK (0x40000000UL) |
---|
104 | #define WRFIFO_DL_MASK (0x20000000UL) |
---|
105 | #define WRFIFO_SCL_MASK (0x10000000UL) |
---|
106 | #define WRFIFO_WIDTH_MASK (0x0E000000UL) |
---|
107 | #define WRFIFO_VAC_MASK (0x01FFFFFFUL) |
---|
108 | |
---|
109 | /***************** Macros (Inline Functions) Definitions *******************/ |
---|
110 | |
---|
111 | /** |
---|
112 | * |
---|
113 | * Write a value to a mgt_fifo1 register. A 32 bit write is performed. |
---|
114 | * If the component is implemented in a smaller width, only the least |
---|
115 | * significant data is written. |
---|
116 | * |
---|
117 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
118 | * @param RegOffset is the register offset from the base to write to. |
---|
119 | * @param Data is the data written to the register. |
---|
120 | * |
---|
121 | * @return None. |
---|
122 | * |
---|
123 | * @note None. |
---|
124 | * |
---|
125 | * C-style signature: |
---|
126 | * void mgt_fifo1_mWriteReg(Xuint32 BaseAddress, unsigned RegOffset, Xuint32 Data) |
---|
127 | * |
---|
128 | */ |
---|
129 | #define mgt_fifo1_mWriteReg(BaseAddress, RegOffset, Data) \ |
---|
130 | XIo_Out32((BaseAddress) + (RegOffset), (Xuint32)(Data)) |
---|
131 | |
---|
132 | /** |
---|
133 | * |
---|
134 | * Read a value from a mgt_fifo1 register. A 32 bit read is performed. |
---|
135 | * If the component is implemented in a smaller width, only the least |
---|
136 | * significant data is read from the register. The most significant data |
---|
137 | * will be read as 0. |
---|
138 | * |
---|
139 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
140 | * @param RegOffset is the register offset from the base to write to. |
---|
141 | * |
---|
142 | * @return Data is the data from the register. |
---|
143 | * |
---|
144 | * @note None. |
---|
145 | * |
---|
146 | * C-style signature: |
---|
147 | * Xuint32 mgt_fifo1_mReadReg(Xuint32 BaseAddress, unsigned RegOffset) |
---|
148 | * |
---|
149 | */ |
---|
150 | #define mgt_fifo1_mReadReg(BaseAddress, RegOffset) \ |
---|
151 | XIo_In32((BaseAddress) + (RegOffset)) |
---|
152 | |
---|
153 | |
---|
154 | /** |
---|
155 | * |
---|
156 | * Write/Read value to/from mgt_fifo1 user logic slave registers. |
---|
157 | * |
---|
158 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
159 | * @param Value is the data written to the register. |
---|
160 | * |
---|
161 | * @return Data is the data from the user logic slave register. |
---|
162 | * |
---|
163 | * @note None. |
---|
164 | * |
---|
165 | * C-style signature: |
---|
166 | * Xuint32 mgt_fifo1_mReadSlaveRegn(Xuint32 BaseAddress) |
---|
167 | * |
---|
168 | */ |
---|
169 | #define mgt_fifo1_mWriteSlaveReg0(BaseAddress, Value) \ |
---|
170 | XIo_Out32((BaseAddress) + (mgt_fifo1_SLAVE_REG0_OFFSET), (Xuint32)(Value)) |
---|
171 | #define mgt_fifo1_mWriteSlaveReg1(BaseAddress, Value) \ |
---|
172 | XIo_Out32((BaseAddress) + (mgt_fifo1_SLAVE_REG1_OFFSET), (Xuint32)(Value)) |
---|
173 | |
---|
174 | #define mgt_fifo1_mReadSlaveReg0(BaseAddress) \ |
---|
175 | XIo_In32((BaseAddress) + (mgt_fifo1_SLAVE_REG0_OFFSET)) |
---|
176 | #define mgt_fifo1_mReadSlaveReg1(BaseAddress) \ |
---|
177 | XIo_In32((BaseAddress) + (mgt_fifo1_SLAVE_REG1_OFFSET)) |
---|
178 | |
---|
179 | /** |
---|
180 | * |
---|
181 | * Reset read packet FIFO of mgt_fifo1 to its initial state. |
---|
182 | * |
---|
183 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
184 | * |
---|
185 | * @return None. |
---|
186 | * |
---|
187 | * @note None. |
---|
188 | * |
---|
189 | * C-style signature: |
---|
190 | * void mgt_fifo1_mResetReadFIFO(Xuint32 BaseAddress) |
---|
191 | * |
---|
192 | */ |
---|
193 | #define mgt_fifo1_mResetReadFIFO(BaseAddress) \ |
---|
194 | XIo_Out32((BaseAddress)+(mgt_fifo1_RDFIFO_RST_OFFSET), IPIF_RESET) |
---|
195 | |
---|
196 | /** |
---|
197 | * |
---|
198 | * Check status of mgt_fifo1 read packet FIFO module. |
---|
199 | * |
---|
200 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
201 | * |
---|
202 | * @return Status is the result of status checking. |
---|
203 | * |
---|
204 | * @note None. |
---|
205 | * |
---|
206 | * C-style signature: |
---|
207 | * bool mgt_fifo1_mReadFIFOEmpty(Xuint32 BaseAddress) |
---|
208 | * Xuint32 mgt_fifo1_mReadFIFOOccupancy(Xuint32 BaseAddress) |
---|
209 | * |
---|
210 | */ |
---|
211 | #define mgt_fifo1_mReadFIFOEmpty(BaseAddress) \ |
---|
212 | ((XIo_In32((BaseAddress)+(mgt_fifo1_RDFIFO_SR_OFFSET)) & RDFIFO_EMPTY_MASK) == RDFIFO_EMPTY_MASK) |
---|
213 | #define mgt_fifo1_mReadFIFOOccupancy(BaseAddress) \ |
---|
214 | ((XIo_In32((BaseAddress)+(mgt_fifo1_RDFIFO_SR_OFFSET)) & RDFIFO_OCC_MASK) == RDFIFO_OCC_MASK) |
---|
215 | |
---|
216 | /** |
---|
217 | * |
---|
218 | * Read data from mgt_fifo1 read packet FIFO module. |
---|
219 | * |
---|
220 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
221 | * |
---|
222 | * @return Data is the data from the read packet FIFO. |
---|
223 | * |
---|
224 | * @note None. |
---|
225 | * |
---|
226 | * C-style signature: |
---|
227 | * Xuint32 mgt_fifo1_mReadFromFIFO(Xuint32 BaseAddress) |
---|
228 | * |
---|
229 | */ |
---|
230 | #define mgt_fifo1_mReadFromFIFO(BaseAddress) \ |
---|
231 | XIo_In32((BaseAddress) + (mgt_fifo1_RDFIFO_DATA_OFFSET)) |
---|
232 | |
---|
233 | /** |
---|
234 | * |
---|
235 | * Reset write packet FIFO of mgt_fifo1 to its initial state. |
---|
236 | * |
---|
237 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
238 | * |
---|
239 | * @return None. |
---|
240 | * |
---|
241 | * @note None. |
---|
242 | * |
---|
243 | * C-style signature: |
---|
244 | * void mgt_fifo1_mResetWriteFIFO(Xuint32 BaseAddress) |
---|
245 | * |
---|
246 | */ |
---|
247 | #define mgt_fifo1_mResetWriteFIFO(BaseAddress) \ |
---|
248 | XIo_Out32((BaseAddress)+(mgt_fifo1_WRFIFO_RST_OFFSET), IPIF_RESET) |
---|
249 | |
---|
250 | /** |
---|
251 | * |
---|
252 | * Check status of mgt_fifo1 write packet FIFO module. |
---|
253 | * |
---|
254 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
255 | * |
---|
256 | * @return Status is the result of status checking. |
---|
257 | * |
---|
258 | * @note None. |
---|
259 | * |
---|
260 | * C-style signature: |
---|
261 | * bool mgt_fifo1_mWriteFIFOFull(Xuint32 BaseAddress) |
---|
262 | * Xuint32 mgt_fifo1_mWriteFIFOVacancy(Xuint32 BaseAddress) |
---|
263 | * |
---|
264 | */ |
---|
265 | #define mgt_fifo1_mWriteFIFOFull(BaseAddress) \ |
---|
266 | ((XIo_In32((BaseAddress)+(mgt_fifo1_WRFIFO_SR_OFFSET)) & WRFIFO_FULL_MASK) == WRFIFO_FULL_MASK) |
---|
267 | #define mgt_fifo1_mWriteFIFOVacancy(BaseAddress) \ |
---|
268 | ((XIo_In32((BaseAddress)+(mgt_fifo1_WRFIFO_SR_OFFSET)) & WRFIFO_VAC_MASK) == WRFIFO_VAC_MASK) |
---|
269 | |
---|
270 | /** |
---|
271 | * |
---|
272 | * Write data to mgt_fifo1 write packet FIFO module. |
---|
273 | * |
---|
274 | * @param BaseAddress is the base address of the mgt_fifo1 device. |
---|
275 | * @param Data is the value to be written to write packet FIFO. |
---|
276 | * |
---|
277 | * @return None. |
---|
278 | * |
---|
279 | * @note None. |
---|
280 | * |
---|
281 | * C-style signature: |
---|
282 | * void mgt_fifo1_mWriteToFIFO(Xuint32 BaseAddress, Xuint32 Data) |
---|
283 | * |
---|
284 | */ |
---|
285 | #define mgt_fifo1_mWriteToFIFO(BaseAddress, Data) \ |
---|
286 | XIo_Out32((BaseAddress) + (mgt_fifo1_WRFIFO_DATA_OFFSET), (Xuint32)(Data)) |
---|
287 | |
---|
288 | /************************** Function Prototypes ****************************/ |
---|
289 | |
---|
290 | |
---|
291 | /** |
---|
292 | * |
---|
293 | * Run a self-test on the driver/device. Note this may be a destructive test if |
---|
294 | * resets of the device are performed. |
---|
295 | * |
---|
296 | * If the hardware system is not built correctly, this function may never |
---|
297 | * return to the caller. |
---|
298 | * |
---|
299 | * @param baseaddr_p is the base address of the mgt_fifo1 instance to be worked on. |
---|
300 | * |
---|
301 | * @return |
---|
302 | * |
---|
303 | * - XST_SUCCESS if all self-test code passed |
---|
304 | * - XST_FAILURE if any self-test code failed |
---|
305 | * |
---|
306 | * @note Caching must be turned off for this function to work. |
---|
307 | * @note Self test may fail if data memory and device are not on the same bus. |
---|
308 | * |
---|
309 | */ |
---|
310 | XStatus mgt_fifo1_SelfTest(void * baseaddr_p); |
---|
311 | |
---|
312 | #endif // mgt_fifo1_H |
---|