]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53_bsp/psu_cortexa53_0/libsrc/standalone_v5_4/src/xil_io.h
Update BSP source files for UltraScale Cortex-A53 and Cortex-R5 and Microblaze to...
[freertos] / FreeRTOS / Demo / CORTEX_A53_64-bit_UltraScale_MPSoC / RTOSDemo_A53_bsp / psu_cortexa53_0 / libsrc / standalone_v5_4 / src / xil_io.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2014 - 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 *
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 *
42 * <pre>
43 * MODIFICATION HISTORY:
44 *
45 * Ver   Who      Date     Changes
46 * ----- -------- -------- -----------------------------------------------
47 * 5.00  pkp      05/29/14 First release
48 * </pre>
49 ******************************************************************************/
50
51 #ifndef XIL_IO_H           /* prevent circular inclusions */
52 #define XIL_IO_H           /* by using protection macros */
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58 /***************************** Include Files *********************************/
59
60 #include "xil_types.h"
61 #include "xpseudo_asm.h"
62 #include "xil_printf.h"
63
64 /************************** Constant Definitions *****************************/
65
66 /**************************** Type Definitions *******************************/
67
68 /***************** Macros (Inline Functions) Definitions *********************/
69
70 #  define SYNCHRONIZE_IO        dmb()
71 #  define INST_SYNC             isb()
72 #  define DATA_SYNC             dsb()
73
74
75 /*****************************************************************************/
76 /**
77 *
78 * Perform an big-endian input operation for a 16-bit memory location
79 * by reading from the specified address and returning the Value read from
80 * that address.
81 *
82 * @param        Addr contains the address to perform the input operation at.
83 *
84 * @return       The Value read from the specified input address with the
85 *               proper endianness. The return Value has the same endianness
86 *               as that of the processor, i.e. if the processor is
87 *               little-engian, the return Value is the byte-swapped Value read
88 *               from the address.
89 *
90 * @note         None.
91 *
92 ******************************************************************************/
93 #define Xil_In16LE(Addr) Xil_In16((Addr))
94
95 /*****************************************************************************/
96 /**
97 *
98 * Perform a big-endian input operation for a 32-bit memory location
99 * by reading from the specified address and returning the Value read from
100 * that address.
101 *
102 * @param        Addr contains the address to perform the input operation at.
103 *
104 * @return       The Value read from the specified input address with the
105 *               proper endianness. The return Value has the same endianness
106 *               as that of the processor, i.e. if the processor is
107 *               little-engian, the return Value is the byte-swapped Value read
108 *               from the address.
109 *
110 *
111 * @note         None.
112 *
113 ******************************************************************************/
114 #define Xil_In32LE(Addr) Xil_In32((Addr))
115
116 /*****************************************************************************/
117 /**
118 *
119 * Perform a big-endian output operation for a 16-bit memory location
120 * by writing the specified Value to the specified address.
121 *
122 * @param        Addr contains the address to perform the output operation at.
123 * @param        Value contains the Value to be output at the specified address.
124 *               The Value has the same endianness as that of the processor.
125 *               If the processor is little-endian, the byte-swapped Value is
126 *               written to the address.
127 *
128 *
129 * @return       None
130 *
131 * @note         None.
132 *
133 ******************************************************************************/
134 #define Xil_Out16LE(Addr, Value) Xil_Out16((Addr), (Value))
135
136 /*****************************************************************************/
137 /**
138 *
139 * Perform a big-endian output operation for a 32-bit memory location
140 * by writing the specified Value to the specified address.
141 *
142 * @param        Addr contains the address to perform the output operation at.
143 * @param        Value contains the Value to be output at the specified address.
144 *               The Value has the same endianness as that of the processor.
145 *               If the processor is little-endian, the byte-swapped Value is
146 *               written to the address.
147 *
148 * @return       None
149 *
150 * @note         None.
151 *
152 ******************************************************************************/
153 #define Xil_Out32LE(Addr, Value) Xil_Out32((Addr), (Value))
154
155 /*****************************************************************************/
156 /**
157 *
158 * Convert a 32-bit number from host byte order to network byte order.
159 *
160 * @param        Data the 32-bit number to be converted.
161 *
162 * @return       The converted 32-bit number in network byte order.
163 *
164 * @note         None.
165 *
166 ******************************************************************************/
167 #define Xil_Htonl(Data) Xil_EndianSwap32((Data))
168
169 /*****************************************************************************/
170 /**
171 *
172 * Convert a 16-bit number from host byte order to network byte order.
173 *
174 * @param        Data the 16-bit number to be converted.
175 *
176 * @return       The converted 16-bit number in network byte order.
177 *
178 * @note         None.
179 *
180 ******************************************************************************/
181 #define Xil_Htons(Data) Xil_EndianSwap16((Data))
182
183 /*****************************************************************************/
184 /**
185 *
186 * Convert a 32-bit number from network byte order to host byte order.
187 *
188 * @param        Data the 32-bit number to be converted.
189 *
190 * @return       The converted 32-bit number in host byte order.
191 *
192 * @note         None.
193 *
194 ******************************************************************************/
195 #define Xil_Ntohl(Data) Xil_EndianSwap32((Data))
196
197 /*****************************************************************************/
198 /**
199 *
200 * Convert a 16-bit number from network byte order to host byte order.
201 *
202 * @param        Data the 16-bit number to be converted.
203 *
204 * @return       The converted 16-bit number in host byte order.
205 *
206 * @note         None.
207 *
208 ******************************************************************************/
209 #define Xil_Ntohs(Data) Xil_EndianSwap16((Data))
210
211 /************************** Function Prototypes ******************************/
212
213 /* The following functions allow the software to be transportable across
214  * processors which may use memory mapped I/O or I/O which is mapped into a
215  * seperate address space.
216  */
217 u8 Xil_In8(INTPTR Addr);
218 u16 Xil_In16(INTPTR Addr);
219 u32 Xil_In32(INTPTR Addr);
220 u64 Xil_In64(INTPTR Addr);
221
222 void Xil_Out8(INTPTR Addr, u8 Value);
223 void Xil_Out16(INTPTR Addr, u16 Value);
224 void Xil_Out32(INTPTR Addr, u32 Value);
225 void Xil_Out64(INTPTR Addr, u64 Value);
226
227
228 u16 Xil_In16BE(INTPTR Addr);
229 u32 Xil_In32BE(INTPTR Addr);
230 void Xil_Out16BE(INTPTR Addr, u16 Value);
231 void Xil_Out32BE(INTPTR Addr, u32 Value);
232
233 u16 Xil_EndianSwap16(u16 Data);
234 u32 Xil_EndianSwap32(u32 Data);
235
236 #ifdef __cplusplus
237 }
238 #endif
239
240 #endif /* end of protection macro */