1 /* 2 * PROJECT: ReactOS DC21x4 Driver 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: Media support header file 5 * COPYRIGHT: Copyright 2023 Dmitry Borisov <di.sean@protonmail.com> 6 */ 7 8 #pragma once 9 10 typedef struct _DC_MEDIA 11 { 12 ULONG OpMode; 13 14 USHORT GpioCtrl; 15 USHORT GpioData; 16 17 union 18 { 19 struct _DC_MEDIA_SIA_DATA 20 { 21 ULONG Csr13; 22 ULONG Csr14; 23 ULONG Csr15; 24 }; 25 26 struct _DC_MEDIA_GPR_DATA 27 { 28 ULONG LinkMask; 29 ULONG Polarity; 30 }; 31 }; 32 } DC_MEDIA, *PDC_MEDIA; 33 34 typedef struct _DC_MII_MEDIA 35 { 36 UCHAR SetupStreamLength; 37 UCHAR ResetStreamLength; 38 USHORT Advertising; 39 USHORT SetupStream[SROM_MAX_STREAM_REGS + 1]; // +1 for GPIO direction (21140) 40 USHORT ResetStream[SROM_MAX_STREAM_REGS]; 41 } DC_MII_MEDIA, *PDC_MII_MEDIA; 42 43 /* 44 * SROM-defined media values 45 */ 46 #define MEDIA_10T 0 47 #define MEDIA_BNC 1 48 #define MEDIA_AUI 2 49 #define MEDIA_100TX_HD 3 50 #define MEDIA_10T_HD MEDIA_100TX_HD /* 21041 only */ 51 #define MEDIA_10T_FD 4 52 #define MEDIA_100TX_FD 5 53 #define MEDIA_100T4 6 54 #define MEDIA_100FX_HD 7 55 #define MEDIA_100FX_FD 8 56 #define MEDIA_HMR 9 57 #define MEDIA_LIST_MAX 10 58 59 /* 60 * Registry configuration 61 */ 62 #define MEDIA_AUTO MEDIA_LIST_MAX 63 64 /* 65 * Extra codes 66 */ 67 #define MEDIA_MII MEDIA_LIST_MAX 68 #define MEDIA_MAX (MEDIA_LIST_MAX + 1) 69 70 #define MEDIA_MII_OVERRIDE_MASK \ 71 ((1 << MEDIA_AUI) | \ 72 (1 << MEDIA_BNC) | \ 73 (1 << MEDIA_100FX_HD) | \ 74 (1 << MEDIA_100FX_FD) | \ 75 (1 << MEDIA_HMR)) 76 77 #define MEDIA_FD_MASK \ 78 ((1 << MEDIA_10T_FD) | \ 79 (1 << MEDIA_100TX_FD) | \ 80 (1 << MEDIA_100FX_FD)) 81 82 #define MEDIA_AUI_BNC_MASK \ 83 ((1 << MEDIA_AUI) | \ 84 (1 << MEDIA_BNC)) 85 86 #define MEDIA_10T_MASK \ 87 ((1 << MEDIA_10T) | \ 88 (1 << MEDIA_10T_FD)) 89 90 #define MEDIA_100_MASK \ 91 ((1 << MEDIA_100TX_HD) | \ 92 (1 << MEDIA_100TX_FD) | \ 93 (1 << MEDIA_100T4) | \ 94 (1 << MEDIA_100FX_HD) | \ 95 (1 << MEDIA_100FX_FD)) 96 97 #define MEDIA_FX_MASK \ 98 ((1 << MEDIA_100FX_HD) | \ 99 (1 << MEDIA_100FX_FD)) 100 101 /* Specifying this media code override the default MII selection */ 102 #define MEDIA_MII_OVERRIDE(MediaNumber) \ 103 (((1 << (MediaNumber)) & MEDIA_MII_OVERRIDE_MASK) != 0) 104 105 /* Full-duplex media */ 106 #define MEDIA_IS_FD(MediaNumber) \ 107 (((1 << (MediaNumber)) & MEDIA_FD_MASK) != 0) 108 109 /* AUI or BNC media */ 110 #define MEDIA_IS_AUI_BNC(MediaNumber) \ 111 (((1 << (MediaNumber)) & MEDIA_AUI_BNC_MASK) != 0) 112 113 /* 10Base-T media */ 114 #define MEDIA_IS_10T(MediaNumber) \ 115 (((1 << (MediaNumber)) & MEDIA_10T_MASK) != 0) 116 117 /* 100mbps media */ 118 #define MEDIA_IS_100(MediaNumber) \ 119 (((1 << (MediaNumber)) & MEDIA_100_MASK) != 0) 120 121 /* 100Base-FX media */ 122 #define MEDIA_IS_FX(MediaNumber) \ 123 (((1 << (MediaNumber)) & MEDIA_FX_MASK) != 0) 124 125 /* Forced speed and duplex */ 126 #define MEDIA_IS_FIXED(Adapter) \ 127 (((Adapter)->Flags & DC_AUTOSENSE) == 0) 128