]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/epl/Debug.h
Staging: epl: remove DWORD
[karo-tx-linux.git] / drivers / staging / epl / Debug.h
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 /*          G L O B A L   D E F I N I T I O N S                            */
78 /*                                                                         */
79 /*                                                                         */
80 /***************************************************************************/
81
82 //---------------------------------------------------------------------------
83 // global const defines
84 //---------------------------------------------------------------------------
85
86 // These definitions are important for level-debug traces.
87 // A macro DEBUG_GLB_LVL() defines the current debug-level using following bis.
88 // If the corresponding bit is set then trace message will be printed out
89 // (only if NDEBUG is not defined). The upper debug-levels are reserved for
90 // the debug-levels ALWAYS, ERROR and ASSERT.
91 #define DEBUG_LVL_01                    0x00000001
92 #define DEBUG_LVL_02                    0x00000002
93 #define DEBUG_LVL_03                    0x00000004
94 #define DEBUG_LVL_04                    0x00000008
95 #define DEBUG_LVL_05                    0x00000010
96 #define DEBUG_LVL_06                    0x00000020
97 #define DEBUG_LVL_07                    0x00000040
98 #define DEBUG_LVL_08                    0x00000080
99 #define DEBUG_LVL_09                    0x00000100
100 #define DEBUG_LVL_10                    0x00000200
101 #define DEBUG_LVL_11                    0x00000400
102 #define DEBUG_LVL_12                    0x00000800
103 #define DEBUG_LVL_13                    0x00001000
104 #define DEBUG_LVL_14                    0x00002000
105 #define DEBUG_LVL_15                    0x00004000
106 #define DEBUG_LVL_16                    0x00008000
107 #define DEBUG_LVL_17                    0x00010000
108 #define DEBUG_LVL_18                    0x00020000
109 #define DEBUG_LVL_19                    0x00040000
110 #define DEBUG_LVL_20                    0x00080000
111 #define DEBUG_LVL_21                    0x00100000
112 #define DEBUG_LVL_22                    0x00200000
113 #define DEBUG_LVL_23                    0x00400000
114 #define DEBUG_LVL_24                    0x00800000
115 #define DEBUG_LVL_25                    0x01000000
116 #define DEBUG_LVL_26                    0x02000000
117 #define DEBUG_LVL_27                    0x04000000
118 #define DEBUG_LVL_28                    0x08000000
119 #define DEBUG_LVL_29                    0x10000000
120 #define DEBUG_LVL_ASSERT                0x20000000
121 #define DEBUG_LVL_ERROR                 0x40000000
122 #define DEBUG_LVL_ALWAYS                0x80000000
123
124 //---------------------------------------------------------------------------
125 // global types
126 //---------------------------------------------------------------------------
127
128 //---------------------------------------------------------------------------
129 // global vars
130 //---------------------------------------------------------------------------
131
132 //---------------------------------------------------------------------------
133 // global function prototypes
134 //---------------------------------------------------------------------------
135
136 //---------------------------------------------------------------------------
137 // global macros
138 //---------------------------------------------------------------------------
139
140 //---------------------------------------------------------------------------
141 // this macro defines a version string
142
143
144 //---------------------------------------------------------------------------
145 // this macro defines a build info string (e.g. for using in printf())
146 #define DEBUG_MAKE_BUILD_INFO(prefix,product,prodid,descr,verstr,author) "\n" \
147     prefix "***************************************************\n" \
148     prefix "Project:   " product ", " prodid                  "\n" \
149     prefix "Descript.: " descr                                "\n" \
150     prefix "Author:    " author                               "\n" \
151     prefix "Date:      " __DATE__                             "\n" \
152     prefix "Version:   " verstr                               "\n" \
153     prefix "***************************************************\n\n"
154
155 //---------------------------------------------------------------------------
156 // The default debug-level is: ERROR and ALWAYS.
157 // You can define an other debug-level in project settings.
158 #ifndef DEF_DEBUG_LVL
159 #define DEF_DEBUG_LVL                   (DEBUG_LVL_ALWAYS | DEBUG_LVL_ERROR)
160 #endif
161 #ifndef DEBUG_GLB_LVL
162 #define DEBUG_GLB_LVL()                 (DEF_DEBUG_LVL)
163 #endif
164
165 //---------------------------------------------------------------------------
166     // At microcontrollers we do reduce the memory usage by deleting DEBUG_TRACE-lines
167     // (compiler does delete the lines).
168     //
169     // Here the parameter 'lvl' can only be used with one debug-level.
170     //
171     // Example: DEBUG_TRACE1(DEBUG_LVL_ERROR, "error code %d", dwRet);
172
173 #if (DEBUG_GLB_LVL() & DEBUG_LVL_ALWAYS)
174 #define DEBUG_LVL_ALWAYS_TRACE0(str)                TRACE0(str)
175 #define DEBUG_LVL_ALWAYS_TRACE1(str,p1)             TRACE1(str,p1)
176 #define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2)          TRACE2(str,p1,p2)
177 #define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3)       TRACE3(str,p1,p2,p3)
178 #define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4)    TRACE4(str,p1,p2,p3,p4)
179 #else
180 #define DEBUG_LVL_ALWAYS_TRACE0(str)
181 #define DEBUG_LVL_ALWAYS_TRACE1(str,p1)
182 #define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2)
183 #define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3)
184 #define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4)
185 #endif
186
187 #if (DEBUG_GLB_LVL() & DEBUG_LVL_ERROR)
188 #define DEBUG_LVL_ERROR_TRACE0(str)                 TRACE0(str)
189 #define DEBUG_LVL_ERROR_TRACE1(str,p1)              TRACE1(str,p1)
190 #define DEBUG_LVL_ERROR_TRACE2(str,p1,p2)           TRACE2(str,p1,p2)
191 #define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3)        TRACE3(str,p1,p2,p3)
192 #define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4)     TRACE4(str,p1,p2,p3,p4)
193 #else
194 #define DEBUG_LVL_ERROR_TRACE0(str)
195 #define DEBUG_LVL_ERROR_TRACE1(str,p1)
196 #define DEBUG_LVL_ERROR_TRACE2(str,p1,p2)
197 #define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3)
198 #define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4)
199 #endif
200
201 #if (DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT)
202 #define DEBUG_LVL_ASSERT_TRACE0(str)                TRACE0(str)
203 #define DEBUG_LVL_ASSERT_TRACE1(str,p1)             TRACE1(str,p1)
204 #define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2)          TRACE2(str,p1,p2)
205 #define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3)       TRACE3(str,p1,p2,p3)
206 #define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4)    TRACE4(str,p1,p2,p3,p4)
207 #else
208 #define DEBUG_LVL_ASSERT_TRACE0(str)
209 #define DEBUG_LVL_ASSERT_TRACE1(str,p1)
210 #define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2)
211 #define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3)
212 #define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4)
213 #endif
214
215 #if (DEBUG_GLB_LVL() & DEBUG_LVL_29)
216 #define DEBUG_LVL_29_TRACE0(str)                    TRACE0(str)
217 #define DEBUG_LVL_29_TRACE1(str,p1)                 TRACE1(str,p1)
218 #define DEBUG_LVL_29_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
219 #define DEBUG_LVL_29_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
220 #define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
221 #else
222 #define DEBUG_LVL_29_TRACE0(str)
223 #define DEBUG_LVL_29_TRACE1(str,p1)
224 #define DEBUG_LVL_29_TRACE2(str,p1,p2)
225 #define DEBUG_LVL_29_TRACE3(str,p1,p2,p3)
226 #define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4)
227 #endif
228
229 #if (DEBUG_GLB_LVL() & DEBUG_LVL_28)
230 #define DEBUG_LVL_28_TRACE0(str)                    TRACE0(str)
231 #define DEBUG_LVL_28_TRACE1(str,p1)                 TRACE1(str,p1)
232 #define DEBUG_LVL_28_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
233 #define DEBUG_LVL_28_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
234 #define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
235 #else
236 #define DEBUG_LVL_28_TRACE0(str)
237 #define DEBUG_LVL_28_TRACE1(str,p1)
238 #define DEBUG_LVL_28_TRACE2(str,p1,p2)
239 #define DEBUG_LVL_28_TRACE3(str,p1,p2,p3)
240 #define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4)
241 #endif
242
243 #if (DEBUG_GLB_LVL() & DEBUG_LVL_27)
244 #define DEBUG_LVL_27_TRACE0(str)                    TRACE0(str)
245 #define DEBUG_LVL_27_TRACE1(str,p1)                 TRACE1(str,p1)
246 #define DEBUG_LVL_27_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
247 #define DEBUG_LVL_27_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
248 #define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
249 #else
250 #define DEBUG_LVL_27_TRACE0(str)
251 #define DEBUG_LVL_27_TRACE1(str,p1)
252 #define DEBUG_LVL_27_TRACE2(str,p1,p2)
253 #define DEBUG_LVL_27_TRACE3(str,p1,p2,p3)
254 #define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4)
255 #endif
256
257 #if (DEBUG_GLB_LVL() & DEBUG_LVL_26)
258 #define DEBUG_LVL_26_TRACE0(str)                    TRACE0(str)
259 #define DEBUG_LVL_26_TRACE1(str,p1)                 TRACE1(str,p1)
260 #define DEBUG_LVL_26_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
261 #define DEBUG_LVL_26_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
262 #define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
263 #else
264 #define DEBUG_LVL_26_TRACE0(str)
265 #define DEBUG_LVL_26_TRACE1(str,p1)
266 #define DEBUG_LVL_26_TRACE2(str,p1,p2)
267 #define DEBUG_LVL_26_TRACE3(str,p1,p2,p3)
268 #define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4)
269 #endif
270
271 #if (DEBUG_GLB_LVL() & DEBUG_LVL_25)
272 #define DEBUG_LVL_25_TRACE0(str)                    TRACE0(str)
273 #define DEBUG_LVL_25_TRACE1(str,p1)                 TRACE1(str,p1)
274 #define DEBUG_LVL_25_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
275 #define DEBUG_LVL_25_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
276 #define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
277 #else
278 #define DEBUG_LVL_25_TRACE0(str)
279 #define DEBUG_LVL_25_TRACE1(str,p1)
280 #define DEBUG_LVL_25_TRACE2(str,p1,p2)
281 #define DEBUG_LVL_25_TRACE3(str,p1,p2,p3)
282 #define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4)
283 #endif
284
285 #if (DEBUG_GLB_LVL() & DEBUG_LVL_24)
286 #define DEBUG_LVL_24_TRACE0(str)                    TRACE0(str)
287 #define DEBUG_LVL_24_TRACE1(str,p1)                 TRACE1(str,p1)
288 #define DEBUG_LVL_24_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
289 #define DEBUG_LVL_24_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
290 #define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
291 #else
292 #define DEBUG_LVL_24_TRACE0(str)
293 #define DEBUG_LVL_24_TRACE1(str,p1)
294 #define DEBUG_LVL_24_TRACE2(str,p1,p2)
295 #define DEBUG_LVL_24_TRACE3(str,p1,p2,p3)
296 #define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4)
297 #endif
298
299 #if (DEBUG_GLB_LVL() & DEBUG_LVL_23)
300 #define DEBUG_LVL_23_TRACE0(str)                    TRACE0(str)
301 #define DEBUG_LVL_23_TRACE1(str,p1)                 TRACE1(str,p1)
302 #define DEBUG_LVL_23_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
303 #define DEBUG_LVL_23_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
304 #define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
305 #else
306 #define DEBUG_LVL_23_TRACE0(str)
307 #define DEBUG_LVL_23_TRACE1(str,p1)
308 #define DEBUG_LVL_23_TRACE2(str,p1,p2)
309 #define DEBUG_LVL_23_TRACE3(str,p1,p2,p3)
310 #define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4)
311 #endif
312
313 #if (DEBUG_GLB_LVL() & DEBUG_LVL_22)
314 #define DEBUG_LVL_22_TRACE0(str)                    TRACE0(str)
315 #define DEBUG_LVL_22_TRACE1(str,p1)                 TRACE1(str,p1)
316 #define DEBUG_LVL_22_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
317 #define DEBUG_LVL_22_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
318 #define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
319 #else
320 #define DEBUG_LVL_22_TRACE0(str)
321 #define DEBUG_LVL_22_TRACE1(str,p1)
322 #define DEBUG_LVL_22_TRACE2(str,p1,p2)
323 #define DEBUG_LVL_22_TRACE3(str,p1,p2,p3)
324 #define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4)
325 #endif
326
327 #if (DEBUG_GLB_LVL() & DEBUG_LVL_21)
328 #define DEBUG_LVL_21_TRACE0(str)                    TRACE0(str)
329 #define DEBUG_LVL_21_TRACE1(str,p1)                 TRACE1(str,p1)
330 #define DEBUG_LVL_21_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
331 #define DEBUG_LVL_21_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
332 #define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
333 #else
334 #define DEBUG_LVL_21_TRACE0(str)
335 #define DEBUG_LVL_21_TRACE1(str,p1)
336 #define DEBUG_LVL_21_TRACE2(str,p1,p2)
337 #define DEBUG_LVL_21_TRACE3(str,p1,p2,p3)
338 #define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4)
339 #endif
340
341 #if (DEBUG_GLB_LVL() & DEBUG_LVL_20)
342 #define DEBUG_LVL_20_TRACE0(str)                    TRACE0(str)
343 #define DEBUG_LVL_20_TRACE1(str,p1)                 TRACE1(str,p1)
344 #define DEBUG_LVL_20_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
345 #define DEBUG_LVL_20_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
346 #define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
347 #else
348 #define DEBUG_LVL_20_TRACE0(str)
349 #define DEBUG_LVL_20_TRACE1(str,p1)
350 #define DEBUG_LVL_20_TRACE2(str,p1,p2)
351 #define DEBUG_LVL_20_TRACE3(str,p1,p2,p3)
352 #define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4)
353 #endif
354
355 #if (DEBUG_GLB_LVL() & DEBUG_LVL_19)
356 #define DEBUG_LVL_19_TRACE0(str)                    TRACE0(str)
357 #define DEBUG_LVL_19_TRACE1(str,p1)                 TRACE1(str,p1)
358 #define DEBUG_LVL_19_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
359 #define DEBUG_LVL_19_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
360 #define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
361 #else
362 #define DEBUG_LVL_19_TRACE0(str)
363 #define DEBUG_LVL_19_TRACE1(str,p1)
364 #define DEBUG_LVL_19_TRACE2(str,p1,p2)
365 #define DEBUG_LVL_19_TRACE3(str,p1,p2,p3)
366 #define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4)
367 #endif
368
369 #if (DEBUG_GLB_LVL() & DEBUG_LVL_18)
370 #define DEBUG_LVL_18_TRACE0(str)                    TRACE0(str)
371 #define DEBUG_LVL_18_TRACE1(str,p1)                 TRACE1(str,p1)
372 #define DEBUG_LVL_18_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
373 #define DEBUG_LVL_18_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
374 #define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
375 #else
376 #define DEBUG_LVL_18_TRACE0(str)
377 #define DEBUG_LVL_18_TRACE1(str,p1)
378 #define DEBUG_LVL_18_TRACE2(str,p1,p2)
379 #define DEBUG_LVL_18_TRACE3(str,p1,p2,p3)
380 #define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4)
381 #endif
382
383 #if (DEBUG_GLB_LVL() & DEBUG_LVL_17)
384 #define DEBUG_LVL_17_TRACE0(str)                    TRACE0(str)
385 #define DEBUG_LVL_17_TRACE1(str,p1)                 TRACE1(str,p1)
386 #define DEBUG_LVL_17_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
387 #define DEBUG_LVL_17_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
388 #define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
389 #else
390 #define DEBUG_LVL_17_TRACE0(str)
391 #define DEBUG_LVL_17_TRACE1(str,p1)
392 #define DEBUG_LVL_17_TRACE2(str,p1,p2)
393 #define DEBUG_LVL_17_TRACE3(str,p1,p2,p3)
394 #define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4)
395 #endif
396
397 #if (DEBUG_GLB_LVL() & DEBUG_LVL_16)
398 #define DEBUG_LVL_16_TRACE0(str)                    TRACE0(str)
399 #define DEBUG_LVL_16_TRACE1(str,p1)                 TRACE1(str,p1)
400 #define DEBUG_LVL_16_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
401 #define DEBUG_LVL_16_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
402 #define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
403 #else
404 #define DEBUG_LVL_16_TRACE0(str)
405 #define DEBUG_LVL_16_TRACE1(str,p1)
406 #define DEBUG_LVL_16_TRACE2(str,p1,p2)
407 #define DEBUG_LVL_16_TRACE3(str,p1,p2,p3)
408 #define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4)
409 #endif
410
411 #if (DEBUG_GLB_LVL() & DEBUG_LVL_15)
412 #define DEBUG_LVL_15_TRACE0(str)                    TRACE0(str)
413 #define DEBUG_LVL_15_TRACE1(str,p1)                 TRACE1(str,p1)
414 #define DEBUG_LVL_15_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
415 #define DEBUG_LVL_15_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
416 #define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
417 #else
418 #define DEBUG_LVL_15_TRACE0(str)
419 #define DEBUG_LVL_15_TRACE1(str,p1)
420 #define DEBUG_LVL_15_TRACE2(str,p1,p2)
421 #define DEBUG_LVL_15_TRACE3(str,p1,p2,p3)
422 #define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4)
423 #endif
424
425 #if (DEBUG_GLB_LVL() & DEBUG_LVL_14)
426 #define DEBUG_LVL_14_TRACE0(str)                    TRACE0(str)
427 #define DEBUG_LVL_14_TRACE1(str,p1)                 TRACE1(str,p1)
428 #define DEBUG_LVL_14_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
429 #define DEBUG_LVL_14_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
430 #define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
431 #else
432 #define DEBUG_LVL_14_TRACE0(str)
433 #define DEBUG_LVL_14_TRACE1(str,p1)
434 #define DEBUG_LVL_14_TRACE2(str,p1,p2)
435 #define DEBUG_LVL_14_TRACE3(str,p1,p2,p3)
436 #define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4)
437 #endif
438
439 #if (DEBUG_GLB_LVL() & DEBUG_LVL_13)
440 #define DEBUG_LVL_13_TRACE0(str)                    TRACE0(str)
441 #define DEBUG_LVL_13_TRACE1(str,p1)                 TRACE1(str,p1)
442 #define DEBUG_LVL_13_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
443 #define DEBUG_LVL_13_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
444 #define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
445 #else
446 #define DEBUG_LVL_13_TRACE0(str)
447 #define DEBUG_LVL_13_TRACE1(str,p1)
448 #define DEBUG_LVL_13_TRACE2(str,p1,p2)
449 #define DEBUG_LVL_13_TRACE3(str,p1,p2,p3)
450 #define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4)
451 #endif
452
453 #if (DEBUG_GLB_LVL() & DEBUG_LVL_12)
454 #define DEBUG_LVL_12_TRACE0(str)                    TRACE0(str)
455 #define DEBUG_LVL_12_TRACE1(str,p1)                 TRACE1(str,p1)
456 #define DEBUG_LVL_12_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
457 #define DEBUG_LVL_12_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
458 #define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
459 #else
460 #define DEBUG_LVL_12_TRACE0(str)
461 #define DEBUG_LVL_12_TRACE1(str,p1)
462 #define DEBUG_LVL_12_TRACE2(str,p1,p2)
463 #define DEBUG_LVL_12_TRACE3(str,p1,p2,p3)
464 #define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4)
465 #endif
466
467 #if (DEBUG_GLB_LVL() & DEBUG_LVL_11)
468 #define DEBUG_LVL_11_TRACE0(str)                    TRACE0(str)
469 #define DEBUG_LVL_11_TRACE1(str,p1)                 TRACE1(str,p1)
470 #define DEBUG_LVL_11_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
471 #define DEBUG_LVL_11_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
472 #define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
473 #else
474 #define DEBUG_LVL_11_TRACE0(str)
475 #define DEBUG_LVL_11_TRACE1(str,p1)
476 #define DEBUG_LVL_11_TRACE2(str,p1,p2)
477 #define DEBUG_LVL_11_TRACE3(str,p1,p2,p3)
478 #define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4)
479 #endif
480
481 #if (DEBUG_GLB_LVL() & DEBUG_LVL_10)
482 #define DEBUG_LVL_10_TRACE0(str)                    TRACE0(str)
483 #define DEBUG_LVL_10_TRACE1(str,p1)                 TRACE1(str,p1)
484 #define DEBUG_LVL_10_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
485 #define DEBUG_LVL_10_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
486 #define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
487 #else
488 #define DEBUG_LVL_10_TRACE0(str)
489 #define DEBUG_LVL_10_TRACE1(str,p1)
490 #define DEBUG_LVL_10_TRACE2(str,p1,p2)
491 #define DEBUG_LVL_10_TRACE3(str,p1,p2,p3)
492 #define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4)
493 #endif
494
495 #if (DEBUG_GLB_LVL() & DEBUG_LVL_09)
496 #define DEBUG_LVL_09_TRACE0(str)                    TRACE0(str)
497 #define DEBUG_LVL_09_TRACE1(str,p1)                 TRACE1(str,p1)
498 #define DEBUG_LVL_09_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
499 #define DEBUG_LVL_09_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
500 #define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
501 #else
502 #define DEBUG_LVL_09_TRACE0(str)
503 #define DEBUG_LVL_09_TRACE1(str,p1)
504 #define DEBUG_LVL_09_TRACE2(str,p1,p2)
505 #define DEBUG_LVL_09_TRACE3(str,p1,p2,p3)
506 #define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4)
507 #endif
508
509 #if (DEBUG_GLB_LVL() & DEBUG_LVL_08)
510 #define DEBUG_LVL_08_TRACE0(str)                    TRACE0(str)
511 #define DEBUG_LVL_08_TRACE1(str,p1)                 TRACE1(str,p1)
512 #define DEBUG_LVL_08_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
513 #define DEBUG_LVL_08_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
514 #define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
515 #else
516 #define DEBUG_LVL_08_TRACE0(str)
517 #define DEBUG_LVL_08_TRACE1(str,p1)
518 #define DEBUG_LVL_08_TRACE2(str,p1,p2)
519 #define DEBUG_LVL_08_TRACE3(str,p1,p2,p3)
520 #define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4)
521 #endif
522
523 #if (DEBUG_GLB_LVL() & DEBUG_LVL_07)
524 #define DEBUG_LVL_07_TRACE0(str)                    TRACE0(str)
525 #define DEBUG_LVL_07_TRACE1(str,p1)                 TRACE1(str,p1)
526 #define DEBUG_LVL_07_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
527 #define DEBUG_LVL_07_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
528 #define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
529 #else
530 #define DEBUG_LVL_07_TRACE0(str)
531 #define DEBUG_LVL_07_TRACE1(str,p1)
532 #define DEBUG_LVL_07_TRACE2(str,p1,p2)
533 #define DEBUG_LVL_07_TRACE3(str,p1,p2,p3)
534 #define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4)
535 #endif
536
537 #if (DEBUG_GLB_LVL() & DEBUG_LVL_06)
538 #define DEBUG_LVL_06_TRACE0(str)                    TRACE0(str)
539 #define DEBUG_LVL_06_TRACE1(str,p1)                 TRACE1(str,p1)
540 #define DEBUG_LVL_06_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
541 #define DEBUG_LVL_06_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
542 #define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
543 #else
544 #define DEBUG_LVL_06_TRACE0(str)
545 #define DEBUG_LVL_06_TRACE1(str,p1)
546 #define DEBUG_LVL_06_TRACE2(str,p1,p2)
547 #define DEBUG_LVL_06_TRACE3(str,p1,p2,p3)
548 #define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4)
549 #endif
550
551 #if (DEBUG_GLB_LVL() & DEBUG_LVL_05)
552 #define DEBUG_LVL_05_TRACE0(str)                    TRACE0(str)
553 #define DEBUG_LVL_05_TRACE1(str,p1)                 TRACE1(str,p1)
554 #define DEBUG_LVL_05_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
555 #define DEBUG_LVL_05_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
556 #define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
557 #else
558 #define DEBUG_LVL_05_TRACE0(str)
559 #define DEBUG_LVL_05_TRACE1(str,p1)
560 #define DEBUG_LVL_05_TRACE2(str,p1,p2)
561 #define DEBUG_LVL_05_TRACE3(str,p1,p2,p3)
562 #define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4)
563 #endif
564
565 #if (DEBUG_GLB_LVL() & DEBUG_LVL_04)
566 #define DEBUG_LVL_04_TRACE0(str)                    TRACE0(str)
567 #define DEBUG_LVL_04_TRACE1(str,p1)                 TRACE1(str,p1)
568 #define DEBUG_LVL_04_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
569 #define DEBUG_LVL_04_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
570 #define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
571 #else
572 #define DEBUG_LVL_04_TRACE0(str)
573 #define DEBUG_LVL_04_TRACE1(str,p1)
574 #define DEBUG_LVL_04_TRACE2(str,p1,p2)
575 #define DEBUG_LVL_04_TRACE3(str,p1,p2,p3)
576 #define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4)
577 #endif
578
579 #if (DEBUG_GLB_LVL() & DEBUG_LVL_03)
580 #define DEBUG_LVL_03_TRACE0(str)                    TRACE0(str)
581 #define DEBUG_LVL_03_TRACE1(str,p1)                 TRACE1(str,p1)
582 #define DEBUG_LVL_03_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
583 #define DEBUG_LVL_03_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
584 #define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
585 #else
586 #define DEBUG_LVL_03_TRACE0(str)
587 #define DEBUG_LVL_03_TRACE1(str,p1)
588 #define DEBUG_LVL_03_TRACE2(str,p1,p2)
589 #define DEBUG_LVL_03_TRACE3(str,p1,p2,p3)
590 #define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4)
591 #endif
592
593 #if (DEBUG_GLB_LVL() & DEBUG_LVL_02)
594 #define DEBUG_LVL_02_TRACE0(str)                    TRACE0(str)
595 #define DEBUG_LVL_02_TRACE1(str,p1)                 TRACE1(str,p1)
596 #define DEBUG_LVL_02_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
597 #define DEBUG_LVL_02_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
598 #define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
599 #else
600 #define DEBUG_LVL_02_TRACE0(str)
601 #define DEBUG_LVL_02_TRACE1(str,p1)
602 #define DEBUG_LVL_02_TRACE2(str,p1,p2)
603 #define DEBUG_LVL_02_TRACE3(str,p1,p2,p3)
604 #define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4)
605 #endif
606
607 #if (DEBUG_GLB_LVL() & DEBUG_LVL_01)
608 #define DEBUG_LVL_01_TRACE0(str)                    TRACE0(str)
609 #define DEBUG_LVL_01_TRACE1(str,p1)                 TRACE1(str,p1)
610 #define DEBUG_LVL_01_TRACE2(str,p1,p2)              TRACE2(str,p1,p2)
611 #define DEBUG_LVL_01_TRACE3(str,p1,p2,p3)           TRACE3(str,p1,p2,p3)
612 #define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4)        TRACE4(str,p1,p2,p3,p4)
613 #else
614 #define DEBUG_LVL_01_TRACE0(str)
615 #define DEBUG_LVL_01_TRACE1(str,p1)
616 #define DEBUG_LVL_01_TRACE2(str,p1,p2)
617 #define DEBUG_LVL_01_TRACE3(str,p1,p2,p3)
618 #define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4)
619 #endif
620
621 #define DEBUG_TRACE0(lvl,str)                           lvl##_TRACE0(str)
622 #define DEBUG_TRACE1(lvl,str,p1)                        lvl##_TRACE1(str,p1)
623 #define DEBUG_TRACE2(lvl,str,p1,p2)                     lvl##_TRACE2(str,p1,p2)
624 #define DEBUG_TRACE3(lvl,str,p1,p2,p3)                  lvl##_TRACE3(str,p1,p2,p3)
625 #define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4)               lvl##_TRACE4(str,p1,p2,p3,p4)
626
627 //---------------------------------------------------------------------------
628 // The macro DEBUG_DUMP_DATA() can be used with the same debug-levels to dump
629 // out data bytes. Function DumpData() has to be included.
630 // NOTE: DUMP_DATA has to be defined in project settings.
631 #if (!defined (NDEBUG) && defined (DUMP_DATA))
632
633 #ifdef __cplusplus
634 extern "C" {
635 #endif
636
637         void DumpData(char *szStr_p, u8 *pbData_p, WORD wSize_p);
638
639 #ifdef __cplusplus
640 }                               // von extern "C"
641 #endif
642 #define DEBUG_DUMP_DATA(lvl,str,ptr,siz)    if ((DEBUG_GLB_LVL() & (lvl))==(lvl)) \
643                                                     DumpData (str, (u8 *)(ptr), (WORD)(siz));
644 #else
645
646 #define DEBUG_DUMP_DATA(lvl,str,ptr,siz)
647
648 #endif
649
650 //---------------------------------------------------------------------------
651 // The macro DEBUG_ASSERT() can be used to print out an error string if the
652 // parametered expresion does not result TRUE.
653 // NOTE: If DEBUG_KEEP_ASSERT is defined, then DEBUG_ASSERT-line will not be
654 //       deleted from compiler (in release version too).
655 #if !defined (NDEBUG) || defined (DEBUG_KEEP_ASSERT)
656
657         // For microcontrollers process will be stopped using endless loop.
658
659 #define DEBUG_ASSERT0(expr,str)         if (!(expr )) { \
660                                                     DEBUG_LVL_ASSERT_TRACE3 ( \
661                                                         "Assertion failed: line %d file '%s'\n" \
662                                                         "    -> '%s'\n", __LINE__, __FILE__, str); \
663                                                     while (1); }
664
665 #define DEBUG_ASSERT1(expr,str,p1)      if (!(expr )) { \
666                                                     DEBUG_LVL_ASSERT_TRACE4 ( \
667                                                         "Assertion failed: line %d file '%s'\n" \
668                                                         "    -> '%s'\n" \
669                                                         "    -> 0x%08lX\n", __LINE__, __FILE__, str, (u32) p1); \
670                                                     while (1); }
671
672
673 #else
674
675 #define DEBUG_ASSERT0(expr,str)
676 #define DEBUG_ASSERT1(expr,str,p1)
677
678 #endif
679
680 //---------------------------------------------------------------------------
681 // The macro DEBUG_ONLY() implements code, if NDEBUG is not defined.
682 #if !defined (DEBUG_ONLY)
683 #if !defined (NDEBUG)
684
685 #define DEBUG_ONLY(expr)    expr
686
687 #else
688
689 #define DEBUG_ONLY(expr)
690
691 #endif
692 #endif
693
694 #endif // _DEBUG_H_