xref: /reactos/drivers/network/ndis/include/debug.h (revision 50cf16b3)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS NDIS library
4  * FILE:        include/debug.h
5  * PURPOSE:     Debugging support macros
6  * DEFINES:     DBG     - Enable debug output
7  */
8 
9 #pragma once
10 
11 #define NORMAL_MASK    0x000000FF
12 #define SPECIAL_MASK   0xFFFFFF00
13 #define MIN_TRACE      0x00000001
14 #define MID_TRACE      0x00000002
15 #define MAX_TRACE      0x00000003
16 
17 #define DEBUG_MINIPORT 0x00000200
18 #define DEBUG_PROTOCOL 0x00000400
19 #define DEBUG_PACKET   0x00000800
20 #define DEBUG_ULTRA    0xFFFFFFFF
21 
22 #if DBG
23 
24 extern ULONG DebugTraceLevel;
25 
26 #ifdef _MSC_VER
27 
28 #define NDIS_DbgPrint(_t_, _x_) \
29     if ((_t_ > NORMAL_MASK) \
30         ? (DebugTraceLevel & _t_) > NORMAL_MASK \
31         : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
32         DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
33         DbgPrint _x_ ; \
34     }
35 
36 #else /* _MSC_VER */
37 
38 #define NDIS_DbgPrint(_t_, _x_) \
39     if ((_t_ > NORMAL_MASK) \
40         ? (DebugTraceLevel & _t_) > NORMAL_MASK \
41         : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
42         DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
43         DbgPrint _x_ ; \
44     }
45 
46 #endif /* _MSC_VER */
47 
48 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
49 
50 #else /* DBG */
51 
52 #define NDIS_DbgPrint(_t_, _x_)
53 
54 #define ASSERT_IRQL(x)
55 /*#define ASSERT(x)*/
56 
57 #endif /* DBG */
58 
59 
60 #define assert(x) ASSERT(x)
61 #define assert_irql(x) ASSERT_IRQL(x)
62 
63 
64 #define UNIMPLEMENTED \
65     NDIS_DbgPrint(MIN_TRACE, ("Unimplemented.\n", __FUNCTION__));
66 
67 
68 #define CHECKPOINT \
69     do { NDIS_DbgPrint(MIN_TRACE, ("\n")); } while(0);
70 
71 #define CP CHECKPOINT
72 
73 /* EOF */
74