Initial revision
[reactos.git] / reactos / 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_ULTRA 0xFFFFFFFF
22
23 #ifdef DBG
24
25 extern DWORD DebugTraceLevel;
26
27 #ifdef _MSC_VER
28
29 #define NDIS_DbgPrint(_t_, _x_) \
30 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
31 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
32 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
33 DbgPrint _x_ ; \
34 }
35
36 #else /* _MSC_VER */
37
38 #define NDIS_DbgPrint(_t_, _x_) \
39 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
40 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
41 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
42 DbgPrint _x_ ; \
43 }
44
45 #endif /* _MSC_VER */
46
47
48 #ifdef ASSERT
49 #undef ASSERT
50 #endif
51
52 #ifdef NASSERT
53 #define ASSERT(x)
54 #else /* NASSERT */
55 #define ASSERT(x) if (!(x)) { NDIS_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
56 #endif /* NASSERT */
57
58 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
59
60 #else /* DBG */
61
62 #define NDIS_DbgPrint(_t_, _x_)
63
64 #define ASSERT_IRQL(x)
65 #define ASSERT(x)
66
67 #endif /* DBG */
68
69
70 #define assert(x) ASSERT(x)
71 #define assert_irql(x) ASSERT_IRQL(x)
72
73
74 #ifdef _MSC_VER
75
76 #define UNIMPLEMENTED \
77 NDIS_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented.\n", __FILE__, __LINE__));
78
79 #else /* _MSC_VER */
80
81 #define UNIMPLEMENTED \
82 NDIS_DbgPrint(MIN_TRACE, ("(%s) at (%s:%d) is unimplemented.\n", __FUNCTION__, __FILE__, __LINE__));
83
84 #endif /* _MSC_VER */
85
86
87 #define CHECKPOINT \
88 do { NDIS_DbgPrint(MIN_TRACE, ("%s:%d\n", __FILE__, __LINE__)); } while(0);
89
90 #endif /* __DEBUG_H */
91
92 /* EOF */