- Get NDIS to compile on msvc/ddk (thanks to filip for his help)
[reactos.git] / reactos / drivers / net / dd / pcnet / pcnet.h
1 /*
2 * ReactOS AMD PCNet Driver
3 *
4 * Copyright (C) 2003 Vizzini <vizzini@plasmic.com>
5 * Copyright (C) 2004 Filip Navara <navaraf@reactos.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * REVISIONS:
22 * 01-Sep-2003 vizzini - Created
23 * NOTES:
24 * - this assumes a 32-bit machine, where sizeof(PVOID) = 32 and sizeof(USHORT) = 16
25 * - this assumes 32-bit physical addresses
26 */
27
28 #ifndef _PCNET_H_
29 #define _PCNET_H_
30
31 /* statistics struct */
32 typedef struct _ADAPTER_STATS
33 {
34 ULONG XmtGoodFrames;
35 ULONG XmtRetryErrors;
36 ULONG XmtLossesOfCarrier;
37 ULONG XmtCollisions;
38 ULONG XmtLateCollisions;
39 ULONG XmtExcessiveDefferals;
40 ULONG XmtBufferUnderflows;
41 ULONG XmtBufferErrors;
42 ULONG XmtOneRetry;
43 ULONG XmtMoreThanOneRetry;
44 ULONG RcvGoodFrames;
45 ULONG RcvBufferErrors;
46 ULONG RcvCrcErrors;
47 ULONG RcvOverflowErrors;
48 ULONG RcvFramingErrors;
49 } ADAPTER_STATS, *PADAPTER_STATS;
50
51 /* adapter struct */
52 typedef struct _ADAPTER
53 {
54 NDIS_SPIN_LOCK Lock;
55
56 NDIS_HANDLE MiniportAdapterHandle;
57 ULONG Flags;
58 ULONG InterruptVector;
59 ULONG IoBaseAddress;
60 ULONG_PTR PortOffset;
61 NDIS_MINIPORT_INTERRUPT InterruptObject;
62 NDIS_MEDIA_STATE MediaState;
63 NDIS_MINIPORT_TIMER MediaDetectionTimer;
64 ULONG CurrentReceiveDescriptorIndex;
65 ULONG CurrentPacketFilter;
66 ULONG CurrentLookaheadSize;
67
68 /* circular indexes to transmit descriptors */
69 ULONG CurrentTransmitStartIndex;
70 ULONG CurrentTransmitEndIndex;
71
72 /* initialization block */
73 ULONG InitializationBlockLength;
74 PINITIALIZATION_BLOCK InitializationBlockVirt;
75 PINITIALIZATION_BLOCK InitializationBlockPhys;
76
77 /* transmit descriptor ring */
78 ULONG TransmitDescriptorRingLength;
79 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingVirt;
80 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingPhys;
81
82 /* transmit buffers */
83 ULONG TransmitBufferLength;
84 PCHAR TransmitBufferPtrVirt;
85 PCHAR TransmitBufferPtrPhys;
86
87 /* receive descriptor ring */
88 ULONG ReceiveDescriptorRingLength;
89 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingVirt;
90 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingPhys;
91
92 /* receive buffers */
93 ULONG ReceiveBufferLength;
94 PCHAR ReceiveBufferPtrVirt;
95 PCHAR ReceiveBufferPtrPhys;
96
97 ADAPTER_STATS Statistics;
98 } ADAPTER, *PADAPTER;
99
100 /* forward declarations */
101 NDIS_STATUS
102 STDCALL
103 MiniportQueryInformation(
104 IN NDIS_HANDLE MiniportAdapterContext,
105 IN NDIS_OID Oid,
106 IN PVOID InformationBuffer,
107 IN ULONG InformationBufferLength,
108 OUT PULONG BytesWritten,
109 OUT PULONG BytesNeeded);
110
111 NDIS_STATUS
112 STDCALL
113 MiniportSetInformation(
114 IN NDIS_HANDLE MiniportAdapterContext,
115 IN NDIS_OID Oid,
116 IN PVOID InformationBuffer,
117 IN ULONG InformationBufferLength,
118 OUT PULONG BytesRead,
119 OUT PULONG BytesNeeded);
120
121 NDIS_STATUS
122 STDCALL
123 MiSetMulticast(
124 PADAPTER Adapter,
125 UCHAR *Addresses,
126 UINT AddressCount);
127
128 NDIS_MEDIA_STATE
129 STDCALL
130 MiGetMediaState(PADAPTER Adapter);
131
132 /* operational constants */
133 #define NUMBER_OF_BUFFERS 0x20
134 #define LOG_NUMBER_OF_BUFFERS 5 /* log2(NUMBER_OF_BUFFERS) */
135 #define BUFFER_SIZE 0x600
136 #define MAX_MULTICAST_ADDRESSES 32
137 #define MEDIA_DETECTION_INTERVAL 5000
138
139 /* flags */
140 #define RESET_IN_PROGRESS 0x1
141
142 #if DBG
143 #define BREAKPOINT DbgBreakPoint();
144 #else
145 #define BREAKPOINT
146 #endif
147
148 /* memory pool tag */
149 #define PCNET_TAG 0xbaadf00d
150
151 #endif // _PCNET_H_
152