ReactOS  0.4.14-dev-49-gfb4591c
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 
65 typedef struct _MINIPORT_RESERVED
66 {
69 
70 #define RESERVED(Packet) ((PMINIPORT_RESERVED)((Packet)->MiniportReserved))
71 
73 
74 /* Information about an adapter */
75 typedef 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 */
185 typedef struct _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,
226  PUSHORT Target,
228  USHORT Length);
229 
231  PNIC_ADAPTER Adapter,
233  PUSHORT Source,
234  USHORT Length);
235 
237  PNIC_ADAPTER Adapter,
238  PUCHAR Target,
240  USHORT Length);
241 
243  PNIC_ADAPTER Adapter,
245  PUCHAR Source,
246  USHORT Length);
247 
249  PNIC_ADAPTER Adapter);
250 
251 #endif /* _NE2000_PCH_ */
UINT LookaheadSize
Definition: ne2000.h:129
ULONG InterruptMask
Definition: ne2000.h:120
NDIS_STATUS NICSetup(PNIC_ADAPTER Adapter)
Definition: 8390.c:352
UINT NextPacket
Definition: ne2000.h:136
UINT TXFree
Definition: ne2000.h:162
PNDIS_PACKET TXQueueHead
Definition: ne2000.h:169
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: ne2000.h:82
UCHAR MulticastAddressMask[8]
Definition: ne2000.h:117
struct _MINIPORT_RESERVED * PMINIPORT_RESERVED
PUCHAR RamBase
Definition: ne2000.h:98
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG PacketFilter
Definition: ne2000.h:126
DRIVER_HARDWARE_ADDRESS PermanentAddress
Definition: ne2000.h:105
NDIS_STATUS NICInitialize(PNIC_ADAPTER Adapter)
Definition: 8390.c:289
#define DRIVER_LENGTH_OF_ADDRESS
Definition: ne2000.h:44
UINT TXCount
Definition: ne2000.h:161
struct _MINIPORT_RESERVED MINIPORT_RESERVED
UINT RamSize
Definition: ne2000.h:99
PNDIS_PACKET TXQueueTail
Definition: ne2000.h:171
PUCHAR IOBase
Definition: ne2000.h:92
UINT TXStart
Definition: ne2000.h:160
ULONG_PTR IoBaseAddress
Definition: ne2000.h:85
int32_t INT
Definition: typedefs.h:56
UINT PageStart
Definition: ne2000.h:133
VOID NICWriteDataAlign(PNIC_ADAPTER Adapter, ULONG_PTR Target, PUSHORT Source, USHORT Length)
Definition: 8390.c:699
int NDIS_STATUS
Definition: ntddndis.h:471
uint32_t ULONG_PTR
Definition: typedefs.h:63
ULONG CrcErrors
Definition: ne2000.h:175
BOOLEAN TransmitPending
Definition: ne2000.h:148
VOID NICUpdateCounters(PNIC_ADAPTER Adapter)
Definition: 8390.c:619
ULONG InterruptLevel
Definition: ne2000.h:86
UCHAR DRIVER_HARDWARE_ADDRESS[DRIVER_LENGTH_OF_ADDRESS]
Definition: ne2000.h:72
unsigned char BOOLEAN
INT TXCurrent
Definition: ne2000.h:166
enum _KINTERRUPT_MODE KINTERRUPT_MODE
BOOLEAN NICCheck(PNIC_ADAPTER Adapter)
Definition: 8390.c:53
PNDIS_PACKET Next
Definition: ne2000.h:67
VOID NICTransmit(PNIC_ADAPTER Adapter)
Definition: 8390.c:1124
KINTERRUPT_MODE InterruptMode
Definition: ne2000.h:89
#define DRIVER_DEFAULT_TX_BUFFER_COUNT
Definition: ne2000.h:54
NDIS_STATUS NICReset(PNIC_ADAPTER Adapter)
Definition: 8390.c:500
BOOLEAN WordMode
Definition: ne2000.h:95
VOID NICWriteData(PNIC_ADAPTER Adapter, ULONG_PTR Target, PUCHAR Source, USHORT Length)
Definition: 8390.c:833
ULONG PacketOffset
Definition: ne2000.h:154
DRIVER_HARDWARE_ADDRESS Addresses[DRIVER_MAX_MULTICAST_LIST_SIZE]
Definition: ne2000.h:114
struct _DRIVER_INFORMATION * PDRIVER_INFORMATION
NDIS_PHYSICAL_ADDRESS HighestAcceptableMax
Definition: main.c:60
BOOLEAN BufferOverflow
Definition: ne2000.h:139
VOID NICReadDataAlign(PNIC_ADAPTER Adapter, PUSHORT Target, ULONG_PTR Source, USHORT Length)
Definition: 8390.c:642
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NDIS_STATUS NICStop(PNIC_ADAPTER Adapter)
Definition: 8390.c:451
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
BOOLEAN ReceiveError
Definition: ne2000.h:142
unsigned char UCHAR
Definition: xmlstorage.h:181
#define DRIVER_MAX_MULTICAST_LIST_SIZE
Definition: ne2000.h:37
UINT CurrentPage
Definition: ne2000.h:135
LIST_ENTRY ListEntry
Definition: ne2000.h:78
PACKET_HEADER PacketHeader
Definition: ne2000.h:151
NDIS_HANDLE MiniportAdapterHandle
Definition: ne2000.h:80
Definition: typedefs.h:117
ULONG MaxMulticastListSize
Definition: ne2000.h:111
UINT TXNext
Definition: ne2000.h:163
#define DRIVER_MAXIMUM_LOOKAHEAD
Definition: ne2000.h:47
UINT PageStop
Definition: ne2000.h:134
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
VOID NICReadData(PNIC_ADAPTER Adapter, PUCHAR Target, ULONG_PTR Source, USHORT Length)
Definition: 8390.c:791
BOOLEAN TransmitError
Definition: ne2000.h:145
unsigned short USHORT
Definition: pedump.c:61
ULONG InterruptVector
Definition: ne2000.h:87
BOOLEAN IOPortRangeRegistered
Definition: ne2000.h:179
ULONG FrameAlignmentErrors
Definition: ne2000.h:174
unsigned int UINT
Definition: ndis.h:50
DRIVER_HARDWARE_ADDRESS StationAddress
Definition: ne2000.h:108
UCHAR SAPROM[16]
Definition: ne2000.h:102
NDIS_HANDLE NdisWrapperHandle
Definition: ne2000.h:187
#define DRIVER_HEADER_SIZE
Definition: ne2000.h:43
BOOLEAN InterruptShared
Definition: ne2000.h:88
ULONG MissedPackets
Definition: ne2000.h:176
struct _NIC_ADAPTER * PNIC_ADAPTER
UCHAR Lookahead[DRIVER_MAXIMUM_LOOKAHEAD+DRIVER_HEADER_SIZE]
Definition: ne2000.h:130
unsigned int ULONG
Definition: retypes.h:1
LIST_ENTRY AdapterListHead
Definition: ne2000.h:189
BOOLEAN InterruptRegistered
Definition: ne2000.h:180
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
BOOLEAN DoneIndicating
Definition: ne2000.h:157
NDIS_STATUS NICStart(PNIC_ADAPTER Adapter)
Definition: 8390.c:429
NDIS_HANDLE NdisMacHandle
Definition: ne2000.h:188
BOOLEAN ShutdownHandlerRegistered
Definition: ne2000.h:181
UINT TXSize[DRIVER_DEFAULT_TX_BUFFER_COUNT]
Definition: ne2000.h:165
unsigned short * PUSHORT
Definition: retypes.h:2
struct _DRIVER_INFORMATION DRIVER_INFORMATION
UCHAR InterruptStatus
Definition: ne2000.h:123
struct _NIC_ADAPTER NIC_ADAPTER