ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Windows/b2ether/driver/b2ether.h
Revision: 1.1
Committed: 2012-04-21T16:23:07Z (12 years, 6 months ago) by asvitkine
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
Import b2ether driver sources from a 2001 source archive of BasiliskII.

File Contents

# User Rev Content
1 asvitkine 1.1 /*
2     * b2ether driver -- derived from DDK packet driver sample
3     *
4     * Basilisk II (C) 1997-1999 Christian Bauer
5     *
6     * Windows platform specific code copyright (C) Lauri Pesonen
7     *
8     * This program is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License as published by
10     * the Free Software Foundation; either version 2 of the License, or
11     * (at your option) any later version.
12     *
13     * This program is distributed in the hope that it will be useful,
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     * GNU General Public License for more details.
17     *
18     * You should have received a copy of the GNU General Public License
19     * along with this program; if not, write to the Free Software
20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21     */
22    
23     #define MAX_REQUESTS 4
24    
25     typedef struct _INTERNAL_REQUEST {
26     LIST_ENTRY ListElement;
27     PIRP Irp;
28     NDIS_REQUEST Request;
29     } INTERNAL_REQUEST, *PINTERNAL_REQUEST;
30    
31     // Port device extension.
32     typedef struct _DEVICE_EXTENSION {
33     PDEVICE_OBJECT DeviceObject;
34     NDIS_HANDLE NdisProtocolHandle;
35     NDIS_STRING AdapterName;
36     PWSTR BindString;
37     PWSTR ExportString;
38     } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
39    
40     typedef struct _OPEN_INSTANCE {
41     PDEVICE_EXTENSION DeviceExtension;
42     NDIS_HANDLE AdapterHandle;
43     NDIS_HANDLE PacketPool;
44     KSPIN_LOCK RcvQSpinLock;
45     LIST_ENTRY RcvList;
46     PIRP OpenCloseIrp;
47     KSPIN_LOCK RequestSpinLock;
48     LIST_ENTRY RequestList;
49     LIST_ENTRY ResetIrpList;
50     INTERNAL_REQUEST Requests[MAX_REQUESTS];
51     } OPEN_INSTANCE, *POPEN_INSTANCE;
52    
53     typedef struct _PACKET_RESERVED {
54     LIST_ENTRY ListElement;
55     PIRP Irp;
56     PMDL pMdl;
57     } PACKET_RESERVED, *PPACKET_RESERVED;
58    
59    
60     #define ETHERNET_HEADER_LENGTH 14
61     #define RESERVED(_p) ((PPACKET_RESERVED)((_p)->ProtocolReserved))
62     #define TRANSMIT_PACKETS 16
63    
64    
65     VOID
66     PacketOpenAdapterComplete(
67     IN NDIS_HANDLE ProtocolBindingContext,
68     IN NDIS_STATUS Status,
69     IN NDIS_STATUS OpenErrorStatus
70     );
71    
72     VOID
73     PacketCloseAdapterComplete(
74     IN NDIS_HANDLE ProtocolBindingContext,
75     IN NDIS_STATUS Status
76     );
77    
78    
79     NDIS_STATUS
80     PacketReceiveIndicate(
81     IN NDIS_HANDLE ProtocolBindingContext,
82     IN NDIS_HANDLE MacReceiveContext,
83     IN PVOID HeaderBuffer,
84     IN UINT HeaderBufferSize,
85     IN PVOID LookAheadBuffer,
86     IN UINT LookaheadBufferSize,
87     IN UINT PacketSize
88     );
89    
90     VOID
91     PacketReceiveComplete(
92     IN NDIS_HANDLE ProtocolBindingContext
93     );
94    
95    
96     VOID
97     PacketRequestComplete(
98     IN NDIS_HANDLE ProtocolBindingContext,
99     IN PNDIS_REQUEST pRequest,
100     IN NDIS_STATUS Status
101     );
102    
103     VOID
104     PacketSendComplete(
105     IN NDIS_HANDLE ProtocolBindingContext,
106     IN PNDIS_PACKET pPacket,
107     IN NDIS_STATUS Status
108     );
109    
110    
111     VOID
112     PacketResetComplete(
113     IN NDIS_HANDLE ProtocolBindingContext,
114     IN NDIS_STATUS Status
115     );
116    
117    
118     VOID
119     PacketStatus(
120     IN NDIS_HANDLE ProtocolBindingContext,
121     IN NDIS_STATUS Status,
122     IN PVOID StatusBuffer,
123     IN UINT StatusBufferSize
124     );
125    
126    
127     VOID
128     PacketStatusComplete(
129     IN NDIS_HANDLE ProtocolBindingContext
130     );
131    
132     VOID
133     PacketTransferDataComplete(
134     IN NDIS_HANDLE ProtocolBindingContext,
135     IN PNDIS_PACKET Packet,
136     IN NDIS_STATUS Status,
137     IN UINT BytesTransferred
138     );
139    
140    
141     VOID
142     PacketRemoveReference(
143     IN PDEVICE_EXTENSION DeviceExtension
144     );
145    
146    
147     NTSTATUS
148     PacketCleanup(
149     IN PDEVICE_OBJECT DeviceObject,
150     IN PIRP FlushIrp
151     );
152    
153    
154     NTSTATUS
155     PacketShutdown(
156     IN PDEVICE_OBJECT DeviceObject,
157     IN PIRP Irp
158     );
159    
160     VOID
161     PacketUnload(
162     IN PDRIVER_OBJECT DriverObject
163     );
164    
165    
166    
167     NTSTATUS
168     PacketOpen(
169     IN PDEVICE_OBJECT DeviceObject,
170     IN PIRP Irp
171     );
172    
173     NTSTATUS
174     PacketClose(
175     IN PDEVICE_OBJECT DeviceObject,
176     IN PIRP Irp
177     );
178    
179     NTSTATUS
180     PacketWrite(
181     IN PDEVICE_OBJECT DeviceObject,
182     IN PIRP Irp
183     );
184    
185     NTSTATUS
186     PacketRead(
187     IN PDEVICE_OBJECT DeviceObject,
188     IN PIRP Irp
189     );
190    
191     NTSTATUS
192     PacketIoControl(
193     IN PDEVICE_OBJECT DeviceObject,
194     IN PIRP Irp
195     );