NetBurner 3.5.0
PDF Version
debugiprintf.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
5
// Note: /** changed to /* to disable inclusion in NetBurner API docs, internal use only
6
7
/* @file debugiprintf.h
8
* @brief NetBurner IPrintf Debugging Header File
9
*/
10
11
/* @addtogroup groupDebugIprintf Subsystem Debug Options
12
* \IncludeFileName \n\n
13
*
14
* @brief To include feature define NB_DEBUG_IPRINTF_CONTROL as uint32_t for choices
15
*
16
* Debug iprintf choice #DEFINEs have user defined bits 9 through 27.
17
*
18
* @par Example:
19
* - Declare once
20
* `uint32_t WifiDebug = ( NB_DEBUG_IPRINTF_INIT | NB_DEBUG_IPRINTF_ERROR );`
21
* - Define before "include"ing this file
22
* `#define NB_DEBUG_IPRINTF_CONTROL WifiDebug`
23
*
24
* @{
25
*/
26
27
#ifndef _DEBUG_IPRINTF_H_
28
#define _DEBUG_IPRINTF_H_
29
#include <stdio.h>
30
31
32
#define NB_DEBUG_OFF (0x00000000)
33
#define NB_DEBUG_ERROR (0x00000001)
34
#define NB_DEBUG_INIT (0x00000002)
35
#define NB_DEBUG_INT (0x00000004)
36
#define NB_DEBUG_RX (0x00000008)
37
#define NB_DEBUG_TX (0x00000010)
38
#define NB_DEBUG_USER_BEG (0x00010000)
39
#define NB_DEBUG_USER_END (0x08000000)
40
#define NB_DEBUG_TRACE (0x80000100)
41
#define NB_DEBUG_ALL (0xFFFFFFFF)
42
43
#ifdef NB_DEBUG_IPRINTF_CONTROL
44
45
#include <utils.h>
46
extern
uint32_t NB_DEBUG_IPRINTF_CONTROL;
47
48
/*
49
* @brief NB_DEBUG_IPRINTF
50
*/
51
#define NB_DEBUG_IPRINTF(choice, ...) \
52
{ \
53
if ((NB_DEBUG_IPRINTF_CONTROL & choice) == choice) \
54
{ \
55
(void)iprintf("NB Debug %s, line %d, at %ld\r\n", __FUNCTION__, __LINE__, TimeTick); \
56
iprintf(__VA_ARGS__); \
57
iprintf("\r\n"); \
58
} \
59
}
60
61
#else
/* #ifdef NB_DEBUG_IPRINTF_CONTROL */
62
63
/*
64
* @copydoc NB_DEBUG_IPRINTF
65
*/
66
#define NB_DEBUG_IPRINTF(choice, ...) \
67
{ \
68
(void)0; \
69
}
70
71
#endif
/* #ifdef NB_DEBUG_IPRINTF_CONTROL */
72
73
#endif
/* #ifndef _DEBUG_IPRINTF_H_ */
74
75
/* @} */