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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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
32 typedef struct _ADAPTER
34 NDIS_HANDLE MiniportAdapterHandle
;
36 ULONG InterruptVector
;
39 NDIS_MINIPORT_INTERRUPT InterruptObject
;
40 ULONG CurrentReceiveDescriptorIndex
;
41 ULONG CurrentPacketFilter
;
42 ULONG CurrentLookaheadSize
;
44 /* circular indexes to transmit descriptors */
45 ULONG CurrentTransmitStartIndex
;
46 ULONG CurrentTransmitEndIndex
;
48 /* initialization block */
49 ULONG InitializationBlockLength
;
50 PINITIALIZATION_BLOCK InitializationBlockVirt
;
51 PINITIALIZATION_BLOCK InitializationBlockPhys
;
53 /* transmit descriptor ring */
54 ULONG TransmitDescriptorRingLength
;
55 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingVirt
;
56 PTRANSMIT_DESCRIPTOR TransmitDescriptorRingPhys
;
58 /* transmit buffers */
59 ULONG TransmitBufferLength
;
60 PCHAR TransmitBufferPtrVirt
;
61 PCHAR TransmitBufferPtrPhys
;
63 /* receive descriptor ring */
64 ULONG ReceiveDescriptorRingLength
;
65 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingVirt
;
66 PRECEIVE_DESCRIPTOR ReceiveDescriptorRingPhys
;
69 ULONG ReceiveBufferLength
;
70 PCHAR ReceiveBufferPtrVirt
;
71 PCHAR ReceiveBufferPtrPhys
;
74 /* forward declarations */
77 MiniportQueryInformation(
78 IN NDIS_HANDLE MiniportAdapterContext
,
80 IN PVOID InformationBuffer
,
81 IN ULONG InformationBufferLength
,
82 OUT PULONG BytesWritten
,
83 OUT PULONG BytesNeeded
);
87 MiniportSetInformation(
88 IN NDIS_HANDLE MiniportAdapterContext
,
90 IN PVOID InformationBuffer
,
91 IN ULONG InformationBufferLength
,
93 OUT PULONG BytesNeeded
);
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
101 #define RESET_IN_PROGRESS 0x1
105 #define PCNET_DbgPrint(_x) \
107 DbgPrint("%s:%d %s: ", __FILE__, __LINE__, __FUNCTION__); \
111 #define PCNET_DbgPrint(_x)
115 #define BREAKPOINT __asm__ ("int $3\n");
120 /* memory pool tag */
121 #define PCNET_TAG 0xbaadf00d