update for HEAD-2003091401
[reactos.git] / drivers / net / ndis / include / debug.h
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  *              NASSERT - Disable assertions
8  */
9 #ifndef __DEBUG_H
10 #define __DEBUG_H
11
12 #define NORMAL_MASK    0x000000FF
13 #define SPECIAL_MASK   0xFFFFFF00
14 #define MIN_TRACE      0x00000001
15 #define MID_TRACE      0x00000002
16 #define MAX_TRACE      0x00000003
17
18 #define DEBUG_REFCOUNT 0x00000100
19 #define DEBUG_MINIPORT 0x00000200
20 #define DEBUG_PROTOCOL 0x00000400
21 #define DEBUG_PACKET   0x00000800
22 #define DEBUG_ULTRA    0xFFFFFFFF
23
24 #ifdef DBG
25
26 extern DWORD DebugTraceLevel;
27
28 #ifdef _MSC_VER
29
30 #define NDIS_DbgPrint(_t_, _x_) \
31     if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
32         ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
33         DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
34         DbgPrint _x_ ; \
35     }
36
37 #else /* _MSC_VER */
38
39 #define NDIS_DbgPrint(_t_, _x_) \
40     if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
41         ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
42         DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
43         DbgPrint _x_ ; \
44     }
45
46 #endif /* _MSC_VER */
47
48
49 /* ASSERT is in rtl.h */
50 #if 0
51 #ifdef ASSERT
52 #undef ASSERT
53 #endif
54
55 #ifdef NASSERT
56 #define ASSERT(x)
57 #else /* NASSERT */
58 #define ASSERT(x) if (!(x)) { NDIS_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
59 #endif /* NASSERT */
60 #endif
61 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
62
63 #else /* DBG */
64
65 #define NDIS_DbgPrint(_t_, _x_)
66
67 #define ASSERT_IRQL(x)
68 /*#define ASSERT(x)*/
69
70 #endif /* DBG */
71
72
73 #define assert(x) ASSERT(x)
74 #define assert_irql(x) ASSERT_IRQL(x)
75
76
77 #ifdef _MSC_VER
78
79 #define UNIMPLEMENTED \
80     NDIS_DbgPrint(MIN_TRACE, ("The function at (%s:%d) is unimplemented.\n", __FILE__, __LINE__));
81
82 #else /* _MSC_VER */
83
84 #define UNIMPLEMENTED \
85     NDIS_DbgPrint(MIN_TRACE, ("(%s) at (%s:%d) is unimplemented.\n", __FUNCTION__, __FILE__, __LINE__));
86
87 #endif /* _MSC_VER */
88
89
90 #define CHECKPOINT \
91     do { NDIS_DbgPrint(MIN_TRACE, ("(%s:%d)\n", __FILE__, __LINE__)); } while(0);
92
93 #define CP CHECKPOINT
94
95 #endif /* __DEBUG_H */
96
97 /* EOF */