]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/standalone_v5_4/src/xil_io.h
Correct alignment issue in GCC and RVDS Cortex-A9 port that was preventing full float...
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_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      02/20/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 #if defined __GNUC__
71 #  define SYNCHRONIZE_IO        dmb()
72 #  define INST_SYNC             isb()
73 #  define DATA_SYNC             dsb()
74 #else
75 #  define SYNCHRONIZE_IO
76 #  define INST_SYNC
77 #  define DATA_SYNC
78 #endif /* __GNUC__ */
79
80 /*****************************************************************************/
81 /**
82 *
83 * Perform an big-endian input operation for a 16-bit memory location
84 * by reading from the specified address and returning the Value read from
85 * that address.
86 *
87 * @param        Addr contains the address to perform the input operation at.
88 *
89 * @return       The Value read from the specified input address with the
90 *               proper endianness. The return Value has the same endianness
91 *               as that of the processor, i.e. if the processor is
92 *               little-engian, the return Value is the byte-swapped Value read
93 *               from the address.
94 *
95 * @note         None.
96 *
97 ******************************************************************************/
98 #define Xil_In16LE(Addr) Xil_In16((Addr))
99
100 /*****************************************************************************/
101 /**
102 *
103 * Perform a big-endian input operation for a 32-bit memory location
104 * by reading from the specified address and returning the Value read from
105 * that address.
106 *
107 * @param        Addr contains the address to perform the input operation at.
108 *
109 * @return       The Value read from the specified input address with the
110 *               proper endianness. The return Value has the same endianness
111 *               as that of the processor, i.e. if the processor is
112 *               little-engian, the return Value is the byte-swapped Value read
113 *               from the address.
114 *
115 *
116 * @note         None.
117 *
118 ******************************************************************************/
119 #define Xil_In32LE(Addr) Xil_In32((Addr))
120
121 /*****************************************************************************/
122 /**
123 *
124 * Perform a big-endian output operation for a 16-bit memory location
125 * by writing the specified Value to the specified address.
126 *
127 * @param        Addr contains the address to perform the output operation at.
128 * @param        Value contains the Value to be output at the specified address.
129 *               The Value has the same endianness as that of the processor.
130 *               If the processor is little-endian, the byte-swapped Value is
131 *               written to the address.
132 *
133 *
134 * @return       None
135 *
136 * @note         None.
137 *
138 ******************************************************************************/
139 #define Xil_Out16LE(Addr, Value) Xil_Out16((Addr), (Value))
140
141 /*****************************************************************************/
142 /**
143 *
144 * Perform a big-endian output operation for a 32-bit memory location
145 * by writing the specified Value to the specified address.
146 *
147 * @param        Addr contains the address to perform the output operation at.
148 * @param        Value contains the Value to be output at the specified address.
149 *               The Value has the same endianness as that of the processor.
150 *               If the processor is little-endian, the byte-swapped Value is
151 *               written to the address.
152 *
153 * @return       None
154 *
155 * @note         None.
156 *
157 ******************************************************************************/
158 #define Xil_Out32LE(Addr, Value) Xil_Out32((Addr), (Value))
159
160 /*****************************************************************************/
161 /**
162 *
163 * Convert a 32-bit number from host byte order to network byte order.
164 *
165 * @param        Data the 32-bit number to be converted.
166 *
167 * @return       The converted 32-bit number in network byte order.
168 *
169 * @note         None.
170 *
171 ******************************************************************************/
172 #define Xil_Htonl(Data) Xil_EndianSwap32((Data))
173
174 /*****************************************************************************/
175 /**
176 *
177 * Convert a 16-bit number from host byte order to network byte order.
178 *
179 * @param        Data the 16-bit number to be converted.
180 *
181 * @return       The converted 16-bit number in network byte order.
182 *
183 * @note         None.
184 *
185 ******************************************************************************/
186 #define Xil_Htons(Data) Xil_EndianSwap16((Data))
187
188 /*****************************************************************************/
189 /**
190 *
191 * Convert a 32-bit number from network byte order to host byte order.
192 *
193 * @param        Data the 32-bit number to be converted.
194 *
195 * @return       The converted 32-bit number in host byte order.
196 *
197 * @note         None.
198 *
199 ******************************************************************************/
200 #define Xil_Ntohl(Data) Xil_EndianSwap32((Data))
201
202 /*****************************************************************************/
203 /**
204 *
205 * Convert a 16-bit number from network byte order to host byte order.
206 *
207 * @param        Data the 16-bit number to be converted.
208 *
209 * @return       The converted 16-bit number in host byte order.
210 *
211 * @note         None.
212 *
213 ******************************************************************************/
214 #define Xil_Ntohs(Data) Xil_EndianSwap16((Data))
215
216 /************************** Function Prototypes ******************************/
217
218 /* The following functions allow the software to be transportable across
219  * processors which may use memory mapped I/O or I/O which is mapped into a
220  * seperate address space.
221  */
222 u8 Xil_In8(INTPTR Addr);
223 u16 Xil_In16(INTPTR Addr);
224 u32 Xil_In32(INTPTR Addr);
225 u64 Xil_In64(INTPTR Addr);
226
227 void Xil_Out8(INTPTR Addr, u8 Value);
228 void Xil_Out16(INTPTR Addr, u16 Value);
229 void Xil_Out32(INTPTR Addr, u32 Value);
230 void Xil_Out64(INTPTR Addr, u64 Value);
231
232 u16 Xil_In16BE(INTPTR Addr);
233 u32 Xil_In32BE(INTPTR Addr);
234 void Xil_Out16BE(INTPTR Addr, u16 Value);
235 void Xil_Out32BE(INTPTR Addr, u32 Value);
236
237 u16 Xil_EndianSwap16(u16 Data);
238 u32 Xil_EndianSwap32(u32 Data);
239
240 #ifdef __cplusplus
241 }
242 #endif
243
244 #endif /* end of protection macro */