The Pedigree Project 0.1
3Com90xConstants.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef NIC_3COM90X_CONSTANTS_H
21#define NIC_3COM90X_CONSTANTS_H
22
27#define MAX_PACKET_SIZE 0xFFFF
28
29#define NUM_UPDS 32
30
31#define XCVR_MAGIC (0x5A00)
36#define XMIT_RETRIES 2 // 250
37
38/*** Register definitions for the 3c905 ***/
39enum Registers {
40 regPowerMgmtCtrl_w = 0x7c,
41 regUpMaxBurst_w = 0x7a,
42 regDnMaxBurst_w = 0x78,
43 regDebugControl_w = 0x74,
44 regDebugData_l = 0x70,
45 regRealTimeCnt_l = 0x40,
46 regUpBurstThresh_b = 0x3e,
47 regUpPoll_b = 0x3d,
48 regUpPriorityThresh_b = 0x3c,
49 regUpListPtr_l = 0x38,
50 regCountdown_w = 0x36,
51 regFreeTimer_w = 0x34,
52 regUpPktStatus_l = 0x30,
53 regTxFreeThresh_b = 0x2f,
54 regDnPoll_b = 0x2d,
55 regDnPriorityThresh_b = 0x2c,
56 regDnBurstThresh_b = 0x2a,
57 regDnListPtr_l = 0x24,
58 regDmaCtrl_l = 0x20,
60 regIntStatusAuto_w = 0x1e,
61 regTxStatus_b = 0x1b,
62 regTimer_b = 0x1a,
63 regTxPktId_b = 0x18,
64 regCommandIntStatus_w = 0x0e,
65};
66
68enum Registers7 {
69 regPowerMgmtEvent_7_w = 0x0c,
70 regVlanEtherType_7_w = 0x04,
71 regVlanMask_7_w = 0x00,
72};
73
74enum Registers6 {
75 regBytesXmittedOk_6_w = 0x0c,
76 regBytesRcvdOk_6_w = 0x0a,
77 regUpperFramesOk_6_b = 0x09,
78 regFramesDeferred_6_b = 0x08,
79 regFramesRecdOk_6_b = 0x07,
80 regFramesXmittedOk_6_b = 0x06,
81 regRxOverruns_6_b = 0x05,
82 regLateCollisions_6_b = 0x04,
83 regSingleCollisions_6_b = 0x03,
84 regMultipleCollisions_6_b = 0x02,
85 regSqeErrors_6_b = 0x01,
86 regCarrierLost_6_b = 0x00,
87};
88
89enum Registers5 {
90 regIndicationEnable_5_w = 0x0c,
91 regInterruptEnable_5_w = 0x0a,
92 regTxReclaimThresh_5_b = 0x09,
93 regRxFilter_5_b = 0x08,
94 regRxEarlyThresh_5_w = 0x06,
95 regTxStartThresh_5_w = 0x00,
96};
97
98enum Registers4 {
99 regUpperBytesOk_4_b = 0x0d,
100 regBadSSD_4_b = 0x0c,
101 regMediaStatus_4_w = 0x0a,
102 regPhysicalMgmt_4_w = 0x08,
103 regNetworkDiagnostic_4_w = 0x06,
104 regFifoDiagnostic_4_w = 0x04,
105 regVcoDiagnostic_4_w = 0x02,
106};
107
108enum Registers3 {
109 regTxFree_3_w = 0x0c,
110 regRxFree_3_w = 0x0a,
111 regResetMediaOptions_3_w = 0x08,
113 regMacControl_3_w = 0x06,
114 regMaxPktSize_3_w = 0x04,
115 regInternalConfig_3_l = 0x00,
117};
118
119enum Registers2 {
120 regResetOptions_2_w = 0x0c,
121 regStationMask_2_3w = 0x06,
122 regStationAddress_2_3w = 0x00,
123};
124
125enum Registers1 {
126 regRxStatus_1_w = 0x0a,
127};
128
129enum Registers0 {
130 regEepromData_0_w = 0x0c,
131 regEepromCommand_0_w = 0x0a,
132 regBiosRomData_0_b = 0x08,
133 regBiosRomAddr_0_l = 0x04,
134};
135
136/*** The names for the eight register windows ***/
137enum Windows {
138 winPowerVlan7 = 0x07,
139 winStatistics6 = 0x06,
140 winTxRxControl5 = 0x05,
141 winDiagnostics4 = 0x04,
142 winTxRxOptions3 = 0x03,
143 winAddressing2 = 0x02,
144 winUnused1 = 0x01,
145 winEepromBios0 = 0x00,
146};
147
148/*** Command definitions for the 3c90X ***/
149enum Commands {
150 cmdGlobalReset = 0x00,
151 cmdSelectRegisterWindow = 0x01,
152 cmdEnableDcConverter = 0x02,
153 cmdRxDisable = 0x03,
154 cmdRxEnable = 0x04,
155 cmdRxReset = 0x05,
156 cmdStallCtl = 0x06,
157 cmdTxEnable = 0x09,
158 cmdTxDisable = 0x0A,
159 cmdTxReset = 0x0B,
160 cmdRequestInterrupt = 0x0C,
161 cmdAcknowledgeInterrupt = 0x0D,
162 cmdSetInterruptEnable = 0x0E,
163 cmdSetIndicationEnable = 0x0F,
164 cmdSetRxFilter = 0x10,
165 cmdSetRxEarlyThresh = 0x11,
166 cmdSetTxStartThresh = 0x13,
167 cmdStatisticsEnable = 0x15,
168 cmdStatisticsDisable = 0x16,
169 cmdDisableDcConverter = 0x17,
170 cmdSetTxReclaimThresh = 0x18,
171 cmdSetHashFilterBit = 0x19,
172};
173
174/*** Values for int status register bitmask **/
175#define INT_INTERRUPTLATCH (1 << 0)
176#define INT_HOSTERROR (1 << 1)
177#define INT_TXCOMPLETE (1 << 2)
178#define INT_RXCOMPLETE (1 << 4)
179#define INT_RXEARLY (1 << 5)
180#define INT_INTREQUESTED (1 << 6)
181#define INT_UPDATESTATS (1 << 7)
182#define INT_LINKEVENT (1 << 8)
183#define INT_DNCOMPLETE (1 << 9)
184#define INT_UPCOMPLETE (1 << 10)
185#define INT_DMAINPROGRESS (1 << 11)
186#define INT_CMDINPROGRESS (1 << 12)
187#define INT_WINDOWNUMBER (7 << 13)
188
189#define ENABLED_INTS \
190 (INT_UPCOMPLETE | INT_HOSTERROR | INT_DNCOMPLETE | INT_TXCOMPLETE | INT_INTERRUPTLATCH)
191
192#endif