]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/xilinx/common/xbasic_types.h
1 /******************************************************************************
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.
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.
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.
30 * (c) Copyright 2002-2004 Xilinx Inc.
31 * All rights reserved.
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.
38 ******************************************************************************/
39 /*****************************************************************************/
42 * @file xbasic_types.h
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.
50 * This file contains items which are architecture dependent.
53 * MODIFICATION HISTORY:
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
60 * 1.00a rpm 11/07/03 Added XNullHandler function as a stub interrupt handler
63 ******************************************************************************/
65 #ifndef XBASIC_TYPES_H /* prevent circular inclusions */
66 #define XBASIC_TYPES_H /* by using protection macros */
68 /***************************** Include Files *********************************/
70 /************************** Constant Definitions *****************************/
84 #define XCOMPONENT_IS_READY 0x11111111 /* component has been initialized */
85 #define XCOMPONENT_IS_STARTED 0x22222222 /* component has been started */
87 /* the following constants and declarations are for unit test purposes and are
88 * designed to be used in test applications.
90 #define XTEST_PASSED 0
91 #define XTEST_FAILED 1
93 #define XASSERT_NONE 0
94 #define XASSERT_OCCURRED 1
96 extern unsigned int XAssertStatus
;
97 extern void XAssert(char *, int);
99 /**************************** Type Definitions *******************************/
101 /** @name Primitive types
102 * These primitive types are created for transportability.
103 * They are dependent upon the target architecture.
106 #include <linux/types.h>
116 * This data type defines an interrupt handler for a device.
117 * The argument points to the instance of the component
119 typedef void (*XInterruptHandler
) (void *InstancePtr
);
122 * This data type defines a callback to be invoked when an
123 * assert occurs. The callback is invoked only when asserts are enabled
125 typedef void (*XAssertCallback
) (char *FilenamePtr
, int LineNumber
);
127 /***************** Macros (Inline Functions) Definitions *********************/
129 /*****************************************************************************/
131 * Return the most significant half of the 64 bit data type.
133 * @param x is the 64 bit word.
137 * The upper 32 bits of the 64 bit word.
143 ******************************************************************************/
144 #define XUINT64_MSW(x) ((x).Upper)
146 /*****************************************************************************/
148 * Return the least significant half of the 64 bit data type.
150 * @param x is the 64 bit word.
154 * The lower 32 bits of the 64 bit word.
160 ******************************************************************************/
161 #define XUINT64_LSW(x) ((x).Lower)
165 /*****************************************************************************/
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.
171 * @param expression is the expression to evaluate. If it evaluates to false,
176 * Returns void unless the XWaitInAssert variable is true, in which case
177 * no return is made and an infinite loop is entered.
183 ******************************************************************************/
184 #define XASSERT_VOID(expression) \
187 XAssertStatus = XASSERT_NONE; \
189 XAssert(__FILE__, __LINE__); \
190 XAssertStatus = XASSERT_OCCURRED; \
195 /*****************************************************************************/
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.
201 * @param expression is the expression to evaluate. If it evaluates to false,
206 * Returns 0 unless the XWaitInAssert variable is true, in which case
207 * no return is made and an infinite loop is entered.
213 ******************************************************************************/
214 #define XASSERT_NONVOID(expression) \
217 XAssertStatus = XASSERT_NONE; \
219 XAssert(__FILE__, __LINE__); \
220 XAssertStatus = XASSERT_OCCURRED; \
225 /*****************************************************************************/
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
233 * Returns void unless the XWaitInAssert variable is true, in which case
234 * no return is made and an infinite loop is entered.
240 ******************************************************************************/
241 #define XASSERT_VOID_ALWAYS() \
243 XAssert(__FILE__, __LINE__); \
244 XAssertStatus = XASSERT_OCCURRED; \
248 /*****************************************************************************/
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.
255 * Returns void unless the XWaitInAssert variable is true, in which case
256 * no return is made and an infinite loop is entered.
262 ******************************************************************************/
263 #define XASSERT_NONVOID_ALWAYS() \
265 XAssert(__FILE__, __LINE__); \
266 XAssertStatus = XASSERT_OCCURRED; \
272 #define XASSERT_VOID(expression)
273 #define XASSERT_VOID_ALWAYS()
274 #define XASSERT_NONVOID(expression)
275 #define XASSERT_NONVOID_ALWAYS()
278 /************************** Function Prototypes ******************************/
280 void XAssertSetCallback(XAssertCallback Routine
);
281 void XNullHandler(void *NullParameter
);
283 #endif /* end of protection macro */