2 * ReactOS AMD PCNet Driver
3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * PROJECT: ReactOS AMD PCNet Driver
21 * PURPOSE: PCNet Device Driver
22 * PROGRAMMER: Vizzini (vizzini@plasmic.com)
24 * 1-Sept-2003 vizzini - Created
26 * - this is hard-coded to NDIS4
27 * - this assumes a little-endian machine
28 * - this assumes a 32-bit machine, where sizeof(PVOID) = 32 and sizeof(USHORT) = 16
29 * - this assumes 32-bit physical addresses
36 typedef struct _ADAPTER
38 NDIS_HANDLE MiniportAdapterHandle
;
42 ULONG InterruptVector
;
45 NDIS_MINIPORT_INTERRUPT InterruptObject
;
46 ULONG CurrentReceiveDescriptorIndex
;
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
;
75 /* operational constants */
76 #define NUMBER_OF_BUFFERS 0x20
77 #define LOG_NUMBER_OF_BUFFERS 5 /* log2(NUMBER_OF_BUFFERS) */
78 #define BUFFER_SIZE 0x600
81 #define RESET_IN_PROGRESS 0x1
85 #define PCNET_DbgPrint(_x) \
87 DbgPrint("%s:%d %s: ", __FILE__, __LINE__, __FUNCTION__); \
91 #define PCNET_DbgPrint(_x)
95 #define BREAKPOINT __asm__ ("int $3\n");
100 /* memory pool tag */
101 #define PCNET_TAG 0xbaadf00d
103 /* stack validation */
104 #define STACKENTER __asm__("movl %%esp, %0\n" : "=m" (esp));
106 #define STACKLEAVE {\
107 unsigned long esptemp = esp; \
108 __asm__ ("movl %%esp, %0\n": "=m" (esp)); \
110 __asm__ ("int $3\n"); \