1 /******************************************************************************
4 * (c) Copyright 2009 Xilinx, Inc. All rights reserved.
6 * This file contains confidential and proprietary information of Xilinx, Inc.
7 * and is protected under U.S. and international copyright and other
8 * intellectual property laws.
11 * This disclaimer is not a license and does not grant any rights to the
12 * materials distributed herewith. Except as otherwise provided in a valid
13 * license issued to you by Xilinx, and to the maximum extent permitted by
14 * applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
15 * FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
16 * IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
17 * MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
18 * and (2) Xilinx shall not be liable (whether in contract or tort, including
19 * negligence, or under any other theory of liability) for any loss or damage
20 * of any kind or nature related to, arising under or in connection with these
21 * materials, including for any direct, or any indirect, special, incidental,
22 * or consequential loss or damage (including loss of data, profits, goodwill,
23 * or any type of loss or damage suffered as a result of any action brought by
24 * a third party) even if such damage or loss was reasonably foreseeable or
25 * Xilinx had been advised of the possibility of the same.
27 * CRITICAL APPLICATIONS
28 * Xilinx products are not designed or intended to be fail-safe, or for use in
29 * any application requiring fail-safe performance, such as life-support or
30 * safety devices or systems, Class III medical devices, nuclear facilities,
31 * applications related to the deployment of airbags, or any other applications
32 * that could lead to death, personal injury, or severe property or
33 * environmental damage (individually and collectively, "Critical
34 * Applications"). Customer assumes the sole risk and liability of any use of
35 * Xilinx products in Critical Applications, subject only to applicable laws
36 * and regulations governing limitations on product liability.
38 * THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
42 ******************************************************************************/
43 /*****************************************************************************/
48 * This file contains basic assert related functions for Xilinx software IP.
51 * MODIFICATION HISTORY:
53 * Ver Who Date Changes
54 * ----- ---- -------- -------------------------------------------------------
55 * 1.00a hbm 07/14/09 Initial release
58 ******************************************************************************/
60 /***************************** Include Files *********************************/
62 #include "xil_types.h"
63 #include "xil_assert.h"
65 /************************** Constant Definitions *****************************/
67 /**************************** Type Definitions *******************************/
69 /***************** Macros (Inline Functions) Definitions *********************/
71 /************************** Variable Definitions *****************************/
74 * This variable allows testing to be done easier with asserts. An assert
75 * sets this variable such that a driver can evaluate this variable
76 * to determine if an assert occurred.
78 unsigned int Xil_AssertStatus;
81 * This variable allows the assert functionality to be changed for testing
82 * such that it does not wait infinitely. Use the debugger to disable the
83 * waiting during testing of asserts.
85 int Xil_AssertWait = TRUE;
87 /* The callback function to be invoked when an assert is taken */
88 static Xil_AssertCallback Xil_AssertCallbackRoutine = NULL;
90 /************************** Function Prototypes ******************************/
92 /*****************************************************************************/
95 * Implement assert. Currently, it calls a user-defined callback function
96 * if one has been set. Then, it potentially enters an infinite loop depending
97 * on the value of the Xil_AssertWait variable.
99 * @param file is the name of the filename of the source
100 * @param line is the linenumber within File
106 ******************************************************************************/
107 void Xil_Assert(const char *File, int Line)
109 /* if the callback has been set then invoke it */
110 if (Xil_AssertCallbackRoutine != 0) {
111 (*Xil_AssertCallbackRoutine)(File, Line);
114 /* if specified, wait indefinitely such that the assert will show up
117 while (Xil_AssertWait) {
121 /*****************************************************************************/
124 * Set 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
131 * @note This function has no effect if NDEBUG is set
133 ******************************************************************************/
134 void Xil_AssertSetCallback(Xil_AssertCallback Routine)
136 Xil_AssertCallbackRoutine = Routine;
139 /*****************************************************************************/
142 * Null handler function. This follows the XInterruptHandler signature for
143 * interrupt handlers. It can be used to assign a null handler (a stub) to an
144 * interrupt controller vector table.
146 * @param NullParameter is an arbitrary void pointer and not used.
152 ******************************************************************************/
153 void XNullHandler(void *NullParameter)
155 (void) NullParameter;