ReactOS 0.4.16-dev-122-g325d74c
media040.c File Reference
#include "dc21x4.h"
#include <debug.h>
Include dependency graph for media040.c:

Go to the source code of this file.

Functions

VOID MediaLinkStateChange21040 (_In_ PDC21X4_ADAPTER Adapter, _In_ ULONG InterruptStatus)
 
VOID NTAPI MediaMonitor21040Dpc (_In_ PVOID SystemSpecific1, _In_ PVOID FunctionContext, _In_ PVOID SystemSpecific2, _In_ PVOID SystemSpecific3)
 

Function Documentation

◆ MediaLinkStateChange21040()

VOID MediaLinkStateChange21040 ( _In_ PDC21X4_ADAPTER  Adapter,
_In_ ULONG  InterruptStatus 
)

Definition at line 17 of file media040.c.

20{
21 UNREFERENCED_PARAMETER(InterruptStatus);
22
23 INFO_VERB("Link failed, CSR12 %08lx\n", DC_READ(Adapter, DcCsr12_SiaStatus));
24
25 NdisDprAcquireSpinLock(&Adapter->ModeLock);
26
27 /* Start the media timer when the 10Base-T link has changed state */
28 if (Adapter->MediaNumber != MEDIA_BNC)
29 {
31
32 NdisMSetTimer(&Adapter->MediaMonitorTimer, 3000);
33 }
34
35 NdisDprReleaseSpinLock(&Adapter->ModeLock);
36}
FORCEINLINE ULONG DC_READ(_In_ PDC21X4_ADAPTER Adapter, _In_ DC_CSR Register)
Definition: dc21x4.h:262
VOID MediaIndicateConnect(_In_ PDC21X4_ADAPTER Adapter, _In_ BOOLEAN LinkUp)
Definition: media.c:17
@ DcCsr12_SiaStatus
Definition: dc21x4hw.h:188
#define FALSE
Definition: types.h:117
#define INFO_VERB
Definition: debug.h:90
VOID EXPORT NdisMSetTimer(IN PNDIS_MINIPORT_TIMER Timer, IN UINT MillisecondsToDelay)
Definition: time.c:272
#define MEDIA_BNC
Definition: media.h:47
#define NdisDprReleaseSpinLock(_SpinLock)
Definition: ndis.h:4133
#define NdisDprAcquireSpinLock(_SpinLock)
Definition: ndis.h:4124
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

◆ MediaMonitor21040Dpc()

VOID NTAPI MediaMonitor21040Dpc ( _In_ PVOID  SystemSpecific1,
_In_ PVOID  FunctionContext,
_In_ PVOID  SystemSpecific2,
_In_ PVOID  SystemSpecific3 
)

Definition at line 40 of file media040.c.

45{
47 BOOLEAN LinkUp, Report, RunAgain;
48
49 UNREFERENCED_PARAMETER(SystemSpecific1);
52
53 if (!(Adapter->Flags & DC_ACTIVE))
54 return;
55
56 LinkUp = FALSE;
57 Report = FALSE;
58 RunAgain = TRUE;
59
61
62 if (Adapter->MediaNumber != MEDIA_BNC)
63 {
64 ULONG SiaStatus = DC_READ(Adapter, DcCsr12_SiaStatus);
65
66 Report = TRUE;
69
70 if (!LinkUp)
71 {
72 /* Select the other port */
73 if (!MEDIA_IS_FIXED(Adapter))
74 {
75 Adapter->MediaNumber = MEDIA_BNC;
76
77 DcWriteSia(Adapter,
78 Adapter->Media[MEDIA_BNC].Csr13,
79 Adapter->Media[MEDIA_BNC].Csr14,
80 Adapter->Media[MEDIA_BNC].Csr15);
81
82 Adapter->LastReceiveActivity = (ULONG)Adapter->Statistics.ReceiveOk;
83 }
84 }
85 else
86 {
87 /* Wait until the next link change event */
88 RunAgain = FALSE;
89 }
90 }
91 else
92 {
94
95 if (!(Adapter->ModeFlags & DC_MODE_TEST_PACKET))
96 {
97 /* Check for any received packets */
99 {
100 LinkUp = TRUE;
101 Report = TRUE;
102 }
103 else
104 {
105 /* Send a loopback packet */
107 DcTestPacket(Adapter);
109 }
110 }
111 else
112 {
113 Adapter->ModeFlags &= ~DC_MODE_TEST_PACKET;
114
115 LinkUp = !!Adapter->MediaTestStatus;
116 Report = TRUE;
117
118 /* Select the other port */
119 if (!LinkUp && !MEDIA_IS_FIXED(Adapter))
120 {
121 Adapter->MediaNumber = MEDIA_10T;
122
123 DcWriteSia(Adapter,
124 Adapter->Media[MEDIA_10T].Csr13,
125 Adapter->Media[MEDIA_10T].Csr14,
126 Adapter->Media[MEDIA_10T].Csr15);
127 }
128 }
130 }
131
132 if (Report)
133 {
135 }
136
138
139 if (RunAgain)
140 {
141 NdisMSetTimer(&Adapter->MediaMonitorTimer, LinkUp ? 6000 : 3000);
142 }
143}
unsigned char BOOLEAN
#define DC_ACTIVE
Definition: dc21x4.h:120
VOID DcWriteSia(_In_ PDC21X4_ADAPTER Adapter, _In_ ULONG Csr13, _In_ ULONG Csr14, _In_ ULONG Csr15)
Definition: hardware.c:89
#define DC_MODE_TEST_PACKET
Definition: dc21x4.h:165
VOID DcTestPacket(_In_ PDC21X4_ADAPTER Adapter)
Definition: hardware.c:135
#define DC_SIA_STATUS_10T_LINK_FAIL
Definition: dc21x4hw.h:422
#define DC_SIA_STATUS_NETWORK_CONNECTION_ERROR
Definition: dc21x4hw.h:420
#define TRUE
Definition: types.h:120
if(dx< 0)
Definition: linetemp.h:194
#define MEDIA_IS_FIXED(Adapter)
Definition: media.h:126
#define MEDIA_10T
Definition: media.h:46
_In_ PVOID _In_ PVOID SystemSpecific2
Definition: ndis.h:638
_In_ PVOID FunctionContext
Definition: ndis.h:637
_In_ PVOID _In_ PVOID _In_ PVOID SystemSpecific3
Definition: ndis.h:639
static NTSTATUS ReceiveActivity(PAFD_FCB FCB, PIRP Irp)
Definition: read.c:151
@ LinkUp
Definition: srb.h:741
volatile LONG MediaTestStatus
Definition: dc21x4.h:180
ULONG ModeFlags
Definition: dc21x4.h:162
DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK ModeLock
Definition: dc21x4.h:161
ULONG LastReceiveActivity
Definition: dc21x4.h:179
ULONG MediaNumber
Definition: dc21x4.h:174
NDIS_MINIPORT_TIMER MediaMonitorTimer
Definition: dc21x4.h:181
DC_MEDIA Media[MEDIA_LIST_MAX]
Definition: dc21x4.h:183
DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK SendLock
Definition: dc21x4.h:129
DC_STATISTICS Statistics
Definition: dc21x4.h:156
ULONG Flags
Definition: dc21x4.h:119
ULONG Csr14
Definition: media.h:22
ULONG Csr13
Definition: media.h:21
ULONG Csr15
Definition: media.h:23
ULONG64 ReceiveOk
Definition: dc21x4.h:90
uint32_t ULONG
Definition: typedefs.h:59