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-2003 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
62 ******************************************************************************/
64 #ifndef XBASIC_TYPES_H /* prevent circular inclusions */
65 #define XBASIC_TYPES_H /* by using protection macros */
67 /***************************** Include Files *********************************/
69 /************************** Constant Definitions *****************************/
83 #define XCOMPONENT_IS_READY 0x11111111 /* component has been initialized */
84 #define XCOMPONENT_IS_STARTED 0x22222222 /* component has been started */
86 /* the following constants and declarations are for unit test purposes and are
87 * designed to be used in test applications.
89 #define XTEST_PASSED 0
90 #define XTEST_FAILED 1
92 #define XASSERT_NONE 0
93 #define XASSERT_OCCURRED 1
95 extern unsigned int XAssertStatus;
96 extern void XAssert(char *, int);
98 /**************************** Type Definitions *******************************/
100 /** @name Primitive types
101 * These primitive types are created for transportability.
102 * They are dependent upon the target architecture.
105 #include <linux/types.h>
112 /* Xilinx's unsigned integer types */
117 /* and signed integer types */
126 typedef unsigned long Xboolean;
135 * This data type defines an interrupt handler for a device.
136 * The argument points to the instance of the component
138 typedef void (*XInterruptHandler) (void *InstancePtr);
141 * This data type defines a callback to be invoked when an
142 * assert occurs. The callback is invoked only when asserts are enabled
144 typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber);
146 /***************** Macros (Inline Functions) Definitions *********************/
148 /*****************************************************************************/
150 * Return the most significant half of the 64 bit data type.
152 * @param x is the 64 bit word.
156 * The upper 32 bits of the 64 bit word.
162 ******************************************************************************/
163 #define XUINT64_MSW(x) ((x).Upper)
165 /*****************************************************************************/
167 * Return the least significant half of the 64 bit data type.
169 * @param x is the 64 bit word.
173 * The lower 32 bits of the 64 bit word.
179 ******************************************************************************/
180 #define XUINT64_LSW(x) ((x).Lower)
184 /*****************************************************************************/
186 * This assert macro is to be used for functions that do not return anything
187 * (void). This in conjunction with the XWaitInAssert boolean can be used to
188 * accomodate tests so that asserts which fail allow execution to continue.
190 * @param expression is the expression to evaluate. If it evaluates to false,
195 * Returns void unless the XWaitInAssert variable is true, in which case
196 * no return is made and an infinite loop is entered.
202 ******************************************************************************/
203 #define XASSERT_VOID(expression) \
206 XAssertStatus = XASSERT_NONE; \
208 XAssert(__FILE__, __LINE__); \
209 XAssertStatus = XASSERT_OCCURRED; \
214 /*****************************************************************************/
216 * This assert macro is to be used for functions that do return a value. This in
217 * conjunction with the XWaitInAssert boolean can be used to accomodate tests so
218 * that asserts which fail allow execution to continue.
220 * @param expression is the expression to evaluate. If it evaluates to false,
225 * Returns 0 unless the XWaitInAssert variable is true, in which case
226 * no return is made and an infinite loop is entered.
232 ******************************************************************************/
233 #define XASSERT_NONVOID(expression) \
236 XAssertStatus = XASSERT_NONE; \
238 XAssert(__FILE__, __LINE__); \
239 XAssertStatus = XASSERT_OCCURRED; \
244 /*****************************************************************************/
246 * Always assert. This assert macro is to be used for functions that do not
247 * return anything (void). Use for instances where an assert should always
252 * Returns void unless the XWaitInAssert variable is true, in which case
253 * no return is made and an infinite loop is entered.
259 ******************************************************************************/
260 #define XASSERT_VOID_ALWAYS() \
262 XAssert(__FILE__, __LINE__); \
263 XAssertStatus = XASSERT_OCCURRED; \
267 /*****************************************************************************/
269 * Always assert. This assert macro is to be used for functions that do return
270 * a value. Use for instances where an assert should always occur.
274 * Returns void unless the XWaitInAssert variable is true, in which case
275 * no return is made and an infinite loop is entered.
281 ******************************************************************************/
282 #define XASSERT_NONVOID_ALWAYS() \
284 XAssert(__FILE__, __LINE__); \
285 XAssertStatus = XASSERT_OCCURRED; \
291 #define XASSERT_VOID(expression)
292 #define XASSERT_VOID_ALWAYS()
293 #define XASSERT_NONVOID(expression)
294 #define XASSERT_NONVOID_ALWAYS()
297 /************************** Function Prototypes ******************************/
299 void XAssertSetCallback(XAssertCallback Routine);
301 #endif /* end of protection macro */