xref: /reactos/drivers/network/dd/rtl8139/debug.h (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * COPYRIGHT:   See COPYING in the top level directory
3*c2c66affSColin Finck  * PROJECT:     ReactOS Novell Eagle 2000 driver
4*c2c66affSColin Finck  * FILE:        include/debug.h
5*c2c66affSColin Finck  * PURPOSE:     Debugging support macros
6*c2c66affSColin Finck  * DEFINES:     DBG     - Enable debug output
7*c2c66affSColin Finck  *              NASSERT - Disable assertions
8*c2c66affSColin Finck  */
9*c2c66affSColin Finck 
10*c2c66affSColin Finck #pragma once
11*c2c66affSColin Finck 
12*c2c66affSColin Finck #define NORMAL_MASK    0x000000FF
13*c2c66affSColin Finck #define SPECIAL_MASK   0xFFFFFF00
14*c2c66affSColin Finck #define MIN_TRACE      0x00000001
15*c2c66affSColin Finck #define MID_TRACE      0x00000002
16*c2c66affSColin Finck #define MAX_TRACE      0x00000003
17*c2c66affSColin Finck 
18*c2c66affSColin Finck #define DEBUG_MEMORY   0x00000100
19*c2c66affSColin Finck #define DEBUG_ULTRA    0xFFFFFFFF
20*c2c66affSColin Finck 
21*c2c66affSColin Finck #if DBG
22*c2c66affSColin Finck 
23*c2c66affSColin Finck extern ULONG DebugTraceLevel;
24*c2c66affSColin Finck 
25*c2c66affSColin Finck #ifdef _MSC_VER
26*c2c66affSColin Finck 
27*c2c66affSColin Finck #define NDIS_DbgPrint(_t_, _x_) \
28*c2c66affSColin Finck     if ((_t_ > NORMAL_MASK) \
29*c2c66affSColin Finck         ? (DebugTraceLevel & _t_) > NORMAL_MASK \
30*c2c66affSColin Finck         : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
31*c2c66affSColin Finck         DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
32*c2c66affSColin Finck         DbgPrint _x_ ; \
33*c2c66affSColin Finck     }
34*c2c66affSColin Finck 
35*c2c66affSColin Finck #else /* _MSC_VER */
36*c2c66affSColin Finck 
37*c2c66affSColin Finck #define NDIS_DbgPrint(_t_, _x_) \
38*c2c66affSColin Finck     if ((_t_ > NORMAL_MASK) \
39*c2c66affSColin Finck         ? (DebugTraceLevel & _t_) > NORMAL_MASK \
40*c2c66affSColin Finck         : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
41*c2c66affSColin Finck         DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
42*c2c66affSColin Finck         DbgPrint _x_ ; \
43*c2c66affSColin Finck     }
44*c2c66affSColin Finck 
45*c2c66affSColin Finck #endif /* _MSC_VER */
46*c2c66affSColin Finck 
47*c2c66affSColin Finck 
48*c2c66affSColin Finck #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
49*c2c66affSColin Finck #define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql() == (x))
50*c2c66affSColin Finck 
51*c2c66affSColin Finck #else /* DBG */
52*c2c66affSColin Finck 
53*c2c66affSColin Finck #define NDIS_DbgPrint(_t_, _x_)
54*c2c66affSColin Finck 
55*c2c66affSColin Finck #define ASSERT_IRQL(x)
56*c2c66affSColin Finck #define ASSERT_IRQL_EQUAL(x)
57*c2c66affSColin Finck /* #define ASSERT(x) */  /* ndis.h */
58*c2c66affSColin Finck 
59*c2c66affSColin Finck #endif /* DBG */
60*c2c66affSColin Finck 
61*c2c66affSColin Finck 
62*c2c66affSColin Finck #define assert(x) ASSERT(x)
63*c2c66affSColin Finck #define assert_irql(x) ASSERT_IRQL(x)
64*c2c66affSColin Finck 
65*c2c66affSColin Finck 
66*c2c66affSColin Finck #ifdef _MSC_VER
67*c2c66affSColin Finck 
68*c2c66affSColin Finck #define UNIMPLEMENTED \
69*c2c66affSColin Finck     NDIS_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
70*c2c66affSColin Finck         but come back another day.\n", __FILE__, __LINE__));
71*c2c66affSColin Finck 
72*c2c66affSColin Finck #else /* _MSC_VER */
73*c2c66affSColin Finck 
74*c2c66affSColin Finck #define UNIMPLEMENTED \
75*c2c66affSColin Finck     NDIS_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, \
76*c2c66affSColin Finck         but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
77*c2c66affSColin Finck 
78*c2c66affSColin Finck #endif /* _MSC_VER */
79*c2c66affSColin Finck 
80*c2c66affSColin Finck 
81*c2c66affSColin Finck #define CHECKPOINT \
82*c2c66affSColin Finck     do { NDIS_DbgPrint(MIN_TRACE, ("%s:%d\n", __FILE__, __LINE__)); } while(0);
83*c2c66affSColin Finck 
84*c2c66affSColin Finck /* EOF */
85