Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 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 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 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 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 124 | //--------------------------------------------------------------------------- |
| 125 | // global types |
| 126 | //--------------------------------------------------------------------------- |
| 127 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 128 | //--------------------------------------------------------------------------- |
| 129 | // global vars |
| 130 | //--------------------------------------------------------------------------- |
| 131 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 132 | //--------------------------------------------------------------------------- |
| 133 | // global function prototypes |
| 134 | //--------------------------------------------------------------------------- |
| 135 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 136 | //--------------------------------------------------------------------------- |
| 137 | // global macros |
| 138 | //--------------------------------------------------------------------------- |
| 139 | |
| 140 | //--------------------------------------------------------------------------- |
| 141 | // this macro defines a version string |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 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 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 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 |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 159 | #define DEF_DEBUG_LVL (DEBUG_LVL_ALWAYS | DEBUG_LVL_ERROR) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 160 | #endif |
| 161 | #ifndef DEBUG_GLB_LVL |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 162 | #define DEBUG_GLB_LVL() (DEF_DEBUG_LVL) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 163 | #endif |
| 164 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 165 | //--------------------------------------------------------------------------- |
| 166 | #if (DEV_SYSTEM == _DEV_WIN32_) && defined (TRACE_MSG) |
| 167 | |
| 168 | // For WIN32 the macro DEBUG_TRACE0 can be defined as function call TraceLvl() |
| 169 | // or as macro TRACE(). |
| 170 | // |
| 171 | // Here the parameter 'lvl' can be used with more than one |
| 172 | // debug-level (using OR). |
| 173 | // |
| 174 | // Example: DEBUG_TRACE1(DEBUG_LVL_30 | DEBUG_LVL_02, "Hello %d", bCount); |
| 175 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 176 | #define DEBUG_TRACE0(lvl,str) TraceLvl((lvl),str) |
| 177 | #define DEBUG_TRACE1(lvl,str,p1) TraceLvl((lvl),str,p1) |
| 178 | #define DEBUG_TRACE2(lvl,str,p1,p2) TraceLvl((lvl),str,p1,p2) |
| 179 | #define DEBUG_TRACE3(lvl,str,p1,p2,p3) TraceLvl((lvl),str,p1,p2,p3) |
| 180 | #define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4) TraceLvl((lvl),str,p1,p2,p3,p4) |
| 181 | #define DEBUG_GLB_LVL() dwDebugLevel_g |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 182 | |
| 183 | #else |
| 184 | |
| 185 | // At microcontrollers we do reduce the memory usage by deleting DEBUG_TRACE-lines |
| 186 | // (compiler does delete the lines). |
| 187 | // |
| 188 | // Here the parameter 'lvl' can only be used with one debug-level. |
| 189 | // |
| 190 | // Example: DEBUG_TRACE1(DEBUG_LVL_ERROR, "error code %d", dwRet); |
| 191 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 192 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_ALWAYS) |
| 193 | #define DEBUG_LVL_ALWAYS_TRACE0(str) TRACE0(str) |
| 194 | #define DEBUG_LVL_ALWAYS_TRACE1(str,p1) TRACE1(str,p1) |
| 195 | #define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 196 | #define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 197 | #define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 198 | #else |
| 199 | #define DEBUG_LVL_ALWAYS_TRACE0(str) |
| 200 | #define DEBUG_LVL_ALWAYS_TRACE1(str,p1) |
| 201 | #define DEBUG_LVL_ALWAYS_TRACE2(str,p1,p2) |
| 202 | #define DEBUG_LVL_ALWAYS_TRACE3(str,p1,p2,p3) |
| 203 | #define DEBUG_LVL_ALWAYS_TRACE4(str,p1,p2,p3,p4) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 204 | #endif |
| 205 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 206 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_ERROR) |
| 207 | #define DEBUG_LVL_ERROR_TRACE0(str) TRACE0(str) |
| 208 | #define DEBUG_LVL_ERROR_TRACE1(str,p1) TRACE1(str,p1) |
| 209 | #define DEBUG_LVL_ERROR_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 210 | #define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 211 | #define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 212 | #else |
| 213 | #define DEBUG_LVL_ERROR_TRACE0(str) |
| 214 | #define DEBUG_LVL_ERROR_TRACE1(str,p1) |
| 215 | #define DEBUG_LVL_ERROR_TRACE2(str,p1,p2) |
| 216 | #define DEBUG_LVL_ERROR_TRACE3(str,p1,p2,p3) |
| 217 | #define DEBUG_LVL_ERROR_TRACE4(str,p1,p2,p3,p4) |
| 218 | #endif |
| 219 | |
| 220 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT) |
| 221 | #define DEBUG_LVL_ASSERT_TRACE0(str) TRACE0(str) |
| 222 | #define DEBUG_LVL_ASSERT_TRACE1(str,p1) TRACE1(str,p1) |
| 223 | #define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 224 | #define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 225 | #define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 226 | #else |
| 227 | #define DEBUG_LVL_ASSERT_TRACE0(str) |
| 228 | #define DEBUG_LVL_ASSERT_TRACE1(str,p1) |
| 229 | #define DEBUG_LVL_ASSERT_TRACE2(str,p1,p2) |
| 230 | #define DEBUG_LVL_ASSERT_TRACE3(str,p1,p2,p3) |
| 231 | #define DEBUG_LVL_ASSERT_TRACE4(str,p1,p2,p3,p4) |
| 232 | #endif |
| 233 | |
| 234 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_29) |
| 235 | #define DEBUG_LVL_29_TRACE0(str) TRACE0(str) |
| 236 | #define DEBUG_LVL_29_TRACE1(str,p1) TRACE1(str,p1) |
| 237 | #define DEBUG_LVL_29_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 238 | #define DEBUG_LVL_29_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 239 | #define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 240 | #else |
| 241 | #define DEBUG_LVL_29_TRACE0(str) |
| 242 | #define DEBUG_LVL_29_TRACE1(str,p1) |
| 243 | #define DEBUG_LVL_29_TRACE2(str,p1,p2) |
| 244 | #define DEBUG_LVL_29_TRACE3(str,p1,p2,p3) |
| 245 | #define DEBUG_LVL_29_TRACE4(str,p1,p2,p3,p4) |
| 246 | #endif |
| 247 | |
| 248 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_28) |
| 249 | #define DEBUG_LVL_28_TRACE0(str) TRACE0(str) |
| 250 | #define DEBUG_LVL_28_TRACE1(str,p1) TRACE1(str,p1) |
| 251 | #define DEBUG_LVL_28_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 252 | #define DEBUG_LVL_28_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 253 | #define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 254 | #else |
| 255 | #define DEBUG_LVL_28_TRACE0(str) |
| 256 | #define DEBUG_LVL_28_TRACE1(str,p1) |
| 257 | #define DEBUG_LVL_28_TRACE2(str,p1,p2) |
| 258 | #define DEBUG_LVL_28_TRACE3(str,p1,p2,p3) |
| 259 | #define DEBUG_LVL_28_TRACE4(str,p1,p2,p3,p4) |
| 260 | #endif |
| 261 | |
| 262 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_27) |
| 263 | #define DEBUG_LVL_27_TRACE0(str) TRACE0(str) |
| 264 | #define DEBUG_LVL_27_TRACE1(str,p1) TRACE1(str,p1) |
| 265 | #define DEBUG_LVL_27_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 266 | #define DEBUG_LVL_27_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 267 | #define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 268 | #else |
| 269 | #define DEBUG_LVL_27_TRACE0(str) |
| 270 | #define DEBUG_LVL_27_TRACE1(str,p1) |
| 271 | #define DEBUG_LVL_27_TRACE2(str,p1,p2) |
| 272 | #define DEBUG_LVL_27_TRACE3(str,p1,p2,p3) |
| 273 | #define DEBUG_LVL_27_TRACE4(str,p1,p2,p3,p4) |
| 274 | #endif |
| 275 | |
| 276 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_26) |
| 277 | #define DEBUG_LVL_26_TRACE0(str) TRACE0(str) |
| 278 | #define DEBUG_LVL_26_TRACE1(str,p1) TRACE1(str,p1) |
| 279 | #define DEBUG_LVL_26_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 280 | #define DEBUG_LVL_26_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 281 | #define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 282 | #else |
| 283 | #define DEBUG_LVL_26_TRACE0(str) |
| 284 | #define DEBUG_LVL_26_TRACE1(str,p1) |
| 285 | #define DEBUG_LVL_26_TRACE2(str,p1,p2) |
| 286 | #define DEBUG_LVL_26_TRACE3(str,p1,p2,p3) |
| 287 | #define DEBUG_LVL_26_TRACE4(str,p1,p2,p3,p4) |
| 288 | #endif |
| 289 | |
| 290 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_25) |
| 291 | #define DEBUG_LVL_25_TRACE0(str) TRACE0(str) |
| 292 | #define DEBUG_LVL_25_TRACE1(str,p1) TRACE1(str,p1) |
| 293 | #define DEBUG_LVL_25_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 294 | #define DEBUG_LVL_25_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 295 | #define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 296 | #else |
| 297 | #define DEBUG_LVL_25_TRACE0(str) |
| 298 | #define DEBUG_LVL_25_TRACE1(str,p1) |
| 299 | #define DEBUG_LVL_25_TRACE2(str,p1,p2) |
| 300 | #define DEBUG_LVL_25_TRACE3(str,p1,p2,p3) |
| 301 | #define DEBUG_LVL_25_TRACE4(str,p1,p2,p3,p4) |
| 302 | #endif |
| 303 | |
| 304 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_24) |
| 305 | #define DEBUG_LVL_24_TRACE0(str) TRACE0(str) |
| 306 | #define DEBUG_LVL_24_TRACE1(str,p1) TRACE1(str,p1) |
| 307 | #define DEBUG_LVL_24_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 308 | #define DEBUG_LVL_24_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 309 | #define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 310 | #else |
| 311 | #define DEBUG_LVL_24_TRACE0(str) |
| 312 | #define DEBUG_LVL_24_TRACE1(str,p1) |
| 313 | #define DEBUG_LVL_24_TRACE2(str,p1,p2) |
| 314 | #define DEBUG_LVL_24_TRACE3(str,p1,p2,p3) |
| 315 | #define DEBUG_LVL_24_TRACE4(str,p1,p2,p3,p4) |
| 316 | #endif |
| 317 | |
| 318 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_23) |
| 319 | #define DEBUG_LVL_23_TRACE0(str) TRACE0(str) |
| 320 | #define DEBUG_LVL_23_TRACE1(str,p1) TRACE1(str,p1) |
| 321 | #define DEBUG_LVL_23_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 322 | #define DEBUG_LVL_23_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 323 | #define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 324 | #else |
| 325 | #define DEBUG_LVL_23_TRACE0(str) |
| 326 | #define DEBUG_LVL_23_TRACE1(str,p1) |
| 327 | #define DEBUG_LVL_23_TRACE2(str,p1,p2) |
| 328 | #define DEBUG_LVL_23_TRACE3(str,p1,p2,p3) |
| 329 | #define DEBUG_LVL_23_TRACE4(str,p1,p2,p3,p4) |
| 330 | #endif |
| 331 | |
| 332 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_22) |
| 333 | #define DEBUG_LVL_22_TRACE0(str) TRACE0(str) |
| 334 | #define DEBUG_LVL_22_TRACE1(str,p1) TRACE1(str,p1) |
| 335 | #define DEBUG_LVL_22_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 336 | #define DEBUG_LVL_22_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 337 | #define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 338 | #else |
| 339 | #define DEBUG_LVL_22_TRACE0(str) |
| 340 | #define DEBUG_LVL_22_TRACE1(str,p1) |
| 341 | #define DEBUG_LVL_22_TRACE2(str,p1,p2) |
| 342 | #define DEBUG_LVL_22_TRACE3(str,p1,p2,p3) |
| 343 | #define DEBUG_LVL_22_TRACE4(str,p1,p2,p3,p4) |
| 344 | #endif |
| 345 | |
| 346 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_21) |
| 347 | #define DEBUG_LVL_21_TRACE0(str) TRACE0(str) |
| 348 | #define DEBUG_LVL_21_TRACE1(str,p1) TRACE1(str,p1) |
| 349 | #define DEBUG_LVL_21_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 350 | #define DEBUG_LVL_21_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 351 | #define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 352 | #else |
| 353 | #define DEBUG_LVL_21_TRACE0(str) |
| 354 | #define DEBUG_LVL_21_TRACE1(str,p1) |
| 355 | #define DEBUG_LVL_21_TRACE2(str,p1,p2) |
| 356 | #define DEBUG_LVL_21_TRACE3(str,p1,p2,p3) |
| 357 | #define DEBUG_LVL_21_TRACE4(str,p1,p2,p3,p4) |
| 358 | #endif |
| 359 | |
| 360 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_20) |
| 361 | #define DEBUG_LVL_20_TRACE0(str) TRACE0(str) |
| 362 | #define DEBUG_LVL_20_TRACE1(str,p1) TRACE1(str,p1) |
| 363 | #define DEBUG_LVL_20_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 364 | #define DEBUG_LVL_20_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 365 | #define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 366 | #else |
| 367 | #define DEBUG_LVL_20_TRACE0(str) |
| 368 | #define DEBUG_LVL_20_TRACE1(str,p1) |
| 369 | #define DEBUG_LVL_20_TRACE2(str,p1,p2) |
| 370 | #define DEBUG_LVL_20_TRACE3(str,p1,p2,p3) |
| 371 | #define DEBUG_LVL_20_TRACE4(str,p1,p2,p3,p4) |
| 372 | #endif |
| 373 | |
| 374 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_19) |
| 375 | #define DEBUG_LVL_19_TRACE0(str) TRACE0(str) |
| 376 | #define DEBUG_LVL_19_TRACE1(str,p1) TRACE1(str,p1) |
| 377 | #define DEBUG_LVL_19_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 378 | #define DEBUG_LVL_19_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 379 | #define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 380 | #else |
| 381 | #define DEBUG_LVL_19_TRACE0(str) |
| 382 | #define DEBUG_LVL_19_TRACE1(str,p1) |
| 383 | #define DEBUG_LVL_19_TRACE2(str,p1,p2) |
| 384 | #define DEBUG_LVL_19_TRACE3(str,p1,p2,p3) |
| 385 | #define DEBUG_LVL_19_TRACE4(str,p1,p2,p3,p4) |
| 386 | #endif |
| 387 | |
| 388 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_18) |
| 389 | #define DEBUG_LVL_18_TRACE0(str) TRACE0(str) |
| 390 | #define DEBUG_LVL_18_TRACE1(str,p1) TRACE1(str,p1) |
| 391 | #define DEBUG_LVL_18_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 392 | #define DEBUG_LVL_18_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 393 | #define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 394 | #else |
| 395 | #define DEBUG_LVL_18_TRACE0(str) |
| 396 | #define DEBUG_LVL_18_TRACE1(str,p1) |
| 397 | #define DEBUG_LVL_18_TRACE2(str,p1,p2) |
| 398 | #define DEBUG_LVL_18_TRACE3(str,p1,p2,p3) |
| 399 | #define DEBUG_LVL_18_TRACE4(str,p1,p2,p3,p4) |
| 400 | #endif |
| 401 | |
| 402 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_17) |
| 403 | #define DEBUG_LVL_17_TRACE0(str) TRACE0(str) |
| 404 | #define DEBUG_LVL_17_TRACE1(str,p1) TRACE1(str,p1) |
| 405 | #define DEBUG_LVL_17_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 406 | #define DEBUG_LVL_17_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 407 | #define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 408 | #else |
| 409 | #define DEBUG_LVL_17_TRACE0(str) |
| 410 | #define DEBUG_LVL_17_TRACE1(str,p1) |
| 411 | #define DEBUG_LVL_17_TRACE2(str,p1,p2) |
| 412 | #define DEBUG_LVL_17_TRACE3(str,p1,p2,p3) |
| 413 | #define DEBUG_LVL_17_TRACE4(str,p1,p2,p3,p4) |
| 414 | #endif |
| 415 | |
| 416 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_16) |
| 417 | #define DEBUG_LVL_16_TRACE0(str) TRACE0(str) |
| 418 | #define DEBUG_LVL_16_TRACE1(str,p1) TRACE1(str,p1) |
| 419 | #define DEBUG_LVL_16_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 420 | #define DEBUG_LVL_16_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 421 | #define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 422 | #else |
| 423 | #define DEBUG_LVL_16_TRACE0(str) |
| 424 | #define DEBUG_LVL_16_TRACE1(str,p1) |
| 425 | #define DEBUG_LVL_16_TRACE2(str,p1,p2) |
| 426 | #define DEBUG_LVL_16_TRACE3(str,p1,p2,p3) |
| 427 | #define DEBUG_LVL_16_TRACE4(str,p1,p2,p3,p4) |
| 428 | #endif |
| 429 | |
| 430 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_15) |
| 431 | #define DEBUG_LVL_15_TRACE0(str) TRACE0(str) |
| 432 | #define DEBUG_LVL_15_TRACE1(str,p1) TRACE1(str,p1) |
| 433 | #define DEBUG_LVL_15_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 434 | #define DEBUG_LVL_15_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 435 | #define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 436 | #else |
| 437 | #define DEBUG_LVL_15_TRACE0(str) |
| 438 | #define DEBUG_LVL_15_TRACE1(str,p1) |
| 439 | #define DEBUG_LVL_15_TRACE2(str,p1,p2) |
| 440 | #define DEBUG_LVL_15_TRACE3(str,p1,p2,p3) |
| 441 | #define DEBUG_LVL_15_TRACE4(str,p1,p2,p3,p4) |
| 442 | #endif |
| 443 | |
| 444 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_14) |
| 445 | #define DEBUG_LVL_14_TRACE0(str) TRACE0(str) |
| 446 | #define DEBUG_LVL_14_TRACE1(str,p1) TRACE1(str,p1) |
| 447 | #define DEBUG_LVL_14_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 448 | #define DEBUG_LVL_14_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 449 | #define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 450 | #else |
| 451 | #define DEBUG_LVL_14_TRACE0(str) |
| 452 | #define DEBUG_LVL_14_TRACE1(str,p1) |
| 453 | #define DEBUG_LVL_14_TRACE2(str,p1,p2) |
| 454 | #define DEBUG_LVL_14_TRACE3(str,p1,p2,p3) |
| 455 | #define DEBUG_LVL_14_TRACE4(str,p1,p2,p3,p4) |
| 456 | #endif |
| 457 | |
| 458 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_13) |
| 459 | #define DEBUG_LVL_13_TRACE0(str) TRACE0(str) |
| 460 | #define DEBUG_LVL_13_TRACE1(str,p1) TRACE1(str,p1) |
| 461 | #define DEBUG_LVL_13_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 462 | #define DEBUG_LVL_13_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 463 | #define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 464 | #else |
| 465 | #define DEBUG_LVL_13_TRACE0(str) |
| 466 | #define DEBUG_LVL_13_TRACE1(str,p1) |
| 467 | #define DEBUG_LVL_13_TRACE2(str,p1,p2) |
| 468 | #define DEBUG_LVL_13_TRACE3(str,p1,p2,p3) |
| 469 | #define DEBUG_LVL_13_TRACE4(str,p1,p2,p3,p4) |
| 470 | #endif |
| 471 | |
| 472 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_12) |
| 473 | #define DEBUG_LVL_12_TRACE0(str) TRACE0(str) |
| 474 | #define DEBUG_LVL_12_TRACE1(str,p1) TRACE1(str,p1) |
| 475 | #define DEBUG_LVL_12_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 476 | #define DEBUG_LVL_12_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 477 | #define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 478 | #else |
| 479 | #define DEBUG_LVL_12_TRACE0(str) |
| 480 | #define DEBUG_LVL_12_TRACE1(str,p1) |
| 481 | #define DEBUG_LVL_12_TRACE2(str,p1,p2) |
| 482 | #define DEBUG_LVL_12_TRACE3(str,p1,p2,p3) |
| 483 | #define DEBUG_LVL_12_TRACE4(str,p1,p2,p3,p4) |
| 484 | #endif |
| 485 | |
| 486 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_11) |
| 487 | #define DEBUG_LVL_11_TRACE0(str) TRACE0(str) |
| 488 | #define DEBUG_LVL_11_TRACE1(str,p1) TRACE1(str,p1) |
| 489 | #define DEBUG_LVL_11_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 490 | #define DEBUG_LVL_11_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 491 | #define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 492 | #else |
| 493 | #define DEBUG_LVL_11_TRACE0(str) |
| 494 | #define DEBUG_LVL_11_TRACE1(str,p1) |
| 495 | #define DEBUG_LVL_11_TRACE2(str,p1,p2) |
| 496 | #define DEBUG_LVL_11_TRACE3(str,p1,p2,p3) |
| 497 | #define DEBUG_LVL_11_TRACE4(str,p1,p2,p3,p4) |
| 498 | #endif |
| 499 | |
| 500 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_10) |
| 501 | #define DEBUG_LVL_10_TRACE0(str) TRACE0(str) |
| 502 | #define DEBUG_LVL_10_TRACE1(str,p1) TRACE1(str,p1) |
| 503 | #define DEBUG_LVL_10_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 504 | #define DEBUG_LVL_10_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 505 | #define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 506 | #else |
| 507 | #define DEBUG_LVL_10_TRACE0(str) |
| 508 | #define DEBUG_LVL_10_TRACE1(str,p1) |
| 509 | #define DEBUG_LVL_10_TRACE2(str,p1,p2) |
| 510 | #define DEBUG_LVL_10_TRACE3(str,p1,p2,p3) |
| 511 | #define DEBUG_LVL_10_TRACE4(str,p1,p2,p3,p4) |
| 512 | #endif |
| 513 | |
| 514 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_09) |
| 515 | #define DEBUG_LVL_09_TRACE0(str) TRACE0(str) |
| 516 | #define DEBUG_LVL_09_TRACE1(str,p1) TRACE1(str,p1) |
| 517 | #define DEBUG_LVL_09_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 518 | #define DEBUG_LVL_09_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 519 | #define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 520 | #else |
| 521 | #define DEBUG_LVL_09_TRACE0(str) |
| 522 | #define DEBUG_LVL_09_TRACE1(str,p1) |
| 523 | #define DEBUG_LVL_09_TRACE2(str,p1,p2) |
| 524 | #define DEBUG_LVL_09_TRACE3(str,p1,p2,p3) |
| 525 | #define DEBUG_LVL_09_TRACE4(str,p1,p2,p3,p4) |
| 526 | #endif |
| 527 | |
| 528 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_08) |
| 529 | #define DEBUG_LVL_08_TRACE0(str) TRACE0(str) |
| 530 | #define DEBUG_LVL_08_TRACE1(str,p1) TRACE1(str,p1) |
| 531 | #define DEBUG_LVL_08_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 532 | #define DEBUG_LVL_08_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 533 | #define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 534 | #else |
| 535 | #define DEBUG_LVL_08_TRACE0(str) |
| 536 | #define DEBUG_LVL_08_TRACE1(str,p1) |
| 537 | #define DEBUG_LVL_08_TRACE2(str,p1,p2) |
| 538 | #define DEBUG_LVL_08_TRACE3(str,p1,p2,p3) |
| 539 | #define DEBUG_LVL_08_TRACE4(str,p1,p2,p3,p4) |
| 540 | #endif |
| 541 | |
| 542 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_07) |
| 543 | #define DEBUG_LVL_07_TRACE0(str) TRACE0(str) |
| 544 | #define DEBUG_LVL_07_TRACE1(str,p1) TRACE1(str,p1) |
| 545 | #define DEBUG_LVL_07_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 546 | #define DEBUG_LVL_07_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 547 | #define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 548 | #else |
| 549 | #define DEBUG_LVL_07_TRACE0(str) |
| 550 | #define DEBUG_LVL_07_TRACE1(str,p1) |
| 551 | #define DEBUG_LVL_07_TRACE2(str,p1,p2) |
| 552 | #define DEBUG_LVL_07_TRACE3(str,p1,p2,p3) |
| 553 | #define DEBUG_LVL_07_TRACE4(str,p1,p2,p3,p4) |
| 554 | #endif |
| 555 | |
| 556 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_06) |
| 557 | #define DEBUG_LVL_06_TRACE0(str) TRACE0(str) |
| 558 | #define DEBUG_LVL_06_TRACE1(str,p1) TRACE1(str,p1) |
| 559 | #define DEBUG_LVL_06_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 560 | #define DEBUG_LVL_06_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 561 | #define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 562 | #else |
| 563 | #define DEBUG_LVL_06_TRACE0(str) |
| 564 | #define DEBUG_LVL_06_TRACE1(str,p1) |
| 565 | #define DEBUG_LVL_06_TRACE2(str,p1,p2) |
| 566 | #define DEBUG_LVL_06_TRACE3(str,p1,p2,p3) |
| 567 | #define DEBUG_LVL_06_TRACE4(str,p1,p2,p3,p4) |
| 568 | #endif |
| 569 | |
| 570 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_05) |
| 571 | #define DEBUG_LVL_05_TRACE0(str) TRACE0(str) |
| 572 | #define DEBUG_LVL_05_TRACE1(str,p1) TRACE1(str,p1) |
| 573 | #define DEBUG_LVL_05_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 574 | #define DEBUG_LVL_05_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 575 | #define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 576 | #else |
| 577 | #define DEBUG_LVL_05_TRACE0(str) |
| 578 | #define DEBUG_LVL_05_TRACE1(str,p1) |
| 579 | #define DEBUG_LVL_05_TRACE2(str,p1,p2) |
| 580 | #define DEBUG_LVL_05_TRACE3(str,p1,p2,p3) |
| 581 | #define DEBUG_LVL_05_TRACE4(str,p1,p2,p3,p4) |
| 582 | #endif |
| 583 | |
| 584 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_04) |
| 585 | #define DEBUG_LVL_04_TRACE0(str) TRACE0(str) |
| 586 | #define DEBUG_LVL_04_TRACE1(str,p1) TRACE1(str,p1) |
| 587 | #define DEBUG_LVL_04_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 588 | #define DEBUG_LVL_04_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 589 | #define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 590 | #else |
| 591 | #define DEBUG_LVL_04_TRACE0(str) |
| 592 | #define DEBUG_LVL_04_TRACE1(str,p1) |
| 593 | #define DEBUG_LVL_04_TRACE2(str,p1,p2) |
| 594 | #define DEBUG_LVL_04_TRACE3(str,p1,p2,p3) |
| 595 | #define DEBUG_LVL_04_TRACE4(str,p1,p2,p3,p4) |
| 596 | #endif |
| 597 | |
| 598 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_03) |
| 599 | #define DEBUG_LVL_03_TRACE0(str) TRACE0(str) |
| 600 | #define DEBUG_LVL_03_TRACE1(str,p1) TRACE1(str,p1) |
| 601 | #define DEBUG_LVL_03_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 602 | #define DEBUG_LVL_03_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 603 | #define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 604 | #else |
| 605 | #define DEBUG_LVL_03_TRACE0(str) |
| 606 | #define DEBUG_LVL_03_TRACE1(str,p1) |
| 607 | #define DEBUG_LVL_03_TRACE2(str,p1,p2) |
| 608 | #define DEBUG_LVL_03_TRACE3(str,p1,p2,p3) |
| 609 | #define DEBUG_LVL_03_TRACE4(str,p1,p2,p3,p4) |
| 610 | #endif |
| 611 | |
| 612 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_02) |
| 613 | #define DEBUG_LVL_02_TRACE0(str) TRACE0(str) |
| 614 | #define DEBUG_LVL_02_TRACE1(str,p1) TRACE1(str,p1) |
| 615 | #define DEBUG_LVL_02_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 616 | #define DEBUG_LVL_02_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 617 | #define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 618 | #else |
| 619 | #define DEBUG_LVL_02_TRACE0(str) |
| 620 | #define DEBUG_LVL_02_TRACE1(str,p1) |
| 621 | #define DEBUG_LVL_02_TRACE2(str,p1,p2) |
| 622 | #define DEBUG_LVL_02_TRACE3(str,p1,p2,p3) |
| 623 | #define DEBUG_LVL_02_TRACE4(str,p1,p2,p3,p4) |
| 624 | #endif |
| 625 | |
| 626 | #if (DEBUG_GLB_LVL() & DEBUG_LVL_01) |
| 627 | #define DEBUG_LVL_01_TRACE0(str) TRACE0(str) |
| 628 | #define DEBUG_LVL_01_TRACE1(str,p1) TRACE1(str,p1) |
| 629 | #define DEBUG_LVL_01_TRACE2(str,p1,p2) TRACE2(str,p1,p2) |
| 630 | #define DEBUG_LVL_01_TRACE3(str,p1,p2,p3) TRACE3(str,p1,p2,p3) |
| 631 | #define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4) TRACE4(str,p1,p2,p3,p4) |
| 632 | #else |
| 633 | #define DEBUG_LVL_01_TRACE0(str) |
| 634 | #define DEBUG_LVL_01_TRACE1(str,p1) |
| 635 | #define DEBUG_LVL_01_TRACE2(str,p1,p2) |
| 636 | #define DEBUG_LVL_01_TRACE3(str,p1,p2,p3) |
| 637 | #define DEBUG_LVL_01_TRACE4(str,p1,p2,p3,p4) |
| 638 | #endif |
| 639 | |
| 640 | #define DEBUG_TRACE0(lvl,str) lvl##_TRACE0(str) |
| 641 | #define DEBUG_TRACE1(lvl,str,p1) lvl##_TRACE1(str,p1) |
| 642 | #define DEBUG_TRACE2(lvl,str,p1,p2) lvl##_TRACE2(str,p1,p2) |
| 643 | #define DEBUG_TRACE3(lvl,str,p1,p2,p3) lvl##_TRACE3(str,p1,p2,p3) |
| 644 | #define DEBUG_TRACE4(lvl,str,p1,p2,p3,p4) lvl##_TRACE4(str,p1,p2,p3,p4) |
| 645 | |
| 646 | #endif |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 647 | |
| 648 | //--------------------------------------------------------------------------- |
| 649 | // The macro DEBUG_DUMP_DATA() can be used with the same debug-levels to dump |
| 650 | // out data bytes. Function DumpData() has to be included. |
| 651 | // NOTE: DUMP_DATA has to be defined in project settings. |
| 652 | #if (!defined (NDEBUG) && defined (DUMP_DATA)) || (DEV_SYSTEM == _DEV_WIN32_) |
| 653 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 654 | #ifdef __cplusplus |
| 655 | extern "C" { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 656 | #endif |
| 657 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 658 | void DumpData(char *szStr_p, BYTE MEM * pbData_p, WORD wSize_p); |
| 659 | |
| 660 | #ifdef __cplusplus |
| 661 | } // von extern "C" |
| 662 | #endif |
| 663 | #define DEBUG_DUMP_DATA(lvl,str,ptr,siz) if ((DEBUG_GLB_LVL() & (lvl))==(lvl)) \ |
| 664 | DumpData (str, (BYTE MEM*) (ptr), (WORD) (siz)); |
| 665 | #else |
| 666 | |
| 667 | #define DEBUG_DUMP_DATA(lvl,str,ptr,siz) |
| 668 | |
| 669 | #endif |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 670 | |
| 671 | //--------------------------------------------------------------------------- |
| 672 | // The macro DEBUG_ASSERT() can be used to print out an error string if the |
| 673 | // parametered expresion does not result TRUE. |
| 674 | // NOTE: If DEBUG_KEEP_ASSERT is defined, then DEBUG_ASSERT-line will not be |
| 675 | // deleted from compiler (in release version too). |
| 676 | #if !defined (NDEBUG) || defined (DEBUG_KEEP_ASSERT) |
| 677 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 678 | #if (DEV_SYSTEM == _DEV_WIN32_) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 679 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 680 | // For WIN32 process will be killed after closing message box. |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 681 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 682 | #define DEBUG_ASSERT0(expr,str) if (!(expr ) && ((DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT)!=0)) { \ |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 683 | MessageBox (NULL, \ |
| 684 | "Assertion failed: line " __LINE__ " file " __FILE__ \ |
| 685 | "\n -> " str "\n"); \ |
| 686 | ExitProcess (-1); } |
| 687 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 688 | #define DEBUG_ASSERT1(expr,str,p1) if (!(expr ) && ((DEBUG_GLB_LVL() & DEBUG_LVL_ASSERT)!=0)) { \ |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 689 | MessageBox (NULL, \ |
| 690 | "Assertion failed: line " __LINE__ " file " __FILE__ \ |
| 691 | "\n -> " str "\n"); \ |
| 692 | ExitProcess (-1); } |
| 693 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 694 | #else |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 695 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 696 | // For microcontrollers process will be stopped using endless loop. |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 697 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 698 | #define DEBUG_ASSERT0(expr,str) if (!(expr )) { \ |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 699 | DEBUG_LVL_ASSERT_TRACE3 ( \ |
| 700 | "Assertion failed: line %d file '%s'\n" \ |
| 701 | " -> '%s'\n", __LINE__, __FILE__, str); \ |
| 702 | while (1); } |
| 703 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 704 | #define DEBUG_ASSERT1(expr,str,p1) if (!(expr )) { \ |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 705 | DEBUG_LVL_ASSERT_TRACE4 ( \ |
| 706 | "Assertion failed: line %d file '%s'\n" \ |
| 707 | " -> '%s'\n" \ |
| 708 | " -> 0x%08lX\n", __LINE__, __FILE__, str, (DWORD) p1); \ |
| 709 | while (1); } |
| 710 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 711 | #endif |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 712 | |
| 713 | #else |
| 714 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 715 | #define DEBUG_ASSERT0(expr,str) |
| 716 | #define DEBUG_ASSERT1(expr,str,p1) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 717 | |
| 718 | #endif |
| 719 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 720 | //--------------------------------------------------------------------------- |
| 721 | // The macro DEBUG_ONLY() implements code, if NDEBUG is not defined. |
| 722 | #if !defined (DEBUG_ONLY) |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 723 | #if !defined (NDEBUG) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 724 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 725 | #define DEBUG_ONLY(expr) expr |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 726 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 727 | #else |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 728 | |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 729 | #define DEBUG_ONLY(expr) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 730 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 731 | #endif |
Greg Kroah-Hartman | e0ca059 | 2008-12-19 17:09:38 -0800 | [diff] [blame] | 732 | #endif |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 733 | |
| 734 | #endif // _DEBUG_H_ |