[DRIVERS] Spelling fixes by Josh Soref. CORE-12286
[reactos.git] / reactos / drivers / network / 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 along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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_PCH_
29 #define _PCNET_PCH_
30
31 #include <ndis.h>
32
33 #include "pci.h"
34 #include "pcnethw.h"
35
36 /* statistics struct */
37 typedef struct _ADAPTER_STATS
38 {
39 ULONG XmtGoodFrames;
40 ULONG XmtRetryErrors;
41 ULONG XmtLossesOfCarrier;
42 ULONG XmtCollisions;
43 ULONG XmtLateCollisions;
44 ULONG XmtExcessiveDeferrals;
45 ULONG XmtBufferUnderflows;
46 ULONG XmtBufferErrors;
47 ULONG XmtOneRetry;
48 ULONG XmtMoreThanOneRetry;
49 ULONG RcvGoodFrames;
50 ULONG RcvBufferErrors;
51 ULONG RcvCrcErrors;
52 ULONG RcvOverflowErrors;
53 ULONG RcvFramingErrors;
54 } ADAPTER_STATS, *PADAPTER_STATS;
55
56 /* adapter struct */
57 typedef struct _ADAPTER
58 {
59 NDIS_SPIN_LOCK Lock;
60
61 NDIS_HANDLE MiniportAdapterHandle;
62 ULONG Flags;
63 ULONG InterruptVector;
64 ULONG IoBaseAddress;
65 ULONG_PTR PortOffset;
66 NDIS_MINIPORT_INTERRUPT InterruptObject;
67 NDIS_MEDIA_STATE MediaState;
68 UINT MediaSpeed;
69 BOOLEAN FullDuplex;
70 NDIS_MINIPORT_TIMER MediaDetectionTimer;
71 ULONG CurrentReceiveDescriptorIndex;
72 ULONG CurrentPacketFilter;
73 ULONG CurrentLookaheadSize;
74
75 /* circular indexes to transmit descriptors */
76 ULONG CurrentTransmitStartIndex;
77 ULONG CurrentTransmitEndIndex;
78
79 /* initialization block */
80 ULONG InitializationBlockLength;
81 PINITIALIZATION_BLOCK InitializationBlockVirt;
82 PINITIALIZATION_BLOCK InitializationBlockPhys;
83
84 /* transmit descriptor ring */
85 ULONG TransmitDescriptorRingLength;
86 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingVirt;
87 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingPhys;
88
89 /* transmit buffers */
90 ULONG TransmitBufferLength;
91 PCHAR TransmitBufferPtrVirt;
92 PCHAR TransmitBufferPtrPhys;
93
94 /* receive descriptor ring */
95 ULONG ReceiveDescriptorRingLength;
96 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingVirt;
97 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingPhys;
98
99 /* receive buffers */
100 ULONG ReceiveBufferLength;
101 PCHAR ReceiveBufferPtrVirt;
102 PCHAR ReceiveBufferPtrPhys;
103
104 /* buffer count */
105 ULONG BufferCount;
106 ULONG LogBufferCount;
107
108 ADAPTER_STATS Statistics;
109 } ADAPTER, *PADAPTER;
110
111 /* forward declarations */
112 NDIS_STATUS
113 NTAPI
114 MiniportQueryInformation(
115 IN NDIS_HANDLE MiniportAdapterContext,
116 IN NDIS_OID Oid,
117 IN PVOID InformationBuffer,
118 IN ULONG InformationBufferLength,
119 OUT PULONG BytesWritten,
120 OUT PULONG BytesNeeded);
121
122 NDIS_STATUS
123 NTAPI
124 MiniportSetInformation(
125 IN NDIS_HANDLE MiniportAdapterContext,
126 IN NDIS_OID Oid,
127 IN PVOID InformationBuffer,
128 IN ULONG InformationBufferLength,
129 OUT PULONG BytesRead,
130 OUT PULONG BytesNeeded);
131
132 NDIS_STATUS
133 NTAPI
134 MiSetMulticast(
135 PADAPTER Adapter,
136 UCHAR *Addresses,
137 UINT AddressCount);
138
139 NDIS_MEDIA_STATE
140 NTAPI
141 MiGetMediaState(PADAPTER Adapter);
142
143 UINT
144 NTAPI
145 MiGetMediaSpeed(PADAPTER Adapter);
146
147 BOOLEAN
148 NTAPI
149 MiGetMediaDuplex(PADAPTER Adapter);
150
151 /* operational constants */
152 #define NUMBER_OF_BUFFERS 0x20
153 #define LOG_NUMBER_OF_BUFFERS 5 /* log2(NUMBER_OF_BUFFERS) */
154 #define BUFFER_SIZE 0x600
155 #define MAX_MULTICAST_ADDRESSES 32
156 #define MEDIA_DETECTION_INTERVAL 5000
157
158 /* flags */
159 #define RESET_IN_PROGRESS 0x1
160
161 /* Maximum number of interrupts handled per call to MiniportHandleInterrupt */
162 #define INTERRUPT_LIMIT 10
163
164 /* memory pool tag */
165 #define PCNET_TAG 'tNcP'
166
167 #endif /* _PCNET_PCH_ */