Tizen RT Libs&Environment  v1.1 D4
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=filesystem, 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 
139 #ifdef CONFIG_DEBUG_ERROR
140 #ifdef CONFIG_LOGM
141 #define dbg(format, ...) \
142  logm(LOGM_NORMAL, LOGM_IDX, LOGM_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
143 
144 #define dbg_noarg(format, ...) \
145  logm(LOGM_NORMAL, LOGM_IDX, LOGM_ERR, format, ##__VA_ARGS__)
146 
147 #define lldbg(format, ...) \
148  logm(LOGM_LOWPUT, LOGM_IDX, LOGM_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
149 
150 #else
151 
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 
167 #define lldbg(format, ...) \
168  lowsyslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
169 #else
170 #define lldbg(x...)
171 #endif
172 #endif
173 
174 #else
175 #define dbg(x...)
176 #define lldbg(x...)
177 #endif
178 
179 #ifdef CONFIG_DEBUG_WARN
180 #ifdef CONFIG_LOGM
181 #define wdbg(format, ...) \
182  logm(LOGM_NORMAL, LOGM_IDX, LOGM_WRN, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
183 
184 #define llwdbg(format, ...) \
185  logm(LOGM_LOWPUT, LOGM_IDX, LOGM_WRN, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
186 
187 #else
188 
193 #define wdbg(format, ...) \
194  syslog(LOG_WARNING, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
195 
196 #ifdef CONFIG_ARCH_LOWPUTC
197 
202 #define llwdbg(format, ...) \
203  lowsyslog(LOG_WARNING, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
204 #else
205 #define llwdbg(x...)
206 #endif
207 #endif
208 
209 #else
210 #define wdbg(x...)
211 #define llwdbg(x...)
212 #endif
213 
214 #ifdef CONFIG_DEBUG_VERBOSE
215 #ifdef CONFIG_LOGM
216 #define vdbg(format, ...) \
217  logm(LOGM_NORMAL, LOGM_IDX, LOGM_INF, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
218 
219 #define llvdbg(format, ...) \
220  logm(LOGM_LOWPUT, LOGM_IDX, LOGM_INF, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
221 
222 #else
223 
228 #define vdbg(format, ...) \
229  syslog(LOG_INFO, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
230 
231 #ifdef CONFIG_ARCH_LOWPUTC
232 
237 #define llvdbg(format, ...) \
238  lowsyslog(LOG_INFO, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
239 
240 #else
241 #define llvdbg(x...)
242 #endif
243 #endif
244 
245 #else
246 #define vdbg(x...)
247 #define llvdbg(x...)
248 #endif
249 
250 #else /* CONFIG_DEBUG */
251 
252 #define dbg(x...)
253 #define lldbg(x...)
254 #define wdbg(x...)
255 #define llwdbg(x...)
256 #define vdbg(x...)
257 #define llvdbg(x...)
258 
259 #endif /* CONFIG_DEBUG */
260 
261 /* Subsystem specific debug */
262 
263 #ifdef CONFIG_DEBUG_MM_ERROR
264 #define mdbg(format, ...) dbg(format, ##__VA_ARGS__)
265 #define mlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
266 #else
267 #define mdbg(x...)
268 #define mlldbg(x...)
269 #endif
270 
271 #ifdef CONFIG_DEBUG_MM_WARN
272 #define mwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
273 #define mllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
274 #else
275 #define mwdbg(x...)
276 #define mllwdbg(x...)
277 #endif
278 
279 #ifdef CONFIG_DEBUG_MM_INFO
280 #define mvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
281 #define mllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
282 #else
283 #define mvdbg(x...)
284 #define mllvdbg(x...)
285 #endif
286 
287 #ifdef CONFIG_DEBUG_SCHED_ERROR
288 #define sdbg(format, ...) dbg(format, ##__VA_ARGS__)
289 #define slldbg(format, ...) lldbg(format, ##__VA_ARGS__)
290 #else
291 #define sdbg(x...)
292 #define slldbg(x...)
293 #endif
294 
295 #ifdef CONFIG_DEBUG_SCHED_WARN
296 #define swdbg(format, ...) wdbg(format, ##__VA_ARGS__)
297 #define sllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
298 #else
299 #define swdbg(x...)
300 #define sllwdbg(x...)
301 #endif
302 
303 #ifdef CONFIG_DEBUG_SCHED_INFO
304 #define svdbg(format, ...) vdbg(format, ##__VA_ARGS__)
305 #define sllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
306 #else
307 #define svdbg(x...)
308 #define sllvdbg(x...)
309 #endif
310 
311 #ifdef CONFIG_DEBUG_PM_ERROR
312 #define pmdbg(format, ...) dbg(format, ##__VA_ARGS__)
313 #define pmlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
314 #else
315 #define pmdbg(x...)
316 #define pmlldbg(x...)
317 #endif
318 
319 #ifdef CONFIG_DEBUG_PM_WARN
320 #define pmwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
321 #define pmllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
322 #else
323 #define pmwdbg(x...)
324 #define pmllwdbg(x...)
325 #endif
326 
327 #ifdef CONFIG_DEBUG_PM_INFO
328 #define pmvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
329 #define pmllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
330 #else
331 #define pmvdbg(x...)
332 #define pmllvdbg(x...)
333 #endif
334 
335 #ifdef CONFIG_DEBUG_PAGING_ERROR
336 #define pgdbg(format, ...) dbg(format, ##__VA_ARGS__)
337 #define pglldbg(format, ...) lldbg(format, ##__VA_ARGS__)
338 #else
339 #define pgdbg(x...)
340 #define pglldbg(x...)
341 #endif
342 
343 #ifdef CONFIG_DEBUG_PAGING_WARN
344 #define pgwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
345 #define pgllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
346 #else
347 #define pgwdbg(x...)
348 #define pgllwdbg(x...)
349 #endif
350 
351 #ifdef CONFIG_DEBUG_PAGING_INFO
352 #define pgvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
353 #define pgllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
354 #else
355 #define pgvdbg(x...)
356 #define pgllvdbg(x...)
357 #endif
358 
359 #ifdef CONFIG_DEBUG_DMA_ERROR
360 #define dmadbg(format, ...) dbg(format, ##__VA_ARGS__)
361 #define dmalldbg(format, ...) lldbg(format, ##__VA_ARGS__)
362 #else
363 #define dmadbg(x...)
364 #define dmalldbg(x...)
365 #endif
366 
367 #ifdef CONFIG_DEBUG_DMA_WARN
368 #define dmawdbg(format, ...) wdbg(format, ##__VA_ARGS__)
369 #define dmallwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
370 #else
371 #define dmawdbg(x...)
372 #define dmallwdbg(x...)
373 #endif
374 
375 #ifdef CONFIG_DEBUG_DMA_INFO
376 #define dmavdbg(format, ...) vdbg(format, ##__VA_ARGS__)
377 #define dmallvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
378 #else
379 #define dmavdbg(x...)
380 #define dmallvdbg(x...)
381 #endif
382 
383 #ifdef CONFIG_DEBUG_NET_ERROR
384 #define ndbg(format, ...) dbg(format, ##__VA_ARGS__)
385 #define nlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
386 #else
387 #define ndbg(x...)
388 #define nlldbg(x...)
389 #endif
390 
391 #ifdef CONFIG_DEBUG_NET_WARN
392 #define nwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
393 #define nllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
394 #else
395 #define nwdbg(x...)
396 #define nllwdbg(x...)
397 #endif
398 
399 #ifdef CONFIG_DEBUG_NET_INFO
400 #define nvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
401 #define nllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
402 #else
403 #define nvdbg(x...)
404 #define nllvdbg(x...)
405 #endif
406 
407 #ifdef CONFIG_DEBUG_USB_ERROR
408 #define udbg(format, ...) dbg(format, ##__VA_ARGS__)
409 #define ulldbg(format, ...) lldbg(format, ##__VA_ARGS__)
410 #else
411 #define udbg(x...)
412 #define ulldbg(x...)
413 #endif
414 
415 #ifdef CONFIG_DEBUG_USB_WARN
416 #define uwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
417 #define ullwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
418 #else
419 #define uwdbg(x...)
420 #define ullwdbg(x...)
421 #endif
422 
423 #ifdef CONFIG_DEBUG_USB_INFO
424 #define uvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
425 #define ullvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
426 #else
427 #define uvdbg(x...)
428 #define ullvdbg(x...)
429 #endif
430 
431 #ifdef CONFIG_DEBUG_FS_ERROR
432 #define fdbg(format, ...) dbg(format, ##__VA_ARGS__)
433 #define flldbg(format, ...) lldbg(format, ##__VA_ARGS__)
434 #else
435 #define fdbg(x...)
436 #define flldbg(x...)
437 #endif
438 
439 #ifdef CONFIG_DEBUG_FS_WARN
440 #define fwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
441 #define fllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
442 #else
443 #define fwdbg(x...)
444 #define fllwdbg(x...)
445 #endif
446 
447 #ifdef CONFIG_DEBUG_FS_INFO
448 #define fvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
449 #define fsdbg(format, ...) dbg_noarg(format, ##__VA_ARGS__)
450 #define fllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
451 #else
452 #define fvdbg(x...)
453 #define fsdbg(format, ...)
454 #define fllvdbg(x...)
455 #endif
456 
457 #ifdef CONFIG_DEBUG_DM_ERROR
458 #define dmdbg(format, ...) dbg(format, ##__VA_ARGS__)
459 #define dmlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
460 #else
461 #define dmdbg(x...)
462 #define dmlldbg(x...)
463 #endif
464 
465 #ifdef CONFIG_DEBUG_DM_WARN
466 #define dmwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
467 #define dmllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
468 #else
469 #define dmwdbg(x...)
470 #define dmllwdbg(x...)
471 #endif
472 
473 #ifdef CONFIG_DEBUG_DM_INFO
474 #define dmvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
475 #define dmllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
476 #else
477 #define dmvdbg(x...)
478 #define dmllvdbg(x...)
479 #endif
480 
481 #ifdef CONFIG_DEBUG_INPUT_ERROR
482 #define idbg(format, ...) dbg(format, ##__VA_ARGS__)
483 #define illdbg(format, ...) lldbg(format, ##__VA_ARGS__)
484 #else
485 #define idbg(x...)
486 #define illdbg(x...)
487 #endif
488 
489 #ifdef CONFIG_DEBUG_INPUT_WARN
490 #define iwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
491 #define illwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
492 #else
493 #define iwdbg(x...)
494 #define illwdbg(x...)
495 #endif
496 
497 #ifdef CONFIG_DEBUG_INPUT_INFO
498 #define ivdbg(format, ...) vdbg(format, ##__VA_ARGS__)
499 #define illvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
500 #else
501 #define ivdbg(x...)
502 #define illvdbg(x...)
503 #endif
504 
505 #ifdef CONFIG_DEBUG_SENSORS_ERROR
506 #define sndbg(format, ...) dbg(format, ##__VA_ARGS__)
507 #define snlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
508 #else
509 #define sndbg(x...)
510 #define snlldbg(x...)
511 #endif
512 
513 #ifdef CONFIG_DEBUG_SENSORS_WARN
514 #define snwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
515 #define snllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
516 #else
517 #define snwdbg(x...)
518 #define snllwdbg(x...)
519 #endif
520 
521 #ifdef CONFIG_DEBUG_SENSORS_INFO
522 #define snvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
523 #define snllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
524 #else
525 #define snvdbg(x...)
526 #define snllvdbg(x...)
527 #endif
528 
529 #ifdef CONFIG_DEBUG_ANALOG_ERROR
530 #define adbg(format, ...) dbg(format, ##__VA_ARGS__)
531 #define alldbg(format, ...) lldbg(format, ##__VA_ARGS__)
532 #else
533 #define adbg(x...)
534 #define alldbg(x...)
535 #endif
536 
537 #ifdef CONFIG_DEBUG_ANALOG_WARN
538 #define awdbg(format, ...) wdbg(format, ##__VA_ARGS__)
539 #define allwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
540 #else
541 #define awdbg(x...)
542 #define allwdbg(x...)
543 #endif
544 
545 #ifdef CONFIG_DEBUG_ANALOG_INFO
546 #define avdbg(format, ...) vdbg(format, ##__VA_ARGS__)
547 #define allvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
548 #else
549 #define avdbg(x...)
550 #define allvdbg(x...)
551 #endif
552 
553 #ifdef CONFIG_DEBUG_GRAPHICS_ERROR
554 #define gdbg(format, ...) dbg(format, ##__VA_ARGS__)
555 #define glldbg(format, ...) lldbg(format, ##__VA_ARGS__)
556 #else
557 #define gdbg(x...)
558 #define glldbg(x...)
559 #endif
560 
561 #ifdef CONFIG_DEBUG_GRAPHICS_WARN
562 #define gwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
563 #define gllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
564 #else
565 #define gwdbg(x...)
566 #define gllwdbg(x...)
567 #endif
568 
569 #ifdef CONFIG_DEBUG_GRAPHICS_INFO
570 #define gvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
571 #define gllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
572 #else
573 #define gvdbg(x...)
574 #define gllvdbg(x...)
575 #endif
576 
577 #ifdef CONFIG_DEBUG_LIB_ERROR
578 #define ldbg(format, ...) dbg(format, ##__VA_ARGS__)
579 #define llldbg(format, ...) lldbg(format, ##__VA_ARGS__)
580 #else
581 #define ldbg(x...)
582 #define llldbg(x...)
583 #endif
584 
585 #ifdef CONFIG_DEBUG_LIB_WARN
586 #define lwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
587 #define lllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
588 #else
589 #define lwdbg(x...)
590 #define lllwdbg(x...)
591 #endif
592 
593 #ifdef CONFIG_DEBUG_LIB_INFO
594 #define lvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
595 #define lllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
596 #else
597 #define lvdbg(x...)
598 #define lllvdbg(x...)
599 #endif
600 
601 #ifdef CONFIG_DEBUG_AUDIO_ERROR
602 #define auddbg(format, ...) dbg(format, ##__VA_ARGS__)
603 #define audlldbg(format, ...) lldbg(format, ##__VA_ARGS__)
604 #else
605 #define auddbg(x...)
606 #define audlldbg(x...)
607 #endif
608 
609 #ifdef CONFIG_DEBUG_AUDIO_WARN
610 #define audwdbg(format, ...) wdbg(format, ##__VA_ARGS__)
611 #define audllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
612 #else
613 #define audwdbg(x...)
614 #define audllwdbg(x...)
615 #endif
616 
617 #ifdef CONFIG_DEBUG_AUDIO_INFO
618 #define audvdbg(format, ...) vdbg(format, ##__VA_ARGS__)
619 #define audllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
620 #else
621 #define audvdbg(x...)
622 #define audllvdbg(x...)
623 #endif
624 
625 #ifdef CONFIG_DEBUG_I2C_ERROR
626 #define i2cerr(format, ...) dbg(format, ##__VA_ARGS__)
627 #define i2clldbg(format, ...) lldbg(format, ##__VA_ARGS__)
628 #else
629 #define i2cerr(x...)
630 #define i2clldbg(x...)
631 #endif
632 
633 #ifdef CONFIG_DEBUG_I2C_WARN
634 #define i2cwarn(format, ...) wdbg(format, ##__VA_ARGS__)
635 #define i2cllwdbg(format, ...) llwdbg(format, ##__VA_ARGS__)
636 #else
637 #define i2cwarn(x...)
638 #define i2cllwdbg(x...)
639 #endif
640 
641 #ifdef CONFIG_DEBUG_I2C_INFO
642 #define i2cinfo(format, ...) vdbg(format, ##__VA_ARGS__)
643 #define i2cllvdbg(format, ...) llvdbg(format, ##__VA_ARGS__)
644 #else
645 #define i2cinfo(x...)
646 #define i2cllvdbg(x...)
647 #endif
648 
649 #ifdef CONFIG_NET_LWIP_DEBUG
650 #define lwipdbg(format, ...) dbg(format, ##__VA_ARGS__)
651 #define lwiplldbg(format, ...) lldbg(format, ##__VA_ARGS__)
652 #else
653 #define lwipdbg(x...)
654 #define lwiplldbg(x...)
655 #endif
656 
657 #ifdef CONFIG_DEBUG_TTRACE
658 #define ttdbg(format, ...) dbg(format, ##__VA_ARGS__)
659 #else
660 #define ttdbg(format, ...)
661 #endif
662 
663 #else /* CONFIG_CPP_HAVE_VARARGS */
664 
665 /* Variadic macros NOT supported */
666 
667 #ifdef CONFIG_DEBUG
668 #ifndef CONFIG_DEBUG_ERROR
669 #define dbg (void)
670 #define lldbg (void)
671 #else
672 #ifndef CONFIG_ARCH_LOWPUTC
673 #define lldbg (void)
674 #endif
675 #endif
676 #ifndef CONFIG_DEBUG_WARN
677 #define wdbg (void)
678 #define llwdbg (void)
679 #else
680 #ifndef CONFIG_ARCH_LOWPUTC
681 #define llwdbg (void)
682 #endif
683 #endif
684 #ifndef CONFIG_DEBUG_VERBOSE
685 #define vdbg (void)
686 #define llvdbg (void)
687 #else
688 #ifndef CONFIG_ARCH_LOWPUTC
689 #define llvdbg (void)
690 #endif
691 #endif
692 #else
693 #define dbg (void)
694 #define lldbg (void)
695 #define wdbg (void)
696 #define llwdbg (void)
697 #define vdbg (void)
698 #define llvdbg (void)
699 #endif
700 
701 /* Subsystem specific debug */
702 
703 #ifdef CONFIG_DEBUG_MM_ERROR
704 #define mdbg dbg
705 #define mlldbg lldbg
706 #else
707 #define mdbg (void)
708 #define mlldbg (void)
709 #endif
710 
711 #ifdef CONFIG_DEBUG_MM_WARN
712 #define mwdbg wdbg
713 #define mllwdbg llwdbg
714 #else
715 #define mwdbg (void)
716 #define mlwldbg (void)
717 #endif
718 
719 #ifdef CONFIG_DEBUG_MM_INFO
720 #define mvdbg vdbg
721 #define mllvdbg llvdbg
722 #else
723 #define mvdbg (void)
724 #define mllvdbg (void)
725 #endif
726 
727 #ifdef CONFIG_DEBUG_SCHED_ERROR
728 #define sdbg dbg
729 #define slldbg lldbg
730 #else
731 #define sdbg (void)
732 #define slldbg (void)
733 #endif
734 
735 #ifdef CONFIG_DEBUG_SCHED_WARN
736 #define swdbg wdbg
737 #define sllwdbg llwdbg
738 #else
739 #define swdbg (void)
740 #define sllwdbg (void)
741 #endif
742 
743 #ifdef CONFIG_DEBUG_SCHED_INFO
744 #define svdbg vdbg
745 #define sllvdbg llvdbg
746 #else
747 #define svdbg (void)
748 #define sllvdbg (void)
749 #endif
750 
751 #ifdef CONFIG_DEBUG_PAGING_ERROR
752 #define pgdbg dbg
753 #define pglldbg lldbg
754 #else
755 #define pgdbg (void)
756 #define pglldbg (void)
757 #endif
758 
759 #ifdef CONFIG_DEBUG_PAGING_WARN
760 #define pgwdbg wdbg
761 #define pgllwdbg llwdbg
762 #else
763 #define pgwdbg (void)
764 #define pgllwdbg (void)
765 #endif
766 
767 #ifdef CONFIG_DEBUG_PAGING_INFO
768 #define pgvdbg vdbg
769 #define pgllvdbg llvdbg
770 #else
771 #define pgvdbg (void)
772 #define pgllvdbg (void)
773 #endif
774 
775 #ifdef CONFIG_DEBUG_DMA_ERROR
776 #define dmadbg dbg
777 #define dmalldbg lldbg
778 #else
779 #define dmadbg (void)
780 #define dmalldbg (void)
781 #endif
782 
783 #ifdef CONFIG_DEBUG_DMA_WARN
784 #define dmawdbg wdbg
785 #define dmallwdbg llwdbg
786 #else
787 #define dmawdbg (void)
788 #define dmallwdbg (void)
789 #endif
790 
791 #ifdef CONFIG_DEBUG_DMA_INFO
792 #define dmavdbg vdbg
793 #define dmallvdbg llvdbg
794 #else
795 #define dmavdbg (void)
796 #define dmallvdbg (void)
797 #endif
798 
799 #ifdef CONFIG_DEBUG_NET_ERROR
800 #define ndbg dbg
801 #define nlldbg lldbg
802 #else
803 #define ndbg (void)
804 #define nlldbg (void)
805 #endif
806 
807 #ifdef CONFIG_DEBUG_NET_WARN
808 #define nwdbg wdbg
809 #define nllwdbg llwdbg
810 #else
811 #define nwdbg (void)
812 #define nllwdbg (void)
813 #endif
814 
815 #ifdef CONFIG_DEBUG_NET_INFO
816 #define nvdbg vdbg
817 #define nllvdbg llvdbg
818 #else
819 #define nvdbg (void)
820 #define nllvdbg (void)
821 #endif
822 
823 #ifdef CONFIG_DEBUG_USB_ERROR
824 #define udbg dbg
825 #define ulldbg lldbg
826 #else
827 #define udbg (void)
828 #define ulldbg (void)
829 #endif
830 
831 #ifdef CONFIG_DEBUG_USB_WARN
832 #define uwdbg wdbg
833 #define ullwdbg llwdbg
834 #else
835 #define uwdbg (void)
836 #define ullwdbg (void)
837 #endif
838 
839 #ifdef CONFIG_DEBUG_USB_INFO
840 #define uvdbg vdbg
841 #define ullvdbg llvdbg
842 #else
843 #define uvdbg (void)
844 #define ullvdbg (void)
845 #endif
846 
847 #ifdef CONFIG_DEBUG_FS_ERROR
848 #define fdbg dbg
849 #define flldbg lldbg
850 #else
851 #define fdbg (void)
852 #define flldbg (void)
853 #endif
854 
855 #ifdef CONFIG_DEBUG_FS_WARN
856 #define fwdbg wdbg
857 #define fllwdbg llwdbg
858 #else
859 #define fwdbg (void)
860 #define fllwdbg (void)
861 #endif
862 
863 #ifdef CONFIG_DEBUG_FS_INFO
864 #define fvdbg vdbg
865 #define fllvdbg llvdbg
866 #else
867 #define fvdbg (void)
868 #define fllvdbg (void)
869 #endif
870 
871 #ifdef CONFIG_DEBUG_INPUT_ERROR
872 #define idbg dbg
873 #define illdbg lldbg
874 #else
875 #define idbg (void)
876 #define illdbg (void)
877 #endif
878 
879 #ifdef CONFIG_DEBUG_INPUT_WARN
880 #define iwdbg wdbg
881 #define illwdbg llwdbg
882 #else
883 #define iwdbg (void)
884 #define illwdbg (void)
885 #endif
886 
887 #ifdef CONFIG_DEBUG_INPUT_INFO
888 #define ivdbg vdbg
889 #define illvdbg llvdbg
890 #else
891 #define ivdbg (void)
892 #define illvdbg (void)
893 #endif
894 
895 #ifdef CONFIG_DEBUG_SENSORS_ERROR
896 #define sndbg dbg
897 #define snlldbg lldbg
898 #else
899 #define sndbg (void)
900 #define snlldbg (void)
901 #endif
902 
903 #ifdef CONFIG_DEBUG_SENSORS_WARN
904 #define snwdbg wdbg
905 #define snllwdbg llwdbg
906 #else
907 #define snwdbg (void)
908 #define snllwdbg (void)
909 #endif
910 
911 #ifdef CONFIG_DEBUG_SENSORS_INFO
912 #define snvdbg vdbg
913 #define snllvdbg llvdbg
914 #else
915 #define snvdbg (void)
916 #define snllvdbg (void)
917 #endif
918 
919 #ifdef CONFIG_DEBUG_ANALOG_ERROR
920 #define adbg dbg
921 #define alldbg lldbg
922 #else
923 #define adbg (void)
924 #define alldbg (void)
925 #endif
926 
927 #ifdef CONFIG_DEBUG_ANALOG_WARN
928 #define awdbg wdbg
929 #define allwdbg llwdbg
930 #else
931 #define awdbg (void)
932 #define allwdbg (void)
933 #endif
934 
935 #ifdef CONFIG_DEBUG_ANALOG_INFO
936 #define avdbg vdbg
937 #define allvdbg llvdbg
938 #else
939 #define avdbg (void)
940 #define allvdbg (void)
941 #endif
942 
943 #ifdef CONFIG_DEBUG_GRAPHICS_ERROR
944 #define gdbg dbg
945 #define glldbg lldbg
946 #else
947 #define gdbg (void)
948 #define glldbg (void)
949 #endif
950 
951 #ifdef CONFIG_DEBUG_GRAPHICS_WARN
952 #define gwdbg wdbg
953 #define gllwdbg llwdbg
954 #else
955 #define gwdbg (void)
956 #define gllwdbg (void)
957 #endif
958 
959 #ifdef CONFIG_DEBUG_GRAPHICS_INFO
960 #define gvdbg vdbg
961 #define gllvdbg llvdbg
962 #else
963 #define gvdbg (void)
964 #define gllvdbg (void)
965 #endif
966 
967 #ifdef CONFIG_DEBUG_LIB_ERROR
968 #define ldbg dbg
969 #define llldbg lldbg
970 #else
971 #define ldbg (void)
972 #define llldbg (void)
973 #endif
974 
975 #ifdef CONFIG_DEBUG_LIB_WARN
976 #define lwdbg wdbg
977 #define lllwdbg llwdbg
978 #else
979 #define lwdbg (void)
980 #define lllwdbg (void)
981 #endif
982 
983 #ifdef CONFIG_DEBUG_LIB_INFO
984 #define lvdbg vdbg
985 #define lllvdbg llvdbg
986 #else
987 #define lvdbg (void)
988 #define lllvdbg (void)
989 #endif
990 
991 #ifdef CONFIG_DEBUG_AUDIO_ERROR
992 #define auddbg dbg
993 #define audlldbg lldbg
994 #else
995 #define auddbg (void)
996 #define audlldbg (void)
997 #endif
998 
999 #ifdef CONFIG_DEBUG_AUDIO_WARN
1000 #define audwdbg wdbg
1001 #define audllwdbg llwdbg
1002 #else
1003 #define audwdbg (void)
1004 #define audllwdbg (void)
1005 #endif
1006 
1007 #ifdef CONFIG_DEBUG_AUDIO_INFO
1008 #define audvdbg vdbg
1009 #define audllvdbg llvdbg
1010 #else
1011 #define audvdbg (void)
1012 #define audllvdbg (void)
1013 #endif
1014 #endif /* CONFIG_CPP_HAVE_VARARGS */
1015 
1016 /* Buffer dumping macros do not depend on varargs */
1017 
1018 #ifdef CONFIG_DEBUG
1019 #ifdef CONFIG_DEBUG_ERROR
1020 #define dbgdumpbuffer(m, b, n) lib_dumpbuffer(m, b, n)
1021 #else
1022 #define dbgdumpbuffer(m, b, n)
1023 #endif
1024 #ifdef CONFIG_DEBUG_WARN
1025 #define wdbgdumpbuffer(m, b, n) lib_dumpbuffer(m, b, n)
1026 #else
1027 #define wdbgdumpbuffer(m, b, n)
1028 #endif
1029 #ifdef CONFIG_DEBUG_VERBOSE
1030 #define vdbgdumpbuffer(m, b, n) lib_dumpbuffer(m, b, n)
1031 #else
1032 #define vdbgdumpbuffer(m, b, n)
1033 #endif
1034 #else
1035 #define dbgdumpbuffer(m, b, n)
1036 #define wdbgdumpbuffer(m, b, n)
1037 #define vdbgdumpbuffer(m, b, n)
1038 #endif
1039 
1040 /* Subsystem specific debug */
1041 
1042 #ifdef CONFIG_DEBUG_MM
1043 #define mdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1044 #define mvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1045 #else
1046 #define mdbgdumpbuffer(m, b, n)
1047 #define mvdbgdumpbuffer(m, b, n)
1048 #endif
1049 
1050 #ifdef CONFIG_DEBUG_SCHED
1051 #define sdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1052 #define svdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1053 #else
1054 #define sdbgdumpbuffer(m, b, n)
1055 #define svdbgdumpbuffer(m, b, n)
1056 #endif
1057 
1058 #ifdef CONFIG_DEBUG_PAGING
1059 #define pgdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1060 #define pgvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1061 #else
1062 #define pgdbgdumpbuffer(m, b, n)
1063 #define pgvdbgdumpbuffer(m, b, n)
1064 #endif
1065 
1066 #ifdef CONFIG_DEBUG_DMA
1067 #define dmadbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1068 #define dmavdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1069 #else
1070 #define dmadbgdumpbuffer(m, b, n)
1071 #define dmavdbgdumpbuffer(m, b, n)
1072 #endif
1073 
1074 #ifdef CONFIG_DEBUG_NET
1075 #define ndbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1076 #define nvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1077 #else
1078 #define ndbgdumpbuffer(m, b, n)
1079 #define nvdbgdumpbuffer(m, b, n)
1080 #endif
1081 
1082 #ifdef CONFIG_DEBUG_USB
1083 #define udbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1084 #define uvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1085 #else
1086 #define udbgdumpbuffer(m, b, n)
1087 #define uvdbgdumpbuffer(m, b, n)
1088 #endif
1089 
1090 #ifdef CONFIG_DEBUG_FS
1091 #define fdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1092 #define fvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1093 #else
1094 #define fdbgdumpbuffer(m, b, n)
1095 #define fvdbgdumpbuffer(m, b, n)
1096 #endif
1097 
1098 #ifdef CONFIG_DEBUG_INPUT
1099 #define idbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1100 #define ivdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1101 #else
1102 #define idbgdumpbuffer(m, b, n)
1103 #define ivdbgdumpbuffer(m, b, n)
1104 #endif
1105 
1106 #ifdef CONFIG_DEBUG_GRAPHICS
1107 #define gdbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1108 #define gvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1109 #else
1110 #define gdbgdumpbuffer(m, b, n)
1111 #define gvdbgdumpbuffer(m, b, n)
1112 #endif
1113 
1114 #ifdef CONFIG_DEBUG_LIB
1115 #define ldbgdumpbuffer(m, b, n) dbgdumpbuffer(m, b, n)
1116 #define lvdbgdumpbuffer(m, b, n) vdbgdumpbuffer(m, b, n)
1117 #else
1118 #define ldbgdumpbuffer(m, b, n)
1119 #define lvdbgdumpbuffer(m, b, n)
1120 #endif
1121 
1122 /****************************************************************************
1123  * Public Type Declarations
1124  ****************************************************************************/
1125 
1126 /****************************************************************************
1127  * Public Variables
1128  ****************************************************************************/
1129 
1130 /****************************************************************************
1131  * Public Function Prototypes
1132  ****************************************************************************/
1133 
1134 #if defined(__cplusplus)
1135 extern "C" {
1136 #endif
1137 
1150 void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen);
1151 
1152 /* The system logging interfaces are normally accessed via the macros
1153  * provided above. If the cross-compiler's C pre-processor supports a
1154  * variable number of macro arguments, then those macros below will map all
1155  * debug statements to the logging interfaces declared in syslog.h.
1156  *
1157  * If the cross-compiler's pre-processor does not support variable length
1158  * arguments, then these additional APIs will be built.
1159  */
1160 
1161 #ifndef CONFIG_CPP_HAVE_VARARGS
1162 #ifdef CONFIG_DEBUG
1163 
1164 #ifdef CONFIG_DEBUG_ERROR
1165 int dbg(const char *format, ...);
1166 
1167 #ifdef CONFIG_ARCH_LOWPUTC
1168 int lldbg(const char *format, ...);
1169 #endif
1170 #endif
1171 
1172 #ifdef CONFIG_DEBUG_WARN
1173 int wdbg(const char *format, ...);
1174 
1175 #ifdef CONFIG_ARCH_LOWPUTC
1176 int llwdbg(const char *format, ...);
1177 #endif
1178 #endif
1179 
1180 #ifdef CONFIG_DEBUG_VERBOSE
1181 int vdbg(const char *format, ...);
1182 
1183 #ifdef CONFIG_ARCH_LOWPUTC
1184 int llvdbg(const char *format, ...);
1185 #endif
1186 #endif
1187 
1188 #endif /* CONFIG_DEBUG */
1189 #endif /* CONFIG_CPP_HAVE_VARARGS */
1190 
1191 #if defined(__cplusplus)
1192 }
1193 #endif
1194 #endif /* __INCLUDE_DEBUG_H */
1195 
#define vdbg
Definition: debug.h:685
#define lldbg
Definition: debug.h:670
void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen)
Dump a buffer of data.
#define llvdbg
Definition: debug.h:686
#define wdbg
Definition: debug.h:677
Syslog APIs.
#define dbg
Definition: debug.h:669
#define llwdbg
Definition: debug.h:678