Fixes for NE2000 driver

svn path=/trunk/; revision=1796
This commit is contained in:
Casper Hornstrup 2001-04-16 01:16:36 +00:00
parent 8c8d19c080
commit bdfcd5630a
8 changed files with 39 additions and 75 deletions

View file

@ -1 +0,0 @@
DIRS= ne2000

View file

@ -143,11 +143,15 @@ typedef struct _PACKET_HEADER {
} PACKET_HEADER, PPACKET_HEADER;
#define NICDisableInterrupts(Adapter) \
NdisRawWritePortUchar((Adapter)->IOBase + PG0_IMR, 0x00);
#define NICDisableInterrupts(Adapter) { \
NDIS_DbgPrint(MAX_TRACE, ("NICDisableInterrupts()\n")); \
NdisRawWritePortUchar((Adapter)->IOBase + PG0_IMR, 0x00); \
}
#define NICEnableInterrupts(Adapter) \
NdisRawWritePortUchar((Adapter)->IOBase + PG0_IMR, (Adapter)->InterruptMask);
#define NICEnableInterrupts(Adapter) { \
NDIS_DbgPrint(MAX_TRACE, ("NICEnableInterrupts() Mask (0x%X)\n", (Adapter)->InterruptMask)); \
NdisRawWritePortUchar((Adapter)->IOBase + PG0_IMR, (Adapter)->InterruptMask); \
}
VOID MiniportHandleInterrupt(
IN NDIS_HANDLE MiniportAdapterContext);

View file

@ -52,9 +52,7 @@ BOOLEAN NICTestAddress(
* ARGUMENTS:
* Adapter = Pointer to adapter information
* RETURNS:
* TRUE if the RAM size was found, FALSE if not
* NOTES:
* Starts at 1KB and tests every 1KB up to 64KB
* TRUE if the address is writable, FALSE if not
*/
{
USHORT Data;
@ -217,7 +215,7 @@ BOOLEAN NICReadSAPROM(
/* If WordLength is 2 the data read before was doubled. We must compensate for this */
if (WordLength == 2) {
NDIS_DbgPrint(MIN_TRACE, ("NE2000 found.\n"));
DbgPrint("NE2000 or compatible network adapter found.\n");
Adapter->WordMode = TRUE;
@ -236,7 +234,7 @@ BOOLEAN NICReadSAPROM(
return TRUE;
} else {
NDIS_DbgPrint(MIN_TRACE, ("NE1000 found.\n"));
DbgPrint("NE1000 or compatible network adapter found.\n");
Adapter->WordMode = FALSE;
@ -262,7 +260,7 @@ NDIS_STATUS NICInitialize(
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
if (!NICCheck(Adapter)) {
NDIS_DbgPrint(MIN_TRACE, ("No adapter found at (0x%X).\n", Adapter->IOBase));
NDIS_DbgPrint(MID_TRACE, ("No adapter found at (0x%X).\n", Adapter->IOBase));
return NDIS_STATUS_ADAPTER_NOT_FOUND;
} else
NDIS_DbgPrint(MID_TRACE, ("Adapter found at (0x%X).\n", Adapter->IOBase));
@ -553,13 +551,13 @@ VOID NICGetCurrentPage(
UCHAR Current;
/* Select page 1 */
NdisRawWritePortUchar(Adapter->IOBase + PG0_CR, CR_STP | CR_RD2 | CR_PAGE1);
NdisRawWritePortUchar(Adapter->IOBase + PG0_CR, CR_STA | CR_RD2 | CR_PAGE1);
/* Read current page */
NdisRawReadPortUchar(Adapter->IOBase + PG1_CURR, &Current);
/* Select page 0 */
NdisRawWritePortUchar(Adapter->IOBase + PG0_CR, CR_STP | CR_RD2 | CR_PAGE0);
NdisRawWritePortUchar(Adapter->IOBase + PG0_CR, CR_STA | CR_RD2 | CR_PAGE0);
Adapter->CurrentPage = Current;
}
@ -900,16 +898,10 @@ VOID NICReadPacket(
* Adapter = Pointer to adapter information
*/
{
UCHAR Tmp;
BOOLEAN SkipPacket = FALSE;
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
/* Check if receive buffer ring is empty */
/* Read boundary page */
NdisRawReadPortUchar(Adapter->IOBase + PG0_BNRY, &Tmp);
/* Get the header of the next packet in the receive ring */
Adapter->PacketOffset = Adapter->NextPacket << 8;
NICReadData(Adapter,
@ -1135,6 +1127,11 @@ VOID HandleReceive(
NdisStallExecution(500);
}
#ifdef DBG
if (i == 4)
NDIS_DbgPrint(MIN_TRACE, ("NIC was not reset after 2ms.\n"));
#endif
if ((Adapter->InterruptStatus & (ISR_PTX | ISR_TXE)) == 0) {
/* We may need to restart the transmitter */
Adapter->TransmitPending = TRUE;
@ -1164,6 +1161,10 @@ VOID HandleReceive(
for (;;) {
NICGetCurrentPage(Adapter);
NDIS_DbgPrint(MAX_TRACE, ("Current page (0x%X) NextPacket (0x%X).\n",
Adapter->CurrentPage,
Adapter->NextPacket));
if (Adapter->CurrentPage == Adapter->NextPacket) {
NDIS_DbgPrint(MAX_TRACE, ("No more packets.\n"));
break;
@ -1257,7 +1258,7 @@ VOID MiniportHandleInterrupt(
NDIS_DbgPrint(MAX_TRACE, ("ISRValue (0x%X).\n", ISRValue));
Adapter->InterruptStatus = (ISRValue & ISRMask);
Adapter->InterruptStatus |= (ISRValue & ISRMask);
if (ISRValue != 0x00)
/* Acknowledge interrupts */
@ -1266,13 +1267,15 @@ VOID MiniportHandleInterrupt(
Mask = 0x01;
while (Adapter->InterruptStatus != 0x00) {
NDIS_DbgPrint(MAX_TRACE, ("Adapter->InterruptStatus (0x%X).\n", Adapter->InterruptStatus));
NDIS_DbgPrint(MAX_TRACE, ("Adapter->InterruptStatus (0x%X) Mask (0x%X).\n",
Adapter->InterruptStatus, Mask));
/* Find next interrupt type */
while (((Adapter->InterruptStatus & Mask) == 0) && (Mask < ISRMask))
Mask = (Mask << 1);
switch (Adapter->InterruptStatus & Mask) {
case ISR_OVW:
case ISR_OVW:
NDIS_DbgPrint(MAX_TRACE, ("Overflow interrupt.\n"));
/* Overflow. Handled almost the same way as a receive interrupt */
Adapter->BufferOverflow = TRUE;
@ -1294,7 +1297,7 @@ VOID MiniportHandleInterrupt(
HandleReceive(Adapter);
Adapter->InterruptStatus &= ~(ISR_PRX | ISR_RXE);
break;
break;
case ISR_TXE:
NDIS_DbgPrint(MAX_TRACE, ("Transmit error interrupt.\n"));
@ -1327,7 +1330,11 @@ VOID MiniportHandleInterrupt(
Mask = (Mask << 1);
/* Check if new interrupts are generated */
NdisRawReadPortUchar(Adapter->IOBase + PG0_ISR, &ISRValue);
NDIS_DbgPrint(MAX_TRACE, ("ISRValue (0x%X).\n", ISRValue));
Adapter->InterruptStatus |= (ISRValue & ISRMask);
if (ISRValue != 0x00) {

View file

@ -1,6 +0,0 @@
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -1,10 +0,0 @@
#include <windows.h>
#include <ntverp.h>
#define VER_FILETYPE VFT_DRV
#define VER_FILESUBTYPE VFT2_DRV_NETWORK
#define VER_FILEDESCRIPTION_STR "Novell NE2000 network driver"
#define VER_INTERNALNAME_STR "NE2000.SYS"
#define VER_ORIGINALFILENAME_STR "NE2000.SYS"
#include "common.ver"

View file

@ -1,15 +0,0 @@
TARGETNAME=ne2000
TARGETPATH=..\objects
TARGETTYPE=DRIVER
TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib
C_DEFINES=$(C_DEFINES) -DNDIS_MINIPORT_DRIVER -DDBG
INCLUDES=..\include;..\..\..\..\..\include\net;$(BASEDIR)\inc
SOURCES=main.c \
8390.c \
RESOURCE.RC
MSC_WARNING_LEVEL=/W3 /WX

View file

@ -217,7 +217,10 @@ NDIS_STATUS MiniportInitialize(
#ifndef NOCARD
Status = NICInitialize(Adapter);
if (Status != NDIS_STATUS_SUCCESS) {
NDIS_DbgPrint(MIN_TRACE, ("Cannot find NE2000 NIC. Status (0x%X).\n", Status));
DbgPrint("No NE2000 or compatible network adapter found at address 0x%X.\n",
Adapter->IOBase);
NDIS_DbgPrint(MID_TRACE, ("Status (0x%X).\n", Status));
MiniportHalt((NDIS_HANDLE)Adapter);
return Status;
}
@ -246,12 +249,12 @@ NDIS_STATUS MiniportInitialize(
/* Setup the NIC */
NICSetup(Adapter);
NDIS_DbgPrint(MIN_TRACE, ("TXStart (0x%X) TXCount (0x%X) PageStart (0x%X)\n",
NDIS_DbgPrint(MAX_TRACE, ("TXStart (0x%X) TXCount (0x%X) PageStart (0x%X)\n",
Adapter->TXStart,
Adapter->TXCount,
Adapter->PageStart));
NDIS_DbgPrint(MIN_TRACE, ("PageStop (0x%X) CurrentPage (0x%X) NextPacket (0x%X).\n",
NDIS_DbgPrint(MAX_TRACE, ("PageStop (0x%X) CurrentPage (0x%X) NextPacket (0x%X).\n",
Adapter->PageStop,
Adapter->CurrentPage,
Adapter->NextPacket));

View file

@ -1,18 +0,0 @@
Build instructions for NE2000 driver
------------------------------------
Building with Visual C++ and Windows NT DDK:
Variables:
%BASEDIR% = path to NT4 DDK (e.g. c:\ntddk)
%DDKBUILDENV% = DDK build environment (free or checked)
DDK environment variables must be set! (run setenv.bat)
- Create the directory objects/i386/%DDKBUILDENV%
- Run "build" to build the driver
Building with Mingw32 and ReactOS include files:
- Run "make ne2000" FROM THE ReactOS ROOT DIRECTORY to build the driver