ReactOS 0.4.15-dev-8138-g1e75ea8
eeprom.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS DC21x4 Driver
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: EEPROM specific definitions
5 * COPYRIGHT: Copyright 2023 Dmitry Borisov <di.sean@protonmail.com>
6 */
7
8#pragma once
9
10#include <pshpack1.h>
12{
14 UCHAR GpioDirection; /* 21140 only */
17#include <poppack.h>
18
20{
21#if DBG
22 PCSTR Name;
23#endif
27
28typedef struct _DC_SROM_ENTRY
29{
39
40#define SRomIsBlockExtended(Byte) ((Byte) & 0x80)
41#define SRomGetExtendedBlockLength(Byte) (((Byte) & 0x7F) + 1)
42#define SRomGetMediaCode(Byte) ((Byte) & 0x3F)
43#define SRomBlockHasExtendedData(Byte) ((Byte) & 0x40)
44#define SRomIsDefaultMedia(Word) ((Word) & 0x4000)
45#define SRomMediaHasActivityIndicator(Word) (((Word) & 0x8000) == 0)
46#define SRomMediaActivityIsActiveLow(Word) ((Word) & 0x80)
47#define SRomMediaGetSenseMask(Word) (1 << (((Word) & 0x0E) >> 1))
48#define SRomCommandToOpMode(Word) (((Word) & 0x71) << 18)
49#define SRomMediaAutoSense(Media) ((Media) & 0x800)
50#define SRomMediaToMediaNumber(Word) ((Word) & 0x1F)
51#define SRomHmrRegAddress(Byte) ((Byte) & 0x1F)
52
53#define SROM_OPMODE_MASK \
54 (DC_OPMODE_PORT_SELECT | \
55 DC_OPMODE_PORT_XMIT_10 | \
56 DC_OPMODE_PORT_PCS | \
57 DC_OPMODE_PORT_SCRAMBLER)
58
59#define EE_SIZE 128
60#define EAR_SIZE 32
61
62#define EAR_TEST_PATTERN 0xAA5500FFAA5500FFULL
63
64#define EEPROM_CMD_WRITE 5
65#define EEPROM_CMD_READ 6
66#define EEPROM_CMD_ERASE 7
67
68#define EEPROM_CMD_LENGTH 3
69
70/*
71 * Various offsets in the SROM
72 */
73#define SROM_VERSION 18
74#define SROM_CONTROLLER_COUNT 19
75#define SROM_MAC_ADDRESS 20
76#define SROM_DEVICE_NUMBER(n) (26 + ((n) * 3))
77#define SROM_LEAF_OFFSET(n) (27 + ((n) * 3))
78#define SROM_CHECKSUM_V1 126
79#define SROM_CHECKSUM_V2 94
80
81/*
82 * SROM compact and extended format types
83 */
84#define SROM_BLOCK_TYPE_GPR 0
85#define SROM_BLOCK_TYPE_MII_1 1
86#define SROM_BLOCK_TYPE_SIA 2
87#define SROM_BLOCK_TYPE_MII_2 3
88#define SROM_BLOCK_TYPE_SYM 4
89#define SROM_BLOCK_TYPE_RESET 5
90#define SROM_BLOCK_TYPE_PHY_SHUTDOWN 6
91#define SROM_BLOCK_TYPE_HOMERUN 7
92
93#define SROM_MAX_STREAM_REGS 6
94
95/*
96 * SROM media codes
97 */
98#define SROM_MEDIA_10T 0
99#define SROM_MEDIA_BNC 1
100#define SROM_MEDIA_AUI 2
101#define SROM_MEDIA_100T_HD 3
102#define SROM_MEDIA_10T_FD 4
103#define SROM_MEDIA_100TX_FD 5
104#define SROM_MEDIA_100T4 6
105#define SROM_MEDIA_100FX_HD 7
106#define SROM_MEDIA_100FX_FD 8
107#define SROM_MEDIA_MAX 8
108#define SROM_MEDIA_HMR 18
struct NameRec_ * Name
Definition: cdprocs.h:460
enum _DC_CHIP_TYPE DC_CHIP_TYPE
struct _DC_SROM_COMPACT_BLOCK * PDC_SROM_COMPACT_BLOCK
struct _DC_SROM_COMPACT_BLOCK DC_SROM_COMPACT_BLOCK
struct _DC_SROM_ENTRY DC_SROM_ENTRY
struct _DC_SROM_ENTRY * PDC_SROM_ENTRY
struct _DC_SROM_REPAIR_ENTRY DC_SROM_REPAIR_ENTRY
struct _DC_SROM_REPAIR_ENTRY * PDC_SROM_REPAIR_ENTRY
unsigned short USHORT
Definition: pedump.c:61
USHORT SelectedConnectionType
Definition: eeprom.h:13
Definition: eeprom.h:29
UCHAR DeviceNumber
Definition: eeprom.h:33
DC_CHIP_TYPE ChipType
Definition: eeprom.h:32
LIST_ENTRY ListEntry
Definition: eeprom.h:30
ULONG InterruptVector
Definition: eeprom.h:35
ULONG InterruptLevel
Definition: eeprom.h:34
ULONG BusNumber
Definition: eeprom.h:31
UCHAR SRomImage[ANYSIZE_ARRAY]
Definition: eeprom.h:37
ULONG DeviceBitmap
Definition: eeprom.h:36
Definition: eeprom.h:20
ULONG Length
Definition: eeprom.h:25
PUCHAR InfoLeaf
Definition: eeprom.h:24
Definition: typedefs.h:120
#define ANYSIZE_ARRAY
Definition: typedefs.h:46
const char * PCSTR
Definition: typedefs.h:52
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: xmlstorage.h:181