source: trunk/minix/drivers/fxp/mii.c@ 12

Last change on this file since 12 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 4.1 KB
Line 
1/*
2ibm/mii.c
3
4Created: Nov 2004 by Philip Homburg <philip@f-mnx.phicoh.com>
5
6Media Independent (Ethernet) Interface functions
7*/
8
9#include "../drivers.h"
10#if __minix_vmd
11#include "config.h"
12#endif
13
14#include "mii.h"
15
16/*===========================================================================*
17 * mii_print_stat_speed *
18 *===========================================================================*/
19PUBLIC void mii_print_stat_speed(stat, extstat)
20u16_t stat;
21u16_t extstat;
22{
23 int fs, ft;
24
25 fs= 1;
26 if (stat & MII_STATUS_EXT_STAT)
27 {
28 if (extstat & (MII_ESTAT_1000XFD | MII_ESTAT_1000XHD |
29 MII_ESTAT_1000TFD | MII_ESTAT_1000THD))
30 {
31 printf("1000 Mbps: ");
32 fs= 0;
33 ft= 1;
34 if (extstat & (MII_ESTAT_1000XFD | MII_ESTAT_1000XHD))
35 {
36 ft= 0;
37 printf("X-");
38 switch(extstat &
39 (MII_ESTAT_1000XFD|MII_ESTAT_1000XHD))
40 {
41 case MII_ESTAT_1000XFD: printf("FD"); break;
42 case MII_ESTAT_1000XHD: printf("HD"); break;
43 default: printf("FD/HD"); break;
44 }
45 }
46 if (extstat & (MII_ESTAT_1000TFD | MII_ESTAT_1000THD))
47 {
48 if (!ft)
49 printf(", ");
50 ft= 0;
51 printf("T-");
52 switch(extstat &
53 (MII_ESTAT_1000TFD|MII_ESTAT_1000THD))
54 {
55 case MII_ESTAT_1000TFD: printf("FD"); break;
56 case MII_ESTAT_1000THD: printf("HD"); break;
57 default: printf("FD/HD"); break;
58 }
59 }
60 }
61 }
62 if (stat & (MII_STATUS_100T4 |
63 MII_STATUS_100XFD | MII_STATUS_100XHD |
64 MII_STATUS_100T2FD | MII_STATUS_100T2HD))
65 {
66 if (!fs)
67 printf(", ");
68 fs= 0;
69 printf("100 Mbps: ");
70 ft= 1;
71 if (stat & MII_STATUS_100T4)
72 {
73 printf("T4");
74 ft= 0;
75 }
76 if (stat & (MII_STATUS_100XFD | MII_STATUS_100XHD))
77 {
78 if (!ft)
79 printf(", ");
80 ft= 0;
81 printf("TX-");
82 switch(stat & (MII_STATUS_100XFD|MII_STATUS_100XHD))
83 {
84 case MII_STATUS_100XFD: printf("FD"); break;
85 case MII_STATUS_100XHD: printf("HD"); break;
86 default: printf("FD/HD"); break;
87 }
88 }
89 if (stat & (MII_STATUS_100T2FD | MII_STATUS_100T2HD))
90 {
91 if (!ft)
92 printf(", ");
93 ft= 0;
94 printf("T2-");
95 switch(stat & (MII_STATUS_100T2FD|MII_STATUS_100T2HD))
96 {
97 case MII_STATUS_100T2FD: printf("FD"); break;
98 case MII_STATUS_100T2HD: printf("HD"); break;
99 default: printf("FD/HD"); break;
100 }
101 }
102 }
103 if (stat & (MII_STATUS_10FD | MII_STATUS_10HD))
104 {
105 if (!fs)
106 printf(", ");
107 printf("10 Mbps: ");
108 fs= 0;
109 printf("T-");
110 switch(stat & (MII_STATUS_10FD|MII_STATUS_10HD))
111 {
112 case MII_STATUS_10FD: printf("FD"); break;
113 case MII_STATUS_10HD: printf("HD"); break;
114 default: printf("FD/HD"); break;
115 }
116 }
117}
118
119/*===========================================================================*
120 * mii_print_techab *
121 *===========================================================================*/
122PUBLIC void mii_print_techab(techab)
123u16_t techab;
124{
125 int fs, ft;
126
127 if ((techab & MII_ANA_SEL_M) != MII_ANA_SEL_802_3)
128 {
129 printf("strange selector 0x%x, value 0x%x",
130 techab & MII_ANA_SEL_M,
131 (techab & MII_ANA_TAF_M) >> MII_ANA_TAF_S);
132 return;
133 }
134 fs= 1;
135 if (techab & (MII_ANA_100T4 | MII_ANA_100TXFD | MII_ANA_100TXHD))
136 {
137 printf("100 Mbps: ");
138 fs= 0;
139 ft= 1;
140 if (techab & MII_ANA_100T4)
141 {
142 printf("T4");
143 ft= 0;
144 }
145 if (techab & (MII_ANA_100TXFD | MII_ANA_100TXHD))
146 {
147 if (!ft)
148 printf(", ");
149 ft= 0;
150 printf("TX-");
151 switch(techab & (MII_ANA_100TXFD|MII_ANA_100TXHD))
152 {
153 case MII_ANA_100TXFD: printf("FD"); break;
154 case MII_ANA_100TXHD: printf("HD"); break;
155 default: printf("FD/HD"); break;
156 }
157 }
158 }
159 if (techab & (MII_ANA_10TFD | MII_ANA_10THD))
160 {
161 if (!fs)
162 printf(", ");
163 printf("10 Mbps: ");
164 fs= 0;
165 printf("T-");
166 switch(techab & (MII_ANA_10TFD|MII_ANA_10THD))
167 {
168 case MII_ANA_10TFD: printf("FD"); break;
169 case MII_ANA_10THD: printf("HD"); break;
170 default: printf("FD/HD"); break;
171 }
172 }
173 if (techab & MII_ANA_PAUSE_SYM)
174 {
175 if (!fs)
176 printf(", ");
177 fs= 0;
178 printf("pause(SYM)");
179 }
180 if (techab & MII_ANA_PAUSE_ASYM)
181 {
182 if (!fs)
183 printf(", ");
184 fs= 0;
185 printf("pause(ASYM)");
186 }
187 if (techab & MII_ANA_TAF_RES)
188 {
189 if (!fs)
190 printf(", ");
191 fs= 0;
192 printf("0x%x", (techab & MII_ANA_TAF_RES) >> MII_ANA_TAF_S);
193 }
194}
195
196/*
197 * $PchId: mii.c,v 1.2 2005/01/31 22:17:26 philip Exp $
198 */
Note: See TracBrowser for help on using the repository browser.