aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/epl/Debug.h
diff options
context:
space:
mode:
authorDaniel Krueger <daniel.krueger@systec-electronic.com>2008-12-19 14:41:57 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 16:52:36 -0500
commit9d7164cfdb611c2f864d535ae5794f23db3d84f7 (patch)
tree046847f7d6432f1f3dc8236f62492503f4c9ebdc /drivers/staging/epl/Debug.h
parent37bcd24b845abbfd85c838ee9ce07c2b254d3a05 (diff)
Staging: add epl stack
This is the openPOWERLINK network stack from systec electronic. It's a bit messed up as there is a driver mixed into the middle of it, lots of work needs to be done to unwind the different portions to make it sane. Cc: Daniel Krueger <daniel.krueger@systec-electronic.com> Cc: Ronald Sieber <Ronald.Sieber@systec-electronic.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/epl/Debug.h')
-rw-r--r--drivers/staging/epl/Debug.h750
1 files changed, 750 insertions, 0 deletions
diff --git a/drivers/staging/epl/Debug.h b/drivers/staging/epl/Debug.h
new file mode 100644
index 00000000000..f804e2fda9e
--- /dev/null
+++ b/drivers/staging/epl/Debug.h
@@ -0,0 +1,750 @@
1/****************************************************************************
2
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
5
6 Project: openPOWERLINK
7
8 Description: Debug interface
9
10 License:
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22
23 3. Neither the name of SYSTEC electronic GmbH nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without prior written permission. For written
26 permission, please contact info@systec-electronic.com.
27
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
40
41 Severability Clause:
42
43 If a provision of this License is or becomes illegal, invalid or
44 unenforceable in any jurisdiction, that shall not affect:
45 1. the validity or enforceability in that jurisdiction of any other
46 provision of this License; or
47 2. the validity or enforceability in other jurisdictions of that or
48 any other provision of this License.
49
50 -------------------------------------------------------------------------
51
52 $RCSfile: Debug.h,v $
53
54 $Author: D.Krueger $
55
56 $Revision: 1.4 $ $Date: 2008/10/17 15:32:32 $
57
58 $State: Exp $
59
60 Build Environment:
61 ...
62
63 -------------------------------------------------------------------------
64
65 Revision History:
66
67****************************************************************************/
68
69#ifndef _DEBUG_H_
70#define _DEBUG_H_
71
72#include "global.h"
73
74
75/***************************************************************************/
76/* */
77/* */
78/* G L O B A L D E F I N I T I O N S */
79/* */
80/* */
81/***************************************************************************/
82
83//---------------------------------------------------------------------------
84// global const defines
85//---------------------------------------------------------------------------
86
87// These definitions are important for level-debug traces.
88// A macro DEBUG_GLB_LVL() defines the current debug-level using following bis.
89// If the corresponding bit is set then trace message will be printed out
90// (only if NDEBUG is not defined). The upper debug-levels are reserved for
91// the debug-levels ALWAYS, ERROR and ASSERT.
92#define DEBUG_LVL_01 0x00000001
93#define DEBUG_LVL_02 0x00000002
94#define DEBUG_LVL_03 0x00000004
95#define DEBUG_LVL_04 0x00000008
96#define DEBUG_LVL_05 0x00000010
97#define DEBUG_LVL_06 0x00000020
98#define DEBUG_LVL_07 0x00000040
99#define DEBUG_LVL_08 0x00000080
100#define DEBUG_LVL_09 0x00000100
101#define DEBUG_LVL_10 0x00000200
102#define DEBUG_LVL_11 0x00000400
103#define DEBUG_LVL_12 0x00000800
104#define DEBUG_LVL_13 0x00001000
105#define DEBUG_LVL_14 0x00002000
106#define DEBUG_LVL_15 0x00004000
107#define DEBUG_LVL_16 0x00008000
108#define DEBUG_LVL_17 0x00010000
109#define DEBUG_LVL_18 0x00020000
110#define DEBUG_LVL_19 0x00040000
111#define DEBUG_LVL_20 0x00080000
112#define DEBUG_LVL_21 0x00100000
113#define DEBUG_LVL_22 0x00200000
114#define DEBUG_LVL_23 0x00400000
115#define DEBUG_LVL_24 0x00800000
116#define DEBUG_LVL_25 0x01000000
117#define DEBUG_LVL_26 0x02000000
118#define DEBUG_LVL_27 0x04000000
119#define DEBUG_LVL_28 0x08000000
120#define DEBUG_LVL_29 0x10000000
121#define DEBUG_LVL_ASSERT 0x20000000
122#define DEBUG_LVL_ERROR 0x40000000
123#define DEBUG_LVL_ALWAYS 0x80000000
124
125
126//---------------------------------------------------------------------------
127// global types
128//---------------------------------------------------------------------------
129
130
131//---------------------------------------------------------------------------
132// global vars
133//---------------------------------------------------------------------------
134
135
136//---------------------------------------------------------------------------
137// global function prototypes
138//---------------------------------------------------------------------------
139
140
141//---------------------------------------------------------------------------
142// global macros
143//---------------------------------------------------------------------------
144
145//---------------------------------------------------------------------------
146// this macro defines a version string
147#define MAKE_VERSION_STRING(product,appname,verstr,author) \
148 "§prd§:" product ",§app§:" appname ",§ver§:" verstr ",§dat§:" __DATE__ ",§aut§:" author
149
150
151//---------------------------------------------------------------------------
152// this macro defines a build info string (e.g. for using in printf())
153#define DEBUG_MAKE_BUILD_INFO(prefix,product,prodid,descr,verstr,author) "\n" \
154 prefix "***************************************************\n" \
155 prefix "Project: " product ", " prodid "\n" \
156 prefix "Descript.: " descr "\n" \
157 prefix "Author: " author "\n" \
158 prefix "Date: " __DATE__ "\n" \
159 prefix "Version: " verstr "\n" \
160 prefix "***************************************************\n\n"
161
162
163//---------------------------------------------------------------------------
164// The default debug-level is: ERROR and ALWAYS.
165// You can define an other debug-level in project settings.
166#ifndef DEF_DEBUG_LVL
167 #define DEF_DEBUG_LVL (DEBUG_LVL_ALWAYS | DEBUG_LVL_ERROR)
168#endif
169#ifndef DEBUG_GLB_LVL
170 #define DEBUG_GLB_LVL() (DEF_DEBUG_LVL)
171#endif
172
173
174//---------------------------------------------------------------------------
175#if (DEV_SYSTEM == _DEV_WIN32_) && defined (TRACE_MSG)
176
177 // For WIN32 the macro DEBUG_TRACE0 can be defined as function call TraceLvl()
178 // or as macro TRACE().
179 //
180 // Here the parameter 'lvl' can be used with more than one
181 // debug-level (using OR).
182 //
183 // Example: DEBUG_TRACE1(DEBUG_LVL_30 | DEBUG_LVL_02, "Hello %d", bCount);
184
185 #define DEBUG_TRACE0(lvl,str) TraceLvl((lvl),str)
186 #define DEBUG_TRACE1(lvl,str,p1) TraceLvl((lvl),str,p1)
187 #define DEBUG_TRACE2(lvl,str,p1,p2) TraceLvl((lvl),str,p1,p2)
188 #define DEBUG_TRACE3(lvl,str,p1,p2,p3) TraceLvl((lvl),str,p1,p2,p3)
189 #define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4) TraceLvl((lvl),str,p1,p2,p3,p4)
190 #define DEBUG_GLB_LVL() dwDebugLevel_g
191
192#else
193
194 // At microcontrollers we do reduce the memory usage by deleting DEBUG_TRACE-lines
195 // (compiler does delete the lines).
196 //
197 // Here the parameter 'lvl' can only be used with one debug-level.
198 //
199 // Example: DEBUG_TRACE1(DEBUG_LVL_ERROR, "error code %d", dwRet);
200
201 #if (DEBUG_GLB_LVL() & DEBUG_LVL_ALWAYS)
202 #define DEBUG_LVL_ALWAYS_TRACE0(str) TRACE0(str)
203 #define DEBUG_LVL_ALWAYS_TRACE1(str,p1) TRACE1(str,p1)
204 #define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
205 #define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
206 #define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
207 #else
208 #define DEBUG_LVL_ALWAYS_TRACE0(str)
209 #define DEBUG_LVL_ALWAYS_TRACE1(str,p1)
210 #define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2)
211 #define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3)
212 #define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4)
213 #endif
214
215 #if (DEBUG_GLB_LVL() & DEBUG_LVL_ERROR)
216 #define DEBUG_LVL_ERROR_TRACE0(str) TRACE0(str)
217 #define DEBUG_LVL_ERROR_TRACE1(str,p1) TRACE1(str,p1)
218 #define DEBUG_LVL_ERROR_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
219 #define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
220 #define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
221 #else
222 #define DEBUG_LVL_ERROR_TRACE0(str)
223 #define DEBUG_LVL_ERROR_TRACE1(str,p1)
224 #define DEBUG_LVL_ERROR_TRACE2(str,p1,p2)
225 #define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3)
226 #define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4)
227 #endif
228
229 #if (DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT)
230 #define DEBUG_LVL_ASSERT_TRACE0(str) TRACE0(str)
231 #define DEBUG_LVL_ASSERT_TRACE1(str,p1) TRACE1(str,p1)
232 #define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
233 #define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
234 #define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
235 #else
236 #define DEBUG_LVL_ASSERT_TRACE0(str)
237 #define DEBUG_LVL_ASSERT_TRACE1(str,p1)
238 #define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2)
239 #define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3)
240 #define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4)
241 #endif
242
243 #if (DEBUG_GLB_LVL() & DEBUG_LVL_29)
244 #define DEBUG_LVL_29_TRACE0(str) TRACE0(str)
245 #define DEBUG_LVL_29_TRACE1(str,p1) TRACE1(str,p1)
246 #define DEBUG_LVL_29_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
247 #define DEBUG_LVL_29_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
248 #define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
249 #else
250 #define DEBUG_LVL_29_TRACE0(str)
251 #define DEBUG_LVL_29_TRACE1(str,p1)
252 #define DEBUG_LVL_29_TRACE2(str,p1,p2)
253 #define DEBUG_LVL_29_TRACE3(str,p1,p2,p3)
254 #define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4)
255 #endif
256
257 #if (DEBUG_GLB_LVL() & DEBUG_LVL_28)
258 #define DEBUG_LVL_28_TRACE0(str) TRACE0(str)
259 #define DEBUG_LVL_28_TRACE1(str,p1) TRACE1(str,p1)
260 #define DEBUG_LVL_28_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
261 #define DEBUG_LVL_28_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
262 #define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
263 #else
264 #define DEBUG_LVL_28_TRACE0(str)
265 #define DEBUG_LVL_28_TRACE1(str,p1)
266 #define DEBUG_LVL_28_TRACE2(str,p1,p2)
267 #define DEBUG_LVL_28_TRACE3(str,p1,p2,p3)
268 #define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4)
269 #endif
270
271 #if (DEBUG_GLB_LVL() & DEBUG_LVL_27)
272 #define DEBUG_LVL_27_TRACE0(str) TRACE0(str)
273 #define DEBUG_LVL_27_TRACE1(str,p1) TRACE1(str,p1)
274 #define DEBUG_LVL_27_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
275 #define DEBUG_LVL_27_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
276 #define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
277 #else
278 #define DEBUG_LVL_27_TRACE0(str)
279 #define DEBUG_LVL_27_TRACE1(str,p1)
280 #define DEBUG_LVL_27_TRACE2(str,p1,p2)
281 #define DEBUG_LVL_27_TRACE3(str,p1,p2,p3)
282 #define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4)
283 #endif
284
285 #if (DEBUG_GLB_LVL() & DEBUG_LVL_26)
286 #define DEBUG_LVL_26_TRACE0(str) TRACE0(str)
287 #define DEBUG_LVL_26_TRACE1(str,p1) TRACE1(str,p1)
288 #define DEBUG_LVL_26_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
289 #define DEBUG_LVL_26_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
290 #define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
291 #else
292 #define DEBUG_LVL_26_TRACE0(str)
293 #define DEBUG_LVL_26_TRACE1(str,p1)
294 #define DEBUG_LVL_26_TRACE2(str,p1,p2)
295 #define DEBUG_LVL_26_TRACE3(str,p1,p2,p3)
296 #define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4)
297 #endif
298
299 #if (DEBUG_GLB_LVL() & DEBUG_LVL_25)
300 #define DEBUG_LVL_25_TRACE0(str) TRACE0(str)
301 #define DEBUG_LVL_25_TRACE1(str,p1) TRACE1(str,p1)
302 #define DEBUG_LVL_25_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
303 #define DEBUG_LVL_25_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
304 #define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
305 #else
306 #define DEBUG_LVL_25_TRACE0(str)
307 #define DEBUG_LVL_25_TRACE1(str,p1)
308 #define DEBUG_LVL_25_TRACE2(str,p1,p2)
309 #define DEBUG_LVL_25_TRACE3(str,p1,p2,p3)
310 #define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4)
311 #endif
312
313 #if (DEBUG_GLB_LVL() & DEBUG_LVL_24)
314 #define DEBUG_LVL_24_TRACE0(str) TRACE0(str)
315 #define DEBUG_LVL_24_TRACE1(str,p1) TRACE1(str,p1)
316 #define DEBUG_LVL_24_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
317 #define DEBUG_LVL_24_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
318 #define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
319 #else
320 #define DEBUG_LVL_24_TRACE0(str)
321 #define DEBUG_LVL_24_TRACE1(str,p1)
322 #define DEBUG_LVL_24_TRACE2(str,p1,p2)
323 #define DEBUG_LVL_24_TRACE3(str,p1,p2,p3)
324 #define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4)
325 #endif
326
327 #if (DEBUG_GLB_LVL() & DEBUG_LVL_23)
328 #define DEBUG_LVL_23_TRACE0(str) TRACE0(str)
329 #define DEBUG_LVL_23_TRACE1(str,p1) TRACE1(str,p1)
330 #define DEBUG_LVL_23_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
331 #define DEBUG_LVL_23_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
332 #define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
333 #else
334 #define DEBUG_LVL_23_TRACE0(str)
335 #define DEBUG_LVL_23_TRACE1(str,p1)
336 #define DEBUG_LVL_23_TRACE2(str,p1,p2)
337 #define DEBUG_LVL_23_TRACE3(str,p1,p2,p3)
338 #define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4)
339 #endif
340
341 #if (DEBUG_GLB_LVL() & DEBUG_LVL_22)
342 #define DEBUG_LVL_22_TRACE0(str) TRACE0(str)
343 #define DEBUG_LVL_22_TRACE1(str,p1) TRACE1(str,p1)
344 #define DEBUG_LVL_22_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
345 #define DEBUG_LVL_22_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
346 #define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
347 #else
348 #define DEBUG_LVL_22_TRACE0(str)
349 #define DEBUG_LVL_22_TRACE1(str,p1)
350 #define DEBUG_LVL_22_TRACE2(str,p1,p2)
351 #define DEBUG_LVL_22_TRACE3(str,p1,p2,p3)
352 #define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4)
353 #endif
354
355 #if (DEBUG_GLB_LVL() & DEBUG_LVL_21)
356 #define DEBUG_LVL_21_TRACE0(str) TRACE0(str)
357 #define DEBUG_LVL_21_TRACE1(str,p1) TRACE1(str,p1)
358 #define DEBUG_LVL_21_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
359 #define DEBUG_LVL_21_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
360 #define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
361 #else
362 #define DEBUG_LVL_21_TRACE0(str)
363 #define DEBUG_LVL_21_TRACE1(str,p1)
364 #define DEBUG_LVL_21_TRACE2(str,p1,p2)
365 #define DEBUG_LVL_21_TRACE3(str,p1,p2,p3)
366 #define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4)
367 #endif
368
369 #if (DEBUG_GLB_LVL() & DEBUG_LVL_20)
370 #define DEBUG_LVL_20_TRACE0(str) TRACE0(str)
371 #define DEBUG_LVL_20_TRACE1(str,p1) TRACE1(str,p1)
372 #define DEBUG_LVL_20_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
373 #define DEBUG_LVL_20_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
374 #define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
375 #else
376 #define DEBUG_LVL_20_TRACE0(str)
377 #define DEBUG_LVL_20_TRACE1(str,p1)
378 #define DEBUG_LVL_20_TRACE2(str,p1,p2)
379 #define DEBUG_LVL_20_TRACE3(str,p1,p2,p3)
380 #define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4)
381 #endif
382
383 #if (DEBUG_GLB_LVL() & DEBUG_LVL_19)
384 #define DEBUG_LVL_19_TRACE0(str) TRACE0(str)
385 #define DEBUG_LVL_19_TRACE1(str,p1) TRACE1(str,p1)
386 #define DEBUG_LVL_19_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
387 #define DEBUG_LVL_19_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
388 #define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
389 #else
390 #define DEBUG_LVL_19_TRACE0(str)
391 #define DEBUG_LVL_19_TRACE1(str,p1)
392 #define DEBUG_LVL_19_TRACE2(str,p1,p2)
393 #define DEBUG_LVL_19_TRACE3(str,p1,p2,p3)
394 #define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4)
395 #endif
396
397 #if (DEBUG_GLB_LVL() & DEBUG_LVL_18)
398 #define DEBUG_LVL_18_TRACE0(str) TRACE0(str)
399 #define DEBUG_LVL_18_TRACE1(str,p1) TRACE1(str,p1)
400 #define DEBUG_LVL_18_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
401 #define DEBUG_LVL_18_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
402 #define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
403 #else
404 #define DEBUG_LVL_18_TRACE0(str)
405 #define DEBUG_LVL_18_TRACE1(str,p1)
406 #define DEBUG_LVL_18_TRACE2(str,p1,p2)
407 #define DEBUG_LVL_18_TRACE3(str,p1,p2,p3)
408 #define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4)
409 #endif
410
411 #if (DEBUG_GLB_LVL() & DEBUG_LVL_17)
412 #define DEBUG_LVL_17_TRACE0(str) TRACE0(str)
413 #define DEBUG_LVL_17_TRACE1(str,p1) TRACE1(str,p1)
414 #define DEBUG_LVL_17_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
415 #define DEBUG_LVL_17_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
416 #define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
417 #else
418 #define DEBUG_LVL_17_TRACE0(str)
419 #define DEBUG_LVL_17_TRACE1(str,p1)
420 #define DEBUG_LVL_17_TRACE2(str,p1,p2)
421 #define DEBUG_LVL_17_TRACE3(str,p1,p2,p3)
422 #define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4)
423 #endif
424
425 #if (DEBUG_GLB_LVL() & DEBUG_LVL_16)
426 #define DEBUG_LVL_16_TRACE0(str) TRACE0(str)
427 #define DEBUG_LVL_16_TRACE1(str,p1) TRACE1(str,p1)
428 #define DEBUG_LVL_16_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
429 #define DEBUG_LVL_16_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
430 #define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
431 #else
432 #define DEBUG_LVL_16_TRACE0(str)
433 #define DEBUG_LVL_16_TRACE1(str,p1)
434 #define DEBUG_LVL_16_TRACE2(str,p1,p2)
435 #define DEBUG_LVL_16_TRACE3(str,p1,p2,p3)
436 #define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4)
437 #endif
438
439 #if (DEBUG_GLB_LVL() & DEBUG_LVL_15)
440 #define DEBUG_LVL_15_TRACE0(str) TRACE0(str)
441 #define DEBUG_LVL_15_TRACE1(str,p1) TRACE1(str,p1)
442 #define DEBUG_LVL_15_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
443 #define DEBUG_LVL_15_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
444 #define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
445 #else
446 #define DEBUG_LVL_15_TRACE0(str)
447 #define DEBUG_LVL_15_TRACE1(str,p1)
448 #define DEBUG_LVL_15_TRACE2(str,p1,p2)
449 #define DEBUG_LVL_15_TRACE3(str,p1,p2,p3)
450 #define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4)
451 #endif
452
453 #if (DEBUG_GLB_LVL() & DEBUG_LVL_14)
454 #define DEBUG_LVL_14_TRACE0(str) TRACE0(str)
455 #define DEBUG_LVL_14_TRACE1(str,p1) TRACE1(str,p1)
456 #define DEBUG_LVL_14_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
457 #define DEBUG_LVL_14_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
458 #define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
459 #else
460 #define DEBUG_LVL_14_TRACE0(str)
461 #define DEBUG_LVL_14_TRACE1(str,p1)
462 #define DEBUG_LVL_14_TRACE2(str,p1,p2)
463 #define DEBUG_LVL_14_TRACE3(str,p1,p2,p3)
464 #define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4)
465 #endif
466
467 #if (DEBUG_GLB_LVL() & DEBUG_LVL_13)
468 #define DEBUG_LVL_13_TRACE0(str) TRACE0(str)
469 #define DEBUG_LVL_13_TRACE1(str,p1) TRACE1(str,p1)
470 #define DEBUG_LVL_13_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
471 #define DEBUG_LVL_13_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
472 #define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
473 #else
474 #define DEBUG_LVL_13_TRACE0(str)
475 #define DEBUG_LVL_13_TRACE1(str,p1)
476 #define DEBUG_LVL_13_TRACE2(str,p1,p2)
477 #define DEBUG_LVL_13_TRACE3(str,p1,p2,p3)
478 #define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4)
479 #endif
480
481 #if (DEBUG_GLB_LVL() & DEBUG_LVL_12)
482 #define DEBUG_LVL_12_TRACE0(str) TRACE0(str)
483 #define DEBUG_LVL_12_TRACE1(str,p1) TRACE1(str,p1)
484 #define DEBUG_LVL_12_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
485 #define DEBUG_LVL_12_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
486 #define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
487 #else
488 #define DEBUG_LVL_12_TRACE0(str)
489 #define DEBUG_LVL_12_TRACE1(str,p1)
490 #define DEBUG_LVL_12_TRACE2(str,p1,p2)
491 #define DEBUG_LVL_12_TRACE3(str,p1,p2,p3)
492 #define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4)
493 #endif
494
495 #if (DEBUG_GLB_LVL() & DEBUG_LVL_11)
496 #define DEBUG_LVL_11_TRACE0(str) TRACE0(str)
497 #define DEBUG_LVL_11_TRACE1(str,p1) TRACE1(str,p1)
498 #define DEBUG_LVL_11_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
499 #define DEBUG_LVL_11_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
500 #define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
501 #else
502 #define DEBUG_LVL_11_TRACE0(str)
503 #define DEBUG_LVL_11_TRACE1(str,p1)
504 #define DEBUG_LVL_11_TRACE2(str,p1,p2)
505 #define DEBUG_LVL_11_TRACE3(str,p1,p2,p3)
506 #define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4)
507 #endif
508
509 #if (DEBUG_GLB_LVL() & DEBUG_LVL_10)
510 #define DEBUG_LVL_10_TRACE0(str) TRACE0(str)
511 #define DEBUG_LVL_10_TRACE1(str,p1) TRACE1(str,p1)
512 #define DEBUG_LVL_10_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
513 #define DEBUG_LVL_10_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
514 #define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
515 #else
516 #define DEBUG_LVL_10_TRACE0(str)
517 #define DEBUG_LVL_10_TRACE1(str,p1)
518 #define DEBUG_LVL_10_TRACE2(str,p1,p2)
519 #define DEBUG_LVL_10_TRACE3(str,p1,p2,p3)
520 #define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4)
521 #endif
522
523 #if (DEBUG_GLB_LVL() & DEBUG_LVL_09)
524 #define DEBUG_LVL_09_TRACE0(str) TRACE0(str)
525 #define DEBUG_LVL_09_TRACE1(str,p1) TRACE1(str,p1)
526 #define DEBUG_LVL_09_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
527 #define DEBUG_LVL_09_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
528 #define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
529 #else
530 #define DEBUG_LVL_09_TRACE0(str)
531 #define DEBUG_LVL_09_TRACE1(str,p1)
532 #define DEBUG_LVL_09_TRACE2(str,p1,p2)
533 #define DEBUG_LVL_09_TRACE3(str,p1,p2,p3)
534 #define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4)
535 #endif
536
537 #if (DEBUG_GLB_LVL() & DEBUG_LVL_08)
538 #define DEBUG_LVL_08_TRACE0(str) TRACE0(str)
539 #define DEBUG_LVL_08_TRACE1(str,p1) TRACE1(str,p1)
540 #define DEBUG_LVL_08_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
541 #define DEBUG_LVL_08_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
542 #define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
543 #else
544 #define DEBUG_LVL_08_TRACE0(str)
545 #define DEBUG_LVL_08_TRACE1(str,p1)
546 #define DEBUG_LVL_08_TRACE2(str,p1,p2)
547 #define DEBUG_LVL_08_TRACE3(str,p1,p2,p3)
548 #define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4)
549 #endif
550
551 #if (DEBUG_GLB_LVL() & DEBUG_LVL_07)
552 #define DEBUG_LVL_07_TRACE0(str) TRACE0(str)
553 #define DEBUG_LVL_07_TRACE1(str,p1) TRACE1(str,p1)
554 #define DEBUG_LVL_07_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
555 #define DEBUG_LVL_07_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
556 #define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
557 #else
558 #define DEBUG_LVL_07_TRACE0(str)
559 #define DEBUG_LVL_07_TRACE1(str,p1)
560 #define DEBUG_LVL_07_TRACE2(str,p1,p2)
561 #define DEBUG_LVL_07_TRACE3(str,p1,p2,p3)
562 #define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4)
563 #endif
564
565 #if (DEBUG_GLB_LVL() & DEBUG_LVL_06)
566 #define DEBUG_LVL_06_TRACE0(str) TRACE0(str)
567 #define DEBUG_LVL_06_TRACE1(str,p1) TRACE1(str,p1)
568 #define DEBUG_LVL_06_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
569 #define DEBUG_LVL_06_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
570 #define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
571 #else
572 #define DEBUG_LVL_06_TRACE0(str)
573 #define DEBUG_LVL_06_TRACE1(str,p1)
574 #define DEBUG_LVL_06_TRACE2(str,p1,p2)
575 #define DEBUG_LVL_06_TRACE3(str,p1,p2,p3)
576 #define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4)
577 #endif
578
579 #if (DEBUG_GLB_LVL() & DEBUG_LVL_05)
580 #define DEBUG_LVL_05_TRACE0(str) TRACE0(str)
581 #define DEBUG_LVL_05_TRACE1(str,p1) TRACE1(str,p1)
582 #define DEBUG_LVL_05_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
583 #define DEBUG_LVL_05_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
584 #define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
585 #else
586 #define DEBUG_LVL_05_TRACE0(str)
587 #define DEBUG_LVL_05_TRACE1(str,p1)
588 #define DEBUG_LVL_05_TRACE2(str,p1,p2)
589 #define DEBUG_LVL_05_TRACE3(str,p1,p2,p3)
590 #define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4)
591 #endif
592
593 #if (DEBUG_GLB_LVL() & DEBUG_LVL_04)
594 #define DEBUG_LVL_04_TRACE0(str) TRACE0(str)
595 #define DEBUG_LVL_04_TRACE1(str,p1) TRACE1(str,p1)
596 #define DEBUG_LVL_04_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
597 #define DEBUG_LVL_04_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
598 #define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
599 #else
600 #define DEBUG_LVL_04_TRACE0(str)
601 #define DEBUG_LVL_04_TRACE1(str,p1)
602 #define DEBUG_LVL_04_TRACE2(str,p1,p2)
603 #define DEBUG_LVL_04_TRACE3(str,p1,p2,p3)
604 #define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4)
605 #endif
606
607 #if (DEBUG_GLB_LVL() & DEBUG_LVL_03)
608 #define DEBUG_LVL_03_TRACE0(str) TRACE0(str)
609 #define DEBUG_LVL_03_TRACE1(str,p1) TRACE1(str,p1)
610 #define DEBUG_LVL_03_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
611 #define DEBUG_LVL_03_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
612 #define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
613 #else
614 #define DEBUG_LVL_03_TRACE0(str)
615 #define DEBUG_LVL_03_TRACE1(str,p1)
616 #define DEBUG_LVL_03_TRACE2(str,p1,p2)
617 #define DEBUG_LVL_03_TRACE3(str,p1,p2,p3)
618 #define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4)
619 #endif
620
621 #if (DEBUG_GLB_LVL() & DEBUG_LVL_02)
622 #define DEBUG_LVL_02_TRACE0(str) TRACE0(str)
623 #define DEBUG_LVL_02_TRACE1(str,p1) TRACE1(str,p1)
624 #define DEBUG_LVL_02_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
625 #define DEBUG_LVL_02_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
626 #define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
627 #else
628 #define DEBUG_LVL_02_TRACE0(str)
629 #define DEBUG_LVL_02_TRACE1(str,p1)
630 #define DEBUG_LVL_02_TRACE2(str,p1,p2)
631 #define DEBUG_LVL_02_TRACE3(str,p1,p2,p3)
632 #define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4)
633 #endif
634
635 #if (DEBUG_GLB_LVL() & DEBUG_LVL_01)
636 #define DEBUG_LVL_01_TRACE0(str) TRACE0(str)
637 #define DEBUG_LVL_01_TRACE1(str,p1) TRACE1(str,p1)
638 #define DEBUG_LVL_01_TRACE2(str,p1,p2) TRACE2(str,p1,p2)
639 #define DEBUG_LVL_01_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3)
640 #define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4)
641 #else
642 #define DEBUG_LVL_01_TRACE0(str)
643 #define DEBUG_LVL_01_TRACE1(str,p1)
644 #define DEBUG_LVL_01_TRACE2(str,p1,p2)
645 #define DEBUG_LVL_01_TRACE3(str,p1,p2,p3)
646 #define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4)
647 #endif
648
649 #define DEBUG_TRACE0(lvl,str) lvl##_TRACE0(str)
650 #define DEBUG_TRACE1(lvl,str,p1) lvl##_TRACE1(str,p1)
651 #define DEBUG_TRACE2(lvl,str,p1,p2) lvl##_TRACE2(str,p1,p2)
652 #define DEBUG_TRACE3(lvl,str,p1,p2,p3) lvl##_TRACE3(str,p1,p2,p3)
653 #define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4) lvl##_TRACE4(str,p1,p2,p3,p4)
654
655#endif
656
657
658//---------------------------------------------------------------------------
659// The macro DEBUG_DUMP_DATA() can be used with the same debug-levels to dump
660// out data bytes. Function DumpData() has to be included.
661// NOTE: DUMP_DATA has to be defined in project settings.
662#if (!defined (NDEBUG) && defined (DUMP_DATA)) || (DEV_SYSTEM == _DEV_WIN32_)
663
664 #ifdef __cplusplus
665 extern "C"
666 {
667 #endif
668
669 void DumpData (char* szStr_p, BYTE MEM* pbData_p, WORD wSize_p);
670
671 #ifdef __cplusplus
672 } // von extern "C"
673 #endif
674
675 #define DEBUG_DUMP_DATA(lvl,str,ptr,siz) if ((DEBUG_GLB_LVL() & (lvl))==(lvl)) \
676 DumpData (str, (BYTE MEM*) (ptr), (WORD) (siz));
677
678#else
679
680 #define DEBUG_DUMP_DATA(lvl,str,ptr,siz)
681
682#endif
683
684
685//---------------------------------------------------------------------------
686// The macro DEBUG_ASSERT() can be used to print out an error string if the
687// parametered expresion does not result TRUE.
688// NOTE: If DEBUG_KEEP_ASSERT is defined, then DEBUG_ASSERT-line will not be
689// deleted from compiler (in release version too).
690#if !defined (NDEBUG) || defined (DEBUG_KEEP_ASSERT)
691
692 #if (DEV_SYSTEM == _DEV_WIN32_)
693
694 // For WIN32 process will be killed after closing message box.
695
696 #define DEBUG_ASSERT0(expr,str) if (!(expr ) && ((DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT)!=0)) { \
697 MessageBox (NULL, \
698 "Assertion failed: line " __LINE__ " file " __FILE__ \
699 "\n -> " str "\n"); \
700 ExitProcess (-1); }
701
702 #define DEBUG_ASSERT1(expr,str,p1) if (!(expr ) && ((DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT)!=0)) { \
703 MessageBox (NULL, \
704 "Assertion failed: line " __LINE__ " file " __FILE__ \
705 "\n -> " str "\n"); \
706 ExitProcess (-1); }
707
708 #else
709
710 // For microcontrollers process will be stopped using endless loop.
711
712 #define DEBUG_ASSERT0(expr,str) if (!(expr )) { \
713 DEBUG_LVL_ASSERT_TRACE3 ( \
714 "Assertion failed: line %d file '%s'\n" \
715 " -> '%s'\n", __LINE__, __FILE__, str); \
716 while (1); }
717
718 #define DEBUG_ASSERT1(expr,str,p1) if (!(expr )) { \
719 DEBUG_LVL_ASSERT_TRACE4 ( \
720 "Assertion failed: line %d file '%s'\n" \
721 " -> '%s'\n" \
722 " -> 0x%08lX\n", __LINE__, __FILE__, str, (DWORD) p1); \
723 while (1); }
724
725 #endif
726
727#else
728
729 #define DEBUG_ASSERT0(expr,str)
730 #define DEBUG_ASSERT1(expr,str,p1)
731
732#endif
733
734
735//---------------------------------------------------------------------------
736// The macro DEBUG_ONLY() implements code, if NDEBUG is not defined.
737#if !defined (DEBUG_ONLY)
738 #if !defined (NDEBUG)
739
740 #define DEBUG_ONLY(expr) expr
741
742 #else
743
744 #define DEBUG_ONLY(expr)
745
746 #endif
747#endif
748
749
750#endif // _DEBUG_H_