]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53_bsp/psu_cortexa53_0/libsrc/standalone_v6_1/src/xil_io.h
xTaskGenericNotify() now sets xYieldPending to pdTRUE even when the 'higher priority...
[freertos] / FreeRTOS / Demo / CORTEX_A53_64-bit_UltraScale_MPSoC / RTOSDemo_A53_bsp / psu_cortexa53_0 / libsrc / standalone_v6_1 / src / xil_io.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2014 - 2016 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 * 6.00  mus      08/19/16 Remove checking of __LITTLE_ENDIAN__ flag for
49 *                         ARM processors
50 * </pre>
51 ******************************************************************************/
52
53 #ifndef XIL_IO_H           /* prevent circular inclusions */
54 #define XIL_IO_H           /* by using protection macros */
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 /***************************** Include Files *********************************/
61
62 #include "xil_types.h"
63 #include "xil_printf.h"
64
65 #if defined (__MICROBLAZE__)
66 #include "mb_interface.h"
67 #else
68 #include "xpseudo_asm.h"
69 #endif
70
71 /************************** Function Prototypes ******************************/
72 u16 Xil_EndianSwap16(u16 Data);
73 u32 Xil_EndianSwap32(u32 Data);
74
75 /***************** Macros (Inline Functions) Definitions *********************/
76 #if defined __GNUC__
77 #if defined (__MICROBLAZE__)
78 #  define INST_SYNC             mbar(0)
79 #  define DATA_SYNC             mbar(1)
80 # else
81 #  define SYNCHRONIZE_IO        dmb()
82 #  define INST_SYNC             isb()
83 #  define DATA_SYNC             dsb()
84 # endif
85 #else
86 # define SYNCHRONIZE_IO
87 # define INST_SYNC
88 # define DATA_SYNC
89 # define INST_SYNC
90 # define DATA_SYNC
91 #endif
92
93 #if defined (__GNUC__) || defined (__ICCARM__) || defined (__MICROBLAZE__)
94 #define INLINE inline
95 #else
96 #define INLINE __inline
97 #endif
98
99 /*****************************************************************************/
100 /**
101 *
102 * Performs an input operation for an 8-bit memory location by reading from the
103 * specified address and returning the Value read from that address.
104 *
105 * @param        Addr contains the address to perform the input operation
106 *               at.
107 *
108 * @return       The Value read from the specified input address.
109 *
110 * @note         None.
111 *
112 ******************************************************************************/
113 static INLINE u8 Xil_In8(UINTPTR Addr)
114 {
115         return *(volatile u8 *) Addr;
116 }
117
118 /*****************************************************************************/
119 /**
120 *
121 * Performs an input operation for a 16-bit memory location by reading from the
122 * specified address and returning the Value read from that address.
123 *
124 * @param        Addr contains the address to perform the input operation
125 *               at.
126 *
127 * @return       The Value read from the specified input address.
128 *
129 * @note         None.
130 *
131 ******************************************************************************/
132 static INLINE u16 Xil_In16(UINTPTR Addr)
133 {
134         return *(volatile u16 *) Addr;
135 }
136
137 /*****************************************************************************/
138 /**
139 *
140 * Performs an input operation for a 32-bit memory location by reading from the
141 * specified address and returning the Value read from that address.
142 *
143 * @param        Addr contains the address to perform the input operation
144 *               at.
145 *
146 * @return       The Value read from the specified input address.
147 *
148 * @note         None.
149 *
150 ******************************************************************************/
151 static INLINE u32 Xil_In32(UINTPTR Addr)
152 {
153         return *(volatile u32 *) Addr;
154 }
155
156 /*****************************************************************************/
157 /**
158 *
159 * Performs an input operation for a 64-bit memory location by reading the
160 * specified Value to the the specified address.
161 *
162 * @param        OutAddress contains the address to perform the output operation
163 *               at.
164 * @param        Value contains the Value to be output at the specified address.
165 *
166 * @return       None.
167 *
168 * @note         None.
169 *
170 ******************************************************************************/
171 static INLINE u64 Xil_In64(UINTPTR Addr)
172 {
173         return *(volatile u64 *) Addr;
174 }
175
176 /*****************************************************************************/
177 /**
178 *
179 * Performs an output operation for an 8-bit memory location by writing the
180 * specified Value to the the specified address.
181 *
182 * @param        Addr contains the address to perform the output operation
183 *               at.
184 * @param        Value contains the Value to be output at the specified address.
185 *
186 * @return       None.
187 *
188 * @note         None.
189 *
190 ******************************************************************************/
191 static INLINE void Xil_Out8(UINTPTR Addr, u8 Value)
192 {
193         volatile u8 *LocalAddr = (volatile u8 *)Addr;
194         *LocalAddr = Value;
195 }
196
197 /*****************************************************************************/
198 /**
199 *
200 * Performs an output operation for a 16-bit memory location by writing the
201 * specified Value to the the specified address.
202 *
203 * @param        Addr contains the address to perform the output operation
204 *               at.
205 * @param        Value contains the Value to be output at the specified address.
206 *
207 * @return       None.
208 *
209 * @note         None.
210 *
211 ******************************************************************************/
212 static INLINE void Xil_Out16(UINTPTR Addr, u16 Value)
213 {
214         volatile u16 *LocalAddr = (volatile u16 *)Addr;
215         *LocalAddr = Value;
216 }
217
218 /*****************************************************************************/
219 /**
220 *
221 * Performs an output operation for a 32-bit memory location by writing the
222 * specified Value to the the specified address.
223 *
224 * @param        Addr contains the address to perform the output operation
225 *               at.
226 * @param        Value contains the Value to be output at the specified address.
227 *
228 * @return       None.
229 *
230 * @note         None.
231 *
232 ******************************************************************************/
233 static INLINE void Xil_Out32(UINTPTR Addr, u32 Value)
234 {
235         volatile u32 *LocalAddr = (volatile u32 *)Addr;
236         *LocalAddr = Value;
237 }
238
239 /*****************************************************************************/
240 /**
241 *
242 * Performs an output operation for a 64-bit memory location by writing the
243 * specified Value to the the specified address.
244 *
245 * @param        Addr contains the address to perform the output operation
246 *               at.
247 * @param        Value contains the Value to be output at the specified address.
248 *
249 * @return       None.
250 *
251 * @note         None.
252 *
253 ******************************************************************************/
254 static INLINE void Xil_Out64(UINTPTR Addr, u64 Value)
255 {
256         volatile u64 *LocalAddr = (volatile u64 *)Addr;
257         *LocalAddr = Value;
258 }
259
260 #if defined (__MICROBLAZE__)
261 #ifdef __LITTLE_ENDIAN__
262 # define Xil_In16LE     Xil_In16
263 # define Xil_In32LE     Xil_In32
264 # define Xil_Out16LE    Xil_Out16
265 # define Xil_Out32LE    Xil_Out32
266 # define Xil_Htons      Xil_EndianSwap16
267 # define Xil_Htonl      Xil_EndianSwap32
268 # define Xil_Ntohs      Xil_EndianSwap16
269 # define Xil_Ntohl      Xil_EndianSwap32
270 # else
271 # define Xil_In16BE     Xil_In16
272 # define Xil_In32BE     Xil_In32
273 # define Xil_Out16BE    Xil_Out16
274 # define Xil_Out32BE    Xil_Out32
275 # define Xil_Htons(Data) (Data)
276 # define Xil_Htonl(Data) (Data)
277 # define Xil_Ntohs(Data) (Data)
278 # define Xil_Ntohl(Data) (Data)
279 #endif
280 #else
281 # define Xil_In16LE     Xil_In16
282 # define Xil_In32LE     Xil_In32
283 # define Xil_Out16LE    Xil_Out16
284 # define Xil_Out32LE    Xil_Out32
285 # define Xil_Htons      Xil_EndianSwap16
286 # define Xil_Htonl      Xil_EndianSwap32
287 # define Xil_Ntohs      Xil_EndianSwap16
288 # define Xil_Ntohl      Xil_EndianSwap32
289 #endif
290
291 #if defined (__MICROBLAZE__)
292 #ifdef __LITTLE_ENDIAN__
293 static INLINE u16 Xil_In16BE(UINTPTR Addr)
294 #else
295 static INLINE u16 Xil_In16LE(UINTPTR Addr)
296 #endif
297 #else
298 static INLINE u16 Xil_In16BE(UINTPTR Addr)
299 #endif
300 {
301         u16 value = Xil_In16(Addr);
302         return Xil_EndianSwap16(value);
303 }
304
305 #if defined (__MICROBLAZE__)
306 #ifdef __LITTLE_ENDIAN__
307 static INLINE u32 Xil_In32BE(UINTPTR Addr)
308 #else
309 static INLINE u32 Xil_In32LE(UINTPTR Addr)
310 #endif
311 #else
312 static INLINE u32 Xil_In32BE(UINTPTR Addr)
313 #endif
314 {
315         u16 value = Xil_In32(Addr);
316         return Xil_EndianSwap32(value);
317 }
318
319 #if defined (__MICROBLAZE__)
320 #ifdef __LITTLE_ENDIAN__
321 static INLINE void Xil_Out16BE(UINTPTR Addr, u16 Value)
322 #else
323 static INLINE void Xil_Out16LE(UINTPTR Addr, u16 Value)
324 #endif
325 #else
326 static INLINE void Xil_Out16BE(UINTPTR Addr, u16 Value)
327 #endif
328 {
329         Value = Xil_EndianSwap16(Value);
330         Xil_Out16(Addr, Value);
331 }
332
333 #if defined (__MICROBLAZE__)
334 #ifdef __LITTLE_ENDIAN__
335 static INLINE void Xil_Out32BE(UINTPTR Addr, u32 Value)
336 #else
337 static INLINE void Xil_Out32LE(UINTPTR Addr, u32 Value)
338 #endif
339 #else
340 static INLINE void Xil_Out32BE(UINTPTR Addr, u32 Value)
341 #endif
342 {
343         Value = Xil_EndianSwap32(Value);
344         Xil_Out32(Addr, Value);
345 }
346
347 #ifdef __cplusplus
348 }
349 #endif
350
351 #endif /* end of protection macro */