ReactOS 0.4.16-dev-340-g0540c21
ne2000.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Novell Eagle 2000 driver
4 * FILE: include/ne2000.h
5 * PURPOSE: NE2000 driver definitions
6 */
7
8#ifndef _NE2000_PCH_
9#define _NE2000_PCH_
10
11#define NDIS_MINIPORT_DRIVER 1
12#define NDIS_LEGACY_MINIPORT 1
13#define NDIS51_MINIPORT 1
14#include <ndis.h>
15#include <8390.h>
16
17#include "debug.h"
18
19/* Define NOCARD to test NDIS without a card */
20//#define NOCARD
21
22/* NE2000 specific constants */
23#define NIC_DATA 0x10 /* Data register */
24#define NIC_RESET 0x1F /* Reset register */
25
26
27/* Global constants */
28
29#define DRIVER_NDIS_MAJOR_VERSION 3
30#define DRIVER_NDIS_MINOR_VERSION 0
31
32#define DRIVER_DEFAULT_IO_BASE_ADDRESS 0x280 /* bochs default */
33#define DRIVER_DEFAULT_INTERRUPT_NUMBER 9 /* bochs default */
34#define DRIVER_DEFAULT_INTERRUPT_SHARED FALSE
35#define DRIVER_DEFAULT_INTERRUPT_MODE NdisInterruptLatched
36
37#define DRIVER_MAX_MULTICAST_LIST_SIZE 8
38
39#define DRIVER_VENDOR_DESCRIPTION "Novell Eagle 2000 Adapter."
40#define DRIVER_VENDOR_DRIVER_VERSION 0x0100 /* 1.0 */
41
42#define DRIVER_FRAME_SIZE 1514 /* Size of an ethernet frame */
43#define DRIVER_HEADER_SIZE 14 /* Size of an ethernet header */
44#define DRIVER_LENGTH_OF_ADDRESS 6 /* Size of an ethernet address */
45
46/* Maximum lookahead buffer size */
47#define DRIVER_MAXIMUM_LOOKAHEAD (252 - DRIVER_HEADER_SIZE)
48
49/* Size of a block in a buffer ring */
50#define DRIVER_BLOCK_SIZE 256
51
52
53/* Default number of transmit buffers */
54#define DRIVER_DEFAULT_TX_BUFFER_COUNT 12
55#define BUFFERS_PER_TX_BUF 1
56
57/* Interrupt Mask Register value */
58#define DRIVER_INTERRUPT_MASK IMR_ALLE - IMR_RDCE
59
60/* Maximum number of interrupts handled per call to MiniportHandleInterrupt */
61#define INTERRUPT_LIMIT 10
62
63/* Global structures */
64
65typedef struct _MINIPORT_RESERVED
66{
69
70#define RESERVED(Packet) ((PMINIPORT_RESERVED)((Packet)->MiniportReserved))
71
73
74/* Information about an adapter */
75typedef struct _NIC_ADAPTER
76{
77 /* Entry on global adapter list */
79 /* Adapter handle */
81 /* NDIS interrupt object */
83
84 /* I/O base address and interrupt number of adapter */
90
91 /* Mapped address of the I/O base port */
93
94 /* TRUE if the NIC can transfer in word mode */
96
97 /* Base address and size of the onboard memory window */
100
101 /* Station Address PROM (SAPROM) */
103
104 /* Onboard ethernet address from the manufacturer */
106
107 /* Ethernet address currently in use */
109
110 /* Maximum number of multicast addresses this adapter supports */
112
113 /* List of multicast addresses in use */
115
116 /* Current multicast address mask */
118
119 /* Masked interrupts (IMR value) */
121
122 /* Interrupts that have occurred */
124
125 /* Current packet filter */
127
128 /* Lookahead buffer */
131
132 /* Receive buffer ring */
137
138 /* TRUE if there was a buffer overflow */
140
141 /* TRUE if an error occurred during reception of a packet */
143
144 /* TRUE if an error occurred during transmission of a packet */
146
147 /* TRUE if a transmit interrupt is pending */
149
150 /* Received packet header */
152
153 /* Offset in onboard RAM of received packet */
155
156 /* TRUE if receive indications are done and should be completed */
158
159 /* Transmit buffers */
160 UINT TXStart; /* Start block of transmit buffer ring */
161 UINT TXCount; /* Number of blocks in transmit buffer ring */
162 UINT TXFree; /* Number of free transmit buffers */
163 UINT TXNext; /* Next buffer to use */
164 /* Length of packet. 0 means buffer is unused */
166 INT TXCurrent; /* Current buffer beeing transmitted. -1 means none */
167
168 /* Head of transmit queue */
170 /* Tail of transmit queue */
172
173 /* Statistics */
177
178 /* Flags used for driver cleanup */
183
184/* Global driver information */
186{
187 NDIS_HANDLE NdisWrapperHandle; /* Returned from NdisInitializeWrapper */
188 NDIS_HANDLE NdisMacHandle; /* Returned from NdisRegisterMac */
189 LIST_ENTRY AdapterListHead; /* Adapters this driver control */
191
192
193
194/* Global variable */
195
198
199
200
201/* Prototypes */
202
204 PNIC_ADAPTER Adapter);
205
207 PNIC_ADAPTER Adapter);
208
210 PNIC_ADAPTER Adapter);
211
213 PNIC_ADAPTER Adapter);
214
216 PNIC_ADAPTER Adapter);
217
219 PNIC_ADAPTER Adapter);
220
222 PNIC_ADAPTER Adapter);
223
225 PNIC_ADAPTER Adapter,
228 USHORT Length);
229
231 PNIC_ADAPTER Adapter,
234 USHORT Length);
235
237 PNIC_ADAPTER Adapter,
240 USHORT Length);
241
243 PNIC_ADAPTER Adapter,
246 USHORT Length);
247
249 PNIC_ADAPTER Adapter);
250
251#endif /* _NE2000_PCH_ */
unsigned char BOOLEAN
unsigned int UINT
Definition: ndis.h:50
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
struct _DRIVER_INFORMATION DRIVER_INFORMATION
struct _MINIPORT_RESERVED MINIPORT_RESERVED
UCHAR DRIVER_HARDWARE_ADDRESS[DRIVER_LENGTH_OF_ADDRESS]
Definition: ne2000.h:72
VOID NICReadDataAlign(PNIC_ADAPTER Adapter, PUSHORT Target, ULONG_PTR Source, USHORT Length)
Definition: 8390.c:642
#define DRIVER_HEADER_SIZE
Definition: ne2000.h:43
struct _NIC_ADAPTER * PNIC_ADAPTER
#define DRIVER_MAXIMUM_LOOKAHEAD
Definition: ne2000.h:47
struct _NIC_ADAPTER NIC_ADAPTER
#define DRIVER_MAX_MULTICAST_LIST_SIZE
Definition: ne2000.h:37
BOOLEAN NICCheck(PNIC_ADAPTER Adapter)
Definition: 8390.c:53
VOID NICTransmit(PNIC_ADAPTER Adapter)
Definition: 8390.c:1124
struct _MINIPORT_RESERVED * PMINIPORT_RESERVED
#define DRIVER_DEFAULT_TX_BUFFER_COUNT
Definition: ne2000.h:54
NDIS_STATUS NICStop(PNIC_ADAPTER Adapter)
Definition: 8390.c:451
struct _DRIVER_INFORMATION * PDRIVER_INFORMATION
VOID NICReadData(PNIC_ADAPTER Adapter, PUCHAR Target, ULONG_PTR Source, USHORT Length)
Definition: 8390.c:791
#define DRIVER_LENGTH_OF_ADDRESS
Definition: ne2000.h:44
NDIS_STATUS NICSetup(PNIC_ADAPTER Adapter)
Definition: 8390.c:352
NDIS_STATUS NICReset(PNIC_ADAPTER Adapter)
Definition: 8390.c:500
VOID NICUpdateCounters(PNIC_ADAPTER Adapter)
Definition: 8390.c:619
VOID NICWriteDataAlign(PNIC_ADAPTER Adapter, ULONG_PTR Target, PUSHORT Source, USHORT Length)
Definition: 8390.c:699
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
NDIS_PHYSICAL_ADDRESS HighestAcceptableMax
Definition: main.c:60
NDIS_STATUS NICStart(PNIC_ADAPTER Adapter)
Definition: 8390.c:429
NDIS_STATUS NICInitialize(PNIC_ADAPTER Adapter)
Definition: 8390.c:289
VOID NICWriteData(PNIC_ADAPTER Adapter, ULONG_PTR Target, PUCHAR Source, USHORT Length)
Definition: 8390.c:833
int NDIS_STATUS
Definition: ntddndis.h:475
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
unsigned short USHORT
Definition: pedump.c:61
enum _KINTERRUPT_MODE KINTERRUPT_MODE
NDIS_HANDLE NdisMacHandle
Definition: ne2000.h:188
LIST_ENTRY AdapterListHead
Definition: ne2000.h:189
NDIS_HANDLE NdisWrapperHandle
Definition: ne2000.h:187
Definition: typedefs.h:120
PNDIS_PACKET Next
Definition: ne2000.h:67
BOOLEAN BufferOverflow
Definition: ne2000.h:139
ULONG InterruptLevel
Definition: ne2000.h:86
ULONG PacketFilter
Definition: ne2000.h:126
UINT TXFree
Definition: ne2000.h:162
UINT CurrentPage
Definition: ne2000.h:135
PACKET_HEADER PacketHeader
Definition: ne2000.h:151
ULONG InterruptMask
Definition: ne2000.h:120
UINT PageStart
Definition: ne2000.h:133
UINT PageStop
Definition: ne2000.h:134
UINT RamSize
Definition: ne2000.h:99
BOOLEAN ReceiveError
Definition: ne2000.h:142
BOOLEAN WordMode
Definition: ne2000.h:95
BOOLEAN InterruptRegistered
Definition: ne2000.h:180
PUCHAR IOBase
Definition: ne2000.h:92
BOOLEAN InterruptShared
Definition: ne2000.h:88
UCHAR MulticastAddressMask[8]
Definition: ne2000.h:117
BOOLEAN IOPortRangeRegistered
Definition: ne2000.h:179
UCHAR InterruptStatus
Definition: ne2000.h:123
BOOLEAN TransmitError
Definition: ne2000.h:145
PNDIS_PACKET TXQueueTail
Definition: ne2000.h:171
UINT TXCount
Definition: ne2000.h:161
DRIVER_HARDWARE_ADDRESS Addresses[DRIVER_MAX_MULTICAST_LIST_SIZE]
Definition: ne2000.h:114
UINT TXStart
Definition: ne2000.h:160
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: ne2000.h:82
UCHAR Lookahead[DRIVER_MAXIMUM_LOOKAHEAD+DRIVER_HEADER_SIZE]
Definition: ne2000.h:130
UINT NextPacket
Definition: ne2000.h:136
BOOLEAN DoneIndicating
Definition: ne2000.h:157
ULONG InterruptVector
Definition: ne2000.h:87
PUCHAR RamBase
Definition: ne2000.h:98
BOOLEAN TransmitPending
Definition: ne2000.h:148
UCHAR SAPROM[16]
Definition: ne2000.h:102
UINT TXSize[DRIVER_DEFAULT_TX_BUFFER_COUNT]
Definition: ne2000.h:165
ULONG FrameAlignmentErrors
Definition: ne2000.h:174
ULONG PacketOffset
Definition: ne2000.h:154
INT TXCurrent
Definition: ne2000.h:166
DRIVER_HARDWARE_ADDRESS PermanentAddress
Definition: ne2000.h:105
ULONG_PTR IoBaseAddress
Definition: ne2000.h:85
KINTERRUPT_MODE InterruptMode
Definition: ne2000.h:89
NDIS_HANDLE MiniportAdapterHandle
Definition: ne2000.h:80
UINT LookaheadSize
Definition: ne2000.h:129
PNDIS_PACKET TXQueueHead
Definition: ne2000.h:169
LIST_ENTRY ListEntry
Definition: ne2000.h:78
ULONG MaxMulticastListSize
Definition: ne2000.h:111
ULONG MissedPackets
Definition: ne2000.h:176
BOOLEAN ShutdownHandlerRegistered
Definition: ne2000.h:181
DRIVER_HARDWARE_ADDRESS StationAddress
Definition: ne2000.h:108
ULONG CrcErrors
Definition: ne2000.h:175
UINT TXNext
Definition: ne2000.h:163
int32_t INT
Definition: typedefs.h:58
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
unsigned char UCHAR
Definition: xmlstorage.h:181