- Fix receive to work on VMware emulated adapters. We need to set busmaster bit on...
[reactos.git] / reactos / drivers / net / 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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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_H_
29 #define _PCNET_H_
30
31 /* adapter struct */
32 typedef struct _ADAPTER
33 {
34 NDIS_HANDLE MiniportAdapterHandle;
35 ULONG Flags;
36 ULONG InterruptVector;
37 ULONG IoBaseAddress;
38 PVOID PortOffset;
39 NDIS_MINIPORT_INTERRUPT InterruptObject;
40 ULONG CurrentReceiveDescriptorIndex;
41 ULONG CurrentPacketFilter;
42 ULONG CurrentLookaheadSize;
43
44 /* circular indexes to transmit descriptors */
45 ULONG CurrentTransmitStartIndex;
46 ULONG CurrentTransmitEndIndex;
47
48 /* initialization block */
49 ULONG InitializationBlockLength;
50 PINITIALIZATION_BLOCK InitializationBlockVirt;
51 PINITIALIZATION_BLOCK InitializationBlockPhys;
52
53 /* transmit descriptor ring */
54 ULONG TransmitDescriptorRingLength;
55 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingVirt;
56 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingPhys;
57
58 /* transmit buffers */
59 ULONG TransmitBufferLength;
60 PCHAR TransmitBufferPtrVirt;
61 PCHAR TransmitBufferPtrPhys;
62
63 /* receive descriptor ring */
64 ULONG ReceiveDescriptorRingLength;
65 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingVirt;
66 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingPhys;
67
68 /* receive buffers */
69 ULONG ReceiveBufferLength;
70 PCHAR ReceiveBufferPtrVirt;
71 PCHAR ReceiveBufferPtrPhys;
72 } ADAPTER, *PADAPTER;
73
74 /* forward declarations */
75 NDIS_STATUS
76 STDCALL
77 MiniportQueryInformation(
78 IN NDIS_HANDLE MiniportAdapterContext,
79 IN NDIS_OID Oid,
80 IN PVOID InformationBuffer,
81 IN ULONG InformationBufferLength,
82 OUT PULONG BytesWritten,
83 OUT PULONG BytesNeeded);
84
85 NDIS_STATUS
86 STDCALL
87 MiniportSetInformation(
88 IN NDIS_HANDLE MiniportAdapterContext,
89 IN NDIS_OID Oid,
90 IN PVOID InformationBuffer,
91 IN ULONG InformationBufferLength,
92 OUT PULONG BytesRead,
93 OUT PULONG BytesNeeded);
94
95 /* operational constants */
96 #define NUMBER_OF_BUFFERS 0x20
97 #define LOG_NUMBER_OF_BUFFERS 5 /* log2(NUMBER_OF_BUFFERS) */
98 #define BUFFER_SIZE 0x600
99
100 /* flags */
101 #define RESET_IN_PROGRESS 0x1
102
103 /* debugging */
104 #if DBG
105 #define PCNET_DbgPrint(_x) \
106 {\
107 DbgPrint("%s:%d %s: ", __FILE__, __LINE__, __FUNCTION__); \
108 DbgPrint _x; \
109 }
110 #else
111 #define PCNET_DbgPrint(_x)
112 #endif
113
114 #if DBG
115 #define BREAKPOINT __asm__ ("int $3\n");
116 #else
117 #define BREAKPOINT
118 #endif
119
120 /* memory pool tag */
121 #define PCNET_TAG 0xbaadf00d
122
123 #endif // _PCNET_H_
124