2 * ReactOS AMD PCNet Driver
4 * Copyright (C) 2003 Vizzini <vizzini@plasmic.com>
5 * Copyright (C) 2004 Filip Navara <navaraf@reactos.com>
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.
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.
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.
22 * 01-Sep-2003 vizzini - Created
24 * - this assumes a 32-bit machine, where sizeof(PVOID) = 32 and sizeof(USHORT) = 16
25 * - this assumes 32-bit physical addresses
36 /* statistics struct */
37 typedef struct _ADAPTER_STATS
41 ULONG XmtLossesOfCarrier
;
43 ULONG XmtLateCollisions
;
44 ULONG XmtExcessiveDeferrals
;
45 ULONG XmtBufferUnderflows
;
46 ULONG XmtBufferErrors
;
48 ULONG XmtMoreThanOneRetry
;
50 ULONG RcvBufferErrors
;
52 ULONG RcvOverflowErrors
;
53 ULONG RcvFramingErrors
;
54 } ADAPTER_STATS
, *PADAPTER_STATS
;
57 typedef struct _ADAPTER
61 NDIS_HANDLE MiniportAdapterHandle
;
63 ULONG InterruptVector
;
66 NDIS_MINIPORT_INTERRUPT InterruptObject
;
67 NDIS_MEDIA_STATE MediaState
;
70 NDIS_MINIPORT_TIMER MediaDetectionTimer
;
71 ULONG CurrentReceiveDescriptorIndex
;
72 ULONG CurrentPacketFilter
;
73 ULONG CurrentLookaheadSize
;
75 /* circular indexes to transmit descriptors */
76 ULONG CurrentTransmitStartIndex
;
77 ULONG CurrentTransmitEndIndex
;
79 /* initialization block */
80 ULONG InitializationBlockLength
;
81 PINITIALIZATION_BLOCK InitializationBlockVirt
;
82 PINITIALIZATION_BLOCK InitializationBlockPhys
;
84 /* transmit descriptor ring */
85 ULONG TransmitDescriptorRingLength
;
86 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingVirt
;
87 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingPhys
;
89 /* transmit buffers */
90 ULONG TransmitBufferLength
;
91 PCHAR TransmitBufferPtrVirt
;
92 PCHAR TransmitBufferPtrPhys
;
94 /* receive descriptor ring */
95 ULONG ReceiveDescriptorRingLength
;
96 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingVirt
;
97 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingPhys
;
100 ULONG ReceiveBufferLength
;
101 PCHAR ReceiveBufferPtrVirt
;
102 PCHAR ReceiveBufferPtrPhys
;
106 ULONG LogBufferCount
;
108 ADAPTER_STATS Statistics
;
109 } ADAPTER
, *PADAPTER
;
111 /* forward declarations */
114 MiniportQueryInformation(
115 IN NDIS_HANDLE MiniportAdapterContext
,
117 IN PVOID InformationBuffer
,
118 IN ULONG InformationBufferLength
,
119 OUT PULONG BytesWritten
,
120 OUT PULONG BytesNeeded
);
124 MiniportSetInformation(
125 IN NDIS_HANDLE MiniportAdapterContext
,
127 IN PVOID InformationBuffer
,
128 IN ULONG InformationBufferLength
,
129 OUT PULONG BytesRead
,
130 OUT PULONG BytesNeeded
);
141 MiGetMediaState(PADAPTER Adapter
);
145 MiGetMediaSpeed(PADAPTER Adapter
);
149 MiGetMediaDuplex(PADAPTER Adapter
);
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
159 #define RESET_IN_PROGRESS 0x1
161 /* Maximum number of interrupts handled per call to MiniportHandleInterrupt */
162 #define INTERRUPT_LIMIT 10
164 /* memory pool tag */
165 #define PCNET_TAG 'tNcP'
167 #endif /* _PCNET_PCH_ */