705a9d0b6ae44de2f18c489ae7e06c6d71bc8b06
[reactos.git] / drivers / network / afd / include / debug.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Ancillary Function Driver
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_CHECK 0x00000100
19 #define DEBUG_IRP 0x00000200
20 #define DEBUG_ULTRA 0xFFFFFFFF
21
22 #if DBG
23
24 extern DWORD DebugTraceLevel;
25
26 #ifdef _MSC_VER
27
28 #define AFD_DbgPrint(_t_, _x_) \
29 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
30 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
31 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
32 DbgPrint _x_ ; \
33 }
34
35 #else /* _MSC_VER */
36
37 #define AFD_DbgPrint(_t_, _x_) \
38 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
39 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
40 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
41 DbgPrint _x_ ; \
42 }
43
44 #endif /* _MSC_VER */
45
46 #ifdef ASSERT
47 #undef ASSERT
48 #endif
49
50 #ifdef NASSERT
51 #define ASSERT(x)
52 #else /* NASSERT */
53 #define ASSERT(x) if (!(x)) { AFD_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); DbgBreakPoint(); }
54 #endif /* NASSERT */
55
56 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
57
58 #else /* DBG */
59
60 #define AFD_DbgPrint(_t_, _x_)
61
62 #define ASSERT_IRQL(x)
63 #define ASSERTKM(x)
64 #ifndef ASSERT
65 #define ASSERT(x)
66 #endif
67
68 #endif /* DBG */
69
70
71 #undef assert
72 #define assert(x) ASSERT(x)
73 #define assert_irql(x) ASSERT_IRQL(x)
74
75
76 #ifdef _MSC_VER
77
78 #define UNIMPLEMENTED \
79 AFD_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
80 but come back another day.\n", __FILE__, __LINE__));
81
82 #else /* _MSC_VER */
83
84 #define UNIMPLEMENTED \
85 AFD_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, " \
86 "but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
87
88 #endif /* _MSC_VER */
89
90
91 #define CHECKPOINT \
92 AFD_DbgPrint(DEBUG_CHECK, ("\n"));
93
94 #define CP CHECKPOINT
95
96 #endif /* __DEBUG_H */
97
98 /* EOF */