ReactOS 0.4.16-dev-197-g92996da
main.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Novell Eagle 2000 driver
4 * FILE: ne2000/main.c
5 * PURPOSE: Driver entry point
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * REVISIONS:
8 * CSH 27/08-2000 Created
9 */
10
11#include <ne2000.h>
12
18
19
20#if DBG
21
22/* See debug.h for debug/trace constants */
24
25#endif /* DBG */
26
27
28/* List of supported OIDs */
57};
58
61
62
64 IN NDIS_HANDLE MiniportAdapterContext)
65/*
66 * FUNCTION: Examines if an adapter has hung
67 * ARGUMENTS:
68 * MiniportAdapterContext = Pointer to adapter context area
69 * RETURNS:
70 * TRUE if the adapter has hung, FALSE if not
71 */
72{
73 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
74
75 return FALSE;
76}
77
78
80 IN NDIS_HANDLE MiniportAdapterContext)
81/*
82 * FUNCTION: Disables interrupts from an adapter
83 * ARGUMENTS:
84 * MiniportAdapterContext = Pointer to adapter context area
85 */
86{
87 NDIS_DbgPrint(MAX_TRACE, ("Called. (MiniportDisableInterrupt).\n"));
88#ifndef NOCARD
89 NICDisableInterrupts((PNIC_ADAPTER)MiniportAdapterContext);
90#endif
91}
92
93
95 IN NDIS_HANDLE MiniportAdapterContext)
96/*
97 * FUNCTION: Enables interrupts from an adapter
98 * ARGUMENTS:
99 * MiniportAdapterContext = Pointer to adapter context area
100 */
101{
102 NDIS_DbgPrint(MAX_TRACE, ("Called. (MiniportEnableInterrupt).\n"));
103#ifndef NOCARD
104 NICEnableInterrupts((PNIC_ADAPTER)MiniportAdapterContext);
105#endif
106}
107
108
110 IN NDIS_HANDLE MiniportAdapterContext)
111/*
112 * FUNCTION: Deallocates resources for and halts an adapter
113 * ARGUMENTS:
114 * MiniportAdapterContext = Pointer to adapter context area
115 */
116{
117 PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
118
120
121 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
122#ifndef NOCARD
123 /* Stop the NIC */
124 NICStop(Adapter);
125#endif
126 /* Wait for any DPCs to complete. FIXME: Use something else */
127 NdisStallExecution(250000);
128
129 if (Adapter->InterruptRegistered)
130 /* Deregister interrupt */
132
133 if (Adapter->IOPortRangeRegistered)
134 /* Deregister I/O port range */
136 Adapter->MiniportAdapterHandle,
137 Adapter->IoBaseAddress,
138 0x20,
139 Adapter->IOBase);
140
141 if (Adapter->ShutdownHandlerRegistered)
143
144 /* Remove adapter from global adapter list */
145 if ((&Adapter->ListEntry)->Blink != NULL) {
146 RemoveEntryList(&Adapter->ListEntry);
147 }
148
149 /* Free adapter context area */
150 NdisFreeMemory(Adapter, sizeof(NIC_ADAPTER), 0);
151}
152
153
156 IN PNIC_ADAPTER Adapter,
158{
159 PNDIS_RESOURCE_LIST AssignedResources;
160 UINT BufferSize = 0;
162 UINT i;
163
166 NULL,
167 &BufferSize);
169 return;
170
171 *Status = NdisAllocateMemory((PVOID)&AssignedResources,
173 0,
176 return;
177
180 AssignedResources,
181 &BufferSize);
183 return;
184
185 for (i = 0; i < AssignedResources->Count; i++)
186 {
187 Descriptor = AssignedResources->PartialDescriptors + i;
188 switch (Descriptor->Type)
189 {
191 Adapter->InterruptLevel = Descriptor->u.Interrupt.Level;
192 Adapter->InterruptVector = Descriptor->u.Interrupt.Vector;
193 Adapter->InterruptShared = (Descriptor->ShareDisposition == CmResourceShareShared);
194 Adapter->InterruptMode = Descriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED ?
196 break;
198 Adapter->IoBaseAddress = Descriptor->u.Port.Start.LowPart;
199 break;
200 }
201 }
202}
203
204VOID
205NTAPI
207{
208 #ifndef NOCARD
210 #endif
211}
212
216 IN PNDIS_MEDIUM MediumArray,
220/*
221 * FUNCTION: Adapter initialization function
222 * ARGUMENTS:
223 * OpenErrorStatus = Address of buffer to place additional status information
224 * SelectedMediumIndex = Address of buffer to place selected medium index
225 * MediumArray = Pointer to an array of NDIS_MEDIUMs
226 * MediaArraySize = Number of elements in MediumArray
227 * MiniportAdapterHandle = Miniport adapter handle assigned by NDIS
228 * WrapperConfigurationContext = Handle used to identify configuration context
229 * RETURNS:
230 * Status of operation
231 */
232{
233 UINT i;
235 PNIC_ADAPTER Adapter;
237 UINT *RegNetworkAddress = 0;
238 UINT RegNetworkAddressLength = 0;
239
241
242 NDIS_DbgPrint(MAX_TRACE, ("Called (Adapter %X).\n", MiniportAdapterHandle));
243
244 /* Search for 802.3 media which is the only one we support */
245 for (i = 0; i < MediumArraySize; i++) {
246 if (MediumArray[i] == NdisMedium802_3)
247 break;
248 }
249
250 if (i == MediumArraySize) {
251 NDIS_DbgPrint(MIN_TRACE, ("No supported media.\n"));
253 }
254
256
257 Status = NdisAllocateMemory((PVOID)&Adapter,
258 sizeof(NIC_ADAPTER),
259 0,
262 NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
263 return Status;
264 }
265
266 NdisZeroMemory(Adapter, sizeof(NIC_ADAPTER));
276
277 /* Query the resources from PnP. */
279
280 /* Get the port, irq, and MAC address from registry if the PnP
281 failed. */
283 {
284 PNDIS_CONFIGURATION_PARAMETER ConfigurationParameter;
286
289 {
293 {
294 NDIS_DbgPrint(MID_TRACE,("NdisReadConfiguration for Irq returned successfully, irq 0x%x\n",
295 ConfigurationParameter->ParameterData.IntegerData));
296 Adapter->InterruptLevel =
297 Adapter->InterruptVector = ConfigurationParameter->ParameterData.IntegerData;
298 }
299
303 {
304 NDIS_DbgPrint(MID_TRACE,("NdisReadConfiguration for Port returned successfully, port 0x%x\n",
305 ConfigurationParameter->ParameterData.IntegerData));
306 Adapter->IoBaseAddress = ConfigurationParameter->ParameterData.IntegerData;
307 }
308
310 }
311 else
312 {
313 NDIS_DbgPrint(MIN_TRACE,("NdisOpenConfiguration returned error 0x%x\n", Status));
314 }
315 }
316
317 /* find the nic */
318 if (!NICCheck(Adapter)) {
319 NDIS_DbgPrint(MID_TRACE, ("No adapter found at (0x%X).\n", Adapter->IoBaseAddress));
320 NdisFreeMemory(Adapter, sizeof(NIC_ADAPTER), 0);
322 } else
323 NDIS_DbgPrint(MID_TRACE, ("Adapter found at (0x%X).\n", Adapter->IoBaseAddress));
324
327 (NDIS_HANDLE)Adapter,
328 FALSE,
330
332 (PVOID*)&Adapter->IOBase,
334 Adapter->IoBaseAddress,
335 0x20);
336
338 NDIS_DbgPrint(MIN_TRACE, ("Cannot register port range. Status (0x%X).\n", Status));
339 MiniportHalt((NDIS_HANDLE)Adapter);
340 return Status;
341 }
342
343 Adapter->IOPortRangeRegistered = TRUE;
344
345 /* Initialize NIC */
346#ifndef NOCARD
347 Status = NICInitialize(Adapter);
349 NDIS_DbgPrint(MIN_TRACE,("No NE2000 or compatible network adapter found at address 0x%X.\n",
350 Adapter->IOBase));
351
352 NDIS_DbgPrint(MID_TRACE, ("Status (0x%X).\n", Status));
353 MiniportHalt((NDIS_HANDLE)Adapter);
354 return Status;
355 }
356
359 {
360 NdisReadNetworkAddress(&Status, (PVOID *)&RegNetworkAddress, &RegNetworkAddressLength, ConfigurationHandle);
361 if(Status == NDIS_STATUS_SUCCESS && RegNetworkAddressLength == DRIVER_LENGTH_OF_ADDRESS)
362 {
363 int i;
364 NDIS_DbgPrint(MID_TRACE,("NdisReadNetworkAddress returned successfully, address %x:%x:%x:%x:%x:%x\n",
365 RegNetworkAddress[0], RegNetworkAddress[1], RegNetworkAddress[2], RegNetworkAddress[3],
366 RegNetworkAddress[4], RegNetworkAddress[5]));
367 for(i = 0; i < DRIVER_LENGTH_OF_ADDRESS; i++)
368 Adapter->StationAddress[i] = RegNetworkAddress[i];
369 }
370
372 }
373
374 if (Status != NDIS_STATUS_SUCCESS || RegNetworkAddressLength != DRIVER_LENGTH_OF_ADDRESS)
375 {
376 int i;
377 for (i = 0; i < DRIVER_LENGTH_OF_ADDRESS; i++)
378 Adapter->StationAddress[i] = Adapter->PermanentAddress[i];
379 }
380
381 NDIS_DbgPrint(MID_TRACE, ("BOARDDATA:\n"));
382 for (i = 0; i < 4; i++) {
383 NDIS_DbgPrint(MID_TRACE, ("%02X %02X %02X %02X\n",
384 Adapter->SAPROM[i*4+0],
385 Adapter->SAPROM[i*4+1],
386 Adapter->SAPROM[i*4+2],
387 Adapter->SAPROM[i*4+3]));
388 }
389
390 /* Setup adapter structure */
391 Adapter->TXStart = ((ULONG_PTR)Adapter->RamBase >> 8);
394 Adapter->TXCurrent = -1;
395 Adapter->PageStart = Adapter->TXStart + Adapter->TXCount;
396 Adapter->PageStop = Adapter->TXStart + (Adapter->RamSize >> 8);
397
398 /* Initialize multicast address mask to accept all */
399 for (i = 0; i < 8; i++)
400 Adapter->MulticastAddressMask[i] = 0xFF;
401
402 /* Setup the NIC */
403 NICSetup(Adapter);
404
405 NDIS_DbgPrint(MID_TRACE, ("TXStart (0x%X) TXCount (0x%X) PageStart (0x%X)\n",
406 Adapter->TXStart,
407 Adapter->TXCount,
408 Adapter->PageStart));
409
410 NDIS_DbgPrint(MID_TRACE, ("PageStop (0x%X) CurrentPage (0x%X) NextPacket (0x%X).\n",
411 Adapter->PageStop,
412 Adapter->CurrentPage,
413 Adapter->NextPacket));
414#endif
415 /* Register the interrupt */
417 &Adapter->Interrupt,
419 Adapter->InterruptVector,
420 Adapter->InterruptLevel,
421 FALSE,
422 Adapter->InterruptShared,
423 Adapter->InterruptMode);
425 NDIS_DbgPrint(MIN_TRACE, ("Cannot register interrupt. Status (0x%X).\n", Status));
426 MiniportHalt((NDIS_HANDLE)Adapter);
427 return Status;
428 }
429
430 Adapter->InterruptRegistered = TRUE;
431#ifndef NOCARD
432 /* Start the NIC */
433 NICStart(Adapter);
434#endif
435
436 /* Register the shutdown handler */
438
440
441 /* Add adapter to the global adapter list */
443
444 NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
445
446 return NDIS_STATUS_SUCCESS;
447}
448
449
451 OUT PBOOLEAN InterruptRecognized,
452 OUT PBOOLEAN QueueMiniportHandleInterrupt,
453 IN NDIS_HANDLE MiniportAdapterContext)
454/*
455 * FUNCTION: Interrupt Service Routine for controlled adapters
456 * ARGUMENTS:
457 * InterruptRecognized = Address of buffer to place wether
458 * the adapter generated the interrupt
459 * QueueMiniportHandleInterrupt = Address of buffer to place wether
460 * MiniportHandleInterrupt should be called
461 * MiniportAdapterContext = Pointer to adapter context area
462 * NOTES:
463 * All pending interrupts are handled
464 */
465{
466 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
467
468 NICDisableInterrupts((PNIC_ADAPTER)MiniportAdapterContext);
469
470 *InterruptRecognized = TRUE;
471 *QueueMiniportHandleInterrupt = TRUE;
472}
473
474
476 IN NDIS_HANDLE MiniportAdapterContext,
477 IN NDIS_OID Oid,
478 IN PVOID InformationBuffer,
479 IN ULONG InformationBufferLength,
481 OUT PULONG BytesNeeded)
482/*
483 * FUNCTION: Handler to process queries
484 * ARGUMENTS:
485 * MiniportAdapterContext = Pointer to adapter context area
486 * Oid = OID code designating query operation
487 * InformationBuffer = Address of return buffer
488 * InformationBufferLength = Length of return buffer
489 * BytesWritten = Address of buffer to place number of bytes returned
490 * BytesNeeded = Address of buffer to place number of bytes needed
491 * in InformationBuffer for specified OID
492 * RETURNS:
493 * Status of operation
494 */
495{
497 PVOID CopyFrom;
498 UINT CopySize;
499 ULONG GenericULONG;
500 USHORT GenericUSHORT;
502 PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
503
504 NDIS_DbgPrint(MAX_TRACE, ("Called. Oid (0x%X).\n", Oid));
505
507 CopyFrom = (PVOID)&GenericULONG;
508 CopySize = sizeof(ULONG);
509
510 switch (Oid) {
512 CopyFrom = (PVOID)&MiniportOIDList;
513 CopySize = sizeof(MiniportOIDList);
514 break;
516 GenericULONG = (ULONG)NdisHardwareStatusReady;
517 break;
520 CopyFrom = (PVOID)&Medium;
521 CopySize = sizeof(NDIS_MEDIUM);
522 break;
524 GenericULONG = DRIVER_MAXIMUM_LOOKAHEAD;
525 break;
527 GenericULONG = DRIVER_FRAME_SIZE - DRIVER_HEADER_SIZE;
528 break;
530 GenericULONG = 100000; /* 10Mbps */
531 break;
533 GenericULONG = Adapter->TXCount * DRIVER_BLOCK_SIZE;
534 break;
536 GenericULONG = Adapter->RamSize -
537 (ULONG_PTR)Adapter->RamBase -
538 (Adapter->TXCount * DRIVER_BLOCK_SIZE);
539 break;
541 GenericULONG = DRIVER_BLOCK_SIZE;
542 break;
544 GenericULONG = DRIVER_BLOCK_SIZE;
545 break;
547 NdisMoveMemory(&GenericULONG, &Adapter->PermanentAddress, 3);
548 GenericULONG &= 0xFFFFFF00;
549 GenericULONG |= 0x01;
550 break;
552 CopyFrom = (PVOID)&DRIVER_VENDOR_DESCRIPTION;
553 CopySize = sizeof(DRIVER_VENDOR_DESCRIPTION);
554 break;
556 GenericUSHORT = (USHORT)DRIVER_VENDOR_DRIVER_VERSION;
557 CopyFrom = (PVOID)&GenericUSHORT;
558 CopySize = sizeof(USHORT);
559 break;
561 GenericULONG = Adapter->PacketFilter;
562 break;
564 GenericULONG = Adapter->LookaheadSize;
565 break;
568 CopyFrom = (PVOID)&GenericUSHORT;
569 CopySize = sizeof(USHORT);
570 break;
572 GenericULONG = DRIVER_FRAME_SIZE;
573 break;
575 NDIS_DbgPrint(MID_TRACE, ("OID_GEN_PROTOCOL_OPTIONS.\n"));
577 break;
583 break;
585 GenericULONG = (ULONG)NdisMediaStateConnected;
586 break;
588 GenericULONG = 1;
589 break;
591 CopyFrom = (PVOID)&Adapter->PermanentAddress;
592 CopySize = DRIVER_LENGTH_OF_ADDRESS;
593 break;
595 CopyFrom = (PVOID)&Adapter->StationAddress;
596 CopySize = DRIVER_LENGTH_OF_ADDRESS;
597 break;
599 NDIS_DbgPrint(MID_TRACE, ("OID_802_3_MULTICAST_LIST.\n"));
601 break;
603 GenericULONG = Adapter->MaxMulticastListSize;
604 break;
606 NDIS_DbgPrint(MID_TRACE, ("OID_802_3_MAC_OPTIONS.\n"));
608 break;
609 default:
610 NDIS_DbgPrint(MIN_TRACE, ("Unknown OID (0x%X).\n", Oid));
612 break;
613 }
614
616 if (CopySize > InformationBufferLength) {
617 *BytesNeeded = (CopySize - InformationBufferLength);
618 *BytesWritten = 0;
620 } else {
621 NdisMoveMemory(InformationBuffer, CopyFrom, CopySize);
622 *BytesWritten = CopySize;
623 *BytesNeeded = 0;
624 }
625 }
626
627 NDIS_DbgPrint(MAX_TRACE, ("Leaving. Status is (0x%X).\n", Status));
628
629 return Status;
630}
631
632
635 IN NDIS_HANDLE MiniportAdapterContext,
637/*
638 * FUNCTION: Reconfigures an adapter
639 * ARGUMENTS:
640 * OpenErrorStatus = Address of buffer to place additional status information
641 * MiniportAdapterContext = Pointer to adapter context area
642 * WrapperConfigurationContext = Handle used to identify configuration context
643 * RETURNS:
644 * Status of operation
645 * NOTES:
646 * Never called by NDIS library
647 */
648{
649 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
650
651 return NDIS_STATUS_FAILURE;
652}
653
654
655
657 OUT PBOOLEAN AddressingReset,
658 IN NDIS_HANDLE MiniportAdapterContext)
659/*
660 * FUNCTION: Resets an adapter
661 * ARGUMENTS:
662 * AddressingReset = Address of a buffer to place value indicating
663 * wether NDIS library should call MiniportSetInformation
664 * to restore addressing information
665 * MiniportAdapterContext = Pointer to adapter context area
666 * RETURNS:
667 * Status of operation
668 */
669{
670 NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS;
671
672 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
673
674#ifndef NOCARD
675 NdisStatus = NICReset((PNIC_ADAPTER)MiniportAdapterContext);
676#endif
677
678 *AddressingReset = TRUE;
679
680 return NdisStatus;
681}
682
683
685 IN NDIS_HANDLE MiniportAdapterContext,
687 IN UINT Flags)
688/*
689 * FUNCTION: Transmits a packet
690 * ARGUMENTS:
691 * MiniportAdapterContext = Pointer to adapter context area
692 * Packet = Pointer to a packet descriptor specifying
693 * the data to be transmitted
694 * Flags = Specifies optional packet flags
695 * RETURNS:
696 * Status of operation
697 */
698{
699 PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
700
702
703#ifndef NOCARD
704 NDIS_DbgPrint(MID_TRACE, ("Queueing packet.\n"));
705
706 /* Queue the packet on the transmit queue */
707 RESERVED(Packet)->Next = NULL;
708 if (Adapter->TXQueueHead == NULL) {
709 Adapter->TXQueueHead = Packet;
710 } else {
711 RESERVED(Adapter->TXQueueTail)->Next = Packet;
712 }
713
714 Adapter->TXQueueTail = Packet;
715
716 /* Transmit the packet */
717 NICTransmit(Adapter);
718
719 return NDIS_STATUS_PENDING;
720#else
721 return NDIS_STATUS_SUCCESS;
722#endif
723}
724
725
727 IN NDIS_HANDLE MiniportAdapterContext,
728 IN NDIS_OID Oid,
729 IN PVOID InformationBuffer,
730 IN ULONG InformationBufferLength,
732 OUT PULONG BytesNeeded)
733/*
734 * FUNCTION: Changes state information in the driver
735 * ARGUMENTS:
736 * MiniportAdapterContext = Pointer to adapter context area
737 * Oid = OID code designating set operation
738 * InformationBuffer = Pointer to buffer with state information
739 * InformationBufferLength = Length of InformationBuffer
740 * BytesRead = Address of buffer to place number of bytes read
741 * BytesNeeded = Address of buffer to place number of extra bytes
742 * needed in InformationBuffer for specified OID
743 * RETURNS:
744 * Status of operation
745 */
746{
747 ULONG GenericULONG;
749 PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
750
751 NDIS_DbgPrint(MAX_TRACE, ("Called. Oid (0x%X).\n", Oid));
752
753 switch (Oid) {
755 /* Verify length */
756 if (InformationBufferLength < sizeof(ULONG)) {
757 *BytesRead = 0;
758 *BytesNeeded = sizeof(ULONG) - InformationBufferLength;
760 break;
761 }
762
763 NdisMoveMemory(&GenericULONG, InformationBuffer, sizeof(ULONG));
764 /* Check for properties the driver don't support */
765 if (GenericULONG &
772 *BytesRead = 4;
773 *BytesNeeded = 0;
775 break;
776 }
777
778 Adapter->PacketFilter = GenericULONG;
779
780 /* FIXME: Set filter on hardware */
781
782 break;
784 /* Verify length */
785 if (InformationBufferLength < sizeof(ULONG)) {
786 *BytesRead = 0;
787 *BytesNeeded = sizeof(ULONG) - InformationBufferLength;
789 break;
790 }
791
792 NdisMoveMemory(&GenericULONG, InformationBuffer, sizeof(ULONG));
793 if (GenericULONG > DRIVER_MAXIMUM_LOOKAHEAD)
795 else
796 Adapter->LookaheadSize = GenericULONG;
797 break;
799 /* Verify length. Must be multiple of hardware address length */
800 if ((InformationBufferLength % DRIVER_LENGTH_OF_ADDRESS) != 0) {
801 *BytesRead = 0;
802 *BytesNeeded = 0;
804 break;
805 }
806
807 /* Set new multicast address list */
808 NdisMoveMemory(Adapter->Addresses, InformationBuffer, InformationBufferLength);
809
810 /* FIXME: Update hardware */
811
812 break;
813 default:
814 NDIS_DbgPrint(MIN_TRACE, ("Invalid object ID (0x%X).\n", Oid));
815 *BytesRead = 0;
816 *BytesNeeded = 0;
818 break;
819 }
820
822 *BytesRead = InformationBufferLength;
823 *BytesNeeded = 0;
824 }
825
826 NDIS_DbgPrint(MAX_TRACE, ("Leaving. Status (0x%X).\n", Status));
827
828 return Status;
829}
830
831
835 IN NDIS_HANDLE MiniportAdapterContext,
836 IN NDIS_HANDLE MiniportReceiveContext,
838 IN UINT BytesToTransfer)
839/*
840 * FUNCTION: Transfers data from a received frame into an NDIS packet
841 * ARGUMENTS:
842 * Packet = Address of packet to copy received data into
843 * BytesTransferred = Address of buffer to place number of bytes transmitted
844 * MiniportAdapterContext = Pointer to adapter context area
845 * MiniportReceiveContext = Pointer to receive context area (actually NULL)
846 * ByteOffset = Offset within received packet to begin copying
847 * BytesToTransfer = Number of bytes to copy into packet
848 * RETURNS:
849 * Status of operation
850 */
851{
852 PNDIS_BUFFER DstBuffer;
853 UINT BytesCopied, BytesToCopy, DstSize;
854 ULONG SrcData;
855 PUCHAR DstData;
856 UINT RecvStart;
857 UINT RecvStop;
858 PNIC_ADAPTER Adapter = (PNIC_ADAPTER)MiniportAdapterContext;
859
860 NDIS_DbgPrint(MAX_TRACE, ("Called. Packet (0x%X) ByteOffset (0x%X) BytesToTransfer (%d).\n",
861 Packet, ByteOffset, BytesToTransfer));
862
863 if (BytesToTransfer == 0) {
864 *BytesTransferred = 0;
865 return NDIS_STATUS_SUCCESS;
866 }
867
868 RecvStart = Adapter->PageStart * DRIVER_BLOCK_SIZE;
869 RecvStop = Adapter->PageStop * DRIVER_BLOCK_SIZE;
870
871 NdisQueryPacket(Packet, NULL, NULL, &DstBuffer, NULL);
872 NdisQueryBuffer(DstBuffer, (PVOID)&DstData, &DstSize);
873
874 SrcData = Adapter->PacketOffset + sizeof(DISCARD_HEADER) + ByteOffset;
875 if (ByteOffset + sizeof(DISCARD_HEADER) + BytesToTransfer >
876 Adapter->PacketHeader.PacketLength)
877 BytesToTransfer = Adapter->PacketHeader.PacketLength -
878 sizeof(DISCARD_HEADER) - ByteOffset;
879
880 /* Start copying the data */
881 BytesCopied = 0;
882 for (;;) {
883 BytesToCopy = (DstSize < BytesToTransfer) ? DstSize : BytesToTransfer;
884 if (SrcData + BytesToCopy > RecvStop)
885 BytesToCopy = (RecvStop - SrcData);
886
887 NICReadData(Adapter, DstData, SrcData, BytesToCopy);
888
890 SrcData += BytesToCopy;
891 DstData = (PUCHAR)((ULONG_PTR) DstData + BytesToCopy);
892 BytesToTransfer -= BytesToCopy;
893 if (BytesToTransfer == 0)
894 break;
895
896 DstSize -= BytesToCopy;
897 if (DstSize == 0) {
898 /* No more bytes in destination buffer. Proceed to
899 the next buffer in the destination buffer chain */
900 NdisGetNextBuffer(DstBuffer, &DstBuffer);
901 if (!DstBuffer)
902 break;
903
904 NdisQueryBuffer(DstBuffer, (PVOID)&DstData, &DstSize);
905 }
906
907 if (SrcData == RecvStop)
908 SrcData = RecvStart;
909 }
910
911 NDIS_DbgPrint(MID_TRACE, ("Transferred (%d) bytes.\n", BytesToTransfer));
912
914
915 return NDIS_STATUS_SUCCESS;
916}
917
918
920NTAPI
924/*
925 * FUNCTION: Main driver entry point
926 * ARGUMENTS:
927 * DriverObject = Pointer to a driver object for this driver
928 * RegistryPath = Registry node for configuration parameters
929 * RETURNS:
930 * Status of driver initialization
931 */
932{
934 NDIS_HANDLE NdisWrapperHandle;
936
937 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
938
939 NdisZeroMemory(&Miniport, sizeof(Miniport));
940 Miniport.MajorNdisVersion = DRIVER_NDIS_MAJOR_VERSION;
941 Miniport.MinorNdisVersion = DRIVER_NDIS_MINOR_VERSION;
942 Miniport.CheckForHangHandler = MiniportCheckForHang;
943 Miniport.DisableInterruptHandler = MiniportDisableInterrupt;
944 Miniport.EnableInterruptHandler = MiniportEnableInterrupt;
945 Miniport.HaltHandler = MiniportHalt;
946 Miniport.HandleInterruptHandler = MiniportHandleInterrupt;
947 Miniport.InitializeHandler = MiniportInitialize;
948 Miniport.ISRHandler = MiniportISR;
949 Miniport.QueryInformationHandler = MiniportQueryInformation;
950 Miniport.ReconfigureHandler = MiniportReconfigure;
951 Miniport.ResetHandler = MiniportReset;
952 Miniport.SendHandler = MiniportSend;
953 Miniport.SetInformationHandler = MiniportSetInformation;
954 Miniport.TransferDataHandler = MiniportTransferData;
955
956 NdisMInitializeWrapper(&NdisWrapperHandle,
959 NULL);
960
961 if (!NdisWrapperHandle) {
962 NDIS_DbgPrint(MIN_TRACE, ("NdisMInitializeWrapper() failed\n"));
963 return STATUS_UNSUCCESSFUL;
964 }
965
966 DriverInfo.NdisWrapperHandle = NdisWrapperHandle;
969
970 Status = NdisMRegisterMiniport(NdisWrapperHandle,
971 &Miniport,
974 NDIS_DbgPrint(MIN_TRACE, ("NdisMRegisterMiniport() failed with status code (0x%X).\n", Status));
975 NdisTerminateWrapper(NdisWrapperHandle, NULL);
976 return STATUS_UNSUCCESSFUL;
977 }
978
979 return STATUS_SUCCESS;
980}
981
982#if 0
983 /* while i'm here - some basic registry sanity checks */
984 {
985 /* write tests */
987
988 ParameterValue.ParameterType = NdisParameterInteger;
989 ParameterValue.ParameterData.IntegerData = 0x12345678;
990 NdisInitUnicodeString(&Keyword, L"DwordTest");
992
994 {
995 DbgPrint("ne2000!MiniportInitialize: failed to set DwordTest: 0x%x\n", Status);
997 }
998
999 DbgPrint("ne2000!MiniportInitialize: DwordTest successfully set\n");
1000
1001 NdisInitUnicodeString(&Keyword, L"StringTest");
1002 ParameterValue.ParameterType = NdisParameterString;
1003 NdisInitUnicodeString(&ParameterValue.ParameterData.StringData, L"Testing123");
1004
1006
1008 {
1009 DbgPrint("ne2000!MiniportInitialize: failed to set StringTest: 0x%x\n", Status);
1010 DbgBreakPoint();
1011 }
1012
1013 DbgPrint("ne2000!MiniportInitialize: StringTest successfully set\n");
1014 }
1015
1016 {
1017 /* read back the test values */
1019
1020 NdisInitUnicodeString(&Keyword, L"DwordTest");
1022
1024 {
1025 DbgPrint("ne2000!MiniportInitialize: failed to read DwordTest: 0x%x\n", Status);
1026 DbgBreakPoint();
1027 }
1028
1029 if(ParameterValue->ParameterData.IntegerData != 0x12345678)
1030 {
1031 DbgPrint("ne2000!MiniportInitialize: DwordTest value is wrong: 0x%x\n",
1032 ParameterValue->ParameterData.IntegerData);
1033 DbgBreakPoint();
1034 }
1035
1036 DbgPrint("ne2000!MiniportInitialize: DwordTest value was correctly read\n");
1037
1038 NdisInitUnicodeString(&Keyword, L"StringTest");
1040
1042 {
1043 DbgPrint("ne2000!MiniportInitialize: failed to read StringTest: 0x%x\n", Status);
1044 DbgBreakPoint();
1045 }
1046
1047 if(wcsncmp(ParameterValue->ParameterData.StringData.Buffer, L"Testing123",
1048 wcslen(L"Testing123")))
1049 {
1050 DbgPrint("ne2000!MiniportInitialize: StringTest value is wrong: %wZ\n",
1051 &ParameterValue->ParameterData.StringData);
1052 DbgBreakPoint();
1053 }
1054
1055 DbgPrint("ne2000!MiniportInitialize: StringTest value was correctly read\n");
1056 }
1057
1058#endif
1059
1060/* EOF */
struct _DISCARD_HEADER DISCARD_HEADER
#define NICEnableInterrupts(Adapter)
Definition: 8390.h:164
#define NICDisableInterrupts(Adapter)
Definition: 8390.h:159
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define MIN_TRACE
Definition: debug.h:14
#define MID_TRACE
Definition: debug.h:15
#define MAX_TRACE
Definition: debug.h:16
_In_opt_ PWSTR _In_ PWSTR _Inout_ PULONG ParameterValue
Definition: cdrom.h:963
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DRIVER_INITIALIZE DriverEntry
Definition: main.c:9
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define ASSERT_IRQL_EQUAL(x)
Definition: debug.h:43
VOID NTAPI MiniportHandleInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:46
static VOID NTAPI MiniportEnableInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:94
static ULONG MiniportOIDList[]
Definition: main.c:29
VOID NTAPI MiniportShutdown(PVOID Context)
Definition: main.c:206
static NDIS_STATUS NTAPI MiniportSetInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
Definition: main.c:726
static NDIS_STATUS NTAPI MiniportInitialize(OUT PNDIS_STATUS OpenErrorStatus, OUT PUINT SelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT MediumArraySize, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: main.c:213
static VOID NTAPI MiniportISR(OUT PBOOLEAN InterruptRecognized, OUT PBOOLEAN QueueMiniportHandleInterrupt, IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:450
static VOID NTAPI MiniportHalt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:109
static NDIS_STATUS NTAPI MiniportTransferData(OUT PNDIS_PACKET Packet, OUT PUINT BytesTransferred, IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_HANDLE MiniportReceiveContext, IN UINT ByteOffset, IN UINT BytesToTransfer)
Definition: main.c:832
static NDIS_STATUS NTAPI MiniportQueryInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
Definition: main.c:475
static VOID NTAPI MiniportDisableInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:79
static BOOLEAN NTAPI MiniportCheckForHang(IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:63
static NDIS_STATUS NTAPI MiniportReset(OUT PBOOLEAN AddressingReset, IN NDIS_HANDLE MiniportAdapterContext)
Definition: main.c:656
static VOID NTAPI MiQueryResources(OUT PNDIS_STATUS Status, IN PNIC_ADAPTER Adapter, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: main.c:154
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
NDIS_PHYSICAL_ADDRESS HighestAcceptableMax
Definition: main.c:60
static NDIS_STATUS NTAPI MiniportSend(IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet, IN UINT Flags)
Definition: main.c:684
static NDIS_STATUS NTAPI MiniportReconfigure(OUT PNDIS_STATUS OpenErrorStatus, IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: main.c:633
VOID EXPORT NdisCloseConfiguration(IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:136
VOID EXPORT NdisWriteConfiguration(OUT PNDIS_STATUS Status, IN NDIS_HANDLE ConfigurationHandle, IN PNDIS_STRING Keyword, IN PNDIS_CONFIGURATION_PARAMETER ParameterValue)
Definition: config.c:45
VOID EXPORT NdisReadConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue, IN NDIS_HANDLE ConfigurationHandle, IN PNDIS_STRING Keyword, IN NDIS_PARAMETER_TYPE ParameterType)
Definition: config.c:414
VOID EXPORT NdisReadNetworkAddress(OUT PNDIS_STATUS Status, OUT PVOID *NetworkAddress, OUT PUINT NetworkAddressLength, IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:740
VOID EXPORT NdisOpenConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_HANDLE ConfigurationHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: config.c:197
VOID EXPORT NdisMQueryAdapterResources(OUT PNDIS_STATUS Status, IN NDIS_HANDLE WrapperConfigurationContext, OUT PNDIS_RESOURCE_LIST ResourceList, IN OUT PUINT BufferSize)
Definition: hardware.c:103
VOID EXPORT NdisMDeregisterInterrupt(IN PNDIS_MINIPORT_INTERRUPT Interrupt)
Definition: io.c:700
VOID EXPORT NdisMDeregisterIoPortRange(IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts, IN PVOID PortOffset)
Definition: io.c:1093
NDIS_STATUS EXPORT NdisMRegisterIoPortRange(OUT PVOID *PortOffset, IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts)
Definition: io.c:1018
NDIS_STATUS EXPORT NdisMRegisterInterrupt(OUT PNDIS_MINIPORT_INTERRUPT Interrupt, IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InterruptVector, IN UINT InterruptLevel, IN BOOLEAN RequestIsr, IN BOOLEAN SharedInterrupt, IN NDIS_INTERRUPT_MODE InterruptMode)
Definition: io.c:941
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110
NDIS_STATUS EXPORT NdisAllocateMemory(OUT PVOID *VirtualAddress, IN UINT Length, IN UINT MemoryFlags, IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: memory.c:57
VOID EXPORT NdisInitUnicodeString(IN OUT PNDIS_STRING DestinationString, IN PCWSTR SourceString)
Definition: string.c:130
#define ULONG_PTR
Definition: config.h:101
ULONG DebugTraceLevel
Definition: ndis.c:13
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:732
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DbgPrint
Definition: hal.h:12
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define NdisGetNextBuffer(CurrentBuffer, NextBuffer)
Definition: ndis.h:3386
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
@ NdisParameterInteger
Definition: ndis.h:926
@ NdisParameterString
Definition: ndis.h:928
@ NdisParameterHexInteger
Definition: ndis.h:927
#define NdisInterruptLatched
Definition: ndis.h:921
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
unsigned int * PUINT
Definition: ndis.h:50
unsigned int UINT
Definition: ndis.h:50
#define NdisMSetAttributes(MiniportAdapterHandle, MiniportAdapterContext, BusMaster, AdapterType)
Definition: ndis.h:5736
static __inline VOID NdisQueryPacket(IN PNDIS_PACKET Packet, OUT PUINT PhysicalBufferCount OPTIONAL, OUT PUINT BufferCount OPTIONAL, OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, OUT PUINT TotalPacketLength OPTIONAL)
Definition: ndis.h:3593
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NDIS_PACKET_TYPE_MAC_FRAME
Definition: ndis.h:674
#define NdisInterruptLevelSensitive
Definition: ndis.h:920
#define NDIS_PACKET_TYPE_SOURCE_ROUTING
Definition: ndis.h:667
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL
Definition: ndis.h:672
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
Definition: ndis.h:3171
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED
Definition: ndis.h:683
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT SelectedMediumIndex
Definition: ndis.h:6011
#define NdisStallExecution
Definition: ndis.h:4453
#define NDIS_PACKET_TYPE_FUNCTIONAL
Definition: ndis.h:673
#define NDIS_PACKET_TYPE_GROUP
Definition: ndis.h:671
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3168
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
MDL * PNDIS_BUFFER
Definition: ndis.h:343
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT MediumArraySize
Definition: ndis.h:6013
@ NdisInterfaceIsa
Definition: ndis.h:901
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3946
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
#define NDIS_PACKET_TYPE_SMT
Definition: ndis.h:669
#define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length)
Definition: ndis.h:3029
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE ConfigurationHandle
Definition: ndis.h:3945
#define NDIS_STATUS_UNSUPPORTED_MEDIA
Definition: ndis.h:490
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_CONFIGURATION_PARAMETER _In_ NDIS_HANDLE _In_ PNDIS_STRING Keyword
Definition: ndis.h:4416
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS OpenErrorStatus
Definition: ndis.h:6009
#define NDIS_STATUS_ADAPTER_NOT_FOUND
Definition: ndis.h:470
#define NdisMInitializeWrapper(NdisWrapperHandle, SystemSpecific1, SystemSpecific2, SystemSpecific3)
Definition: ndis.h:5592
#define NDIS_PHYSICAL_ADDRESS_CONST(Low, High)
Definition: ndis.h:3866
#define NDIS_MAC_OPTION_NO_LOOPBACK
Definition: ndis.h:685
* PNDIS_STATUS
Definition: ndis.h:45
#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
Definition: ndis.h:682
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
#define DRIVER_VENDOR_DESCRIPTION
Definition: ne2000.h:39
#define RESERVED(Packet)
Definition: ne2000.h:70
#define DRIVER_HEADER_SIZE
Definition: ne2000.h:43
#define DRIVER_DEFAULT_INTERRUPT_MODE
Definition: ne2000.h:35
struct _NIC_ADAPTER * PNIC_ADAPTER
#define DRIVER_MAXIMUM_LOOKAHEAD
Definition: ne2000.h:47
#define DRIVER_MAX_MULTICAST_LIST_SIZE
Definition: ne2000.h:37
BOOLEAN NICCheck(PNIC_ADAPTER Adapter)
Definition: 8390.c:53
#define DRIVER_FRAME_SIZE
Definition: ne2000.h:42
VOID NICTransmit(PNIC_ADAPTER Adapter)
Definition: 8390.c:1124
#define DRIVER_DEFAULT_INTERRUPT_SHARED
Definition: ne2000.h:34
#define DRIVER_DEFAULT_INTERRUPT_NUMBER
Definition: ne2000.h:33
#define DRIVER_DEFAULT_TX_BUFFER_COUNT
Definition: ne2000.h:54
#define DRIVER_INTERRUPT_MASK
Definition: ne2000.h:58
NDIS_STATUS NICStop(PNIC_ADAPTER Adapter)
Definition: 8390.c:451
#define DRIVER_NDIS_MAJOR_VERSION
Definition: ne2000.h:29
VOID NICReadData(PNIC_ADAPTER Adapter, PUCHAR Target, ULONG_PTR Source, USHORT Length)
Definition: 8390.c:791
#define DRIVER_LENGTH_OF_ADDRESS
Definition: ne2000.h:44
NDIS_STATUS NICSetup(PNIC_ADAPTER Adapter)
Definition: 8390.c:352
NDIS_STATUS NICReset(PNIC_ADAPTER Adapter)
Definition: 8390.c:500
#define DRIVER_VENDOR_DRIVER_VERSION
Definition: ne2000.h:40
#define DRIVER_BLOCK_SIZE
Definition: ne2000.h:50
#define DRIVER_NDIS_MINOR_VERSION
Definition: ne2000.h:30
NDIS_STATUS NICStart(PNIC_ADAPTER Adapter)
Definition: 8390.c:429
NDIS_STATUS NICInitialize(PNIC_ADAPTER Adapter)
Definition: 8390.c:289
#define DRIVER_DEFAULT_IO_BASE_ADDRESS
Definition: ne2000.h:32
VOID EXPORT NdisMDeregisterAdapterShutdownHandler(IN NDIS_HANDLE MiniportHandle)
Definition: miniport.c:1517
VOID EXPORT NdisMRegisterAdapterShutdownHandler(IN NDIS_HANDLE MiniportHandle, IN PVOID ShutdownContext, IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler)
Definition: miniport.c:1694
NDIS_STATUS EXPORT NdisMRegisterMiniport(IN NDIS_HANDLE NdisWrapperHandle, IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, IN UINT CharacteristicsLength)
Definition: miniport.c:2637
VOID EXPORT NdisTerminateWrapper(IN NDIS_HANDLE NdisWrapperHandle, IN PVOID SystemSpecific)
Definition: miniport.c:3012
enum _NDIS_MEDIUM NDIS_MEDIUM
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define OID_GEN_PROTOCOL_OPTIONS
Definition: ntddndis.h:250
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
@ NdisMediaStateConnected
Definition: ntddndis.h:470
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
#define OID_802_3_MAC_OPTIONS
Definition: ntddndis.h:306
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
enum _NDIS_MEDIUM * PNDIS_MEDIUM
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
@ NdisMedium802_3
Definition: ntddndis.h:188
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
int NDIS_STATUS
Definition: ntddndis.h:475
@ NdisHardwareStatusReady
Definition: ntddndis.h:450
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
ULONG NDIS_OID
Definition: ntddndis.h:230
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define STATUS_SUCCESS
Definition: shellext.h:65
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
NDIS_HANDLE NdisMacHandle
Definition: ne2000.h:188
LIST_ENTRY AdapterListHead
Definition: ne2000.h:189
NDIS_HANDLE NdisWrapperHandle
Definition: ne2000.h:187
union _NDIS_CONFIGURATION_PARAMETER::@2101 ParameterData
ULONG InterruptLevel
Definition: ne2000.h:86
ULONG PacketFilter
Definition: ne2000.h:126
UINT TXFree
Definition: ne2000.h:162
UINT CurrentPage
Definition: ne2000.h:135
PACKET_HEADER PacketHeader
Definition: ne2000.h:151
ULONG InterruptMask
Definition: ne2000.h:120
UINT PageStart
Definition: ne2000.h:133
UINT PageStop
Definition: ne2000.h:134
UINT RamSize
Definition: ne2000.h:99
BOOLEAN InterruptRegistered
Definition: ne2000.h:180
PUCHAR IOBase
Definition: ne2000.h:92
BOOLEAN InterruptShared
Definition: ne2000.h:88
UCHAR MulticastAddressMask[8]
Definition: ne2000.h:117
BOOLEAN IOPortRangeRegistered
Definition: ne2000.h:179
PNDIS_PACKET TXQueueTail
Definition: ne2000.h:171
UINT TXCount
Definition: ne2000.h:161
DRIVER_HARDWARE_ADDRESS Addresses[DRIVER_MAX_MULTICAST_LIST_SIZE]
Definition: ne2000.h:114
UINT TXStart
Definition: ne2000.h:160
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: ne2000.h:82
UINT NextPacket
Definition: ne2000.h:136
ULONG InterruptVector
Definition: ne2000.h:87
PUCHAR RamBase
Definition: ne2000.h:98
UCHAR SAPROM[16]
Definition: ne2000.h:102
ULONG PacketOffset
Definition: ne2000.h:154
INT TXCurrent
Definition: ne2000.h:166
DRIVER_HARDWARE_ADDRESS PermanentAddress
Definition: ne2000.h:105
ULONG_PTR IoBaseAddress
Definition: ne2000.h:85
KINTERRUPT_MODE InterruptMode
Definition: ne2000.h:89
NDIS_HANDLE MiniportAdapterHandle
Definition: ne2000.h:80
UINT LookaheadSize
Definition: ne2000.h:129
PNDIS_PACKET TXQueueHead
Definition: ne2000.h:169
LIST_ENTRY ListEntry
Definition: ne2000.h:78
ULONG MaxMulticastListSize
Definition: ne2000.h:111
BOOLEAN ShutdownHandlerRegistered
Definition: ne2000.h:181
DRIVER_HARDWARE_ADDRESS StationAddress
Definition: ne2000.h:108
USHORT PacketLength
Definition: 8390.h:142
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR _Out_opt_ PULONG BytesTransferred
Definition: wdfusb.h:1342
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
@ CmResourceShareShared
Definition: cmtypes.h:243