ReactOS 0.4.15-dev-8222-g9164419
ne2000.h File Reference
#include <ndis.h>
#include <8390.h>
#include "debug.h"
Include dependency graph for ne2000.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _MINIPORT_RESERVED
 
struct  _NIC_ADAPTER
 
struct  _DRIVER_INFORMATION
 

Macros

#define NDIS_MINIPORT_DRIVER   1
 
#define NDIS_LEGACY_MINIPORT   1
 
#define NDIS51_MINIPORT   1
 
#define NIC_DATA   0x10 /* Data register */
 
#define NIC_RESET   0x1F /* Reset register */
 
#define DRIVER_NDIS_MAJOR_VERSION   3
 
#define DRIVER_NDIS_MINOR_VERSION   0
 
#define DRIVER_DEFAULT_IO_BASE_ADDRESS   0x280 /* bochs default */
 
#define DRIVER_DEFAULT_INTERRUPT_NUMBER   9 /* bochs default */
 
#define DRIVER_DEFAULT_INTERRUPT_SHARED   FALSE
 
#define DRIVER_DEFAULT_INTERRUPT_MODE   NdisInterruptLatched
 
#define DRIVER_MAX_MULTICAST_LIST_SIZE   8
 
#define DRIVER_VENDOR_DESCRIPTION   "Novell Eagle 2000 Adapter."
 
#define DRIVER_VENDOR_DRIVER_VERSION   0x0100 /* 1.0 */
 
#define DRIVER_FRAME_SIZE   1514 /* Size of an ethernet frame */
 
#define DRIVER_HEADER_SIZE   14 /* Size of an ethernet header */
 
#define DRIVER_LENGTH_OF_ADDRESS   6 /* Size of an ethernet address */
 
#define DRIVER_MAXIMUM_LOOKAHEAD   (252 - DRIVER_HEADER_SIZE)
 
#define DRIVER_BLOCK_SIZE   256
 
#define DRIVER_DEFAULT_TX_BUFFER_COUNT   12
 
#define BUFFERS_PER_TX_BUF   1
 
#define DRIVER_INTERRUPT_MASK   IMR_ALLE - IMR_RDCE
 
#define INTERRUPT_LIMIT   10
 
#define RESERVED(Packet)   ((PMINIPORT_RESERVED)((Packet)->MiniportReserved))
 

Typedefs

typedef struct _MINIPORT_RESERVED MINIPORT_RESERVED
 
typedef struct _MINIPORT_RESERVEDPMINIPORT_RESERVED
 
typedef UCHAR DRIVER_HARDWARE_ADDRESS[DRIVER_LENGTH_OF_ADDRESS]
 
typedef struct _NIC_ADAPTER NIC_ADAPTER
 
typedef struct _NIC_ADAPTERPNIC_ADAPTER
 
typedef struct _DRIVER_INFORMATION DRIVER_INFORMATION
 
typedef struct _DRIVER_INFORMATIONPDRIVER_INFORMATION
 

Functions

BOOLEAN NICCheck (PNIC_ADAPTER Adapter)
 
NDIS_STATUS NICInitialize (PNIC_ADAPTER Adapter)
 
NDIS_STATUS NICSetup (PNIC_ADAPTER Adapter)
 
NDIS_STATUS NICStart (PNIC_ADAPTER Adapter)
 
NDIS_STATUS NICStop (PNIC_ADAPTER Adapter)
 
NDIS_STATUS NICReset (PNIC_ADAPTER Adapter)
 
VOID NICUpdateCounters (PNIC_ADAPTER Adapter)
 
VOID NICReadDataAlign (PNIC_ADAPTER Adapter, PUSHORT Target, ULONG_PTR Source, USHORT Length)
 
VOID NICWriteDataAlign (PNIC_ADAPTER Adapter, ULONG_PTR Target, PUSHORT Source, USHORT Length)
 
VOID NICReadData (PNIC_ADAPTER Adapter, PUCHAR Target, ULONG_PTR Source, USHORT Length)
 
VOID NICWriteData (PNIC_ADAPTER Adapter, ULONG_PTR Target, PUCHAR Source, USHORT Length)
 
VOID NICTransmit (PNIC_ADAPTER Adapter)
 

Variables

DRIVER_INFORMATION DriverInfo
 
NDIS_PHYSICAL_ADDRESS HighestAcceptableMax
 

Macro Definition Documentation

◆ BUFFERS_PER_TX_BUF

#define BUFFERS_PER_TX_BUF   1

Definition at line 55 of file ne2000.h.

◆ DRIVER_BLOCK_SIZE

#define DRIVER_BLOCK_SIZE   256

Definition at line 50 of file ne2000.h.

◆ DRIVER_DEFAULT_INTERRUPT_MODE

#define DRIVER_DEFAULT_INTERRUPT_MODE   NdisInterruptLatched

Definition at line 35 of file ne2000.h.

◆ DRIVER_DEFAULT_INTERRUPT_NUMBER

#define DRIVER_DEFAULT_INTERRUPT_NUMBER   9 /* bochs default */

Definition at line 33 of file ne2000.h.

◆ DRIVER_DEFAULT_INTERRUPT_SHARED

#define DRIVER_DEFAULT_INTERRUPT_SHARED   FALSE

Definition at line 34 of file ne2000.h.

◆ DRIVER_DEFAULT_IO_BASE_ADDRESS

#define DRIVER_DEFAULT_IO_BASE_ADDRESS   0x280 /* bochs default */

Definition at line 32 of file ne2000.h.

◆ DRIVER_DEFAULT_TX_BUFFER_COUNT

#define DRIVER_DEFAULT_TX_BUFFER_COUNT   12

Definition at line 54 of file ne2000.h.

◆ DRIVER_FRAME_SIZE

#define DRIVER_FRAME_SIZE   1514 /* Size of an ethernet frame */

Definition at line 42 of file ne2000.h.

◆ DRIVER_HEADER_SIZE

#define DRIVER_HEADER_SIZE   14 /* Size of an ethernet header */

Definition at line 43 of file ne2000.h.

◆ DRIVER_INTERRUPT_MASK

#define DRIVER_INTERRUPT_MASK   IMR_ALLE - IMR_RDCE

Definition at line 58 of file ne2000.h.

◆ DRIVER_LENGTH_OF_ADDRESS

#define DRIVER_LENGTH_OF_ADDRESS   6 /* Size of an ethernet address */

Definition at line 44 of file ne2000.h.

◆ DRIVER_MAX_MULTICAST_LIST_SIZE

#define DRIVER_MAX_MULTICAST_LIST_SIZE   8

Definition at line 37 of file ne2000.h.

◆ DRIVER_MAXIMUM_LOOKAHEAD

#define DRIVER_MAXIMUM_LOOKAHEAD   (252 - DRIVER_HEADER_SIZE)

Definition at line 47 of file ne2000.h.

◆ DRIVER_NDIS_MAJOR_VERSION

#define DRIVER_NDIS_MAJOR_VERSION   3

Definition at line 29 of file ne2000.h.

◆ DRIVER_NDIS_MINOR_VERSION

#define DRIVER_NDIS_MINOR_VERSION   0

Definition at line 30 of file ne2000.h.

◆ DRIVER_VENDOR_DESCRIPTION

#define DRIVER_VENDOR_DESCRIPTION   "Novell Eagle 2000 Adapter."

Definition at line 39 of file ne2000.h.

◆ DRIVER_VENDOR_DRIVER_VERSION

#define DRIVER_VENDOR_DRIVER_VERSION   0x0100 /* 1.0 */

Definition at line 40 of file ne2000.h.

◆ INTERRUPT_LIMIT

#define INTERRUPT_LIMIT   10

Definition at line 61 of file ne2000.h.

◆ NDIS51_MINIPORT

#define NDIS51_MINIPORT   1

Definition at line 13 of file ne2000.h.

◆ NDIS_LEGACY_MINIPORT

#define NDIS_LEGACY_MINIPORT   1

Definition at line 12 of file ne2000.h.

◆ NDIS_MINIPORT_DRIVER

#define NDIS_MINIPORT_DRIVER   1

Definition at line 11 of file ne2000.h.

◆ NIC_DATA

#define NIC_DATA   0x10 /* Data register */

Definition at line 23 of file ne2000.h.

◆ NIC_RESET

#define NIC_RESET   0x1F /* Reset register */

Definition at line 24 of file ne2000.h.

◆ RESERVED

#define RESERVED (   Packet)    ((PMINIPORT_RESERVED)((Packet)->MiniportReserved))

Definition at line 70 of file ne2000.h.

Typedef Documentation

◆ DRIVER_HARDWARE_ADDRESS

typedef UCHAR DRIVER_HARDWARE_ADDRESS[DRIVER_LENGTH_OF_ADDRESS]

Definition at line 72 of file ne2000.h.

◆ DRIVER_INFORMATION

◆ MINIPORT_RESERVED

◆ NIC_ADAPTER

◆ PDRIVER_INFORMATION

◆ PMINIPORT_RESERVED

◆ PNIC_ADAPTER

Function Documentation

◆ NICCheck()

BOOLEAN NICCheck ( PNIC_ADAPTER  Adapter)

Definition at line 53 of file 8390.c.

62{
63 int i;
64
65 NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
66
67 /* first try the supplied value */
69 {
70 NDIS_DbgPrint(MID_TRACE, ("Found adapter at 0x%x\n", Adapter->IoBaseAddress));
71 return TRUE;
72 }
73
74 /* ok, no dice, time to probe */
75 for(i = 0; ProbeAddressList[i]; i++)
76 {
78 {
79 NDIS_DbgPrint(MID_TRACE, ("Found adapter at address 0x%x\n", ProbeAddressList[i]));
81 return TRUE;
82 }
83 }
84
85 NDIS_DbgPrint(MIN_TRACE,("Adapter NOT found!\n"));
86 return FALSE;
87}
ULONG_PTR ProbeAddressList[]
Definition: 8390.c:14
static BOOLEAN ProbeAddressForNIC(ULONG_PTR address)
Definition: 8390.c:16
#define MIN_TRACE
Definition: debug.h:14
#define MID_TRACE
Definition: debug.h:15
#define MAX_TRACE
Definition: debug.h:16
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
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
ULONG_PTR IoBaseAddress
Definition: ne2000.h:85

Referenced by MiniportInitialize().

◆ NICInitialize()

NDIS_STATUS NICInitialize ( PNIC_ADAPTER  Adapter)

Definition at line 289 of file 8390.c.

300{
301 UCHAR Tmp;
302
303 NDIS_DbgPrint(MID_TRACE, ("Called.\n"));
304
305 /* Reset the NIC */
306 NdisRawReadPortUchar(Adapter->IOBase + NIC_RESET, &Tmp);
307
308 /* Wait for 1.6ms */
309 NdisStallExecution(1600);
310
311 /* Write the value back */
312 NdisRawWritePortUchar(Adapter->IOBase + NIC_RESET, Tmp);
313
314 /* Select page 0 and stop NIC */
316
317 /* Initialize DCR - Data Configuration Register (byte mode/8 bytes FIFO) */
319
320 /* Clear RBCR0 and RBCR1 - Remote Byte Count Registers */
321 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR0, 0x00);
322 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR1, 0x00);
323
324 /* Initialize RCR - Receive Configuration Register (monitor mode) */
326
327 /* Enter loopback mode (internal NIC module loopback) */
329
330 /* Read the Station Address PROM */
331 if (!NICReadSAPROM(Adapter))
333
334 NDIS_DbgPrint(MID_TRACE, ("Station address is (%02X %02X %02X %02X %02X %02X).\n",
335 Adapter->StationAddress[0], Adapter->StationAddress[1],
336 Adapter->StationAddress[2], Adapter->StationAddress[3],
337 Adapter->StationAddress[4], Adapter->StationAddress[5]));
338
339 /* Select page 0 and start NIC */
341
342 /* Clear ISR - Interrupt Status Register */
343 NdisRawWritePortUchar(Adapter->IOBase + PG0_ISR, 0xFF);
344
345 /* Find NIC RAM size */
346 NICTestRAM(Adapter);
347
348 return NDIS_STATUS_SUCCESS;
349}
static BOOLEAN NICTestRAM(PNIC_ADAPTER Adapter)
Definition: 8390.c:120
static BOOLEAN NICReadSAPROM(PNIC_ADAPTER Adapter)
Definition: 8390.c:215
#define DCR_FT10
Definition: 8390.h:124
#define PG0_ISR
Definition: 8390.h:23
#define TCR_LOOP
Definition: 8390.h:111
#define PG0_TCR
Definition: 8390.h:33
#define DCR_LS
Definition: 8390.h:120
#define CR_RD2
Definition: 8390.h:67
#define PG0_RCR
Definition: 8390.h:31
#define PG0_RBCR0
Definition: 8390.h:28
#define CR_PAGE0
Definition: 8390.h:68
#define PG0_DCR
Definition: 8390.h:35
#define CR_STA
Definition: 8390.h:63
#define PG0_RBCR1
Definition: 8390.h:29
#define PG0_CR
Definition: 8390.h:11
#define CR_STP
Definition: 8390.h:62
#define RCR_MON
Definition: 8390.h:97
#define NdisRawReadPortUchar(Port, Data)
Definition: ndis.h:4173
#define NdisStallExecution
Definition: ndis.h:4453
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NdisRawWritePortUchar(Port, Data)
Definition: ndis.h:4230
#define NDIS_STATUS_ADAPTER_NOT_FOUND
Definition: ndis.h:470
#define NIC_RESET
Definition: ne2000.h:24
PUCHAR IOBase
Definition: ne2000.h:92
DRIVER_HARDWARE_ADDRESS StationAddress
Definition: ne2000.h:108
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by MiniportInitialize().

◆ NICReadData()

VOID NICReadData ( PNIC_ADAPTER  Adapter,
PUCHAR  Target,
ULONG_PTR  Source,
USHORT  Length 
)

Definition at line 791 of file 8390.c.

804{
805 USHORT Tmp;
806
807 /* Avoid transfers to odd addresses */
808 if (Source & 0x01) {
809 /* Transfer one word and use the MSB */
810 NICReadDataAlign(Adapter, &Tmp, Source - 1, 0x02);
811 *Target = (UCHAR)(Tmp >> 8);
812 Source++;
813 Target++;
814 Length--;
815 }
816
817 if (Length & 0x01) {
818 /* Transfer as many words as we can without exceeding the buffer length */
819 Tmp = Length & 0xFFFE;
820 NICReadDataAlign(Adapter, (PUSHORT)Target, Source, Tmp);
821 Source += Tmp;
822 Target = (PUCHAR)((ULONG_PTR) Target + Tmp);
823
824 /* Read one word and keep the LSB */
825 NICReadDataAlign(Adapter, &Tmp, Source, 0x02);
826 *Target = (UCHAR)(Tmp & 0x00FF);
827 } else
828 /* Transfer the rest of the data */
830}
VOID NICReadDataAlign(PNIC_ADAPTER Adapter, PUSHORT Target, ULONG_PTR Source, USHORT Length)
Definition: 8390.c:642
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
unsigned short USHORT
Definition: pedump.c:61
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by MiniportTransferData(), NICIndicatePacket(), and NICReadPacket().

◆ NICReadDataAlign()

VOID NICReadDataAlign ( PNIC_ADAPTER  Adapter,
PUSHORT  Target,
ULONG_PTR  Source,
USHORT  Length 
)

Definition at line 642 of file 8390.c.

655{
656 UCHAR Tmp;
658
659 Count = Length;
660
661 /* Select page 0 and start the NIC */
663
664 /* Initialize RSAR0 and RSAR1 - Remote Start Address Registers */
665 NdisRawWritePortUchar(Adapter->IOBase + PG0_RSAR0, (UCHAR)(Source & 0xFF));
667
668 /* Initialize RBCR0 and RBCR1 - Remote Byte Count Registers */
669 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR0, (UCHAR)(Count & 0xFF));
670 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR1, (UCHAR)(Count >> 8));
671
672 /* Select page 0, read and start the NIC */
674
675 if (Adapter->WordMode)
677 else
679
680 /* Wait for remote DMA to complete, but timeout after some time */
681 for (Count = 0; Count < 0xFFFF; Count++) {
682 NdisRawReadPortUchar(Adapter->IOBase + PG0_ISR, &Tmp);
683 if (Tmp & ISR_RDC)
684 break;
685
687 }
688
689#if DBG
690 if (Count == 0xFFFF)
691 NDIS_DbgPrint(MIN_TRACE, ("Remote DMA did not complete.\n"));
692#endif
693
694 /* Clear remote DMA bit in ISR - Interrupt Status Register */
696}
#define PG0_RSAR1
Definition: 8390.h:27
#define CR_RD0
Definition: 8390.h:65
#define ISR_RDC
Definition: 8390.h:79
#define PG0_RSAR0
Definition: 8390.h:25
#define NdisRawReadPortBufferUshort(Port, Buffer, Length)
Definition: ndis.h:4164
#define NdisRawReadPortBufferUchar(Port, Buffer, Length)
Definition: ndis.h:4144
#define NIC_DATA
Definition: ne2000.h:23
int Count
Definition: noreturn.cpp:7
BOOLEAN WordMode
Definition: ne2000.h:95

Referenced by NICReadData(), NICTestAddress(), and NICWriteData().

◆ NICReset()

NDIS_STATUS NICReset ( PNIC_ADAPTER  Adapter)

Definition at line 500 of file 8390.c.

509{
510 UCHAR Tmp;
511
512 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
513
514 /* Stop the NIC */
515 NICStop(Adapter);
516
517 /* Reset the NIC */
518 NdisRawReadPortUchar(Adapter->IOBase + NIC_RESET, &Tmp);
519
520 /* Wait for 1.6ms */
521 NdisStallExecution(1600);
522
523 /* Write the value back */
524 NdisRawWritePortUchar(Adapter->IOBase + NIC_RESET, Tmp);
525
526 /* Restart the NIC */
527 NICStart(Adapter);
528
529 return NDIS_STATUS_SUCCESS;
530}
NDIS_STATUS NICStop(PNIC_ADAPTER Adapter)
Definition: 8390.c:451
NDIS_STATUS NICStart(PNIC_ADAPTER Adapter)
Definition: 8390.c:429

Referenced by MiniportReset().

◆ NICSetup()

NDIS_STATUS NICSetup ( PNIC_ADAPTER  Adapter)

Definition at line 352 of file 8390.c.

363{
364 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
365
366 if (Adapter->WordMode ) {
367 /* Initialize DCR - Data Configuration Register (word mode/4 words FIFO) */
369 } else {
370 /* Initialize DCR - Data Configuration Register (byte mode/8 bytes FIFO) */
372 }
373
374 /* Clear RBCR0 and RBCR1 - Remote Byte Count Registers */
375 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR0, 0x00);
376 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR1, 0x00);
377
378 /* Initialize RCR - Receive Configuration Register (monitor mode) */
380
381 /* Enter loopback mode (internal NIC module loopback) */
383
384 /* Set boundary page */
385 NdisRawWritePortUchar(Adapter->IOBase + PG0_BNRY, Adapter->NextPacket);
386
387 /* Set start page */
388 NdisRawWritePortUchar(Adapter->IOBase + PG0_PSTART, Adapter->PageStart);
389
390 /* Set stop page */
391 NdisRawWritePortUchar(Adapter->IOBase + PG0_PSTOP, Adapter->PageStop);
392
393 /* Program our address on the NIC */
394 NICSetPhysicalAddress(Adapter);
395
396 /* Program the multicast address mask on the NIC */
398
399 /* Select page 1 and stop NIC */
401
402 /* Initialize current page register */
403 NdisRawWritePortUchar(Adapter->IOBase + PG1_CURR, Adapter->PageStart + 1);
404
405 /* Select page 0 and stop NIC */
407
408 /* Clear ISR - Interrupt Status Register */
409 NdisRawWritePortUchar(Adapter->IOBase + PG0_ISR, 0xFF);
410
411 /* Initialize IMR - Interrupt Mask Register */
413
414 /* Select page 0 and start NIC */
416
417 Adapter->CurrentPage = Adapter->PageStart + 1;
418 Adapter->NextPacket = Adapter->PageStart + 1;
419 Adapter->BufferOverflow = FALSE;
420 Adapter->ReceiveError = FALSE;
421 Adapter->TransmitError = FALSE;
422
423 NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
424
425 return NDIS_STATUS_SUCCESS;
426}
static VOID NICSetPhysicalAddress(PNIC_ADAPTER Adapter)
Definition: 8390.c:165
static VOID NICSetMulticastAddressMask(PNIC_ADAPTER Adapter)
Definition: 8390.c:190
#define PG0_BNRY
Definition: 8390.h:16
#define CR_PAGE1
Definition: 8390.h:69
#define PG0_PSTART
Definition: 8390.h:13
#define PG0_PSTOP
Definition: 8390.h:15
#define PG1_CURR
Definition: 8390.h:42
#define PG0_IMR
Definition: 8390.h:37
#define DCR_WTS
Definition: 8390.h:117
BOOLEAN BufferOverflow
Definition: ne2000.h:139
UINT CurrentPage
Definition: ne2000.h:135
ULONG InterruptMask
Definition: ne2000.h:120
UINT PageStart
Definition: ne2000.h:133
UINT PageStop
Definition: ne2000.h:134
BOOLEAN ReceiveError
Definition: ne2000.h:142
BOOLEAN TransmitError
Definition: ne2000.h:145
UINT NextPacket
Definition: ne2000.h:136

Referenced by MiniportInitialize().

◆ NICStart()

NDIS_STATUS NICStart ( PNIC_ADAPTER  Adapter)

Definition at line 429 of file 8390.c.

438{
439 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
440
441 /* Take NIC out of loopback mode */
442 NdisRawWritePortUchar(Adapter->IOBase + PG0_TCR, 0x00);
443
444 /* Initialize RCR - Receive Configuration Register (accept all) */
446
447 return NDIS_STATUS_SUCCESS;
448}
#define RCR_AB
Definition: 8390.h:94
#define RCR_AM
Definition: 8390.h:95
#define RCR_PRO
Definition: 8390.h:96

Referenced by HandleReceive(), MiniportInitialize(), and NICReset().

◆ NICStop()

NDIS_STATUS NICStop ( PNIC_ADAPTER  Adapter)

Definition at line 451 of file 8390.c.

460{
461 UCHAR Tmp;
462 UINT i;
463
464 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
465
466 /* Select page 0 and stop NIC */
468
469 /* Clear Remote Byte Count Register so ISR_RST will be set */
470 NdisRawWritePortUchar( Adapter->IOBase + PG0_RBCR0, 0x00);
471 NdisRawWritePortUchar( Adapter->IOBase + PG0_RBCR0, 0x00);
472
473 /* Wait for ISR_RST to be set, but timeout after 2ms */
474 for (i = 0; i < 4; i++) {
475 NdisRawReadPortUchar(Adapter->IOBase + PG0_ISR, &Tmp);
476 if (Tmp & ISR_RST)
477 break;
478
480 }
481
482#if DBG
483 if (i == 4)
484 NDIS_DbgPrint(MIN_TRACE, ("NIC was not reset after 2ms.\n"));
485#endif
486
487 /* Initialize RCR - Receive Configuration Register (monitor mode) */
489
490 /* Initialize TCR - Transmit Configuration Register (loopback mode) */
492
493 /* Start NIC */
495
496 return NDIS_STATUS_SUCCESS;
497}
#define ISR_RST
Definition: 8390.h:80
unsigned int UINT
Definition: ndis.h:50

Referenced by MiniportHalt(), MiniportShutdown(), and NICReset().

◆ NICTransmit()

VOID NICTransmit ( PNIC_ADAPTER  Adapter)

Definition at line 1124 of file 8390.c.

1133{
1134 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
1135
1136 if (Adapter->TXCurrent == -1) {
1137 /* NIC is not transmitting, so start transmitting now */
1138
1139 /* Load next packet onto the card, and start transmitting */
1140 if (NICPrepareForTransmit(Adapter))
1141 NICStartTransmit(Adapter);
1142 }
1143}
static BOOLEAN NICPrepareForTransmit(PNIC_ADAPTER Adapter)
Definition: 8390.c:1064
static VOID NICStartTransmit(PNIC_ADAPTER Adapter)
Definition: 8390.c:533
INT TXCurrent
Definition: ne2000.h:166

Referenced by MiniportSend().

◆ NICUpdateCounters()

VOID NICUpdateCounters ( PNIC_ADAPTER  Adapter)

Definition at line 619 of file 8390.c.

626{
627 UCHAR Tmp;
628
629 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
630
631 NdisRawReadPortUchar(Adapter->IOBase + PG0_CNTR0, &Tmp);
632 Adapter->FrameAlignmentErrors += Tmp;
633
634 NdisRawReadPortUchar(Adapter->IOBase + PG0_CNTR1, &Tmp);
635 Adapter->CrcErrors += Tmp;
636
637 NdisRawReadPortUchar(Adapter->IOBase + PG0_CNTR2, &Tmp);
638 Adapter->MissedPackets += Tmp;
639}
#define PG0_CNTR0
Definition: 8390.h:32
#define PG0_CNTR1
Definition: 8390.h:34
#define PG0_CNTR2
Definition: 8390.h:36
ULONG FrameAlignmentErrors
Definition: ne2000.h:174
ULONG MissedPackets
Definition: ne2000.h:176
ULONG CrcErrors
Definition: ne2000.h:175

Referenced by MiniportHandleInterrupt().

◆ NICWriteData()

VOID NICWriteData ( PNIC_ADAPTER  Adapter,
ULONG_PTR  Target,
PUCHAR  Source,
USHORT  Length 
)

Definition at line 833 of file 8390.c.

846{
847 USHORT Tmp;
848
849 /* Avoid transfers to odd addresses */
850 if (Target & 0x01) {
851 /* Read one word */
852 NICReadDataAlign(Adapter, &Tmp, Target - 1, 0x02);
853
854 /* Merge LSB with the new byte which become the new MSB */
855 Tmp = (Tmp & 0x00FF) | (*Source << 8);
856
857 /* Finally write the value back */
858 NICWriteDataAlign(Adapter, Target - 1, &Tmp, 0x02);
859
860 /* Update pointers */
861 Source = (PUCHAR) ((ULONG_PTR) Source + 1);
862 Target += 1;
863 Length--;
864 }
865
866 if (Length & 0x01) {
867 /* Transfer as many words as we can without exceeding the transfer length */
868 Tmp = Length & 0xFFFE;
869 NICWriteDataAlign(Adapter, Target, (PUSHORT)Source, Tmp);
870 Source += Tmp;
871 Target += Tmp;
872
873 /* Read one word */
874 NICReadDataAlign(Adapter, &Tmp, Target, 0x02);
875
876 /* Merge MSB with the new byte which become the new LSB */
877 Tmp = (Tmp & 0xFF00) | (*Source);
878
879 /* Finally write the value back */
880 NICWriteDataAlign(Adapter, Target, &Tmp, 0x02);
881 } else
882 /* Transfer the rest of the data */
884}
VOID NICWriteDataAlign(PNIC_ADAPTER Adapter, ULONG_PTR Target, PUSHORT Source, USHORT Length)
Definition: 8390.c:699

Referenced by NICWritePacket().

◆ NICWriteDataAlign()

VOID NICWriteDataAlign ( PNIC_ADAPTER  Adapter,
ULONG_PTR  Target,
PUSHORT  Source,
USHORT  Length 
)

Definition at line 699 of file 8390.c.

712{
713 UCHAR Tmp;
715
716 /* Select page 0 and start the NIC */
718
719 /* Handle read-before-write bug */
720
721 /* Initialize RSAR0 and RSAR1 - Remote Start Address Registers */
722 NdisRawWritePortUchar(Adapter->IOBase + PG0_RSAR0, (UCHAR)(Target & 0xFF));
724
725 /* Initialize RBCR0 and RBCR1 - Remote Byte Count Registers */
726 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR0, 0x02);
727 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR1, 0x00);
728
729 /* Read and start the NIC */
731
732 /* Read data */
734
735 /* Wait for remote DMA to complete, but timeout after some time */
736 for (Count = 0; Count < 0xFFFF; Count++) {
737 NdisRawReadPortUchar(Adapter->IOBase + PG0_ISR, &Tmp);
738 if (Tmp & ISR_RDC)
739 break;
740
742 }
743
744#if DBG
745 if (Count == 0xFFFF)
746 NDIS_DbgPrint(MIN_TRACE, ("Remote DMA did not complete.\n"));
747#endif
748
749 /* Clear remote DMA bit in ISR - Interrupt Status Register */
751
752
753 /* Now output some data */
754 Count = Length;
755
756 /* Initialize RSAR0 and RSAR1 - Remote Start Address Registers */
757 NdisRawWritePortUchar(Adapter->IOBase + PG0_RSAR0, (UCHAR)(Target & 0xFF));
759
760 /* Initialize RBCR0 and RBCR1 - Remote Byte Count Registers */
761 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR0, (UCHAR)(Count & 0xFF));
762 NdisRawWritePortUchar(Adapter->IOBase + PG0_RBCR1, (UCHAR)(Count >> 8));
763
764 /* Write and start the NIC */
766
767 if (Adapter->WordMode)
769 else
771
772 /* Wait for remote DMA to complete, but timeout after some time */
773 for (Count = 0; Count < 0xFFFF; Count++) {
774 NdisRawReadPortUchar(Adapter->IOBase + PG0_ISR, &Tmp);
775 if (Tmp & ISR_RDC)
776 break;
777
779 }
780
781#if DBG
782 if (Count == 0xFFFF)
783 NDIS_DbgPrint(MIN_TRACE, ("Remote DMA did not complete.\n"));
784#endif
785
786 /* Clear remote DMA bit in ISR - Interrupt Status Register */
788}
#define CR_RD1
Definition: 8390.h:66
#define NdisRawReadPortUshort(Port, Data)
Definition: ndis.h:4191
#define NdisRawWritePortBufferUchar(Port, Buffer, Length)
Definition: ndis.h:4201
#define NdisRawWritePortBufferUshort(Port, Buffer, Length)
Definition: ndis.h:4221

Referenced by NICTestAddress(), and NICWriteData().

Variable Documentation

◆ DriverInfo

DRIVER_INFORMATION DriverInfo
extern

◆ HighestAcceptableMax

NDIS_PHYSICAL_ADDRESS HighestAcceptableMax
extern

Definition at line 60 of file main.c.

Referenced by MiniportInitialize(), and MiQueryResources().