]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/standalone_v6_1/src/xil_assert.h
xTaskGenericNotify() now sets xYieldPending to pdTRUE even when the 'higher priority...
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_0 / libsrc / standalone_v6_1 / src / xil_assert.h
1 /******************************************************************************
2 *
3 * Copyright (C) 2009 - 2016 Xilinx, Inc. All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 *
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
30 *
31 ******************************************************************************/
32 /*****************************************************************************/
33 /**
34 *
35 * @file xil_assert.h
36 *
37 * This file contains assert related functions.
38 *
39 * <pre>
40 * MODIFICATION HISTORY:
41 *
42 * Ver   Who    Date   Changes
43 * ----- ---- -------- -------------------------------------------------------
44 * 1.00a hbm  07/14/09 First release
45 * 6.0   kvn  05/31/16 Make Xil_AsserWait a global variable
46 * </pre>
47 *
48 ******************************************************************************/
49
50 #ifndef XIL_ASSERT_H    /* prevent circular inclusions */
51 #define XIL_ASSERT_H    /* by using protection macros */
52
53 #include "xil_types.h"
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59
60 /***************************** Include Files *********************************/
61
62
63 /************************** Constant Definitions *****************************/
64
65 #define XIL_ASSERT_NONE     0U
66 #define XIL_ASSERT_OCCURRED 1U
67 #define XNULL NULL
68
69 extern u32 Xil_AssertStatus;
70 extern s32 Xil_AssertWait;
71 extern void Xil_Assert(const char8 *File, s32 Line);
72 void XNullHandler(void *NullParameter);
73
74 /**
75  * This data type defines a callback to be invoked when an
76  * assert occurs. The callback is invoked only when asserts are enabled
77  */
78 typedef void (*Xil_AssertCallback) (const char8 *File, s32 Line);
79
80 /***************** Macros (Inline Functions) Definitions *********************/
81
82 #ifndef NDEBUG
83
84 /*****************************************************************************/
85 /**
86 * This assert macro is to be used for functions that do not return anything
87 * (void). This in conjunction with the Xil_AssertWait boolean can be used to
88 * accomodate tests so that asserts which fail allow execution to continue.
89 *
90 * @param    Expression is the expression to evaluate. If it evaluates to
91 *           false, the assert occurs.
92 *
93 * @return   Returns void unless the Xil_AssertWait variable is true, in which
94 *           case no return is made and an infinite loop is entered.
95 *
96 * @note     None.
97 *
98 ******************************************************************************/
99 #define Xil_AssertVoid(Expression)                \
100 {                                                  \
101     if (Expression) {                              \
102         Xil_AssertStatus = XIL_ASSERT_NONE;       \
103     } else {                                       \
104         Xil_Assert(__FILE__, __LINE__);            \
105         Xil_AssertStatus = XIL_ASSERT_OCCURRED;   \
106         return;                                    \
107     }                                              \
108 }
109
110 /*****************************************************************************/
111 /**
112 * This assert macro is to be used for functions that do return a value. This in
113 * conjunction with the Xil_AssertWait boolean can be used to accomodate tests
114 * so that asserts which fail allow execution to continue.
115 *
116 * @param    Expression is the expression to evaluate. If it evaluates to false,
117 *           the assert occurs.
118 *
119 * @return   Returns 0 unless the Xil_AssertWait variable is true, in which
120 *           case no return is made and an infinite loop is entered.
121 *
122 * @note     None.
123 *
124 ******************************************************************************/
125 #define Xil_AssertNonvoid(Expression)             \
126 {                                                  \
127     if (Expression) {                              \
128         Xil_AssertStatus = XIL_ASSERT_NONE;       \
129     } else {                                       \
130         Xil_Assert(__FILE__, __LINE__);            \
131         Xil_AssertStatus = XIL_ASSERT_OCCURRED;   \
132         return 0;                                  \
133     }                                              \
134 }
135
136 /*****************************************************************************/
137 /**
138 * Always assert. This assert macro is to be used for functions that do not
139 * return anything (void). Use for instances where an assert should always
140 * occur.
141 *
142 * @return Returns void unless the Xil_AssertWait variable is true, in which
143 *         case no return is made and an infinite loop is entered.
144 *
145 * @note   None.
146 *
147 ******************************************************************************/
148 #define Xil_AssertVoidAlways()                   \
149 {                                                  \
150    Xil_Assert(__FILE__, __LINE__);                 \
151    Xil_AssertStatus = XIL_ASSERT_OCCURRED;        \
152    return;                                         \
153 }
154
155 /*****************************************************************************/
156 /**
157 * Always assert. This assert macro is to be used for functions that do return
158 * a value. Use for instances where an assert should always occur.
159 *
160 * @return Returns void unless the Xil_AssertWait variable is true, in which
161 *         case no return is made and an infinite loop is entered.
162 *
163 * @note   None.
164 *
165 ******************************************************************************/
166 #define Xil_AssertNonvoidAlways()                \
167 {                                                  \
168    Xil_Assert(__FILE__, __LINE__);                 \
169    Xil_AssertStatus = XIL_ASSERT_OCCURRED;        \
170    return 0;                                       \
171 }
172
173
174 #else
175
176 #define Xil_AssertVoid(Expression)
177 #define Xil_AssertVoidAlways()
178 #define Xil_AssertNonvoid(Expression)
179 #define Xil_AssertNonvoidAlways()
180
181 #endif
182
183 /************************** Function Prototypes ******************************/
184
185 void Xil_AssertSetCallback(Xil_AssertCallback Routine);
186
187 #ifdef __cplusplus
188 }
189 #endif
190
191 #endif  /* end of protection macro */