summaryrefslogtreecommitdiffstats
path: root/private/ntos/ndis/ne3200/ne3200pr.h
blob: 68485cf0ee217f9bed77de3ee42e6adaab9639cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*++

Copyright (c) 1990  Microsoft Corporation

Module Name:

    ne3200proc.h

Abstract:

    Procedure declarations for the Novell NE3200 NDIS 3.0 driver.
    Moved most of these from ne3200sw.h

Author:

    Johnson R. Apacible (johnsona)  21-Aug-1991

Environment:

    Architecturally, there is an assumption in this driver that we are
    on a little endian machine.

Notes:

    optional-notes

Revision History:


--*/

#ifndef _NE3200PROC_
#define _NE3200PROC_

//
// We define the external interfaces to the NE3200 driver.
// These routines are only external to permit separate
// compilation.  Given a truely fast compiler they could
// all reside in a single file and be static.
//
extern
BOOLEAN
NE3200CheckForHang(
    IN NDIS_HANDLE MiniportAdapterContext
    );

extern
VOID
NE3200DisableInterrupt(
    IN  NDIS_HANDLE MiniportAdapterContext
    );

extern
VOID
NE3200EnableInterrupt(
    IN  NDIS_HANDLE MiniportAdapterContext
    );

extern
VOID
NE3200Halt(
    IN  NDIS_HANDLE MiniportAdapterContext
    );

extern
VOID
NE3200HandleInterrupt(
    IN  NDIS_HANDLE MiniportAdapterContext
    );

extern
NDIS_STATUS
NE3200Initialize(
    OUT PNDIS_STATUS OpenErrorStatus,
    OUT PUINT SelectedMediumIndex,
    IN PNDIS_MEDIUM MediumArray,
    IN UINT MediumArraySize,
    IN NDIS_HANDLE MiniportAdapterHandle,
    IN NDIS_HANDLE WrapperConfigurationContext
    );

extern
VOID
NE3200Isr(
    OUT PBOOLEAN InterruptRecognized,
    OUT PBOOLEAN QueueDpc,
    IN  NDIS_HANDLE MiniportAdapterContext
    );

extern
NDIS_STATUS
NE3200QueryInformation(
    IN NDIS_HANDLE MiniportAdapterContext,
    IN NDIS_OID Oid,
    IN PVOID InformationBuffer,
    IN ULONG InformationBufferLength,
    OUT PULONG BytesWritten,
    OUT PULONG BytesNeeded
    );

extern
NDIS_STATUS
NE3200Reset(
    OUT PBOOLEAN AddressingReset,
    IN  NDIS_HANDLE MiniportAdapterContext
    );

extern
NDIS_STATUS
NE3200Send(
    IN NDIS_HANDLE MiniportAdapterContext,
    IN PNDIS_PACKET Packet,
    IN UINT Flags
    );

extern
NDIS_STATUS
NE3200SetInformation(
    IN NDIS_HANDLE MiniportAdapterContext,
    IN NDIS_OID Oid,
    IN PVOID InformationBuffer,
    IN ULONG InformationBufferLength,
    OUT PULONG BytesRead,
    OUT PULONG BytesNeeded
    );

extern
NDIS_STATUS
NE3200TransferData(
    OUT PNDIS_PACKET Packet,
    OUT PUINT BytesTransferred,
    IN NDIS_HANDLE MiniportAdapterContext,
    IN NDIS_HANDLE MiniportReceiveContext,
    IN UINT ByteOffset,
    IN UINT BytesToTransfer
    );

VOID
NE3200StartChipAndDisableInterrupts(
    IN PNE3200_ADAPTER Adapter,
    IN PNE3200_SUPER_RECEIVE_ENTRY FirstReceiveEntry
    );

VOID
NE3200FinishQueryInformation(
    IN PNE3200_ADAPTER Adapter
    );


VOID
NE3200GetStationAddress(
    IN PNE3200_ADAPTER Adapter
    );

VOID
NE3200StopChip(
    IN PNE3200_ADAPTER Adapter
    );

BOOLEAN
NE3200RegisterAdapter(
    IN NDIS_HANDLE MiniportAdapterHandle,
    IN UINT EisaSlot,
    IN UINT InterruptVector,
    IN NDIS_INTERRUPT_MODE InterruptMode,
    IN PUCHAR CurrentAddress
    );

VOID
NE3200AcquirePublicCommandBlock(
    IN PNE3200_ADAPTER Adapter,
    OUT PNE3200_SUPER_COMMAND_BLOCK * CommandBlock
    );

VOID
FASTCALL
NE3200RelinquishCommandBlock(
    IN PNE3200_ADAPTER Adapter,
    IN PNE3200_SUPER_COMMAND_BLOCK CommandBlock
    );

VOID
NE3200DoAdapterReset(
    IN PNE3200_ADAPTER Adapter
    );

VOID
NE3200SetupForReset(
    IN PNE3200_ADAPTER Adapter
    );

NDIS_STATUS
NE3200UpdateMulticastTable(
    IN PNE3200_ADAPTER Adapter,
    IN UINT CurrentAddressCount,
    IN CHAR CurrentAddresses[][NE3200_LENGTH_OF_ADDRESS]
    );

VOID
NE3200ResetVariables(
    IN PNE3200_ADAPTER Adapter
    );

BOOLEAN
SyncNE3200ClearDoorbellInterrupt(
    IN PVOID SyncContext
    );

VOID
NE3200ResetHandler(
    IN PVOID SystemSpecific1,
    IN PNE3200_ADAPTER Adapter,
    IN PVOID SystemSpecific2,
    IN PVOID SystemSpecific3
    );

VOID
NE3200DeferredTimer(
    IN PVOID SystemSpecific1,
    IN PNE3200_ADAPTER Adapter,
    IN PVOID SystemSpecific2,
    IN PVOID SystemSpecific3
    );

VOID
FASTCALL
Ne3200Stall(
    PULONG Dummy
    );

#define NE3200SubmitCommandBlock( _Adapter, _CommandBlock )         \
{                                                                   \
    ASSERT(!(NdisGetPhysicalAddressLow(_CommandBlock->Self) & 1));  \
    _CommandBlock->Timeout = FALSE;                                 \
    if (_Adapter->FirstCommandOnCard != NULL) {                     \
        if (_Adapter->FirstWaitingCommand == NULL) {                \
            _Adapter->FirstWaitingCommand = _CommandBlock;          \
        } else {                                                    \
            PNE3200_SUPER_COMMAND_BLOCK PreviousCommandBlock;       \
            PreviousCommandBlock = _Adapter->LastWaitingCommand;    \
            PreviousCommandBlock->Hardware.NextPending =            \
               NdisGetPhysicalAddressLow(_CommandBlock->Self);      \
            PreviousCommandBlock->NextCommand = _CommandBlock;      \
        }                                                           \
        _Adapter->LastWaitingCommand = _CommandBlock;               \
        IF_LOG('2');                                                \
    } else {                                                        \
        ASSERT(_Adapter->FirstWaitingCommand == NULL);              \
        IF_LOG('1');                                                \
        _Adapter->FirstCommandOnCard = _CommandBlock;               \
        _Adapter->LastCommandOnCard = _CommandBlock;                \
        NE3200_WRITE_COMMAND_POINTER(_Adapter,NdisGetPhysicalAddressLow(_CommandBlock->Self)); \
        { ULONG i; Ne3200Stall(&i); }                               \
        NE3200_WRITE_LOCAL_DOORBELL_INTERRUPT(_Adapter,NE3200_LOCAL_DOORBELL_NEW_COMMAND); \
    }                                                               \
}

#define NE3200AcquireCommandBlock( _Adapter, _CommandBlock ) \
{                                                            \
    if (_Adapter->NumberOfAvailableCommandBlocks) {          \
        IF_LOG('a');                                         \
        _Adapter->NumberOfAvailableCommandBlocks--;          \
        *(_CommandBlock) = _Adapter->NextCommandBlock;       \
        _Adapter->NextCommandBlock++;                        \
        if (_Adapter->NextCommandBlock >= _Adapter->LastCommandBlockAllocated ) {\
            Adapter->NextCommandBlock = Adapter->CommandQueue; \
        }                                                    \
    } else {                                                 \
        *(_CommandBlock) = NULL;                             \
    }                                                        \
}

#endif  //_NE3200PROC_