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.c
44 * This file contains basic functions for Xilinx software IP.
47 * MODIFICATION HISTORY:
49 * Ver Who Date Changes
50 * ----- ---- -------- -------------------------------------------------------
51 * 1.00a rpm 11/07/03 Added XNullHandler function as a stub interrupt handler
54 ******************************************************************************/
56 /***************************** Include Files *********************************/
58 #include "xbasic_types.h"
60 /************************** Constant Definitions *****************************/
62 /**************************** Type Definitions *******************************/
64 /***************** Macros (Inline Functions) Definitions *********************/
66 /************************** Variable Definitions *****************************/
69 * This variable allows testing to be done easier with asserts. An assert
70 * sets this variable such that a driver can evaluate this variable
71 * to determine if an assert occurred.
73 unsigned int XAssertStatus
;
76 * This variable allows the assert functionality to be changed for testing
77 * such that it does not wait infinitely. Use the debugger to disable the
78 * waiting during testing of asserts.
80 u32 XWaitInAssert
= TRUE
;
82 /* The callback function to be invoked when an assert is taken */
83 static XAssertCallback XAssertCallbackRoutine
= (XAssertCallback
) NULL
;
85 /************************** Function Prototypes ******************************/
87 /*****************************************************************************/
90 * Implements assert. Currently, it calls a user-defined callback function
91 * if one has been set. Then, it potentially enters an infinite loop depending
92 * on the value of the XWaitInAssert variable.
94 * @param File is the name of the filename of the source
95 * @param Line is the linenumber within File
105 ******************************************************************************/
107 XAssert(char *File
, int Line
)
109 /* if the callback has been set then invoke it */
110 if (XAssertCallbackRoutine
!= NULL
) {
111 (*XAssertCallbackRoutine
) (File
, Line
);
114 /* if specified, wait indefinitely such that the assert will show up
117 while (XWaitInAssert
) {
121 /*****************************************************************************/
124 * Sets up a callback function to be invoked when an assert occurs. If there
125 * was already a callback installed, then it is replaced.
127 * @param Routine is the callback to be invoked when an assert is taken
135 * This function has no effect if NDEBUG is set
137 ******************************************************************************/
139 XAssertSetCallback(XAssertCallback Routine
)
141 XAssertCallbackRoutine
= Routine
;
144 /*****************************************************************************/
147 * Null handler function. This follows the XInterruptHandler signature for
148 * interrupt handlers. It can be used to assign a null handler (a stub) to an
149 * interrupt controller vector table.
151 * @param NullParameter is an arbitrary void pointer and not used.
161 ******************************************************************************/
163 XNullHandler(void *NullParameter
)