OpenCores
URL https://opencores.org/ocsvn/1g_ethernet_dpi/1g_ethernet_dpi/trunk

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [tags/] [v0.0/] [sw/] [dev/] [test_main/] [src/] [_hdl/] [bsp/] [include/] [xil_assert.h] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 kuzmi4
/******************************************************************************
2
*
3
* Copyright (C) 2009 - 2015 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
* </pre>
46
*
47
******************************************************************************/
48
 
49
#ifndef XIL_ASSERT_H    /* prevent circular inclusions */
50
#define XIL_ASSERT_H    /* by using protection macros */
51
 
52
#include "xil_types.h"
53
 
54
#ifdef __cplusplus
55
extern "C" {
56
#endif
57
 
58
 
59
/***************************** Include Files *********************************/
60
 
61
 
62
/************************** Constant Definitions *****************************/
63
 
64
#define XIL_ASSERT_NONE     0U
65
#define XIL_ASSERT_OCCURRED 1U
66
#define XNULL NULL
67
 
68
extern u32 Xil_AssertStatus;
69
extern void Xil_Assert(const char8 *File, s32 Line);
70
void XNullHandler(void *NullParameter);
71
 
72
/**
73
 * This data type defines a callback to be invoked when an
74
 * assert occurs. The callback is invoked only when asserts are enabled
75
 */
76
typedef void (*Xil_AssertCallback) (const char8 *File, s32 Line);
77
 
78
/***************** Macros (Inline Functions) Definitions *********************/
79
 
80
#ifndef NDEBUG
81
 
82
/*****************************************************************************/
83
/**
84
* This assert macro is to be used for functions that do not return anything
85
* (void). This in conjunction with the Xil_AssertWait boolean can be used to
86
* accomodate tests so that asserts which fail allow execution to continue.
87
*
88
* @param    Expression is the expression to evaluate. If it evaluates to
89
*           false, the assert occurs.
90
*
91
* @return   Returns void unless the Xil_AssertWait variable is true, in which
92
*           case no return is made and an infinite loop is entered.
93
*
94
* @note     None.
95
*
96
******************************************************************************/
97
#define Xil_AssertVoid(Expression)                \
98
{                                                  \
99
    if (Expression) {                              \
100
        Xil_AssertStatus = XIL_ASSERT_NONE;       \
101
    } else {                                       \
102
        Xil_Assert(__FILE__, __LINE__);            \
103
        Xil_AssertStatus = XIL_ASSERT_OCCURRED;   \
104
        return;                                    \
105
    }                                              \
106
}
107
 
108
/*****************************************************************************/
109
/**
110
* This assert macro is to be used for functions that do return a value. This in
111
* conjunction with the Xil_AssertWait boolean can be used to accomodate tests
112
* so that asserts which fail allow execution to continue.
113
*
114
* @param    Expression is the expression to evaluate. If it evaluates to false,
115
*           the assert occurs.
116
*
117
* @return   Returns 0 unless the Xil_AssertWait variable is true, in which
118
*           case no return is made and an infinite loop is entered.
119
*
120
* @note     None.
121
*
122
******************************************************************************/
123
#define Xil_AssertNonvoid(Expression)             \
124
{                                                  \
125
    if (Expression) {                              \
126
        Xil_AssertStatus = XIL_ASSERT_NONE;       \
127
    } else {                                       \
128
        Xil_Assert(__FILE__, __LINE__);            \
129
        Xil_AssertStatus = XIL_ASSERT_OCCURRED;   \
130
        return 0;                                  \
131
    }                                              \
132
}
133
 
134
/*****************************************************************************/
135
/**
136
* Always assert. This assert macro is to be used for functions that do not
137
* return anything (void). Use for instances where an assert should always
138
* occur.
139
*
140
* @return Returns void unless the Xil_AssertWait variable is true, in which
141
*         case no return is made and an infinite loop is entered.
142
*
143
* @note   None.
144
*
145
******************************************************************************/
146
#define Xil_AssertVoidAlways()                   \
147
{                                                  \
148
   Xil_Assert(__FILE__, __LINE__);                 \
149
   Xil_AssertStatus = XIL_ASSERT_OCCURRED;        \
150
   return;                                         \
151
}
152
 
153
/*****************************************************************************/
154
/**
155
* Always assert. This assert macro is to be used for functions that do return
156
* a value. Use for instances where an assert should always occur.
157
*
158
* @return Returns void unless the Xil_AssertWait variable is true, in which
159
*         case no return is made and an infinite loop is entered.
160
*
161
* @note   None.
162
*
163
******************************************************************************/
164
#define Xil_AssertNonvoidAlways()                \
165
{                                                  \
166
   Xil_Assert(__FILE__, __LINE__);                 \
167
   Xil_AssertStatus = XIL_ASSERT_OCCURRED;        \
168
   return 0;                                       \
169
}
170
 
171
 
172
#else
173
 
174
#define Xil_AssertVoid(Expression)
175
#define Xil_AssertVoidAlways()
176
#define Xil_AssertNonvoid(Expression)
177
#define Xil_AssertNonvoidAlways()
178
 
179
#endif
180
 
181
/************************** Function Prototypes ******************************/
182
 
183
//void Xil_AssertSetCallback(Xil_AssertCallback Routine);
184
 
185
#ifdef __cplusplus
186
}
187
#endif
188
 
189
#endif  /* end of protection macro */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.