]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/xilinx/common/xbasic_types.h
board: xilinx: Remove unused ancient i2c driver
[people/ms/u-boot.git] / board / xilinx / common / xbasic_types.h
1 /******************************************************************************
2 *
3 * Author: Xilinx, Inc.
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 *
12 * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
13 * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
14 * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
15 * XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
16 * FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
17 * ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
18 * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
19 * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
20 * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
21 * CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 * FITNESS FOR A PARTICULAR PURPOSE.
23 *
24 *
25 * Xilinx hardware products are not intended for use in life support
26 * appliances, devices, or systems. Use in such applications is
27 * expressly prohibited.
28 *
29 *
30 * (c) Copyright 2002-2004 Xilinx Inc.
31 * All rights reserved.
32 *
33 *
34 * You should have received a copy of the GNU General Public License along
35 * with this program; if not, write to the Free Software Foundation, Inc.,
36 * 675 Mass Ave, Cambridge, MA 02139, USA.
37 *
38 ******************************************************************************/
39 /*****************************************************************************/
40 /**
41 *
42 * @file xbasic_types.h
43 *
44 * This file contains basic types for Xilinx software IP. These types do not
45 * follow the standard naming convention with respect to using the component
46 * name in front of each name because they are considered to be primitives.
47 *
48 * @note
49 *
50 * This file contains items which are architecture dependent.
51 *
52 * <pre>
53 * MODIFICATION HISTORY:
54 *
55 * Ver Who Date Changes
56 * ----- ---- -------- -------------------------------------------------------
57 * 1.00a rmm 12/14/01 First release
58 * rmm 05/09/03 Added "xassert always" macros to rid ourselves of diab
59 * compiler warnings
60 * 1.00a rpm 11/07/03 Added XNullHandler function as a stub interrupt handler
61 * </pre>
62 *
63 ******************************************************************************/
64
65 #ifndef XBASIC_TYPES_H /* prevent circular inclusions */
66 #define XBASIC_TYPES_H /* by using protection macros */
67
68 /***************************** Include Files *********************************/
69
70 /************************** Constant Definitions *****************************/
71
72 #ifndef TRUE
73 #define TRUE 1
74 #endif
75 #ifndef FALSE
76 #define FALSE 0
77 #endif
78
79 #ifndef NULL
80 #define NULL 0
81 #endif
82 /** Null */
83
84 #define XCOMPONENT_IS_READY 0x11111111 /* component has been initialized */
85 #define XCOMPONENT_IS_STARTED 0x22222222 /* component has been started */
86
87 /* the following constants and declarations are for unit test purposes and are
88 * designed to be used in test applications.
89 */
90 #define XTEST_PASSED 0
91 #define XTEST_FAILED 1
92
93 #define XASSERT_NONE 0
94 #define XASSERT_OCCURRED 1
95
96 extern unsigned int XAssertStatus;
97 extern void XAssert(char *, int);
98
99 /**************************** Type Definitions *******************************/
100
101 /** @name Primitive types
102 * These primitive types are created for transportability.
103 * They are dependent upon the target architecture.
104 * @{
105 */
106 #include <linux/types.h>
107
108 typedef struct {
109 u32 Upper;
110 u32 Lower;
111 } Xuint64;
112
113 /*@}*/
114
115 /**
116 * This data type defines an interrupt handler for a device.
117 * The argument points to the instance of the component
118 */
119 typedef void (*XInterruptHandler) (void *InstancePtr);
120
121 /**
122 * This data type defines a callback to be invoked when an
123 * assert occurs. The callback is invoked only when asserts are enabled
124 */
125 typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber);
126
127 /***************** Macros (Inline Functions) Definitions *********************/
128
129 /*****************************************************************************/
130 /**
131 * Return the most significant half of the 64 bit data type.
132 *
133 * @param x is the 64 bit word.
134 *
135 * @return
136 *
137 * The upper 32 bits of the 64 bit word.
138 *
139 * @note
140 *
141 * None.
142 *
143 ******************************************************************************/
144 #define XUINT64_MSW(x) ((x).Upper)
145
146 /*****************************************************************************/
147 /**
148 * Return the least significant half of the 64 bit data type.
149 *
150 * @param x is the 64 bit word.
151 *
152 * @return
153 *
154 * The lower 32 bits of the 64 bit word.
155 *
156 * @note
157 *
158 * None.
159 *
160 ******************************************************************************/
161 #define XUINT64_LSW(x) ((x).Lower)
162
163 #ifndef NDEBUG
164
165 /*****************************************************************************/
166 /**
167 * This assert macro is to be used for functions that do not return anything
168 * (void). This in conjunction with the XWaitInAssert boolean can be used to
169 * accomodate tests so that asserts which fail allow execution to continue.
170 *
171 * @param expression is the expression to evaluate. If it evaluates to false,
172 * the assert occurs.
173 *
174 * @return
175 *
176 * Returns void unless the XWaitInAssert variable is true, in which case
177 * no return is made and an infinite loop is entered.
178 *
179 * @note
180 *
181 * None.
182 *
183 ******************************************************************************/
184 #define XASSERT_VOID(expression) \
185 { \
186 if (expression) { \
187 XAssertStatus = XASSERT_NONE; \
188 } else { \
189 XAssert(__FILE__, __LINE__); \
190 XAssertStatus = XASSERT_OCCURRED; \
191 return; \
192 } \
193 }
194
195 /*****************************************************************************/
196 /**
197 * This assert macro is to be used for functions that do return a value. This in
198 * conjunction with the XWaitInAssert boolean can be used to accomodate tests so
199 * that asserts which fail allow execution to continue.
200 *
201 * @param expression is the expression to evaluate. If it evaluates to false,
202 * the assert occurs.
203 *
204 * @return
205 *
206 * Returns 0 unless the XWaitInAssert variable is true, in which case
207 * no return is made and an infinite loop is entered.
208 *
209 * @note
210 *
211 * None.
212 *
213 ******************************************************************************/
214 #define XASSERT_NONVOID(expression) \
215 { \
216 if (expression) { \
217 XAssertStatus = XASSERT_NONE; \
218 } else { \
219 XAssert(__FILE__, __LINE__); \
220 XAssertStatus = XASSERT_OCCURRED; \
221 return 0; \
222 } \
223 }
224
225 /*****************************************************************************/
226 /**
227 * Always assert. This assert macro is to be used for functions that do not
228 * return anything (void). Use for instances where an assert should always
229 * occur.
230 *
231 * @return
232 *
233 * Returns void unless the XWaitInAssert variable is true, in which case
234 * no return is made and an infinite loop is entered.
235 *
236 * @note
237 *
238 * None.
239 *
240 ******************************************************************************/
241 #define XASSERT_VOID_ALWAYS() \
242 { \
243 XAssert(__FILE__, __LINE__); \
244 XAssertStatus = XASSERT_OCCURRED; \
245 return; \
246 }
247
248 /*****************************************************************************/
249 /**
250 * Always assert. This assert macro is to be used for functions that do return
251 * a value. Use for instances where an assert should always occur.
252 *
253 * @return
254 *
255 * Returns void unless the XWaitInAssert variable is true, in which case
256 * no return is made and an infinite loop is entered.
257 *
258 * @note
259 *
260 * None.
261 *
262 ******************************************************************************/
263 #define XASSERT_NONVOID_ALWAYS() \
264 { \
265 XAssert(__FILE__, __LINE__); \
266 XAssertStatus = XASSERT_OCCURRED; \
267 return 0; \
268 }
269
270 #else
271
272 #define XASSERT_VOID(expression)
273 #define XASSERT_VOID_ALWAYS()
274 #define XASSERT_NONVOID(expression)
275 #define XASSERT_NONVOID_ALWAYS()
276 #endif
277
278 /************************** Function Prototypes ******************************/
279
280 void XAssertSetCallback(XAssertCallback Routine);
281 void XNullHandler(void *NullParameter);
282
283 #endif /* end of protection macro */