ReactOS  0.4.14-dev-297-g23e575c
nic.h File Reference
#include <ndis.h>
#include "rtlhw.h"
Include dependency graph for nic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RTL_ADAPTER
 

Macros

#define ADAPTER_TAG   'Altr'
 
#define RESOURCE_LIST_TAG   'Rltr'
 
#define MAX_RESET_ATTEMPTS   25
 
#define RECEIVE_BUFFER_SIZE   (32768)
 
#define FULL_RECEIVE_BUFFER_SIZE   (32768 + 16 + 2048)
 
#define RECV_CRC_LENGTH   4
 
#define MINIMUM_FRAME_SIZE   60
 
#define MAXIMUM_FRAME_SIZE   1514
 
#define DRIVER_VERSION   1
 
#define RC_VAL   (0x800B780)
 
#define TC_VAL   (0x700)
 

Typedefs

typedef struct _RTL_ADAPTER RTL_ADAPTER
 
typedef struct _RTL_ADAPTERPRTL_ADAPTER
 

Functions

NDIS_STATUS NTAPI NICPowerOn (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICSoftReset (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICRegisterReceiveBuffer (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICRemoveReceiveBuffer (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICEnableTxRx (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICGetPermanentMacAddress (IN PRTL_ADAPTER Adapter, OUT PUCHAR MacAddress)
 
NDIS_STATUS NTAPI NICApplyPacketFilter (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICApplyInterruptMask (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICDisableInterrupts (IN PRTL_ADAPTER Adapter)
 
USHORT NTAPI NICInterruptRecognized (IN PRTL_ADAPTER Adapter, OUT PBOOLEAN InterruptRecognized)
 
VOID NTAPI NICAcknowledgeInterrupts (IN PRTL_ADAPTER Adapter)
 
VOID NTAPI NICUpdateLinkStatus (IN PRTL_ADAPTER Adapter)
 
NDIS_STATUS NTAPI NICTransmitPacket (IN PRTL_ADAPTER Adapter, IN UCHAR TxDesc, IN ULONG PhysicalAddress, IN ULONG Length)
 
NDIS_STATUS NTAPI MiniportSetInformation (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
 
NDIS_STATUS NTAPI MiniportQueryInformation (IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
 
VOID NTAPI MiniportISR (OUT PBOOLEAN InterruptRecognized, OUT PBOOLEAN QueueMiniportHandleInterrupt, IN NDIS_HANDLE MiniportAdapterContext)
 
VOID NTAPI MiniportHandleInterrupt (IN NDIS_HANDLE MiniportAdapterContext)
 

Macro Definition Documentation

◆ ADAPTER_TAG

#define ADAPTER_TAG   'Altr'

Definition at line 15 of file nic.h.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1

Definition at line 28 of file nic.h.

◆ FULL_RECEIVE_BUFFER_SIZE

#define FULL_RECEIVE_BUFFER_SIZE   (32768 + 16 + 2048)

Definition at line 22 of file nic.h.

◆ MAX_RESET_ATTEMPTS

#define MAX_RESET_ATTEMPTS   25

Definition at line 18 of file nic.h.

◆ MAXIMUM_FRAME_SIZE

#define MAXIMUM_FRAME_SIZE   1514

Definition at line 26 of file nic.h.

◆ MINIMUM_FRAME_SIZE

#define MINIMUM_FRAME_SIZE   60

Definition at line 25 of file nic.h.

◆ RC_VAL

#define RC_VAL   (0x800B780)

Definition at line 31 of file nic.h.

◆ RECEIVE_BUFFER_SIZE

#define RECEIVE_BUFFER_SIZE   (32768)

Definition at line 19 of file nic.h.

◆ RECV_CRC_LENGTH

#define RECV_CRC_LENGTH   4

Definition at line 23 of file nic.h.

◆ RESOURCE_LIST_TAG

#define RESOURCE_LIST_TAG   'Rltr'

Definition at line 16 of file nic.h.

◆ TC_VAL

#define TC_VAL   (0x700)

Definition at line 34 of file nic.h.

Typedef Documentation

◆ PRTL_ADAPTER

◆ RTL_ADAPTER

Function Documentation

◆ MiniportHandleInterrupt()

VOID NTAPI MiniportHandleInterrupt ( IN NDIS_HANDLE  MiniportAdapterContext)

Definition at line 40 of file interrupt.c.

42 {
43  ULONG InterruptPending;
44  PE1000_ADAPTER Adapter = (PE1000_ADAPTER)MiniportAdapterContext;
45  volatile PE1000_TRANSMIT_DESCRIPTOR TransmitDescriptor;
46 
47  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
48 
49  InterruptPending = InterlockedExchange(&Adapter->InterruptPending, 0);
50 
51 
52  /* Link State Changed */
53  if (InterruptPending & E1000_IMS_LSC)
54  {
55  ULONG Status;
56 
57  InterruptPending &= ~E1000_IMS_LSC;
58  NDIS_DbgPrint(MAX_TRACE, ("Link status changed!.\n"));
59 
60  NICUpdateLinkStatus(Adapter);
61 
63 
66  }
67 
68  /* Handling receive interrupts */
69  if (InterruptPending & (E1000_IMS_RXDMT0 | E1000_IMS_RXT0))
70  {
71  volatile PE1000_RECEIVE_DESCRIPTOR ReceiveDescriptor;
72  PETH_HEADER EthHeader;
73  ULONG BufferOffset;
74  BOOLEAN bGotAny = FALSE;
75  ULONG RxDescHead, RxDescTail, CurrRxDesc;
76 
77  /* Clear out these interrupts */
78  InterruptPending &= ~(E1000_IMS_RXDMT0 | E1000_IMS_RXT0);
79 
80  E1000ReadUlong(Adapter, E1000_REG_RDH, &RxDescHead);
81  E1000ReadUlong(Adapter, E1000_REG_RDT, &RxDescTail);
82 
83  while (((RxDescTail + 1) % NUM_RECEIVE_DESCRIPTORS) != RxDescHead)
84  {
85  CurrRxDesc = (RxDescTail + 1) % NUM_RECEIVE_DESCRIPTORS;
86  BufferOffset = CurrRxDesc * Adapter->ReceiveBufferEntrySize;
87  ReceiveDescriptor = Adapter->ReceiveDescriptors + CurrRxDesc;
88 
89  /* Check if the hardware have released this descriptor (DD - Descriptor Done) */
90  if (!(ReceiveDescriptor->Status & E1000_RDESC_STATUS_DD))
91  {
92  /* No need to check descriptors after the first unfinished one */
93  break;
94  }
95 
96  /* Ignoring these flags for now */
97  ReceiveDescriptor->Status &= ~(E1000_RDESC_STATUS_IXSM | E1000_RDESC_STATUS_PIF);
98 
99  if (ReceiveDescriptor->Status != (E1000_RDESC_STATUS_EOP | E1000_RDESC_STATUS_DD))
100  {
101  NDIS_DbgPrint(MIN_TRACE, ("Unrecognized ReceiveDescriptor status flag: %u\n", ReceiveDescriptor->Status));
102  }
103 
104  if (ReceiveDescriptor->Length != 0 && ReceiveDescriptor->Address != 0)
105  {
106  EthHeader = (PETH_HEADER)(Adapter->ReceiveBuffer + BufferOffset);
107 
109  NULL,
110  (PCHAR)EthHeader,
111  sizeof(ETH_HEADER),
112  (PCHAR)(EthHeader + 1),
113  ReceiveDescriptor->Length - sizeof(ETH_HEADER),
114  ReceiveDescriptor->Length - sizeof(ETH_HEADER));
115 
116  bGotAny = TRUE;
117  }
118  else
119  {
120  NDIS_DbgPrint(MIN_TRACE, ("Got a NULL descriptor"));
121  }
122 
123  /* Give the descriptor back */
124  ReceiveDescriptor->Status = 0;
125 
126  RxDescTail = CurrRxDesc;
127  }
128 
129  if (bGotAny)
130  {
131  /* Write back new tail value */
132  E1000WriteUlong(Adapter, E1000_REG_RDT, RxDescTail);
133 
134  NDIS_DbgPrint(MAX_TRACE, ("Rx done (RDH: %u, RDT: %u)\n", RxDescHead, RxDescTail));
135 
137  }
138  }
139 
140  /* Handling transmit interrupts */
141  if (InterruptPending & (E1000_IMS_TXD_LOW | E1000_IMS_TXDW | E1000_IMS_TXQE))
142  {
143  PNDIS_PACKET AckPackets[40] = {0};
144  ULONG NumPackets = 0, i;
145 
146  /* Clear out these interrupts */
147  InterruptPending &= ~(E1000_IMS_TXD_LOW | E1000_IMS_TXDW | E1000_IMS_TXQE);
148 
149  while ((Adapter->TxFull || Adapter->LastTxDesc != Adapter->CurrentTxDesc) && NumPackets < ARRAYSIZE(AckPackets))
150  {
151  TransmitDescriptor = Adapter->TransmitDescriptors + Adapter->LastTxDesc;
152 
153  if (TransmitDescriptor->Status & E1000_TDESC_STATUS_DD)
154  {
155  if (Adapter->TransmitPackets[Adapter->LastTxDesc])
156  {
157  AckPackets[NumPackets++] = Adapter->TransmitPackets[Adapter->LastTxDesc];
158  Adapter->TransmitPackets[Adapter->LastTxDesc] = NULL;
159  TransmitDescriptor->Status = 0;
160  }
161 
162  Adapter->LastTxDesc = (Adapter->LastTxDesc + 1) % NUM_TRANSMIT_DESCRIPTORS;
163  Adapter->TxFull = FALSE;
164  }
165  else
166  {
167  break;
168  }
169  }
170 
171  if (NumPackets)
172  {
173  NDIS_DbgPrint(MAX_TRACE, ("Tx: (TDH: %u, TDT: %u)\n", Adapter->CurrentTxDesc, Adapter->LastTxDesc));
174  NDIS_DbgPrint(MAX_TRACE, ("Tx Done: %u packets to ack\n", NumPackets));
175 
176  for (i = 0; i < NumPackets; ++i)
177  {
178  NdisMSendComplete(Adapter->AdapterHandle, AckPackets[i], NDIS_STATUS_SUCCESS);
179  }
180  }
181  }
182 
183  ASSERT(InterruptPending == 0);
184 }
#define E1000_IMS_RXT0
Definition: e1000hw.h:186
signed char * PCHAR
Definition: retypes.h:7
VOID EXPORT NdisMSendComplete(IN NDIS_HANDLE MiniportAdapterHandle, IN PNDIS_PACKET Packet, IN NDIS_STATUS Status)
Definition: miniport.c:2809
#define E1000_REG_RDH
Definition: e1000hw.h:132
#define TRUE
Definition: types.h:120
VOID NTAPI E1000ReadUlong(IN PE1000_ADAPTER Adapter, IN ULONG Address, OUT PULONG Value)
Definition: hardware.c:70
NDIS_HANDLE AdapterHandle
Definition: nic.h:31
PE1000_RECEIVE_DESCRIPTOR ReceiveDescriptors
Definition: nic.h:81
volatile PUCHAR ReceiveBuffer
Definition: nic.h:85
#define NUM_RECEIVE_DESCRIPTORS
Definition: e1000hw.h:109
#define NdisMEthIndicateReceiveComplete(MiniportAdapterHandle)
Definition: ndis.h:5482
struct _E1000_ADAPTER * PE1000_ADAPTER
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define NUM_TRANSMIT_DESCRIPTORS
Definition: e1000hw.h:108
#define E1000_IMS_TXQE
Definition: e1000hw.h:183
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 E1000_REG_RDT
Definition: e1000hw.h:133
Definition: lan.h:33
#define E1000_RDESC_STATUS_EOP
Definition: e1000hw.h:61
LONG InterruptPending
Definition: nic.h:66
#define E1000_RDESC_STATUS_DD
Definition: e1000hw.h:62
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI NICUpdateLinkStatus(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:808
#define E1000_RDESC_STATUS_IXSM
Definition: e1000hw.h:60
VOID EXPORT NdisMIndicateStatusComplete(IN NDIS_HANDLE MiniportAdapterHandle)
Definition: miniport.c:1580
ULONG MediaState
Definition: nic.h:43
#define NDIS_STATUS_MEDIA_CONNECT
Definition: ndis.h:361
#define E1000_IMS_LSC
Definition: e1000hw.h:184
#define E1000_IMS_RXDMT0
Definition: e1000hw.h:185
struct _ETH_HEADER * PETH_HEADER
ULONG LastTxDesc
Definition: nic.h:76
BOOLEAN TxFull
Definition: nic.h:77
#define NdisMEthIndicateReceive(MiniportAdapterHandle, MiniportReceiveContext, HeaderBuffer, HeaderBufferSize, LookaheadBuffer, LookaheadBufferSize, PacketSize)
Definition: ndis.h:5458
PE1000_TRANSMIT_DESCRIPTOR TransmitDescriptors
Definition: nic.h:70
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define E1000_RDESC_STATUS_PIF
Definition: e1000hw.h:59
ULONG CurrentTxDesc
Definition: nic.h:75
ULONG ReceiveBufferEntrySize
Definition: nic.h:87
PNDIS_PACKET TransmitPackets[NUM_TRANSMIT_DESCRIPTORS]
Definition: nic.h:73
#define InterlockedExchange
Definition: armddk.h:54
Status
Definition: gdiplustypes.h:24
#define E1000_IMS_TXDW
Definition: e1000hw.h:182
#define E1000_TDESC_STATUS_DD
Definition: e1000hw.h:84
#define E1000_IMS_TXD_LOW
Definition: e1000hw.h:187
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
VOID NTAPI E1000WriteUlong(IN PE1000_ADAPTER Adapter, IN ULONG Address, IN ULONG Value)
Definition: hardware.c:65
VOID EXPORT NdisMIndicateStatus(IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_STATUS GeneralStatus, IN PVOID StatusBuffer, IN UINT StatusBufferSize)
Definition: miniport.c:1565
#define NDIS_STATUS_MEDIA_DISCONNECT
Definition: ndis.h:362

Referenced by DriverEntry().

◆ MiniportISR()

VOID NTAPI MiniportISR ( OUT PBOOLEAN  InterruptRecognized,
OUT PBOOLEAN  QueueMiniportHandleInterrupt,
IN NDIS_HANDLE  MiniportAdapterContext 
)

Definition at line 16 of file interrupt.c.

20 {
21  ULONG Value;
22  PE1000_ADAPTER Adapter = (PE1000_ADAPTER)MiniportAdapterContext;
23 
24  Value = NICInterruptRecognized(Adapter, InterruptRecognized);
26 
27  if (!(*InterruptRecognized))
28  {
29  /* This is not ours. */
30  *QueueMiniportHandleInterrupt = FALSE;
31  return;
32  }
33 
34  /* Mark the events pending service */
35  *QueueMiniportHandleInterrupt = TRUE;
36 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define TRUE
Definition: types.h:120
struct _E1000_ADAPTER * PE1000_ADAPTER
ULONG NTAPI NICInterruptRecognized(IN PE1000_ADAPTER Adapter, OUT PBOOLEAN InterruptRecognized)
Definition: hardware.c:790
LONG InterruptPending
Definition: nic.h:66
#define InterlockedOr
Definition: interlocked.h:224
unsigned int ULONG
Definition: retypes.h:1

Referenced by DriverEntry().

◆ MiniportQueryInformation()

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 at line 51 of file info.c.

58 {
59  PE1000_ADAPTER Adapter = (PE1000_ADAPTER)MiniportAdapterContext;
60  ULONG genericUlong;
61  ULONG copyLength;
62  PVOID copySource;
64 
66  copySource = &genericUlong;
67  copyLength = sizeof(ULONG);
68 
69  switch (Oid)
70  {
72  copySource = (PVOID)&SupportedOidList;
73  copyLength = sizeof(SupportedOidList);
74  break;
75 
77  genericUlong = Adapter->PacketFilter;
78  break;
79 
82  genericUlong = (ULONG)NdisHardwareStatusReady; //FIXME
83  break;
84 
87  {
88  static const NDIS_MEDIUM medium = NdisMedium802_3;
89  copySource = (PVOID)&medium;
90  copyLength = sizeof(medium);
91  break;
92  }
93 
99  genericUlong = MAXIMUM_FRAME_SIZE - sizeof(ETH_HEADER);
100  break;
101 
103  genericUlong = MAXIMUM_MULTICAST_ADDRESSES;
104  break;
105 
106  case OID_GEN_LINK_SPEED:
107  genericUlong = Adapter->LinkSpeedMbps * 10000;
108  break;
109 
111  genericUlong = MAXIMUM_FRAME_SIZE;
112  break;
113 
115  genericUlong = RECEIVE_BUFFER_SIZE;
116  break;
117 
118  case OID_GEN_VENDOR_ID:
119  /* The 3 bytes of the MAC address is the vendor ID */
120  genericUlong = 0;
121  genericUlong |= (Adapter->PermanentMacAddress[0] << 16);
122  genericUlong |= (Adapter->PermanentMacAddress[1] << 8);
123  genericUlong |= (Adapter->PermanentMacAddress[2] & 0xFF);
124  break;
125 
127  {
128  static UCHAR vendorDesc[] = "ReactOS Team";
129  copySource = vendorDesc;
130  copyLength = sizeof(vendorDesc);
131  break;
132  }
133 
135  genericUlong = DRIVER_VERSION;
136  break;
137 
139  {
140  static const USHORT driverVersion =
141  (NDIS_MINIPORT_MAJOR_VERSION << 8) + NDIS_MINIPORT_MINOR_VERSION;
142  copySource = (PVOID)&driverVersion;
143  copyLength = sizeof(driverVersion);
144  break;
145  }
146 
148  genericUlong = MAXIMUM_FRAME_SIZE;
149  break;
150 
152  genericUlong = 1;
153  break;
154 
155  case OID_GEN_MAC_OPTIONS:
156  genericUlong = NDIS_MAC_OPTION_RECEIVE_SERIALIZED |
160  break;
161 
163  genericUlong = Adapter->MediaState;
164  break;
165 
166 
168  copySource = Adapter->MulticastList[0].MacAddress;
169  copyLength = IEEE_802_ADDR_LENGTH;
170  break;
171 
173  copySource = Adapter->PermanentMacAddress;
174  copyLength = IEEE_802_ADDR_LENGTH;
175  break;
176 
177  case OID_GEN_XMIT_OK:
178  genericUlong = 0;
179  break;
180  case OID_GEN_RCV_OK:
181  genericUlong = 0;
182  break;
183  case OID_GEN_XMIT_ERROR:
184  genericUlong = 0;
185  break;
186  case OID_GEN_RCV_ERROR:
187  genericUlong = 0;
188  break;
190  genericUlong = 0;
191  break;
192 
193  default:
194  NDIS_DbgPrint(MIN_TRACE, ("Unknown OID 0x%x(%s)\n", Oid, Oid2Str(Oid)));
196  break;
197  }
198 
200  {
201  if (copyLength > InformationBufferLength)
202  {
203  *BytesNeeded = copyLength;
204  *BytesWritten = 0;
206  }
207  else
208  {
209  NdisMoveMemory(InformationBuffer, copySource, copyLength);
210  *BytesWritten = copyLength;
211  *BytesNeeded = copyLength;
212  }
213  }
214  else
215  {
216  *BytesWritten = 0;
217  *BytesNeeded = 0;
218  }
219 
220  /* XMIT_ERROR and RCV_ERROR are really noisy, so do not log those. */
221  if (Oid != OID_GEN_XMIT_ERROR && Oid != OID_GEN_RCV_ERROR)
222  {
223  NDIS_DbgPrint(MAX_TRACE, ("Query OID 0x%x(%s): Completed with status 0x%x (%d, %d)\n",
224  Oid, Oid2Str(Oid), status, *BytesWritten, *BytesNeeded));
225  }
226 
227  return status;
228 }
#define MAXIMUM_MULTICAST_ADDRESSES
Definition: e1000hw.h:23
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
static ULONG
Definition: info.c:26
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
enum _NDIS_MEDIUM NDIS_MEDIUM
#define DRIVER_VERSION
Definition: nic.h:22
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
struct _E1000_ADAPTER * PE1000_ADAPTER
static ULONG SupportedOidList[]
Definition: info.c:13
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define NDIS_MAC_OPTION_NO_LOOPBACK
Definition: ndis.h:685
int NDIS_STATUS
Definition: ntddndis.h:471
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
ULONG PacketFilter
Definition: nic.h:44
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
Definition: ndis.h:682
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED
Definition: ndis.h:683
ULONG MediaState
Definition: nic.h:43
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
struct _ETH_HEADER ETH_HEADER
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
ULONG LinkSpeedMbps
Definition: nic.h:42
#define IEEE_802_ADDR_LENGTH
Definition: e1000hw.h:11
UCHAR PermanentMacAddress[IEEE_802_ADDR_LENGTH]
Definition: nic.h:37
const char * Oid2Str(IN NDIS_OID Oid)
Definition: debug.c:12
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _E1000_ADAPTER::@987 MulticastList[MAXIMUM_MULTICAST_ADDRESSES]
static PVOID
Definition: info.c:26
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define MAX_TRACE
Definition: debug.h:16
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
unsigned short USHORT
Definition: pedump.c:61
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define RECEIVE_BUFFER_SIZE
Definition: nic.h:20
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
#define MAXIMUM_FRAME_SIZE
Definition: nic.h:19
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
static SERVICE_STATUS status
Definition: service.c:31
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271
Definition: ps.c:97

Referenced by DriverEntry().

◆ MiniportSetInformation()

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 at line 232 of file info.c.

239 {
240  PE1000_ADAPTER Adapter = (PE1000_ADAPTER)MiniportAdapterContext;
241  ULONG genericUlong;
243 
245 
246  switch (Oid)
247  {
249  if (InformationBufferLength < sizeof(ULONG))
250  {
251  *BytesRead = 0;
252  *BytesNeeded = sizeof(ULONG);
254  break;
255  }
256 
257  NdisMoveMemory(&genericUlong, InformationBuffer, sizeof(ULONG));
258 
259  if (genericUlong &
266  {
267  *BytesRead = sizeof(ULONG);
268  *BytesNeeded = sizeof(ULONG);
270  break;
271  }
272 
273  Adapter->PacketFilter = genericUlong;
274 
275  status = NICApplyPacketFilter(Adapter);
277  {
278  NDIS_DbgPrint(MIN_TRACE, ("Failed to apply new packet filter (0x%x)\n", status));
279  break;
280  }
281 
282  break;
283 
285  if (InformationBufferLength < sizeof(ULONG))
286  {
287  *BytesRead = 0;
288  *BytesNeeded = sizeof(ULONG);
290  break;
291  }
292 
293  NdisMoveMemory(&genericUlong, InformationBuffer, sizeof(ULONG));
294 
295  if (genericUlong > MAXIMUM_FRAME_SIZE - sizeof(ETH_HEADER))
296  {
298  }
299  else
300  {
301  // Ignore this...
302  }
303 
304  break;
305 
307  if (InformationBufferLength % IEEE_802_ADDR_LENGTH)
308  {
309  *BytesRead = 0;
310  *BytesNeeded = InformationBufferLength + (InformationBufferLength % IEEE_802_ADDR_LENGTH);
312  break;
313  }
314 
315  if (InformationBufferLength / 6 > MAXIMUM_MULTICAST_ADDRESSES)
316  {
318  *BytesRead = 0;
320  break;
321  }
322 
323  NdisMoveMemory(Adapter->MulticastList, InformationBuffer, InformationBufferLength);
324  NICUpdateMulticastList(Adapter);
325  break;
326 
327  default:
328  NDIS_DbgPrint(MIN_TRACE, ("Unknown OID 0x%x(%s)\n", Oid, Oid2Str(Oid)));
330  *BytesRead = 0;
331  *BytesNeeded = 0;
332  break;
333  }
334 
336  {
337  *BytesRead = InformationBufferLength;
338  *BytesNeeded = 0;
339  }
340 
341  return status;
342 }
#define MAXIMUM_MULTICAST_ADDRESSES
Definition: e1000hw.h:23
static ULONG
Definition: info.c:26
NDIS_STATUS NTAPI NICApplyPacketFilter(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:752
struct _E1000_ADAPTER * PE1000_ADAPTER
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
int NDIS_STATUS
Definition: ntddndis.h:471
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
ULONG PacketFilter
Definition: nic.h:44
Definition: lan.h:33
#define NDIS_PACKET_TYPE_SOURCE_ROUTING
Definition: ndis.h:667
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define NDIS_PACKET_TYPE_GROUP
Definition: ndis.h:671
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486
#define IEEE_802_ADDR_LENGTH
Definition: e1000hw.h:11
#define NDIS_PACKET_TYPE_FUNCTIONAL
Definition: ndis.h:673
const char * Oid2Str(IN NDIS_OID Oid)
Definition: debug.c:12
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
struct _E1000_ADAPTER::@987 MulticastList[MAXIMUM_MULTICAST_ADDRESSES]
#define NDIS_PACKET_TYPE_SMT
Definition: ndis.h:669
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL
Definition: ndis.h:672
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
NDIS_STATUS NTAPI NICUpdateMulticastList(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:722
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define MAXIMUM_FRAME_SIZE
Definition: nic.h:19
#define NDIS_PACKET_TYPE_ALL_LOCAL
Definition: ndis.h:670
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
static SERVICE_STATUS status
Definition: service.c:31
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
Definition: ps.c:97

Referenced by DriverEntry().

◆ NICAcknowledgeInterrupts()

VOID NTAPI NICAcknowledgeInterrupts ( IN PRTL_ADAPTER  Adapter)

Definition at line 167 of file hardware.c.

170 {
171  NdisRawWritePortUshort(Adapter->IoBase + R_IS, Adapter->InterruptPending);
172 }
#define R_IS
Definition: rtlhw.h:54
#define NdisRawWritePortUshort(Port, Data)
Definition: ndis.h:4248

Referenced by MiniportISR().

◆ NICApplyInterruptMask()

NDIS_STATUS NTAPI NICApplyInterruptMask ( IN PRTL_ADAPTER  Adapter)

Definition at line 131 of file hardware.c.

134 {
135  NdisRawWritePortUshort(Adapter->IoBase + R_IM, Adapter->InterruptMask);
136  return NDIS_STATUS_SUCCESS;
137 }
#define R_IM
Definition: rtlhw.h:53
#define NdisRawWritePortUshort(Port, Data)
Definition: ndis.h:4248
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346

◆ NICApplyPacketFilter()

NDIS_STATUS NTAPI NICApplyPacketFilter ( IN PRTL_ADAPTER  Adapter)

Definition at line 190 of file hardware.c.

193 {
194  ULONG filterMask;
195 
196  filterMask = RC_VAL;
197 
198  if (Adapter->PacketFilter & NDIS_PACKET_TYPE_DIRECTED)
199  {
200  filterMask |= B_RC_APM;
201  }
202 
203  if (Adapter->PacketFilter & NDIS_PACKET_TYPE_MULTICAST)
204  {
205  filterMask |= B_RC_AM;
206  }
207 
208  if (Adapter->PacketFilter & NDIS_PACKET_TYPE_BROADCAST)
209  {
210  filterMask |= B_RC_AB;
211  }
212 
213  if (Adapter->PacketFilter & NDIS_PACKET_TYPE_PROMISCUOUS)
214  {
215  filterMask |= B_RC_AAP;
216  }
217 
218  NdisRawWritePortUlong(Adapter->IoBase + R_RC, filterMask);
219 
220  return NDIS_STATUS_SUCCESS;
221 }
#define B_RC_AM
Definition: rtlhw.h:70
#define B_RC_AB
Definition: rtlhw.h:71
#define NDIS_PACKET_TYPE_MULTICAST
Definition: ndis.h:664
#define R_RC
Definition: rtlhw.h:67
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define B_RC_AAP
Definition: rtlhw.h:68
#define NDIS_PACKET_TYPE_PROMISCUOUS
Definition: ndis.h:668
unsigned int ULONG
Definition: retypes.h:1
#define RC_VAL
Definition: nic.h:31
#define B_RC_APM
Definition: rtlhw.h:69
#define NDIS_PACKET_TYPE_DIRECTED
Definition: ndis.h:663
#define NDIS_PACKET_TYPE_BROADCAST
Definition: ndis.h:666
#define NdisRawWritePortUlong(Port, Data)
Definition: ndis.h:4239

◆ NICDisableInterrupts()

NDIS_STATUS NTAPI NICDisableInterrupts ( IN PRTL_ADAPTER  Adapter)

Definition at line 141 of file hardware.c.

144 {
145  NdisRawWritePortUshort(Adapter->IoBase + R_IM, 0);
146  return NDIS_STATUS_SUCCESS;
147 }
#define R_IM
Definition: rtlhw.h:53
#define NdisRawWritePortUshort(Port, Data)
Definition: ndis.h:4248
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346

◆ NICEnableTxRx()

NDIS_STATUS NTAPI NICEnableTxRx ( IN PRTL_ADAPTER  Adapter)

Definition at line 98 of file hardware.c.

101 {
102  NdisRawWritePortUchar(Adapter->IoBase + R_CMD, B_CMD_TXE | B_CMD_RXE);
103 
104  //
105  // TX and RX must be enabled before setting these
106  //
107  NdisRawWritePortUlong(Adapter->IoBase + R_RC, RC_VAL);
108  NdisRawWritePortUlong(Adapter->IoBase + R_TC, TC_VAL);
109  return NDIS_STATUS_SUCCESS;
110 }
#define B_CMD_RXE
Definition: rtlhw.h:48
#define NdisRawWritePortUchar(Port, Data)
Definition: ndis.h:4230
#define R_TC
Definition: rtlhw.h:55
#define R_RC
Definition: rtlhw.h:67
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define B_CMD_TXE
Definition: rtlhw.h:47
#define R_CMD
Definition: rtlhw.h:45
#define TC_VAL
Definition: nic.h:34
#define RC_VAL
Definition: nic.h:31
#define NdisRawWritePortUlong(Port, Data)
Definition: ndis.h:4239

◆ NICGetPermanentMacAddress()

NDIS_STATUS NTAPI NICGetPermanentMacAddress ( IN PRTL_ADAPTER  Adapter,
OUT PUCHAR  MacAddress 
)

Definition at line 114 of file hardware.c.

118 {
119  UINT i;
120 
121  for (i = 0; i < IEEE_802_ADDR_LENGTH; i++)
122  {
123  NdisRawReadPortUchar(Adapter->IoBase + R_MAC + i, &MacAddress[i]);
124  }
125 
126  return NDIS_STATUS_SUCCESS;
127 }
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 IEEE_802_ADDR_LENGTH
Definition: e1000hw.h:11
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
unsigned int UINT
Definition: ndis.h:50
#define R_MAC
Definition: rtlhw.h:17
#define NdisRawReadPortUchar(Port, Data)
Definition: ndis.h:4173

◆ NICInterruptRecognized()

USHORT NTAPI NICInterruptRecognized ( IN PRTL_ADAPTER  Adapter,
OUT PBOOLEAN  InterruptRecognized 
)

Definition at line 151 of file hardware.c.

155 {
156  USHORT interruptStatus;
157 
158  NdisRawReadPortUshort(Adapter->IoBase + R_IS, &interruptStatus);
159 
160  *InterruptRecognized = (interruptStatus & Adapter->InterruptMask) != 0;
161 
162  return (interruptStatus & Adapter->InterruptMask);
163 }
#define R_IS
Definition: rtlhw.h:54
#define NdisRawReadPortUshort(Port, Data)
Definition: ndis.h:4191
unsigned short USHORT
Definition: pedump.c:61

◆ NICPowerOn()

NDIS_STATUS NTAPI NICPowerOn ( IN PRTL_ADAPTER  Adapter)

Definition at line 29 of file hardware.c.

32 {
33  //
34  // Send 0x00 to the CONFIG_1 register (0x52) to set the LWAKE + LWPTN to active high.
35  // This should essentially *power on* the device.
36  // -- OSDev Wiki
37  //
38  NdisRawWritePortUchar(Adapter->IoBase + R_CFG1, 0x00);
39  return NDIS_STATUS_SUCCESS;
40 }
#define NdisRawWritePortUchar(Port, Data)
Definition: ndis.h:4230
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define R_CFG1
Definition: rtlhw.h:78

◆ NICRegisterReceiveBuffer()

NDIS_STATUS NTAPI NICRegisterReceiveBuffer ( IN PRTL_ADAPTER  Adapter)

Definition at line 75 of file hardware.c.

78 {
79  ASSERT(NdisGetPhysicalAddressHigh(Adapter->ReceiveBufferPa) == 0);
80 
81  NdisRawWritePortUlong(Adapter->IoBase + R_RXSA, Adapter->ReceiveBufferPa.LowPart);
82 
83  return NDIS_STATUS_SUCCESS;
84 }
#define NdisGetPhysicalAddressHigh(PhysicalAddress)
Definition: ndis.h:3830
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define R_RXSA
Definition: rtlhw.h:34
#define NdisRawWritePortUlong(Port, Data)
Definition: ndis.h:4239

Referenced by MiniportInitialize().

◆ NICRemoveReceiveBuffer()

NDIS_STATUS NTAPI NICRemoveReceiveBuffer ( IN PRTL_ADAPTER  Adapter)

Definition at line 88 of file hardware.c.

91 {
92  NdisRawWritePortUlong(Adapter->IoBase + R_RXSA, 0);
93  return NDIS_STATUS_SUCCESS;
94 }
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define R_RXSA
Definition: rtlhw.h:34
#define NdisRawWritePortUlong(Port, Data)
Definition: ndis.h:4239

Referenced by MiniportHalt().

◆ NICSoftReset()

NDIS_STATUS NTAPI NICSoftReset ( IN PRTL_ADAPTER  Adapter)

Definition at line 44 of file hardware.c.

47 {
48  UCHAR commandReg;
49  UINT resetAttempts;
50 
51  //
52  // Sending 0x10 to the Command register (0x37) will send the RTL8139 into a software reset.
53  // Once that byte is sent, the RST bit must be checked to make sure that the chip has finished the reset.
54  // If the RST bit is high (1), then the reset is still in operation.
55  // -- OSDev Wiki
56  NdisRawWritePortUchar(Adapter->IoBase + R_CMD, B_CMD_RST);
57 
58  for (resetAttempts = 0; resetAttempts < MAX_RESET_ATTEMPTS; resetAttempts++)
59  {
60  NdisRawReadPortUchar(Adapter->IoBase + R_CMD, &commandReg);
61 
62  if (!(commandReg & B_CMD_RST))
63  {
64  return NDIS_STATUS_SUCCESS;
65  }
66 
67  NdisMSleep(100);
68  }
69 
70  return NDIS_STATUS_FAILURE;
71 }
#define B_CMD_RST
Definition: rtlhw.h:49
#define NdisRawWritePortUchar(Port, Data)
Definition: ndis.h:4230
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
unsigned char UCHAR
Definition: xmlstorage.h:181
#define MAX_RESET_ATTEMPTS
Definition: e1000hw.h:15
VOID EXPORT NdisMSleep(IN ULONG MicrosecondsToSleep)
Definition: miniport.c:2928
#define R_CMD
Definition: rtlhw.h:45
unsigned int UINT
Definition: ndis.h:50
#define NdisRawReadPortUchar(Port, Data)
Definition: ndis.h:4173
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465

◆ NICTransmitPacket()

NDIS_STATUS NTAPI NICTransmitPacket ( IN PRTL_ADAPTER  Adapter,
IN UCHAR  TxDesc,
IN ULONG  PhysicalAddress,
IN ULONG  Length 
)

Definition at line 225 of file hardware.c.

231 {
232  NdisRawWritePortUlong(Adapter->IoBase + R_TXSAD0 + (TxDesc * sizeof(ULONG)), PhysicalAddress);
233  NdisRawWritePortUlong(Adapter->IoBase + R_TXSTS0 + (TxDesc * sizeof(ULONG)), Length);
234  return NDIS_STATUS_SUCCESS;
235 }
#define R_TXSTS0
Definition: rtlhw.h:26
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
unsigned int ULONG
Definition: retypes.h:1
#define R_TXSAD0
Definition: rtlhw.h:30
#define NdisRawWritePortUlong(Port, Data)
Definition: ndis.h:4239

◆ NICUpdateLinkStatus()

VOID NTAPI NICUpdateLinkStatus ( IN PRTL_ADAPTER  Adapter)

Definition at line 176 of file hardware.c.

179 {
180  UCHAR mediaState;
181 
182  NdisRawReadPortUchar(Adapter->IoBase + R_MS, &mediaState);
183  Adapter->MediaState = (mediaState & R_MS_LINKDWN) ? NdisMediaStateDisconnected :
185  Adapter->LinkSpeedMbps = (mediaState & R_MS_SPEED_10) ? 10 : 100;
186 }
#define R_MS_SPEED_10
Definition: rtlhw.h:83
unsigned char UCHAR
Definition: xmlstorage.h:181
#define R_MS_LINKDWN
Definition: rtlhw.h:82
#define R_MS
Definition: rtlhw.h:80
#define NdisRawReadPortUchar(Port, Data)
Definition: ndis.h:4173