Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

ndismac.h

Go to the documentation of this file.
00001 #if !defined(NDIS_MINIPORT_DRIVER) || defined(NDIS_WRAPPER) 00002 00003 typedef 00004 BOOLEAN 00005 (*PNDIS_INTERRUPT_SERVICE)( 00006 IN PVOID InterruptContext 00007 ); 00008 00009 typedef 00010 VOID 00011 (*PNDIS_DEFERRED_PROCESSING)( 00012 IN PVOID SystemSpecific1, 00013 IN PVOID InterruptContext, 00014 IN PVOID SystemSpecific2, 00015 IN PVOID SystemSpecific3 00016 ); 00017 00018 00019 typedef struct _NDIS_INTERRUPT 00020 { 00021 PKINTERRUPT InterruptObject; 00022 KSPIN_LOCK DpcCountLock; 00023 PNDIS_INTERRUPT_SERVICE MacIsr; // Pointer to Mac ISR routine 00024 PNDIS_DEFERRED_PROCESSING MacDpc; // Pointer to Mac DPC routine 00025 KDPC InterruptDpc; 00026 PVOID InterruptContext; // Pointer to context for calling 00027 // adapters ISR and DPC. 00028 UCHAR DpcCount; 00029 BOOLEAN Removing; // TRUE if removing interrupt 00030 00031 // 00032 // This is used to tell when all the Dpcs for the adapter are completed. 00033 // 00034 KEVENT DpcsCompletedEvent; 00035 00036 } NDIS_INTERRUPT, *PNDIS_INTERRUPT; 00037 00038 // 00039 // Ndis Adapter Information 00040 // 00041 typedef 00042 NDIS_STATUS 00043 (*PNDIS_ACTIVATE_CALLBACK)( 00044 IN NDIS_HANDLE NdisAdatperHandle, 00045 IN NDIS_HANDLE MacAdapterContext, 00046 IN ULONG DmaChannel 00047 ); 00048 00049 typedef struct _NDIS_PORT_DESCRIPTOR 00050 { 00051 ULONG InitialPort; 00052 ULONG NumberOfPorts; 00053 PVOID * PortOffset; 00054 } NDIS_PORT_DESCRIPTOR, *PNDIS_PORT_DESCRIPTOR; 00055 00056 typedef struct _NDIS_ADAPTER_INFORMATION 00057 { 00058 ULONG DmaChannel; 00059 BOOLEAN Master; 00060 BOOLEAN Dma32BitAddresses; 00061 PNDIS_ACTIVATE_CALLBACK ActivateCallback; 00062 NDIS_INTERFACE_TYPE AdapterType; 00063 ULONG PhysicalMapRegistersNeeded; 00064 ULONG MaximumPhysicalMapping; 00065 ULONG NumberOfPortDescriptors; 00066 NDIS_PORT_DESCRIPTOR PortDescriptors[1]; // as many as needed 00067 } NDIS_ADAPTER_INFORMATION, *PNDIS_ADAPTER_INFORMATION; 00068 00069 // 00070 // Function types for NDIS_MAC_CHARACTERISTICS 00071 // 00072 typedef 00073 NDIS_STATUS 00074 (*OPEN_ADAPTER_HANDLER)( 00075 OUT PNDIS_STATUS OpenErrorStatus, 00076 OUT NDIS_HANDLE * MacBindingHandle, 00077 OUT PUINT SelectedMediumIndex, 00078 IN PNDIS_MEDIUM MediumArray, 00079 IN UINT MediumArraySize, 00080 IN NDIS_HANDLE NdisBindingContext, 00081 IN NDIS_HANDLE MacAdapterContext, 00082 IN UINT OpenOptions, 00083 IN PSTRING AddressingInformation OPTIONAL 00084 ); 00085 00086 typedef 00087 NDIS_STATUS 00088 (*CLOSE_ADAPTER_HANDLER)( 00089 IN NDIS_HANDLE MacBindingHandle 00090 ); 00091 00092 typedef 00093 NDIS_STATUS 00094 (*WAN_TRANSFER_DATA_HANDLER)( 00095 VOID 00096 ); 00097 00098 typedef 00099 NDIS_STATUS 00100 (*QUERY_GLOBAL_STATISTICS_HANDLER)( 00101 IN NDIS_HANDLE MacAdapterContext, 00102 IN PNDIS_REQUEST NdisRequest 00103 ); 00104 00105 typedef 00106 VOID 00107 (*UNLOAD_MAC_HANDLER)( 00108 IN NDIS_HANDLE MacMacContext 00109 ); 00110 00111 typedef 00112 NDIS_STATUS 00113 (*ADD_ADAPTER_HANDLER)( 00114 IN NDIS_HANDLE MacMacContext, 00115 IN NDIS_HANDLE WrapperConfigurationContext, 00116 IN PNDIS_STRING AdapterName 00117 ); 00118 00119 typedef 00120 VOID 00121 (*REMOVE_ADAPTER_HANDLER)( 00122 IN NDIS_HANDLE MacAdapterContext 00123 ); 00124 00125 #endif // !defined(NDIS_MINIPORT_DRIVER) || defined(NDIS_WRAPPER) 00126 00127 // 00128 // The following handlers are used in the OPEN_BLOCK 00129 // 00130 typedef 00131 NDIS_STATUS 00132 (*WAN_SEND_HANDLER)( 00133 IN NDIS_HANDLE MacBindingHandle, 00134 IN NDIS_HANDLE LinkHandle, 00135 IN PVOID Packet 00136 ); 00137 00138 typedef 00139 NDIS_STATUS 00140 (*SEND_HANDLER)( 00141 IN NDIS_HANDLE MacBindingHandle, 00142 IN PNDIS_PACKET Packet 00143 ); 00144 00145 typedef 00146 NDIS_STATUS 00147 (*TRANSFER_DATA_HANDLER)( 00148 IN NDIS_HANDLE MacBindingHandle, 00149 IN NDIS_HANDLE MacReceiveContext, 00150 IN UINT ByteOffset, 00151 IN UINT BytesToTransfer, 00152 OUT PNDIS_PACKET Packet, 00153 OUT PUINT BytesTransferred 00154 ); 00155 00156 typedef 00157 NDIS_STATUS 00158 (*RESET_HANDLER)( 00159 IN NDIS_HANDLE MacBindingHandle 00160 ); 00161 00162 typedef 00163 NDIS_STATUS 00164 (*REQUEST_HANDLER)( 00165 IN NDIS_HANDLE MacBindingHandle, 00166 IN PNDIS_REQUEST NdisRequest 00167 ); 00168 00169 // 00170 // NDIS 4.0 extension - however available for miniports only 00171 // 00172 typedef 00173 VOID 00174 (*SEND_PACKETS_HANDLER)( 00175 IN NDIS_HANDLE MiniportAdapterContext, 00176 IN PPNDIS_PACKET PacketArray, 00177 IN UINT NumberOfPackets 00178 ); 00179 00180 00181 #if !defined(NDIS_MINIPORT_DRIVER) || defined(NDIS_WRAPPER) 00182 00183 typedef struct _NDIS_MAC_CHARACTERISTICS 00184 { 00185 UCHAR MajorNdisVersion; 00186 UCHAR MinorNdisVersion; 00187 USHORT Filler; 00188 UINT Reserved; 00189 OPEN_ADAPTER_HANDLER OpenAdapterHandler; 00190 CLOSE_ADAPTER_HANDLER CloseAdapterHandler; 00191 SEND_HANDLER SendHandler; 00192 TRANSFER_DATA_HANDLER TransferDataHandler; 00193 RESET_HANDLER ResetHandler; 00194 REQUEST_HANDLER RequestHandler; 00195 QUERY_GLOBAL_STATISTICS_HANDLER QueryGlobalStatisticsHandler; 00196 UNLOAD_MAC_HANDLER UnloadMacHandler; 00197 ADD_ADAPTER_HANDLER AddAdapterHandler; 00198 REMOVE_ADAPTER_HANDLER RemoveAdapterHandler; 00199 NDIS_STRING Name; 00200 00201 } NDIS_MAC_CHARACTERISTICS, *PNDIS_MAC_CHARACTERISTICS; 00202 00203 typedef NDIS_MAC_CHARACTERISTICS NDIS_WAN_MAC_CHARACTERISTICS; 00204 typedef NDIS_WAN_MAC_CHARACTERISTICS * PNDIS_WAN_MAC_CHARACTERISTICS; 00205 00206 // 00207 // one of these per adapter registered on a MAC 00208 // 00209 struct _NDIS_ADAPTER_BLOCK 00210 { 00211 PDEVICE_OBJECT DeviceObject; // created by NdisRegisterAdapter 00212 PNDIS_MAC_BLOCK MacHandle; // pointer to our MAC block 00213 NDIS_HANDLE MacAdapterContext; // context when calling MacOpenAdapter 00214 NDIS_STRING AdapterName; // how NdisOpenAdapter refers to us 00215 PNDIS_OPEN_BLOCK OpenQueue; // queue of opens for this adapter 00216 PNDIS_ADAPTER_BLOCK NextAdapter; // used by MAC's AdapterQueue 00217 REFERENCE Ref; // contains spinlock for OpenQueue 00218 PVOID BusDataContext; // context to pass to bus driver when 00219 // reading or writing config space 00220 BOOLEAN BeingRemoved; // TRUE if adapter is being removed 00221 UCHAR Flags; 00222 00223 // 00224 // Resource information 00225 // 00226 PCM_RESOURCE_LIST Resources; 00227 00228 PNDIS_STRING pAdapterInstanceName; 00229 00230 // 00231 // Wrapper context. 00232 // 00233 PVOID WrapperContext; 00234 00235 // 00236 // contains adapter information 00237 // 00238 ULONG BusNumber; 00239 NDIS_INTERFACE_TYPE BusType; 00240 ULONG ChannelNumber; 00241 NDIS_INTERFACE_TYPE AdapterType; 00242 BOOLEAN Master; 00243 UCHAR AssignedProcessor; 00244 ULONG PhysicalMapRegistersNeeded; 00245 ULONG MaximumPhysicalMapping; 00246 ULONG InitialPort; 00247 ULONG NumberOfPorts; 00248 00249 // 00250 // Holds the mapping for ports, if needed. 00251 // 00252 PUCHAR InitialPortMapping; 00253 00254 // 00255 // TRUE if InitialPortMapping was mapped with NdisMapIoSpace. 00256 // 00257 BOOLEAN InitialPortMapped; 00258 00259 // 00260 // This is the offset added to the port passed to NdisXXXPort to 00261 // get to the real value to be passed to the NDIS_XXX_PORT macros. 00262 // It equals InitialPortMapping - InitialPort; that is, the 00263 // mapped "address" of port 0, even if we didn't actually 00264 // map port 0. 00265 // 00266 PUCHAR PortOffset; 00267 00268 // 00269 // Holds the map registers for this adapter. 00270 // 00271 PMAP_REGISTER_ENTRY MapRegisters; 00272 00273 // 00274 // These two are used temporarily while allocating 00275 // the map registers. 00276 // 00277 KEVENT AllocationEvent; 00278 UINT CurrentMapRegister; 00279 PADAPTER_OBJECT SystemAdapterObject; 00280 00281 #if defined(NDIS_WRAPPER) 00282 // 00283 // Store information here to track adapters 00284 // 00285 ULONG BusId; 00286 ULONG SlotNumber; 00287 00288 // 00289 // Needed for PnP. Upcased version. The buffer is allocated as part of the 00290 // NDIS_ADAPTER_BLOCK itself. 00291 // 00292 NDIS_STRING BaseName; 00293 00294 // 00295 // PNPPM 00296 // 00297 PDEVICE_OBJECT PhysicalDeviceObject; 00298 PDEVICE_OBJECT NextDeviceObject; 00299 PCM_RESOURCE_LIST AllocatedResources; 00300 PCM_RESOURCE_LIST AllocatedResourcesTranslated; 00301 00302 // 00303 // this event will be set at the end of adapter initialization 00304 // 00305 NDIS_EVENT OpenReadyEvent; 00306 00307 // 00308 // current PnP state of the device, ex. started, stopped, query_removed, etc. 00309 // 00310 NDIS_PNP_DEVICE_STATE PnPDeviceState; 00311 00312 // 00313 // Handlers to Write/Read Bus data 00314 // 00315 PGET_SET_DEVICE_DATA SetBusData; 00316 PGET_SET_DEVICE_DATA GetBusData; 00317 00318 POID_LIST OidList; 00319 00320 // 00321 // flag to specify PnP capabilities of the device. we need this to fail query_stop 00322 // query_remove or suspend request if the device can not handle it 00323 // 00324 ULONG PnPCapabilities; 00325 #endif // NDIS_WRAPPER defined 00326 }; 00327 00328 #endif // !defined(NDIS_MINIPORT_DRIVER) || defined(NDIS_WRAPPER) 00329 00330 // 00331 // one of these per open on an adapter/protocol 00332 // 00333 struct _NDIS_OPEN_BLOCK 00334 { 00335 PNDIS_MAC_BLOCK MacHandle; // pointer to our MAC 00336 NDIS_HANDLE MacBindingHandle; // context when calling MacXX funcs 00337 PNDIS_ADAPTER_BLOCK AdapterHandle; // pointer to our adapter 00338 PNDIS_PROTOCOL_BLOCK ProtocolHandle; // pointer to our protocol 00339 NDIS_HANDLE ProtocolBindingContext;// context when calling ProtXX funcs 00340 PNDIS_OPEN_BLOCK AdapterNextOpen; // used by adapter's OpenQueue 00341 PNDIS_OPEN_BLOCK ProtocolNextOpen; // used by protocol's OpenQueue 00342 PNDIS_OPEN_BLOCK NextGlobalOpen; 00343 BOOLEAN Closing; // TRUE when removing this struct 00344 BOOLEAN Unbinding; // TRUE when starting to unbind the adapter 00345 BOOLEAN NoProtRsvdOnRcvPkt; // Reflect the protocol_options 00346 BOOLEAN ProcessingOpens; 00347 PNDIS_STRING BindDeviceName; 00348 KSPIN_LOCK SpinLock; // guards Closing 00349 PNDIS_STRING RootDeviceName; 00350 00351 // 00352 // These are optimizations for getting to MAC routines. They are not 00353 // necessary, but are here to save a dereference through the MAC block. 00354 // 00355 union 00356 { 00357 SEND_HANDLER SendHandler; 00358 WAN_SEND_HANDLER WanSendHandler; 00359 }; 00360 TRANSFER_DATA_HANDLER TransferDataHandler; 00361 00362 // 00363 // These are optimizations for getting to PROTOCOL routines. They are not 00364 // necessary, but are here to save a dereference through the PROTOCOL block. 00365 // 00366 SEND_COMPLETE_HANDLER SendCompleteHandler; 00367 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; 00368 RECEIVE_HANDLER ReceiveHandler; 00369 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; 00370 00371 // 00372 // Extentions to the OPEN_BLOCK since Product 1. 00373 // 00374 union 00375 { 00376 RECEIVE_HANDLER PostNt31ReceiveHandler; 00377 WAN_RECEIVE_HANDLER WanReceiveHandler; 00378 }; 00379 RECEIVE_COMPLETE_HANDLER PostNt31ReceiveCompleteHandler; 00380 00381 // 00382 // NDIS 4.0 extensions 00383 // 00384 RECEIVE_PACKET_HANDLER ReceivePacketHandler; 00385 SEND_PACKETS_HANDLER SendPacketsHandler; 00386 00387 // 00388 // More NDIS 3.0 Cached Handlers 00389 // 00390 RESET_HANDLER ResetHandler; 00391 REQUEST_HANDLER RequestHandler; 00392 RESET_COMPLETE_HANDLER ResetCompleteHandler; 00393 STATUS_HANDLER StatusHandler; 00394 STATUS_COMPLETE_HANDLER StatusCompleteHandler; 00395 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; 00396 }; 00397 00398 00399 EXPORT 00400 VOID 00401 NdisInitializeTimer( 00402 IN OUT PNDIS_TIMER Timer, 00403 IN PNDIS_TIMER_FUNCTION TimerFunction, 00404 IN PVOID FunctionContext 00405 ); 00406 00407 VOID 00408 NdisCancelTimer( 00409 IN PNDIS_TIMER Timer, 00410 OUT PBOOLEAN TimerCancelled 00411 ); 00412 00413 #if !defined(NDIS_MINIPORT_DRIVER) || defined(NDIS_WRAPPER) 00414 00415 // 00416 // Shared memory 00417 // 00418 00419 EXPORT 00420 VOID 00421 NdisAllocateSharedMemory( 00422 IN NDIS_HANDLE NdisAdapterHandle, 00423 IN ULONG Length, 00424 IN BOOLEAN Cached, 00425 OUT PVOID * VirtualAddress, 00426 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress 00427 ); 00428 00429 EXPORT 00430 VOID 00431 NdisFreeSharedMemory( 00432 IN NDIS_HANDLE NdisAdapterHandle, 00433 IN ULONG Length, 00434 IN BOOLEAN Cached, 00435 IN PVOID VirtualAddress, 00436 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress 00437 ); 00438 00439 // 00440 // Requests Used by MAC Drivers 00441 // 00442 00443 EXPORT 00444 VOID 00445 NdisRegisterMac( 00446 OUT PNDIS_STATUS Status, 00447 OUT PNDIS_HANDLE NdisMacHandle, 00448 IN NDIS_HANDLE NdisWrapperHandle, 00449 IN NDIS_HANDLE MacMacContext, 00450 IN PNDIS_MAC_CHARACTERISTICS MacCharacteristics, 00451 IN UINT CharacteristicsLength 00452 ); 00453 00454 EXPORT 00455 VOID 00456 NdisDeregisterMac( 00457 OUT PNDIS_STATUS Status, 00458 IN NDIS_HANDLE NdisMacHandle 00459 ); 00460 00461 00462 EXPORT 00463 NDIS_STATUS 00464 NdisRegisterAdapter( 00465 OUT PNDIS_HANDLE NdisAdapterHandle, 00466 IN NDIS_HANDLE NdisMacHandle, 00467 IN NDIS_HANDLE MacAdapterContext, 00468 IN NDIS_HANDLE WrapperConfigurationContext, 00469 IN PNDIS_STRING AdapterName, 00470 IN PVOID AdapterInformation 00471 ); 00472 00473 EXPORT 00474 NDIS_STATUS 00475 NdisDeregisterAdapter( 00476 IN NDIS_HANDLE NdisAdapterHandle 00477 ); 00478 00479 EXPORT 00480 VOID 00481 NdisRegisterAdapterShutdownHandler( 00482 IN NDIS_HANDLE NdisAdapterHandle, 00483 IN PVOID ShutdownContext, 00484 IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler 00485 ); 00486 00487 EXPORT 00488 VOID 00489 NdisDeregisterAdapterShutdownHandler( 00490 IN NDIS_HANDLE NdisAdapterHandle 00491 ); 00492 00493 EXPORT 00494 VOID 00495 NdisReleaseAdapterResources( 00496 IN NDIS_HANDLE NdisAdapterHandle 00497 ); 00498 00499 EXPORT 00500 VOID 00501 NdisCompleteOpenAdapter( 00502 IN NDIS_HANDLE NdisBindingContext, 00503 IN NDIS_STATUS Status, 00504 IN NDIS_STATUS OpenErrorStatus 00505 ); 00506 00507 00508 EXPORT 00509 VOID 00510 NdisCompleteCloseAdapter( 00511 IN NDIS_HANDLE NdisBindingContext, 00512 IN NDIS_STATUS Status 00513 ); 00514 00515 00516 /*++ 00517 00518 VOID 00519 NdisCompleteSend( 00520 IN NDIS_HANDLE NdisBindingContext, 00521 IN PNDIS_PACKET Packet, 00522 IN NDIS_STATUS Status 00523 ); 00524 00525 --*/ 00526 #define NdisCompleteSend(NdisBindingContext, Packet, Status) \ 00527 { \ 00528 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->SendCompleteHandler)( \ 00529 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext, \ 00530 (Packet), \ 00531 (Status)); \ 00532 } 00533 00534 00535 #define NdisWanSendComplete(NdisBindingContext, WanPacket, Status) \ 00536 { \ 00537 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->SendCompleteHandler)( \ 00538 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext, \ 00539 (PNDIS_PACKET)(WanPacket), \ 00540 (Status)); \ 00541 } 00542 00543 /*++ 00544 00545 VOID 00546 NdisCompleteTransferData( 00547 IN NDIS_HANDLE NdisBindingContext, 00548 IN PNDIS_PACKET Packet, 00549 IN NDIS_STATUS Status, 00550 IN UINT BytesTransferred 00551 ); 00552 00553 --*/ 00554 #define NdisCompleteTransferData(NdisBindingContext, \ 00555 Packet, \ 00556 Status, \ 00557 BytesTransferred) \ 00558 { \ 00559 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->TransferDataCompleteHandler)(\ 00560 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext, \ 00561 (Packet), \ 00562 (Status), \ 00563 (BytesTransferred)); \ 00564 } 00565 00566 /*++ 00567 00568 VOID 00569 NdisCompleteReset( 00570 IN NDIS_HANDLE NdisBindingContext, 00571 IN NDIS_STATUS Status 00572 ); 00573 00574 --*/ 00575 #define NdisCompleteReset(NdisBindingContext, Status) \ 00576 { \ 00577 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ResetCompleteHandler)( \ 00578 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext, \ 00579 Status); \ 00580 } 00581 00582 00583 /*++ 00584 00585 VOID 00586 NdisCompleteRequest( 00587 IN NDIS_HANDLE NdisBindingContext, 00588 IN PNDIS_REQUEST NdisRequest, 00589 IN NDIS_STATUS Status 00590 ); 00591 00592 --*/ 00593 #define NdisCompleteRequest(NdisBindingContext, NdisRequest, Status) \ 00594 { \ 00595 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->RequestCompleteHandler)( \ 00596 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext, \ 00597 NdisRequest, \ 00598 Status); \ 00599 } 00600 00601 /*++ 00602 00603 VOID 00604 NdisIndicateReceive( 00605 OUT PNDIS_STATUS Status, 00606 IN NDIS_HANDLE NdisBindingContext, 00607 IN NDIS_HANDLE MacReceiveContext, 00608 IN PVOID HeaderBuffer, 00609 IN UINT HeaderBufferSize, 00610 IN PVOID LookaheadBuffer, 00611 IN UINT LookaheadBufferSize, 00612 IN UINT PacketSize 00613 ); 00614 00615 --*/ 00616 #define NdisIndicateReceive(Status, \ 00617 NdisBindingContext, \ 00618 MacReceiveContext, \ 00619 HeaderBuffer, \ 00620 HeaderBufferSize, \ 00621 LookaheadBuffer, \ 00622 LookaheadBufferSize, \ 00623 PacketSize) \ 00624 { \ 00625 KIRQL oldIrql; \ 00626 \ 00627 KeRaiseIrql( DISPATCH_LEVEL, &oldIrql ); \ 00628 *(Status) = \ 00629 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->PostNt31ReceiveHandler)( \ 00630 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext,\ 00631 (MacReceiveContext), \ 00632 (HeaderBuffer), \ 00633 (HeaderBufferSize), \ 00634 (LookaheadBuffer), \ 00635 (LookaheadBufferSize), \ 00636 (PacketSize)); \ 00637 \ 00638 KeLowerIrql( oldIrql ); \ 00639 } 00640 00641 #define NdisWanIndicateReceive(Status, \ 00642 NdisBindingContext, \ 00643 NdisLinkContext, \ 00644 Packet, \ 00645 PacketSize) \ 00646 { \ 00647 *(Status) = (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->WanReceiveHandler)( \ 00648 (NdisLinkContext), \ 00649 (Packet), \ 00650 (PacketSize)); \ 00651 } 00652 00653 // 00654 // Used by the filter packages for indicating receives 00655 // 00656 00657 #define FilterIndicateReceive(Status, \ 00658 NdisBindingContext, \ 00659 MacReceiveContext, \ 00660 HeaderBuffer, \ 00661 HeaderBufferSize, \ 00662 LookaheadBuffer, \ 00663 LookaheadBufferSize, \ 00664 PacketSize) \ 00665 {\ 00666 *(Status) = \ 00667 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->PostNt31ReceiveHandler)( \ 00668 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext, \ 00669 (MacReceiveContext), \ 00670 (HeaderBuffer), \ 00671 (HeaderBufferSize), \ 00672 (LookaheadBuffer), \ 00673 (LookaheadBufferSize), \ 00674 (PacketSize)); \ 00675 } 00676 00677 00678 /*++ 00679 00680 VOID 00681 NdisIndicateReceiveComplete( 00682 IN NDIS_HANDLE NdisBindingContext 00683 ); 00684 00685 --*/ 00686 #define NdisIndicateReceiveComplete(NdisBindingContext) \ 00687 { \ 00688 KIRQL oldIrql; \ 00689 \ 00690 KeRaiseIrql( DISPATCH_LEVEL, &oldIrql ); \ 00691 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->PostNt31ReceiveCompleteHandler)( \ 00692 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext); \ 00693 KeLowerIrql( oldIrql ); \ 00694 } 00695 00696 #define NdisWanIndicateReceiveComplete(NdisBindingContext, \ 00697 NdisLinkContext) \ 00698 { \ 00699 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->PostNt31ReceiveCompleteHandler)( \ 00700 (NdisLinkContext)); \ 00701 } 00702 00703 // 00704 // Used by the filter packages for indicating receive completion 00705 // 00706 00707 #define FilterIndicateReceiveComplete(NdisBindingContext) \ 00708 { \ 00709 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->PostNt31ReceiveCompleteHandler)( \ 00710 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext); \ 00711 } 00712 00713 /*++ 00714 00715 VOID 00716 NdisIndicateStatus( 00717 IN NDIS_HANDLE NdisBindingContext, 00718 IN NDIS_STATUS GeneralStatus, 00719 IN PVOID StatusBuffer, 00720 IN UINT StatusBufferSize 00721 ); 00722 00723 --*/ 00724 #define NdisIndicateStatus(NdisBindingContext, \ 00725 GeneralStatus, \ 00726 StatusBuffer, \ 00727 StatusBufferSize) \ 00728 { \ 00729 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->StatusHandler)( \ 00730 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext, \ 00731 (GeneralStatus), \ 00732 (StatusBuffer), \ 00733 (StatusBufferSize)); \ 00734 } 00735 00736 00737 /*++ 00738 00739 VOID 00740 NdisIndicateStatusComplete( 00741 IN NDIS_HANDLE NdisBindingContext 00742 ); 00743 00744 --*/ 00745 #define NdisIndicateStatusComplete(NdisBindingContext) \ 00746 { \ 00747 (((PNDIS_OPEN_BLOCK)(NdisBindingContext))->StatusCompleteHandler)( \ 00748 ((PNDIS_OPEN_BLOCK)(NdisBindingContext))->ProtocolBindingContext); \ 00749 } 00750 00751 EXPORT 00752 VOID 00753 NdisCompleteQueryStatistics( 00754 IN NDIS_HANDLE NdisAdapterHandle, 00755 IN PNDIS_REQUEST NdisRequest, 00756 IN NDIS_STATUS Status 00757 ); 00758 00759 // 00760 // Operating System Requests 00761 // 00762 00763 EXPORT 00764 VOID 00765 NdisMapIoSpace( 00766 OUT PNDIS_STATUS Status, 00767 OUT PVOID * VirtualAddress, 00768 IN NDIS_HANDLE NdisAdapterHandle, 00769 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, 00770 IN UINT Length 00771 ); 00772 00773 #if defined(_ALPHA_) 00774 00775 /*++ 00776 VOID 00777 NdisUnmapIoSpace( 00778 IN NDIS_HANDLE NdisAdapterHandle, 00779 IN PVOID VirtualAddress, 00780 IN UINT Length 00781 ) 00782 --*/ 00783 #define NdisUnmapIoSpace(Handle,VirtualAddress,Length) 00784 00785 #else 00786 00787 /*++ 00788 VOID 00789 NdisUnmapIoSpace( 00790 IN NDIS_HANDLE NdisAdapterHandle, 00791 IN PVOID VirtualAddress, 00792 IN UINT Length 00793 ) 00794 --*/ 00795 #define NdisUnmapIoSpace(Handle,VirtualAddress,Length) MmUnmapIoSpace((VirtualAddress), (Length)); 00796 00797 #endif 00798 00799 EXPORT 00800 VOID 00801 NdisInitializeInterrupt( 00802 OUT PNDIS_STATUS Status, 00803 IN OUT PNDIS_INTERRUPT Interrupt, 00804 IN NDIS_HANDLE NdisAdapterHandle, 00805 IN PNDIS_INTERRUPT_SERVICE InterruptServiceRoutine, 00806 IN PVOID InterruptContext, 00807 IN PNDIS_DEFERRED_PROCESSING DeferredProcessingRoutine, 00808 IN UINT InterruptVector, 00809 IN UINT InterruptLevel, 00810 IN BOOLEAN SharedInterrupt, 00811 IN NDIS_INTERRUPT_MODE InterruptMode 00812 ); 00813 00814 EXPORT 00815 VOID 00816 NdisRemoveInterrupt( 00817 IN PNDIS_INTERRUPT Interrupt 00818 ); 00819 00820 /*++ 00821 00822 BOOLEAN 00823 NdisSynchronizeWithInterrupt( 00824 IN PNDIS_INTERRUPT Interrupt, 00825 IN PVOID SynchronizeFunction, 00826 IN PVOID SynchronizeContext 00827 ) 00828 00829 --*/ 00830 00831 #define NdisSynchronizeWithInterrupt(Interrupt,Function,Context) \ 00832 KeSynchronizeExecution((Interrupt)->InterruptObject, \ 00833 (PKSYNCHRONIZE_ROUTINE)Function, \ 00834 Context) 00835 00836 // 00837 // Physical Mapping 00838 // 00839 00840 /*++ 00841 00842 VOID 00843 NdisStartBufferPhysicalMapping( 00844 IN NDIS_HANDLE NdisAdapterHandle, 00845 IN PNDIS_BUFFER Buffer, 00846 IN ULONG PhysicalMapRegister, 00847 IN BOOLEAN WriteToDevice, 00848 OUT PNDIS_PHYSICAL_ADDRESS_UNIT PhysicalAddressArray, 00849 OUT PUINT ArraySize 00850 ); 00851 00852 --*/ 00853 #define NdisStartBufferPhysicalMapping(_NdisAdapterHandle, \ 00854 _Buffer, \ 00855 _PhysicalMapRegister, \ 00856 _Write, \ 00857 _PhysicalAddressArray, \ 00858 _ArraySize) \ 00859 { \ 00860 PNDIS_ADAPTER_BLOCK _AdaptP = (PNDIS_ADAPTER_BLOCK)(_NdisAdapterHandle); \ 00861 PHYSICAL_ADDRESS _LogicalAddress; \ 00862 PUCHAR _VirtualAddress; \ 00863 ULONG _LengthRemaining; \ 00864 ULONG _LengthMapped; \ 00865 UINT _CurrentArrayLocation; \ 00866 \ 00867 _VirtualAddress = (PUCHAR)MmGetMdlVirtualAddress(_Buffer); \ 00868 _LengthRemaining = MmGetMdlByteCount(_Buffer); \ 00869 _CurrentArrayLocation = 0; \ 00870 while (_LengthRemaining > 0) \ 00871 { \ 00872 _LengthMapped = _LengthRemaining; \ 00873 _LogicalAddress = IoMapTransfer(_AdaptP->SystemAdapterObject, \ 00874 _Buffer, \ 00875 _AdaptP->MapRegisters[_PhysicalMapRegister].MapRegister,\ 00876 _VirtualAddress, \ 00877 &_LengthMapped, \ 00878 _Write); \ 00879 (_PhysicalAddressArray)[_CurrentArrayLocation].PhysicalAddress = _LogicalAddress;\ 00880 (_PhysicalAddressArray)[_CurrentArrayLocation].Length = _LengthMapped; \ 00881 _LengthRemaining -= _LengthMapped; \ 00882 _VirtualAddress += _LengthMapped; \ 00883 ++_CurrentArrayLocation; \ 00884 } \ 00885 _AdaptP->MapRegisters[_PhysicalMapRegister].WriteToDevice = (_Write); \ 00886 *(_ArraySize) = _CurrentArrayLocation; \ 00887 } 00888 00889 00890 /*++ 00891 00892 VOID 00893 NdisCompleteBufferPhysicalMapping( 00894 IN NDIS_HANDLE NdisAdapterHandle, 00895 IN PNDIS_BUFFER Buffer, 00896 IN ULONG PhysicalMapRegister 00897 ); 00898 00899 --*/ 00900 #define NdisCompleteBufferPhysicalMapping(_NdisAdapterHandle, \ 00901 _Buffer, \ 00902 _PhysicalMapRegister \ 00903 ) \ 00904 { \ 00905 PNDIS_ADAPTER_BLOCK _AdaptP = (PNDIS_ADAPTER_BLOCK)(_NdisAdapterHandle); \ 00906 IoFlushAdapterBuffers(_AdaptP->SystemAdapterObject, \ 00907 _Buffer, \ 00908 _AdaptP->MapRegisters[_PhysicalMapRegister].MapRegister,\ 00909 MmGetMdlVirtualAddress(_Buffer), \ 00910 MmGetMdlByteCount(_Buffer), \ 00911 _AdaptP->MapRegisters[_PhysicalMapRegister].WriteToDevice);\ 00912 } 00913 00914 #endif // !defined(NDIS_MINIPORT_DRIVER) || defined(NDIS_WRAPPER) 00915 00916 

Generated on Sat May 15 19:40:54 2004 for test by doxygen 1.3.7