code cleanup, lots of little bugfixes, implemented MiniportHandleISR
[reactos.git] / reactos / drivers / net / dd / pcnet / pcnet.h
1 /*
2 * ReactOS AMD PCNet Driver
3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4 *
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.
9 *
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.
14 *
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.
18 *
19 * PROJECT: ReactOS AMD PCNet Driver
20 * FILE: pcnet/pcnet.h
21 * PURPOSE: PCNet Device Driver
22 * PROGRAMMER: Vizzini (vizzini@plasmic.com)
23 * REVISIONS:
24 * 1-Sept-2003 vizzini - Created
25 * NOTES:
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
30 */
31
32 #ifndef _PCNET_H_
33 #define _PCNET_H_
34
35 /* adapter struct */
36 typedef struct _ADAPTER
37 {
38 NDIS_HANDLE MiniportAdapterHandle;
39 ULONG Flags;
40 ULONG BusNumber;
41 ULONG SlotNumber;
42 ULONG InterruptVector;
43 ULONG IoBaseAddress;
44 PVOID PortOffset;
45 NDIS_MINIPORT_INTERRUPT InterruptObject;
46 ULONG CurrentReceiveDescriptorIndex;
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
73 } ADAPTER, *PADAPTER;
74
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
79
80 /* flags */
81 #define RESET_IN_PROGRESS 0x1
82
83 /* debugging */
84 #if DBG
85 #define PCNET_DbgPrint(_x) \
86 {\
87 DbgPrint("%s:%d %s: ", __FILE__, __LINE__, __FUNCTION__); \
88 DbgPrint _x; \
89 }
90 #else
91 #define PCNET_DbgPrint(_x)
92 #endif
93
94 #if DBG
95 #define BREAKPOINT __asm__ ("int $3\n");
96 #else
97 #define BREAKPOINT
98 #endif
99
100 /* memory pool tag */
101 #define PCNET_TAG 0xbaadf00d
102
103 /* stack validation */
104 #define STACKENTER __asm__("movl %%esp, %0\n" : "=m" (esp));
105
106 #define STACKLEAVE {\
107 unsigned long esptemp = esp; \
108 __asm__ ("movl %%esp, %0\n": "=m" (esp)); \
109 if(esp != esptemp) \
110 __asm__ ("int $3\n"); \
111 }
112
113 #endif // _PCNET_H_
114