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

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [trunk/] [sw/] [dev/] [test_main/] [src/] [_hdl/] [bsp/] [include/] [xil_io.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 kuzmi4
/******************************************************************************
2
*
3
* Copyright (C) 2009 - 2014 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
*
35
* @file xil_io.h
36
*
37
* This file contains the interface for the general IO component, which
38
* encapsulates the Input/Output functions for processors that do not
39
* require any special I/O handling.
40
*
41
* <pre>
42
* MODIFICATION HISTORY:
43
*
44
* Ver   Who  Date     Changes
45
* ----- ---- -------- -------------------------------------------------------
46
* 3.00a hbm  07/28/09 Initial release
47
* 3.00a hbm  07/21/10 Added Xil_EndianSwap32/16, Xil_Htonl/s, Xil_Ntohl/s
48
* 3.03a sdm  08/18/11 Added INST_SYNC and DATA_SYNC macros.
49
* 3.07a asa  08/31/12 Added xil_printf.h include
50
*
51
* </pre>
52
*
53
* @note
54
*
55
* This file may contain architecture-dependent items.
56
*
57
******************************************************************************/
58
 
59
#ifndef XIL_IO_H                        /* prevent circular inclusions */
60
#define XIL_IO_H                        /* by using protection macros */
61
 
62
#ifdef __cplusplus
63
extern "C" {
64
#endif
65
 
66
/***************************** Include Files *********************************/
67
 
68
#include "xil_types.h"
69
//#include "mb_interface.h"
70
#include "xil_printf.h"
71
#include "simple.h"
72
 
73
/************************** Constant Definitions *****************************/
74
 
75
/**************************** Function Prototypes ****************************/
76
 
77
u8 Xil_In8(u32 Addr);
78
u16 Xil_In16(u32 Addr);
79
u32 Xil_In32(u32 Addr);
80
 
81
void Xil_Out8(u32 Addr, u8 Value);
82
void Xil_Out16(u32 Addr, u16 Value);
83
void Xil_Out32(u32 Addr, u32 Value);
84
 
85
/***************** Macros (Inline Functions) Definitions *********************/
86
 
87
#if defined __GNUC__
88
#  define INST_SYNC             //mbar(0)
89
#  define DATA_SYNC             //mbar(1)
90
#else
91
#  define INST_SYNC
92
#  define DATA_SYNC
93
#endif /* __GNUC__ */
94
 
95
/*
96
 * The following macros allow optimized I/O operations for memory mapped I/O.
97
 * It should be noted that macros cannot be used if synchronization of the I/O
98
 * operation is needed as it will likely break some code.
99
 */
100
 
101
 
102
 
103
extern u16 Xil_EndianSwap16(u16 Data);
104
extern u32 Xil_EndianSwap32(u32 Data);
105
 
106
#ifndef __LITTLE_ENDIAN__
107
extern u16 Xil_In16LE(u32 Addr);
108
extern u32 Xil_In32LE(u32 Addr);
109
extern void Xil_Out16LE(u32 Addr, u16 Value);
110
extern void Xil_Out32LE(u32 Addr, u32 Value);
111
 
112
/**
113
*
114
* Perform an big-endian input operation for a 16-bit memory location
115
* by reading from the specified address and returning the value read from
116
* that address.
117
*
118
* @param        addr contains the address to perform the input operation at.
119
*
120
* @return       The value read from the specified input address with the
121
*               proper endianness. The return value has the same endianness
122
*               as that of the processor, i.e. if the processor is
123
*               little-engian, the return value is the byte-swapped value read
124
*               from the address.
125
*
126
* @note         None.
127
*
128
******************************************************************************/
129
#define Xil_In16BE(Addr) Xil_In16((Addr))
130
 
131
/**
132
*
133
* Perform a big-endian input operation for a 32-bit memory location
134
* by reading from the specified address and returning the value read from
135
* that address.
136
*
137
* @param        Addr contains the address to perform the input operation at.
138
*
139
* @return       The value read from the specified input address with the
140
*               proper endianness. The return value has the same endianness
141
*               as that of the processor, i.e. if the processor is
142
*               little-engian, the return value is the byte-swapped value read
143
*               from the address.
144
*
145
*
146
* @note         None.
147
*
148
******************************************************************************/
149
#define Xil_In32BE(Addr) Xil_In32((Addr))
150
 
151
/*****************************************************************************/
152
/**
153
*
154
* Perform a big-endian output operation for a 16-bit memory location
155
* by writing the specified value to the specified address.
156
*
157
* @param        Addr contains the address to perform the output operation at.
158
* @param        Value contains the value to be output at the specified address.
159
*               The value has the same endianness as that of the processor.
160
*               If the processor is little-endian, the byte-swapped value is
161
*               written to the address.
162
*
163
*
164
* @return       None
165
*
166
* @note         None.
167
*
168
******************************************************************************/
169
#define Xil_Out16BE(Addr, Value) Xil_Out16((Addr), (Value))
170
 
171
/*****************************************************************************/
172
/**
173
*
174
* Perform a big-endian output operation for a 32-bit memory location
175
* by writing the specified value to the specified address.
176
*
177
* @param        Addr contains the address to perform the output operation at.
178
* @param        Value contains the value to be output at the specified address.
179
*               The value has the same endianness as that of the processor.
180
*               If the processor is little-endian, the byte-swapped value is
181
*               written to the address.
182
*
183
* @return       None
184
*
185
* @note         None.
186
*
187
******************************************************************************/
188
#define Xil_Out32BE(Addr, Value) Xil_Out32((Addr), (Value))
189
 
190
#define Xil_Htonl(Data) (Data)
191
#define Xil_Htons(Data) (Data)
192
#define Xil_Ntohl(Data) (Data)
193
#define Xil_Ntohs(Data) (Data)
194
 
195
#else
196
 
197
extern u16 Xil_In16BE(u32 Addr);
198
extern u32 Xil_In32BE(u32 Addr);
199
extern void Xil_Out16BE(u32 Addr, u16 Value);
200
extern void Xil_Out32BE(u32 Addr, u32 Value);
201
 
202
#define Xil_In16LE(Addr) Xil_In16((Addr))
203
#define Xil_In32LE(Addr) Xil_In32((Addr))
204
#define Xil_Out16LE(Addr, Value) Xil_Out16((Addr), (Value))
205
#define Xil_Out32LE(Addr, Value) Xil_Out32((Addr), (Value))
206
 
207
 
208
/*****************************************************************************/
209
/**
210
*
211
* Convert a 32-bit number from host byte order to network byte order.
212
*
213
* @param        Data the 32-bit number to be converted.
214
*
215
* @return       The converted 32-bit number in network byte order.
216
*
217
* @note         None.
218
*
219
******************************************************************************/
220
#define Xil_Htonl(Data) Xil_EndianSwap32((Data))
221
 
222
/*****************************************************************************/
223
/**
224
*
225
* Convert a 16-bit number from host byte order to network byte order.
226
*
227
* @param        Data the 16-bit number to be converted.
228
*
229
* @return       The converted 16-bit number in network byte order.
230
*
231
* @note         None.
232
*
233
******************************************************************************/
234
#define Xil_Htons(Data) Xil_EndianSwap16((Data))
235
 
236
/*****************************************************************************/
237
/**
238
*
239
* Convert a 32-bit number from network byte order to host byte order.
240
*
241
* @param        Value the 32-bit number to be converted.
242
*
243
* @return       The converted 32-bit number in host byte order.
244
*
245
* @note         None.
246
*
247
******************************************************************************/
248
#define Xil_Ntohl(Data) Xil_EndianSwap32((Data))
249
 
250
/*****************************************************************************/
251
/**
252
*
253
* Convert a 16-bit number from network byte order to host byte order.
254
*
255
* @param        Value the 16-bit number to be converted.
256
*
257
* @return       The converted 16-bit number in host byte order.
258
*
259
* @note         None.
260
*
261
******************************************************************************/
262
#define Xil_Ntohs(Data) Xil_EndianSwap16((Data))
263
 
264
#endif
265
 
266
#ifdef __cplusplus
267
}
268
#endif
269
 
270
#endif /* end of protection macro */

powered by: WebSVN 2.1.0

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