summaryrefslogtreecommitdiffstats
path: root/private/ntos/ndis/elnk3/debug.h
blob: da849a12ccaed9e42bfb3b7cb5e927b25a7660ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133

/*++

Copyright (c) 1990  Microsoft Corporation

Module Name:

    debug.h

Abstract:

    It contains the various debug definitions and macros used in displaying
    debugging information on the kernel debugger.

Author:


Environment:

    Kernel Mode     Operating Systems        : NT

Revision History:


--*/


#if DBG

typedef struct _DEBUG_STATS {

    ULONG         TotalInterrupts;
    ULONG         TxCompIntCount;
    ULONG         TxAvailIntCount;
    ULONG         TxCompleted;

    ULONG         RxCompIntCount;
    ULONG         RxEarlyIntCount;
    ULONG         PacketIndicated;
    ULONG         IndicationCompleted;
    ULONG         TransferDataCount;
    ULONG         IndicateWithDataReady;
    ULONG         BadReceives;
    ULONG         SecondEarlyReceive;
    ULONG         BroadcastsRejected;

    } DEBUG_STATS, *PDEBUG_STATUS;

typedef struct _LOG_ENTRY {
    UCHAR         Letter1;
    UCHAR         Letter2;
    USHORT        Data;
    } LOG_ENTRY, *PLOG_ENTRY;


#define  ELNK3_MAX_LOG_SIZE    128

extern ULONG      Elnk3LogArray[];
extern ULONG      ElnkLogPointer;


#define IF_ELNK3DEBUG(f) if (Elnk3DebugFlag & (f))
extern ULONG Elnk3DebugFlag;

#define ELNK3_DEBUG_LOUD               0x00000001  // debugging info
#define ELNK3_DEBUG_VERY_LOUD          0x00000002  // excessive debugging info
#define ELNK3_DEBUG_IO                 0x00000004  // debug I/O port access

#define ELNK3_DEBUG_INIT               0x00000100  // init debugging info
#define ELNK3_DEBUG_SEND               0x00000200  // init debugging info
#define ELNK3_DEBUG_RCV                0x00000400
#define ELNK3_DEBUG_REQ                0x00000800

#define ELNK3_DEBUG_LOG                0x00001000

#define ELNK3_DEBUG_INIT_BREAK         0x80000000  // break at DriverEntry
#define ELNK3_DEBUG_INIT_FAIL          0x40000000  // fail driver load

//
// Macro for deciding whether to dump lots of debugging information.
//

#define IF_LOUD(A) IF_ELNK3DEBUG( ELNK3_DEBUG_LOUD ) { A }
#define IF_VERY_LOUD(A) IF_ELNK3DEBUG( ELNK3_DEBUG_VERY_LOUD ) { A }
#define IF_IO_LOUD(A) IF_ELNK3DEBUG( ELNK3_DEBUG_IO ) { A }
#define IF_INIT_LOUD(A) IF_ELNK3DEBUG( ELNK3_DEBUG_INIT ) { A }
#define IF_SEND_LOUD(A) IF_ELNK3DEBUG( ELNK3_DEBUG_SEND ) { A }
#define IF_RCV_LOUD(A) IF_ELNK3DEBUG( ELNK3_DEBUG_RCV ) { A }
#define IF_REQ_LOUD(A) IF_ELNK3DEBUG( ELNK3_DEBUG_REQ ) { A }


#define IF_LOG(c1,c2,data) {                                                      \
        if (Elnk3DebugFlag & ELNK3_DEBUG_LOG) {                                   \
            Elnk3LogArray[ElnkLogPointer]=((ULONG)(data)<<16) | ((c1)<<8) | (c2); \
            ElnkLogPointer=(ElnkLogPointer+1)% ELNK3_MAX_LOG_SIZE;                \
            Elnk3LogArray[ElnkLogPointer]=0;                                      \
        }                                                                         \
        }
#if 0

#define IF_LOG(c1,c2,data) {                                          \
                                                                      \
        if (Elnk3DebugFlag & ELNK3_DEBUG_LOG) {                       \
            Elnk3LogArray[ElnkLogPointer].Letter1=(c2);               \
            Elnk3LogArray[ElnkLogPointer].Letter2=(c1);               \
            Elnk3LogArray[ElnkLogPointer].Data   =(USHORT)(data);     \
            ElnkLogPointer=(ElnkLogPointer+1)% ELNK3_MAX_LOG_SIZE;    \
                                                                      \
            Elnk3LogArray[ElnkLogPointer].Letter1=0;                  \
            Elnk3LogArray[ElnkLogPointer].Letter2=0;                  \
            Elnk3LogArray[ElnkLogPointer].Data   =0;                  \
            }                                                         \
        }
#endif

#define DEBUG_STAT(x) ((x)++)


#else

#define IF_LOUD(A)
#define IF_VERY_LOUD(A)
#define IF_IO_LOUD(A)
#define IF_INIT_LOUD(A)
#define IF_SEND_LOUD(A)
#define IF_RCV_LOUD(A)
#define IF_REQ_LOUD(A)

#define DEBUG_STAT(x)

#define IF_LOG(c1,c2,data)

#endif