Tizen RT Libs&Environment  v1.0 D5
debug.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 /****************************************************************************
19  * include/debug.h
20  *
21  * Copyright (C) 2007-2011, 2014 Gregory Nutt. All rights reserved.
22  * Author: Gregory Nutt <gnutt@nuttx.org>
23  *
24  * Redistribution and use in source and binary forms, with or without
25  * modification, are permitted provided that the following conditions
26  * are met:
27  *
28  * 1. Redistributions of source code must retain the above copyright
29  * notice, this list of conditions and the following disclaimer.
30  * 2. Redistributions in binary form must reproduce the above copyright
31  * notice, this list of conditions and the following disclaimer in
32  * the documentation and/or other materials provided with the
33  * distribution.
34  * 3. Neither the name NuttX nor the names of its contributors may be
35  * used to endorse or promote products derived from this software
36  * without specific prior written permission.
37  *
38  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
41  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
42  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
43  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
44  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
45  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
46  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
48  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49  * POSSIBILITY OF SUCH DAMAGE.
50  *
51  ****************************************************************************/
60 
63 #ifndef __INCLUDE_DEBUG_H
64 #define __INCLUDE_DEBUG_H
65 
66 /****************************************************************************
67  * Included Files
68  ****************************************************************************/
69 
70 #include <tinyara/config.h>
71 #include <tinyara/compiler.h>
72 #include <tinyara/logm.h>
73 
74 #include <syslog.h>
75 
76 /****************************************************************************
77  * Pre-processor Definitions
78  ****************************************************************************/
79 
80 /* Debug macros to runtime filter the debug messages sent to the console. In
81  * general, there are four forms of the debug macros:
82  *
83  * [a-z]dbg() -- Outputs messages to the console similar to printf() except
84  * that the output is not buffered. The first character indicates the
85  * system system (e.g., n=network, f=filesystm, etc.). If the first
86  * character is missing (i.e., dbg()), then it is common. The common
87  * dbg() macro is enabled by CONFIG_DEBUG. Subsystem debug requires an
88  * additional configuration setting to enable it (e.g., CONFIG_DEBUG_NET
89  * for the network, CONFIG_DEBUG_FS for the file system, etc).
90  *
91  * In general, error messages and output of importance use [a-z]dbg().
92  * [a-z]dbg() is implementation dependent but usually uses file descriptors.
93  * (that is a problem only because the interrupt task may have re-
94  * directed stdout). Therefore [a-z]dbg() should not be used in interrupt
95  * handlers.
96  *
97  * [a-z]vdbg() -- Identical to [a-z]dbg() except that it also requires that
98  * CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug
99  * output that you would normally want to suppress.
100  *
101  * [a-z]lldbg() -- Identical to [a-z]dbg() except this is uses special
102  * interfaces provided by architecture-specific logic to talk directly
103  * to the underlying console hardware. If the architecture provides such
104  * logic, it should define CONFIG_ARCH_LOWPUTC.
105  *
106  * [a-z]lldbg() should not be used in normal code because the implementation
107  * probably disables interrupts and does things that are not consistent with
108  * good real-time performance. However, [a-z]lldbg() is particularly useful
109  * in low-level code where it is inappropriate to use file descriptors. For
110  * example, only [a-z]lldbg() should be used in interrupt handlers.
111  *
112  * [a-z]llvdbg() -- Identical to [a-z]lldbg() except that it also requires that
113  * CONFIG_DEBUG_VERBOSE be defined. This is intended for general debug
114  * output that you would normally want to suppress.
115  */
116 
117 #ifdef CONFIG_HAVE_FUNCTIONNAME
118 #define EXTRA_FMT "%s: "
119 #define EXTRA_ARG , __FUNCTION__
120 #else
121 #define EXTRA_FMT
122 #define EXTRA_ARG
123 #endif
124 
125 /* Debug macros will differ depending upon if the toolchain supports
126  * macros with a variable number of arguments or not.
127  */
128 
129 #ifdef CONFIG_CPP_HAVE_VARARGS
130 
131 /* C-99 style variadic macros are supported */
132 
133 #ifdef CONFIG_DEBUG
134 /* Temporary LOGM macros to route all dbg messages.
135 Once LOGM is approved, each module should have its own index
136 */
137 #define LOGM_IDX (0)
138 #define LOGM_PRI (1)
139 #define LOGM_EN (2)
140 
141 #if defined(CONFIG_DEBUG_ERROR) && defined(CONFIG_LOGM)
142 #define dbg(format, ...) \
143  logm(LOGM_EN, LOGM_IDX, LOGM_PRI, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
144 
145 #define dbg_noarg(format, ...) \
146  logm(LOGM_EN, LOGM_IDX, LOGM_PRI, format, ##__VA_ARGS__)
147 
148 #define lldbg(format, ...) \
149  logm(LOGM_EN, LOGM_IDX, LOGM_PRI, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
150 
151 #elif CONFIG_DEBUG_ERROR
152 
156 #define dbg(format, ...) \
157  syslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
158 #define dbg_noarg(format, ...) \
159  syslog(LOG_ERR, format, ##__VA_ARGS__)
160 
161 #ifdef CONFIG_ARCH_LOWPUTC
162 
166 #define lldbg(format, ...) \
167  lowsyslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
168 #else
169 #define lldbg(x...)
170 #endif
171 
172 #else
173 #define dbg(x...)
174 #define lldbg(x...)
175 #endif
176 
177 #if defined(CONFIG_DEBUG_WARN) && defined(CONFIG_LOGM)
178 #define wdbg(format, ...) \
179  logm(LOGM_EN, LOGM_IDX, LOGM_PRI, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
180 
181 #define llwdbg(format, ...) \
182  logm(LOGM_EN, LOGM_IDX, LOGM_PRI, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
183 
184 #elif CONFIG_DEBUG_WARN
185 
189 #define wdbg(format, ...) \
190  syslog(LOG_WARNING, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
191 
192 #ifdef CONFIG_ARCH_LOWPUTC
193 
197 #define llwdbg(format, ...) \
198  lowsyslog(LOG_WARNING, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
199 #else
200 #define llwdbg(x...)
201 #endif
202 
203 #else
204 #define wdbg(x...)
205 #define llwdbg(x...)
206 #endif
207 
208 #if defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_LOGM)
209 #define vdbg(format, ...) \
210  logm(LOGM_EN, LOGM_IDX, LOGM_PRI, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
211 
212 #define llvdbg(format, ...) \
213  logm(LOGM_EN, LOGM_IDX, LOGM_PRI, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
214 
215 #elif CONFIG_DEBUG_VERBOSE
216 
220 #define vdbg(format, ...) \
221  syslog(LOG_INFO, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
222 
223 #ifdef CONFIG_ARCH_LOWPUTC
224 
228 #define llvdbg(format, ...) \
229  lowsyslog(LOG_INFO, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
230 
231 #else
232 #define llvdbg(x...)
233 #endif
234 
235 #else
236 #define vdbg(x...)
237 #define llvdbg(x...)
238 #endif
239 
240 #else /* CONFIG_DEBUG */
241 
242 #define dbg(x...)
243 #define lldbg(x...)
244 #define wdbg(x...)
245 #define llwdbg(x...)
246 #define vdbg(x...)
247 #define llvdbg(x...)
248 
249 #endif /* CONFIG_DEBUG */
250 
251 /* Subsystem specific debug */
252 
253 #ifdef CONFIG_DEBUG_MM_ERROR
254 #define mdbg(format, ...) dbg(format, ##__VA_ARGS__)
255 #define mlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
256 #else
257 #define mdbg(x...)
258 #define mlldbg(x...)
259 #endif
260 
261 #ifdef CONFIG_DEBUG_MM_WARN
262 #define mwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
263 #define mllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
264 #else
265 #define mwdbg(x...)
266 #define mllwdbg(x...)
267 #endif
268 
269 #ifdef CONFIG_DEBUG_MM_INFO
270 #define mvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
271 #define mllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
272 #else
273 #define mvdbg(x...)
274 #define mllvdbg(x...)
275 #endif
276 
277 #ifdef CONFIG_DEBUG_SCHED_ERROR
278 #define sdbg(format, ...) dbg(format, ##__VA_ARGS__)
279 #define slldbg(format, ...) lldbg(format, ##__VA_ARGS__)
280 #else
281 #define sdbg(x...)
282 #define slldbg(x...)
283 #endif
284 
285 #ifdef CONFIG_DEBUG_SCHED_WARN
286 #define swdbg(format, ...) wdbg(format, ##__VA_ARGS__)
287 #define sllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
288 #else
289 #define swdbg(x...)
290 #define sllwdbg(x...)
291 #endif
292 
293 #ifdef CONFIG_DEBUG_SCHED_INFO
294 #define svdbg(format, ...) vdbg(format, ##__VA_ARGS__)
295 #define sllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
296 #else
297 #define svdbg(x...)
298 #define sllvdbg(x...)
299 #endif
300 
301 #ifdef CONFIG_DEBUG_PM_ERROR
302 #define pmdbg(format, ...) dbg(format, ##__VA_ARGS__)
303 #define pmlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
304 #else
305 #define pmdbg(x...)
306 #define pmlldbg(x...)
307 #endif
308 
309 #ifdef CONFIG_DEBUG_PM_WARN
310 #define pmwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
311 #define pmllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
312 #else
313 #define pmwdbg(x...)
314 #define pmllwdbg(x...)
315 #endif
316 
317 #ifdef CONFIG_DEBUG_PM_INFO
318 #define pmvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
319 #define pmllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
320 #else
321 #define pmvdbg(x...)
322 #define pmllvdbg(x...)
323 #endif
324 
325 #ifdef CONFIG_DEBUG_PAGING_ERROR
326 #define pgdbg(format, ...) dbg(format, ##__VA_ARGS__)
327 #define pglldbg(format, ...) lldbg(format, ##__VA_ARGS__)
328 #else
329 #define pgdbg(x...)
330 #define pglldbg(x...)
331 #endif
332 
333 #ifdef CONFIG_DEBUG_PAGING_WARN
334 #define pgwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
335 #define pgllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
336 #else
337 #define pgwdbg(x...)
338 #define pgllwdbg(x...)
339 #endif
340 
341 #ifdef CONFIG_DEBUG_PAGING_INFO
342 #define pgvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
343 #define pgllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
344 #else
345 #define pgvdbg(x...)
346 #define pgllvdbg(x...)
347 #endif
348 
349 #ifdef CONFIG_DEBUG_DMA_ERROR
350 #define dmadbg(format, ...) dbg(format, ##__VA_ARGS__)
351 #define dmalldbg(format, ...) lldbg(format, ##__VA_ARGS__)
352 #else
353 #define dmadbg(x...)
354 #define dmalldbg(x...)
355 #endif
356 
357 #ifdef CONFIG_DEBUG_DMA_WARN
358 #define dmawdbg(format, ...) wdbg(format, ##__VA_ARGS__)
359 #define dmallwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
360 #else
361 #define dmawdbg(x...)
362 #define dmallwdbg(x...)
363 #endif
364 
365 #ifdef CONFIG_DEBUG_DMA_INFO
366 #define dmavdbg(format, ...) vdbg(format, ##__VA_ARGS__)
367 #define dmallvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
368 #else
369 #define dmavdbg(x...)
370 #define dmallvdbg(x...)
371 #endif
372 
373 #ifdef CONFIG_DEBUG_NET_ERROR
374 #define ndbg(format, ...) dbg(format, ##__VA_ARGS__)
375 #define nlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
376 #else
377 #define ndbg(x...)
378 #define nlldbg(x...)
379 #endif
380 
381 #ifdef CONFIG_DEBUG_NET_WARN
382 #define nwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
383 #define nllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
384 #else
385 #define nwdbg(x...)
386 #define nllwdbg(x...)
387 #endif
388 
389 #ifdef CONFIG_DEBUG_NET_INFO
390 #define nvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
391 #define nllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
392 #else
393 #define nvdbg(x...)
394 #define nllvdbg(x...)
395 #endif
396 
397 #ifdef CONFIG_DEBUG_USB_ERROR
398 #define udbg(format, ...) dbg(format, ##__VA_ARGS__)
399 #define ulldbg(format, ...) lldbg(format, ##__VA_ARGS__)
400 #else
401 #define udbg(x...)
402 #define ulldbg(x...)
403 #endif
404 
405 #ifdef CONFIG_DEBUG_USB_WARN
406 #define uwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
407 #define ullwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
408 #else
409 #define uwdbg(x...)
410 #define ullwdbg(x...)
411 #endif
412 
413 #ifdef CONFIG_DEBUG_USB_INFO
414 #define uvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
415 #define ullvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
416 #else
417 #define uvdbg(x...)
418 #define ullvdbg(x...)
419 #endif
420 
421 #ifdef CONFIG_DEBUG_FS_ERROR
422 #define fdbg(format, ...) dbg(format, ##__VA_ARGS__)
423 #define flldbg(format, ...) lldbg(format, ##__VA_ARGS__)
424 #else
425 #define fdbg(x...)
426 #define flldbg(x...)
427 #endif
428 
429 #ifdef CONFIG_DEBUG_FS_WARN
430 #define fwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
431 #define fllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
432 #else
433 #define fwdbg(x...)
434 #define fllwdbg(x...)
435 #endif
436 
437 #ifdef CONFIG_DEBUG_FS_INFO
438 #define fvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
439 #define fsdbg(format, ...) dbg_noarg(format, ##__VA_ARGS__)
440 #define fllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
441 #else
442 #define fvdbg(x...)
443 #define fsdbg(format, ...)
444 #define fllvdbg(x...)
445 #endif
446 
447 #ifdef CONFIG_DEBUG_DM_ERROR
448 #define dmdbg(format, ...) dbg(format, ##__VA_ARGS__)
449 #define dmlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
450 #else
451 #define dmdbg(x...)
452 #define dmlldbg(x...)
453 #endif
454 
455 #ifdef CONFIG_DEBUG_DM_WARN
456 #define dmwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
457 #define dmllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
458 #else
459 #define dmwdbg(x...)
460 #define dmllwdbg(x...)
461 #endif
462 
463 #ifdef CONFIG_DEBUG_DM_INFO
464 #define dmvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
465 #define dmllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
466 #else
467 #define dmvdbg(x...)
468 #define dmllvdbg(x...)
469 #endif
470 
471 #ifdef CONFIG_DEBUG_INPUT_ERROR
472 #define idbg(format, ...) dbg(format, ##__VA_ARGS__)
473 #define illdbg(format, ...) lldbg(format, ##__VA_ARGS__)
474 #else
475 #define idbg(x...)
476 #define illdbg(x...)
477 #endif
478 
479 #ifdef CONFIG_DEBUG_INPUT_WARN
480 #define iwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
481 #define illwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
482 #else
483 #define iwdbg(x...)
484 #define illwdbg(x...)
485 #endif
486 
487 #ifdef CONFIG_DEBUG_INPUT_INFO
488 #define ivdbg(format, ...) vdbg(format, ##__VA_ARGS__)
489 #define illvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
490 #else
491 #define ivdbg(x...)
492 #define illvdbg(x...)
493 #endif
494 
495 #ifdef CONFIG_DEBUG_SENSORS_ERROR
496 #define sndbg(format, ...) dbg(format, ##__VA_ARGS__)
497 #define snlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
498 #else
499 #define sndbg(x...)
500 #define snlldbg(x...)
501 #endif
502 
503 #ifdef CONFIG_DEBUG_SENSORS_WARN
504 #define snwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
505 #define snllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
506 #else
507 #define snwdbg(x...)
508 #define snllwdbg(x...)
509 #endif
510 
511 #ifdef CONFIG_DEBUG_SENSORS_INFO
512 #define snvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
513 #define snllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
514 #else
515 #define snvdbg(x...)
516 #define snllvdbg(x...)
517 #endif
518 
519 #ifdef CONFIG_DEBUG_ANALOG_ERROR
520 #define adbg(format, ...) dbg(format, ##__VA_ARGS__)
521 #define alldbg(format, ...) lldbg(format, ##__VA_ARGS__)
522 #else
523 #define adbg(x...)
524 #define alldbg(x...)
525 #endif
526 
527 #ifdef CONFIG_DEBUG_ANALOG_WARN
528 #define awdbg(format, ...) wdbg(format, ##__VA_ARGS__)
529 #define allwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
530 #else
531 #define awdbg(x...)
532 #define allwdbg(x...)
533 #endif
534 
535 #ifdef CONFIG_DEBUG_ANALOG_INFO
536 #define avdbg(format, ...) vdbg(format, ##__VA_ARGS__)
537 #define allvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
538 #else
539 #define avdbg(x...)
540 #define allvdbg(x...)
541 #endif
542 
543 #ifdef CONFIG_DEBUG_GRAPHICS_ERROR
544 #define gdbg(format, ...) dbg(format, ##__VA_ARGS__)
545 #define glldbg(format, ...) lldbg(format, ##__VA_ARGS__)
546 #else
547 #define gdbg(x...)
548 #define glldbg(x...)
549 #endif
550 
551 #ifdef CONFIG_DEBUG_GRAPHICS_WARN
552 #define gwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
553 #define gllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
554 #else
555 #define gwdbg(x...)
556 #define gllwdbg(x...)
557 #endif
558 
559 #ifdef CONFIG_DEBUG_GRAPHICS_INFO
560 #define gvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
561 #define gllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
562 #else
563 #define gvdbg(x...)
564 #define gllvdbg(x...)
565 #endif
566 
567 #ifdef CONFIG_DEBUG_LIB_ERROR
568 #define ldbg(format, ...) dbg(format, ##__VA_ARGS__)
569 #define llldbg(format, ...) lldbg(format, ##__VA_ARGS__)
570 #else
571 #define ldbg(x...)
572 #define llldbg(x...)
573 #endif
574 
575 #ifdef CONFIG_DEBUG_LIB_WARN
576 #define lwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
577 #define lllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
578 #else
579 #define lwdbg(x...)
580 #define lllwdbg(x...)
581 #endif
582 
583 #ifdef CONFIG_DEBUG_LIB_INFO
584 #define lvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
585 #define lllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
586 #else
587 #define lvdbg(x...)
588 #define lllvdbg(x...)
589 #endif
590 
591 #ifdef CONFIG_DEBUG_LWIP_ERROR
592 #define lwipdbg(format, ...) dbg(format, ##__VA_ARGS__)
593 #define lwiplldbg(format, ...) lldbg(format, ##__VA_ARGS__)
594 #else
595 #define lwipdbg(x...)
596 #define lwiplldbg(x...)
597 #endif
598 
599 #ifdef CONFIG_DEBUG_LWIP_WARN
600 #define lwipwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
601 #define lwipllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
602 #else
603 #define lwipwdbg(x...)
604 #define lwipllwdbg(x...)
605 #endif
606 
607 #ifdef CONFIG_DEBUG_LWIP_INFO
608 #define lwipvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
609 #define lwipllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
610 #else
611 #define lwipvdbg(x...)
612 #define lwipllvdbg(x...)
613 #endif
614 
615 #else /* CONFIG_CPP_HAVE_VARARGS */
616 
617 /* Variadic macros NOT supported */
618 
619 #ifdef CONFIG_DEBUG
620 #ifndef CONFIG_DEBUG_ERROR
621 #define dbg (void)
622 #define lldbg (void)
623 #else
624 #ifndef CONFIG_ARCH_LOWPUTC
625 #define lldbg (void)
626 #endif
627 #endif
628 #ifndef CONFIG_DEBUG_WARN
629 #define wdbg (void)
630 #define llwdbg (void)
631 #else
632 #ifndef CONFIG_ARCH_LOWPUTC
633 #define llwdbg (void)
634 #endif
635 #endif
636 #ifndef CONFIG_DEBUG_VERBOSE
637 #define vdbg (void)
638 #define llvdbg (void)
639 #else
640 #ifndef CONFIG_ARCH_LOWPUTC
641 #define llvdbg (void)
642 #endif
643 #endif
644 #else
645 #define dbg (void)
646 #define lldbg (void)
647 #define wdbg (void)
648 #define llwdbg (void)
649 #define vdbg (void)
650 #define llvdbg (void)
651 #endif
652 
653 /* Subsystem specific debug */
654 
655 #ifdef CONFIG_DEBUG_MM_ERROR
656 #define mdbg dbg
657 #define mlldbg lldbg
658 #else
659 #define mdbg (void)
660 #define mlldbg (void)
661 #endif
662 
663 #ifdef CONFIG_DEBUG_MM_WARN
664 #define mwdbg wdbg
665 #define mllwdbg llwdbg
666 #else
667 #define mwdbg (void)
668 #define mlwldbg (void)
669 #endif
670 
671 #ifdef CONFIG_DEBUG_MM_INFO
672 #define mvdbg vdbg
673 #define mllvdbg llvdbg
674 #else
675 #define mvdbg (void)
676 #define mllvdbg (void)
677 #endif
678 
679 #ifdef CONFIG_DEBUG_SCHED_ERROR
680 #define sdbg dbg
681 #define slldbg lldbg
682 #else
683 #define sdbg (void)
684 #define slldbg (void)
685 #endif
686 
687 #ifdef CONFIG_DEBUG_SCHED_WARN
688 #define swdbg wdbg
689 #define sllwdbg llwdbg
690 #else
691 #define swdbg (void)
692 #define sllwdbg (void)
693 #endif
694 
695 #ifdef CONFIG_DEBUG_SCHED_INFO
696 #define svdbg vdbg
697 #define sllvdbg llvdbg
698 #else
699 #define svdbg (void)
700 #define sllvdbg (void)
701 #endif
702 
703 #ifdef CONFIG_DEBUG_PAGING_ERROR
704 #define pgdbg dbg
705 #define pglldbg lldbg
706 #else
707 #define pgdbg (void)
708 #define pglldbg (void)
709 #endif
710 
711 #ifdef CONFIG_DEBUG_PAGING_WARN
712 #define pgwdbg wdbg
713 #define pgllwdbg llwdbg
714 #else
715 #define pgwdbg (void)
716 #define pgllwdbg (void)
717 #endif
718 
719 #ifdef CONFIG_DEBUG_PAGING_INFO
720 #define pgvdbg vdbg
721 #define pgllvdbg llvdbg
722 #else
723 #define pgvdbg (void)
724 #define pgllvdbg (void)
725 #endif
726 
727 #ifdef CONFIG_DEBUG_DMA_ERROR
728 #define dmadbg dbg
729 #define dmalldbg lldbg
730 #else
731 #define dmadbg (void)
732 #define dmalldbg (void)
733 #endif
734 
735 #ifdef CONFIG_DEBUG_DMA_WARN
736 #define dmawdbg wdbg
737 #define dmallwdbg llwdbg
738 #else
739 #define dmawdbg (void)
740 #define dmallwdbg (void)
741 #endif
742 
743 #ifdef CONFIG_DEBUG_DMA_INFO
744 #define dmavdbg vdbg
745 #define dmallvdbg llvdbg
746 #else
747 #define dmavdbg (void)
748 #define dmallvdbg (void)
749 #endif
750 
751 #ifdef CONFIG_DEBUG_NET_ERROR
752 #define ndbg dbg
753 #define nlldbg lldbg
754 #else
755 #define ndbg (void)
756 #define nlldbg (void)
757 #endif
758 
759 #ifdef CONFIG_DEBUG_NET_WARN
760 #define nwdbg wdbg
761 #define nllwdbg llwdbg
762 #else
763 #define nwdbg (void)
764 #define nllwdbg (void)
765 #endif
766 
767 #ifdef CONFIG_DEBUG_NET_INFO
768 #define nvdbg vdbg
769 #define nllvdbg llvdbg
770 #else
771 #define nvdbg (void)
772 #define nllvdbg (void)
773 #endif
774 
775 #ifdef CONFIG_DEBUG_USB_ERROR
776 #define udbg dbg
777 #define ulldbg lldbg
778 #else
779 #define udbg (void)
780 #define ulldbg (void)
781 #endif
782 
783 #ifdef CONFIG_DEBUG_USB_WARN
784 #define uwdbg wdbg
785 #define ullwdbg llwdbg
786 #else
787 #define uwdbg (void)
788 #define ullwdbg (void)
789 #endif
790 
791 #ifdef CONFIG_DEBUG_USB_INFO
792 #define uvdbg vdbg
793 #define ullvdbg llvdbg
794 #else
795 #define uvdbg (void)
796 #define ullvdbg (void)
797 #endif
798 
799 #ifdef CONFIG_DEBUG_FS_ERROR
800 #define fdbg dbg
801 #define flldbg lldbg
802 #else
803 #define fdbg (void)
804 #define flldbg (void)
805 #endif
806 
807 #ifdef CONFIG_DEBUG_FS_WARN
808 #define fwdbg wdbg
809 #define fllwdbg llwdbg
810 #else
811 #define fwdbg (void)
812 #define fllwdbg (void)
813 #endif
814 
815 #ifdef CONFIG_DEBUG_FS_INFO
816 #define fvdbg vdbg
817 #define fllvdbg llvdbg
818 #else
819 #define fvdbg (void)
820 #define fllvdbg (void)
821 #endif
822 
823 #ifdef CONFIG_DEBUG_INPUT_ERROR
824 #define idbg dbg
825 #define illdbg lldbg
826 #else
827 #define idbg (void)
828 #define illdbg (void)
829 #endif
830 
831 #ifdef CONFIG_DEBUG_INPUT_WARN
832 #define iwdbg wdbg
833 #define illwdbg llwdbg
834 #else
835 #define iwdbg (void)
836 #define illwdbg (void)
837 #endif
838 
839 #ifdef CONFIG_DEBUG_INPUT_INFO
840 #define ivdbg vdbg
841 #define illvdbg llvdbg
842 #else
843 #define ivdbg (void)
844 #define illvdbg (void)
845 #endif
846 
847 #ifdef CONFIG_DEBUG_SENSORS_ERROR
848 #define sndbg dbg
849 #define snlldbg lldbg
850 #else
851 #define sndbg (void)
852 #define snlldbg (void)
853 #endif
854 
855 #ifdef CONFIG_DEBUG_SENSORS_WARN
856 #define snwdbg wdbg
857 #define snllwdbg llwdbg
858 #else
859 #define snwdbg (void)
860 #define snllwdbg (void)
861 #endif
862 
863 #ifdef CONFIG_DEBUG_SENSORS_INFO
864 #define snvdbg vdbg
865 #define snllvdbg llvdbg
866 #else
867 #define snvdbg (void)
868 #define snllvdbg (void)
869 #endif
870 
871 #ifdef CONFIG_DEBUG_ANALOG_ERROR
872 #define adbg dbg
873 #define alldbg lldbg
874 #else
875 #define adbg (void)
876 #define alldbg (void)
877 #endif
878 
879 #ifdef CONFIG_DEBUG_ANALOG_WARN
880 #define awdbg wdbg
881 #define allwdbg llwdbg
882 #else
883 #define awdbg (void)
884 #define allwdbg (void)
885 #endif
886 
887 #ifdef CONFIG_DEBUG_ANALOG_INFO
888 #define avdbg vdbg
889 #define allvdbg llvdbg
890 #else
891 #define avdbg (void)
892 #define allvdbg (void)
893 #endif
894 
895 #ifdef CONFIG_DEBUG_GRAPHICS_ERROR
896 #define gdbg dbg
897 #define glldbg lldbg
898 #else
899 #define gdbg (void)
900 #define glldbg (void)
901 #endif
902 
903 #ifdef CONFIG_DEBUG_GRAPHICS_WARN
904 #define gwdbg wdbg
905 #define gllwdbg llwdbg
906 #else
907 #define gwdbg (void)
908 #define gllwdbg (void)
909 #endif
910 
911 #ifdef CONFIG_DEBUG_GRAPHICS_INFO
912 #define gvdbg vdbg
913 #define gllvdbg llvdbg
914 #else
915 #define gvdbg (void)
916 #define gllvdbg (void)
917 #endif
918 
919 #ifdef CONFIG_DEBUG_LIB_ERROR
920 #define ldbg dbg
921 #define llldbg lldbg
922 #else
923 #define ldbg (void)
924 #define llldbg (void)
925 #endif
926 
927 #ifdef CONFIG_DEBUG_LIB_WARN
928 #define lwdbg wdbg
929 #define lllwdbg llwdbg
930 #else
931 #define lwdbg (void)
932 #define lllwdbg (void)
933 #endif
934 
935 #ifdef CONFIG_DEBUG_LIB_INFO
936 #define lvdbg vdbg
937 #define lllvdbg llvdbg
938 #else
939 #define lvdbg (void)
940 #define lllvdbg (void)
941 #endif
942 
943 #ifdef CONFIG_DEBUG_LWIP_ERROR
944 #define lwipdbg dbg
945 #define lwiplldbg lldbg
946 #else
947 #define lwipdbg (void)
948 #define lwiplldbg (void)
949 #endif
950 
951 #ifdef CONFIG_DEBUG_LWIP_WARN
952 #define lwipwdbg wdbg
953 #define lwipllwdbg llwdbg
954 #else
955 #define lwipwdbg (void)
956 #define lwipllwdbg (void)
957 #endif
958 
959 #ifdef CONFIG_DEBUG_LWIP_INFO
960 #define lwipvdbg vdbg
961 #define lwipllvdbg llvdbg
962 #else
963 #define lwipvdbg (void)
964 #define lwipllvdbg (void)
965 #endif
966 
967 #endif /* CONFIG_CPP_HAVE_VARARGS */
968 
969 /* Buffer dumping macros do not depend on varargs */
970 
971 #ifdef CONFIG_DEBUG
972 #ifdef CONFIG_DEBUG_ERROR
973 #define dbgdumpbuffer(m, b, n) lib_dumpbuffer(m, b, n)
974 #else
975 #define dbgdumpbuffer(m, b, n)
976 #endif
977 #ifdef CONFIG_DEBUG_WARN
978 #define wdbgdumpbuffer(m, b, n) lib_dumpbuffer(m, b, n)
979 #else
980 #define wdbgdumpbuffer(m, b, n)
981 #endif
982 #ifdef CONFIG_DEBUG_VERBOSE
983 #define vdbgdumpbuffer(m, b, n) lib_dumpbuffer(m, b, n)
984 #else
985 #define vdbgdumpbuffer(m, b, n)
986 #endif
987 #else
988 #define dbgdumpbuffer(m, b, n)
989 #define wdbgdumpbuffer(m, b, n)
990 #define vdbgdumpbuffer(m, b, n)
991 #endif
992 
993 /* Subsystem specific debug */
994 
995 #ifdef CONFIG_DEBUG_MM
996 #define mdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
997 #define mvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
998 #else
999 #define mdbgdumpbuffer(m, b, n)
1000 #define mvdbgdumpbuffer(m, b, n)
1001 #endif
1002 
1003 #ifdef CONFIG_DEBUG_SCHED
1004 #define sdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1005 #define svdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1006 #else
1007 #define sdbgdumpbuffer(m, b, n)
1008 #define svdbgdumpbuffer(m, b, n)
1009 #endif
1010 
1011 #ifdef CONFIG_DEBUG_PAGING
1012 #define pgdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1013 #define pgvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1014 #else
1015 #define pgdbgdumpbuffer(m, b, n)
1016 #define pgvdbgdumpbuffer(m, b, n)
1017 #endif
1018 
1019 #ifdef CONFIG_DEBUG_DMA
1020 #define dmadbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1021 #define dmavdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1022 #else
1023 #define dmadbgdumpbuffer(m, b, n)
1024 #define dmavdbgdumpbuffer(m, b, n)
1025 #endif
1026 
1027 #ifdef CONFIG_DEBUG_NET
1028 #define ndbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1029 #define nvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1030 #else
1031 #define ndbgdumpbuffer(m, b, n)
1032 #define nvdbgdumpbuffer(m, b, n)
1033 #endif
1034 
1035 #ifdef CONFIG_DEBUG_USB
1036 #define udbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1037 #define uvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1038 #else
1039 #define udbgdumpbuffer(m, b, n)
1040 #define uvdbgdumpbuffer(m, b, n)
1041 #endif
1042 
1043 #ifdef CONFIG_DEBUG_FS
1044 #define fdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1045 #define fvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1046 #else
1047 #define fdbgdumpbuffer(m, b, n)
1048 #define fvdbgdumpbuffer(m, b, n)
1049 #endif
1050 
1051 #ifdef CONFIG_DEBUG_INPUT
1052 #define idbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1053 #define ivdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1054 #else
1055 #define idbgdumpbuffer(m, b, n)
1056 #define ivdbgdumpbuffer(m, b, n)
1057 #endif
1058 
1059 #ifdef CONFIG_DEBUG_GRAPHICS
1060 #define gdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1061 #define gvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1062 #else
1063 #define gdbgdumpbuffer(m, b, n)
1064 #define gvdbgdumpbuffer(m, b, n)
1065 #endif
1066 
1067 #ifdef CONFIG_DEBUG_LIB
1068 #define ldbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1069 #define lvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1070 #else
1071 #define ldbgdumpbuffer(m, b, n)
1072 #define lvdbgdumpbuffer(m, b, n)
1073 #endif
1074 
1075 /****************************************************************************
1076  * Public Type Declarations
1077  ****************************************************************************/
1078 
1079 /****************************************************************************
1080  * Public Variables
1081  ****************************************************************************/
1082 
1083 /****************************************************************************
1084  * Public Function Prototypes
1085  ****************************************************************************/
1086 
1087 #if defined(__cplusplus)
1088 extern "C" {
1089 #endif
1090 
1091 /* Dump a buffer of data */
1097 void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen);
1098 
1103 /* The system logging interfaces are normally accessed via the macros
1104  * provided above. If the cross-compiler's C pre-processor supports a
1105  * variable number of macro arguments, then those macros below will map all
1106  * debug statements to the logging interfaces declared in syslog.h.
1107  *
1108  * If the cross-compiler's pre-processor does not support variable length
1109  * arguments, then these additional APIs will be built.
1110  */
1111 
1112 #ifndef CONFIG_CPP_HAVE_VARARGS
1113 #ifdef CONFIG_DEBUG
1114 
1115 #ifdef CONFIG_DEBUG_ERROR
1116 int dbg(const char *format, ...);
1117 
1118 #ifdef CONFIG_ARCH_LOWPUTC
1119 int lldbg(const char *format, ...);
1120 #endif
1121 #endif
1122 
1123 #ifdef CONFIG_DEBUG_WARN
1124 int wdbg(const char *format, ...);
1125 
1126 #ifdef CONFIG_ARCH_LOWPUTC
1127 int llwdbg(const char *format, ...);
1128 #endif
1129 #endif
1130 
1131 #ifdef CONFIG_DEBUG_VERBOSE
1132 int vdbg(const char *format, ...);
1133 
1134 #ifdef CONFIG_ARCH_LOWPUTC
1135 int llvdbg(const char *format, ...);
1136 #endif
1137 #endif
1138 
1139 #endif /* CONFIG_DEBUG */
1140 #endif /* CONFIG_CPP_HAVE_VARARGS */
1141 
1142 #if defined(__cplusplus)
1143 }
1144 #endif
1145 #endif /* __INCLUDE_DEBUG_H */
1146 //end of DEBUG_KERNEL
#define vdbg
Definition: debug.h:637
#define lldbg
Definition: debug.h:622
#define llvdbg
Definition: debug.h:638
#define wdbg
Definition: debug.h:629
Syslog APIs.
#define dbg
Definition: debug.h:621
#define llwdbg
Definition: debug.h:630