ReactOS  0.4.15-dev-1152-g6c94e4f
pcnet.h
Go to the documentation of this file.
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 {
55 
56 /* adapter struct */
57 typedef struct _ADAPTER
58 {
60 
74 
75  /* circular indexes to transmit descriptors */
78 
79  /* initialization block */
83 
84  /* transmit descriptor ring */
88 
89  /* transmit buffers */
93 
94  /* receive descriptor ring */
98 
99  /* receive buffers */
103 
104  /* buffer count */
107 
109 } ADAPTER, *PADAPTER;
110 
111 /* forward declarations */
113 NTAPI
115  IN NDIS_HANDLE MiniportAdapterContext,
116  IN NDIS_OID Oid,
117  IN PVOID InformationBuffer,
118  IN ULONG InformationBufferLength,
120  OUT PULONG BytesNeeded);
121 
123 NTAPI
125  IN NDIS_HANDLE MiniportAdapterContext,
126  IN NDIS_OID Oid,
127  IN PVOID InformationBuffer,
128  IN ULONG InformationBufferLength,
130  OUT PULONG BytesNeeded);
131 
133 NTAPI
135  PADAPTER Adapter,
136  UCHAR *Addresses,
137  UINT AddressCount);
138 
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_ */
signed char * PCHAR
Definition: retypes.h:7
ADAPTER_STATS Statistics
Definition: pcnet.h:108
#define IN
Definition: typedefs.h:39
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
ULONG XmtGoodFrames
Definition: pcnet.h:39
ULONG XmtLateCollisions
Definition: pcnet.h:43
Definition: pcnet.h:57
ULONG RcvFramingErrors
Definition: pcnet.h:53
ULONG ReceiveDescriptorRingLength
Definition: pcnet.h:95
PTRANSMIT_DESCRIPTOR TransmitDescriptorRingVirt
Definition: pcnet.h:86
PHYSICAL_ADDRESS TransmitDescriptorRingPhys
Definition: pcnet.h:87
struct _ADAPTER_STATS * PADAPTER_STATS
UINT NTAPI MiGetMediaSpeed(PADAPTER Adapter)
Definition: pcnet.c:1297
enum _NDIS_MEDIA_STATE NDIS_MEDIA_STATE
NDIS_STATUS NTAPI MiniportQueryInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
Definition: info.c:51
struct _ADAPTER_STATS ADAPTER_STATS
ULONG NDIS_OID
Definition: ntddndis.h:230
ULONG TransmitBufferLength
Definition: pcnet.h:90
PRECEIVE_DESCRIPTOR ReceiveDescriptorRingVirt
Definition: pcnet.h:96
ULONG RcvBufferErrors
Definition: pcnet.h:50
PCHAR ReceiveBufferPtrVirt
Definition: pcnet.h:101
ULONG BufferCount
Definition: pcnet.h:105
struct _ADAPTER * PADAPTER
ULONG CurrentTransmitEndIndex
Definition: pcnet.h:77
UINT MediaSpeed
Definition: pcnet.h:68
NDIS_STATUS NTAPI MiniportSetInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
Definition: info.c:232
ULONG RcvGoodFrames
Definition: pcnet.h:49
ULONG_PTR PortOffset
Definition: pcnet.h:65
NDIS_MINIPORT_TIMER MediaDetectionTimer
Definition: pcnet.h:70
int NDIS_STATUS
Definition: ntddndis.h:471
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _ADAPTER ADAPTER
ULONG XmtRetryErrors
Definition: pcnet.h:40
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
ULONG LogBufferCount
Definition: pcnet.h:106
PHYSICAL_ADDRESS ReceiveBufferPtrPhys
Definition: pcnet.h:102
PHYSICAL_ADDRESS TransmitBufferPtrPhys
Definition: pcnet.h:92
unsigned char BOOLEAN
BOOLEAN NTAPI MiGetMediaDuplex(PADAPTER Adapter)
Definition: pcnet.c:1285
NDIS_SPIN_LOCK Lock
Definition: pcnet.h:59
ULONG InitializationBlockLength
Definition: pcnet.h:80
NDIS_MINIPORT_INTERRUPT InterruptObject
Definition: pcnet.h:66
ULONG XmtCollisions
Definition: pcnet.h:42
ULONG XmtMoreThanOneRetry
Definition: pcnet.h:48
ULONG XmtLossesOfCarrier
Definition: pcnet.h:41
ULONG RcvCrcErrors
Definition: pcnet.h:51
ULONG CurrentLookaheadSize
Definition: pcnet.h:73
NDIS_STATUS NTAPI MiSetMulticast(PADAPTER Adapter, UCHAR *Addresses, UINT AddressCount)
Definition: pcnet.c:1262
ULONG CurrentTransmitStartIndex
Definition: pcnet.h:76
NDIS_HANDLE MiniportAdapterHandle
Definition: pcnet.h:61
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG TransmitDescriptorRingLength
Definition: pcnet.h:85
ULONG CurrentReceiveDescriptorIndex
Definition: pcnet.h:71
ULONG ReceiveBufferLength
Definition: pcnet.h:100
PHYSICAL_ADDRESS ReceiveDescriptorRingPhys
Definition: pcnet.h:97
ULONG XmtBufferUnderflows
Definition: pcnet.h:45
NDIS_MEDIA_STATE NTAPI MiGetMediaState(PADAPTER Adapter)
Definition: pcnet.c:1309
ULONG XmtBufferErrors
Definition: pcnet.h:46
PINITIALIZATION_BLOCK InitializationBlockVirt
Definition: pcnet.h:81
ULONG RcvOverflowErrors
Definition: pcnet.h:52
ULONG Flags
Definition: pcnet.h:62
ULONG XmtExcessiveDeferrals
Definition: pcnet.h:44
unsigned int * PULONG
Definition: retypes.h:1
unsigned int UINT
Definition: ndis.h:50
PHYSICAL_ADDRESS InitializationBlockPhys
Definition: pcnet.h:82
#define OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN FullDuplex
Definition: pcnet.h:69
ULONG IoBaseAddress
Definition: pcnet.h:64
ULONG XmtOneRetry
Definition: pcnet.h:47
ULONG CurrentPacketFilter
Definition: pcnet.h:72
NDIS_MEDIA_STATE MediaState
Definition: pcnet.h:67
PCHAR TransmitBufferPtrVirt
Definition: pcnet.h:91
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
ULONG InterruptVector
Definition: pcnet.h:63