ReactOS 0.4.16-dev-92-g0c2cdca
media140.c File Reference
#include "dc21x4.h"
#include <debug.h>
Include dependency graph for media140.c:

Go to the source code of this file.

Functions

static BOOLEAN MediaGprCheckLink (_In_ PDC21X4_ADAPTER Adapter)
 
static ULONG MediaGprNextMedia (_In_ PDC21X4_ADAPTER Adapter)
 
VOID NTAPI MediaMonitor21140Dpc (_In_ PVOID SystemSpecific1, _In_ PVOID FunctionContext, _In_ PVOID SystemSpecific2, _In_ PVOID SystemSpecific3)
 

Function Documentation

◆ MediaGprCheckLink()

static BOOLEAN MediaGprCheckLink ( _In_ PDC21X4_ADAPTER  Adapter)
static

Definition at line 18 of file media140.c.

20{
21 ULONG GpioData;
22 PDC_MEDIA Media;
23
24 Media = &Adapter->Media[Adapter->MediaNumber];
25
26 /* No media activity indicator */
27 if (Media->LinkMask == 0)
28 {
29 TRACE("No activity indicator\n");
30
31 /* Assume we have a link */
32 if (MEDIA_IS_FIXED(Adapter))
33 return TRUE;
34
35 return FALSE;
36 }
37
38 GpioData = DC_READ(Adapter, DcCsr12_Gpio);
39
40 TRACE("CSR12 %08lx\n", GpioData);
41
42 /* This media supports link indication via GPIO pins */
43 return !!((GpioData & Media->LinkMask) ^ Media->Polarity);
44}
FORCEINLINE ULONG DC_READ(_In_ PDC21X4_ADAPTER Adapter, _In_ DC_CSR Register)
Definition: dc21x4.h:262
@ DcCsr12_Gpio
Definition: dc21x4hw.h:187
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MEDIA_IS_FIXED(Adapter)
Definition: media.h:126
#define TRACE(s)
Definition: solgame.cpp:4
ULONG LinkMask
Definition: media.h:28
ULONG Polarity
Definition: media.h:29
uint32_t ULONG
Definition: typedefs.h:59

Referenced by MediaMonitor21140Dpc().

◆ MediaGprNextMedia()

static ULONG MediaGprNextMedia ( _In_ PDC21X4_ADAPTER  Adapter)
static

Definition at line 48 of file media140.c.

50{
51 ULONG i;
52
53 /* No half-duplex media in the media list */
54 if (!(Adapter->MediaBitmap & ~MEDIA_FD_MASK))
55 {
56 return Adapter->MediaNumber;
57 }
58
59 /* Find the next half-duplex media */
60 i = Adapter->MediaNumber;
61 while (TRUE)
62 {
63 /* We have reached the end of the media list, try the first media */
64 if (i == 0)
65 {
66 _BitScanReverse(&i, Adapter->MediaBitmap);
67 }
68 else
69 {
70 --i;
71 }
72
73 if ((Adapter->MediaBitmap & (1 << i)) && !MEDIA_IS_FD(i))
74 {
75 return i;
76 }
77 }
78}
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
unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask)
Definition: intrin_arm.h:180
#define MEDIA_IS_FD(MediaNumber)
Definition: media.h:106
#define MEDIA_FD_MASK
Definition: media.h:77

Referenced by MediaMonitor21140Dpc().

◆ MediaMonitor21140Dpc()

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

Definition at line 82 of file media140.c.

87{
89 ULONG DelayMs, MediaNumber;
91
92 UNREFERENCED_PARAMETER(SystemSpecific1);
95
96 if (!(Adapter->Flags & DC_ACTIVE))
97 return;
98
100
101 if (Adapter->MediaNumber == MEDIA_MII)
102 {
103 LinkUp = MediaMiiCheckLink(Adapter);
104
105 DelayMs = 5000;
106 }
107 else
108 {
109 LinkUp = MediaGprCheckLink(Adapter);
110
111 /* This media is unconnected, try the next media */
112 if (!LinkUp && !MEDIA_IS_FIXED(Adapter))
113 {
114 MediaNumber = MediaGprNextMedia(Adapter);
115
116 if (Adapter->MediaNumber != MediaNumber)
117 {
118 Adapter->MediaNumber = MediaNumber;
119 MediaGprSelect(Adapter);
120 }
121
122 DelayMs = 3000;
123 }
124 else
125 {
126 /* If we are forcing media, then we need to poll the media less frequently */
127 DelayMs = 5000;
128 }
129 }
130
132
134
135 NdisMSetTimer(&Adapter->MediaMonitorTimer, DelayMs);
136}
unsigned char BOOLEAN
#define DC_ACTIVE
Definition: dc21x4.h:120
VOID MediaGprSelect(_In_ PDC21X4_ADAPTER Adapter)
Definition: media.c:303
VOID MediaIndicateConnect(_In_ PDC21X4_ADAPTER Adapter, _In_ BOOLEAN LinkUp)
Definition: media.c:17
BOOLEAN MediaMiiCheckLink(_In_ PDC21X4_ADAPTER Adapter)
Definition: media.c:141
VOID EXPORT NdisMSetTimer(IN PNDIS_MINIPORT_TIMER Timer, IN UINT MillisecondsToDelay)
Definition: time.c:272
static ULONG MediaGprNextMedia(_In_ PDC21X4_ADAPTER Adapter)
Definition: media140.c:48
static BOOLEAN MediaGprCheckLink(_In_ PDC21X4_ADAPTER Adapter)
Definition: media140.c:18
#define MEDIA_MII
Definition: media.h:67
_In_ PVOID _In_ PVOID SystemSpecific2
Definition: ndis.h:638
#define NdisDprReleaseSpinLock(_SpinLock)
Definition: ndis.h:4133
_In_ PVOID FunctionContext
Definition: ndis.h:637
#define NdisDprAcquireSpinLock(_SpinLock)
Definition: ndis.h:4124
_In_ PVOID _In_ PVOID _In_ PVOID SystemSpecific3
Definition: ndis.h:639
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
@ LinkUp
Definition: srb.h:741
DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK ModeLock
Definition: dc21x4.h:161
ULONG MediaNumber
Definition: dc21x4.h:174
NDIS_MINIPORT_TIMER MediaMonitorTimer
Definition: dc21x4.h:181
ULONG Flags
Definition: dc21x4.h:119