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)
32 
36 #define XMIT_RETRIES 2 // 250
37 
38 /*** Register definitions for the 3c905 ***/
39 enum Registers
40 {
41  regPowerMgmtCtrl_w = 0x7c,
42  regUpMaxBurst_w = 0x7a,
43  regDnMaxBurst_w = 0x78,
44  regDebugControl_w = 0x74,
45  regDebugData_l = 0x70,
46  regRealTimeCnt_l = 0x40,
47  regUpBurstThresh_b = 0x3e,
48  regUpPoll_b = 0x3d,
49  regUpPriorityThresh_b = 0x3c,
50  regUpListPtr_l = 0x38,
51  regCountdown_w = 0x36,
52  regFreeTimer_w = 0x34,
53  regUpPktStatus_l = 0x30,
54  regTxFreeThresh_b = 0x2f,
55  regDnPoll_b = 0x2d,
56  regDnPriorityThresh_b = 0x2c,
57  regDnBurstThresh_b = 0x2a,
58  regDnListPtr_l = 0x24,
59  regDmaCtrl_l = 0x20,
61  regIntStatusAuto_w = 0x1e,
62  regTxStatus_b = 0x1b,
63  regTimer_b = 0x1a,
64  regTxPktId_b = 0x18,
65  regCommandIntStatus_w = 0x0e,
66 };
67 
69 enum Registers7
70 {
71  regPowerMgmtEvent_7_w = 0x0c,
72  regVlanEtherType_7_w = 0x04,
73  regVlanMask_7_w = 0x00,
74 };
75 
76 enum Registers6
77 {
78  regBytesXmittedOk_6_w = 0x0c,
79  regBytesRcvdOk_6_w = 0x0a,
80  regUpperFramesOk_6_b = 0x09,
81  regFramesDeferred_6_b = 0x08,
82  regFramesRecdOk_6_b = 0x07,
83  regFramesXmittedOk_6_b = 0x06,
84  regRxOverruns_6_b = 0x05,
85  regLateCollisions_6_b = 0x04,
86  regSingleCollisions_6_b = 0x03,
87  regMultipleCollisions_6_b = 0x02,
88  regSqeErrors_6_b = 0x01,
89  regCarrierLost_6_b = 0x00,
90 };
91 
92 enum Registers5
93 {
94  regIndicationEnable_5_w = 0x0c,
95  regInterruptEnable_5_w = 0x0a,
96  regTxReclaimThresh_5_b = 0x09,
97  regRxFilter_5_b = 0x08,
98  regRxEarlyThresh_5_w = 0x06,
99  regTxStartThresh_5_w = 0x00,
100 };
101 
102 enum Registers4
103 {
104  regUpperBytesOk_4_b = 0x0d,
105  regBadSSD_4_b = 0x0c,
106  regMediaStatus_4_w = 0x0a,
107  regPhysicalMgmt_4_w = 0x08,
108  regNetworkDiagnostic_4_w = 0x06,
109  regFifoDiagnostic_4_w = 0x04,
110  regVcoDiagnostic_4_w = 0x02,
111 };
112 
113 enum Registers3
114 {
115  regTxFree_3_w = 0x0c,
116  regRxFree_3_w = 0x0a,
117  regResetMediaOptions_3_w = 0x08,
119  regMacControl_3_w = 0x06,
120  regMaxPktSize_3_w = 0x04,
121  regInternalConfig_3_l = 0x00,
123 };
124 
125 enum Registers2
126 {
127  regResetOptions_2_w = 0x0c,
128  regStationMask_2_3w = 0x06,
129  regStationAddress_2_3w = 0x00,
130 };
131 
132 enum Registers1
133 {
134  regRxStatus_1_w = 0x0a,
135 };
136 
137 enum Registers0
138 {
139  regEepromData_0_w = 0x0c,
140  regEepromCommand_0_w = 0x0a,
141  regBiosRomData_0_b = 0x08,
142  regBiosRomAddr_0_l = 0x04,
143 };
144 
145 /*** The names for the eight register windows ***/
146 enum Windows
147 {
148  winPowerVlan7 = 0x07,
149  winStatistics6 = 0x06,
150  winTxRxControl5 = 0x05,
151  winDiagnostics4 = 0x04,
152  winTxRxOptions3 = 0x03,
153  winAddressing2 = 0x02,
154  winUnused1 = 0x01,
155  winEepromBios0 = 0x00,
156 };
157 
158 /*** Command definitions for the 3c90X ***/
159 enum Commands
160 {
161  cmdGlobalReset = 0x00,
162  cmdSelectRegisterWindow = 0x01,
163  cmdEnableDcConverter = 0x02,
164  cmdRxDisable = 0x03,
165  cmdRxEnable = 0x04,
166  cmdRxReset = 0x05,
167  cmdStallCtl = 0x06,
168  cmdTxEnable = 0x09,
169  cmdTxDisable = 0x0A,
170  cmdTxReset = 0x0B,
171  cmdRequestInterrupt = 0x0C,
172  cmdAcknowledgeInterrupt = 0x0D,
173  cmdSetInterruptEnable = 0x0E,
174  cmdSetIndicationEnable = 0x0F,
175  cmdSetRxFilter = 0x10,
176  cmdSetRxEarlyThresh = 0x11,
177  cmdSetTxStartThresh = 0x13,
178  cmdStatisticsEnable = 0x15,
179  cmdStatisticsDisable = 0x16,
180  cmdDisableDcConverter = 0x17,
181  cmdSetTxReclaimThresh = 0x18,
182  cmdSetHashFilterBit = 0x19,
183 };
184 
185 /*** Values for int status register bitmask **/
186 #define INT_INTERRUPTLATCH (1 << 0)
187 #define INT_HOSTERROR (1 << 1)
188 #define INT_TXCOMPLETE (1 << 2)
189 #define INT_RXCOMPLETE (1 << 4)
190 #define INT_RXEARLY (1 << 5)
191 #define INT_INTREQUESTED (1 << 6)
192 #define INT_UPDATESTATS (1 << 7)
193 #define INT_LINKEVENT (1 << 8)
194 #define INT_DNCOMPLETE (1 << 9)
195 #define INT_UPCOMPLETE (1 << 10)
196 #define INT_DMAINPROGRESS (1 << 11)
197 #define INT_CMDINPROGRESS (1 << 12)
198 #define INT_WINDOWNUMBER (7 << 13)
199 
200 #define ENABLED_INTS \
201  (INT_UPCOMPLETE | INT_UPDATESTATS | INT_HOSTERROR | INT_DNCOMPLETE | \
202  INT_TXCOMPLETE | INT_INTERRUPTLATCH)
203 
204 #endif