NetBurner 3.1
debugiprintf.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #ifndef _DEBUG_IPRINTF_H_
6 #define _DEBUG_IPRINTF_H_
7 
8 /*
9  ******************************************************************************
10  *
11  * Definitions
12  *
13  ******************************************************************************
14  */
15 /*
16  * To include feature define NB_DEBUG_IPRINTF_CONTROL as uint32_t for choices
17  * Example:
18  * Declare once
19  * uint32_t WifiDebug = ( NB_DEBUG_IPRINTF_INIT | NB_DEBUG_IPRINTF_ERROR );
20  * Define before "include"ing this file
21  * #define NB_DEBUG_IPRINTF_CONTROL WifiDebug
22  *
23  */
24 /*
25  * Debug iprintf choices
26  * User defined bits 9 through 27
27  *
28  */
29 #define NB_DEBUG_OFF (0x00000000)
30 #define NB_DEBUG_ERROR (0x00000001)
31 #define NB_DEBUG_INIT (0x00000002)
32 #define NB_DEBUG_INT (0x00000004)
33 #define NB_DEBUG_RX (0x00000008)
34 #define NB_DEBUG_TX (0x00000010)
35 #define NB_DEBUG_USER_BEG (0x00010000)
36 #define NB_DEBUG_USER_END (0x08000000)
37 #define NB_DEBUG_TRACE (0x80000100)
38 #define NB_DEBUG_ALL (0xFFFFFFFF)
39 
40 /*
41  ******************************************************************************
42  *
43  * NB_DEBUG_IPRINTF
44  *
45  ******************************************************************************
46  */
47 #ifdef NB_DEBUG_IPRINTF_CONTROL
48 
49 #include <utils.h>
50 extern uint32_t NB_DEBUG_IPRINTF_CONTROL;
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 #define NB_DEBUG_IPRINTF(choice, ...) \
64  { \
65  (void)0; \
66  }
67 
68 #endif /* #ifdef NB_DEBUG_IPRINTF_CONTROL */
69 
70 #endif /* #ifndef _DEBUG_IPRINTF_H_ */