memory: use sys_safememset() for /dev/zero
[minix.git] / drivers / fxp / mii.c
blobc8a8e8fcef191e4055b638de0bc90848491808ad
1 /*
2 ibm/mii.c
4 Created: Nov 2004 by Philip Homburg <philip@f-mnx.phicoh.com>
6 Media Independent (Ethernet) Interface functions
7 */
9 #include <minix/drivers.h>
10 #if __minix_vmd
11 #include "config.h"
12 #endif
14 #include "mii.h"
16 /*===========================================================================*
17 * mii_print_stat_speed *
18 *===========================================================================*/
19 void mii_print_stat_speed(u16_t stat, u16_t extstat)
21 int fs, ft;
23 fs= 1;
24 if (stat & MII_STATUS_EXT_STAT)
26 if (extstat & (MII_ESTAT_1000XFD | MII_ESTAT_1000XHD |
27 MII_ESTAT_1000TFD | MII_ESTAT_1000THD))
29 printf("1000 Mbps: ");
30 fs= 0;
31 ft= 1;
32 if (extstat & (MII_ESTAT_1000XFD | MII_ESTAT_1000XHD))
34 ft= 0;
35 printf("X-");
36 switch(extstat &
37 (MII_ESTAT_1000XFD|MII_ESTAT_1000XHD))
39 case MII_ESTAT_1000XFD: printf("FD"); break;
40 case MII_ESTAT_1000XHD: printf("HD"); break;
41 default: printf("FD/HD"); break;
44 if (extstat & (MII_ESTAT_1000TFD | MII_ESTAT_1000THD))
46 if (!ft)
47 printf(", ");
48 ft= 0;
49 printf("T-");
50 switch(extstat &
51 (MII_ESTAT_1000TFD|MII_ESTAT_1000THD))
53 case MII_ESTAT_1000TFD: printf("FD"); break;
54 case MII_ESTAT_1000THD: printf("HD"); break;
55 default: printf("FD/HD"); break;
60 if (stat & (MII_STATUS_100T4 |
61 MII_STATUS_100XFD | MII_STATUS_100XHD |
62 MII_STATUS_100T2FD | MII_STATUS_100T2HD))
64 if (!fs)
65 printf(", ");
66 fs= 0;
67 printf("100 Mbps: ");
68 ft= 1;
69 if (stat & MII_STATUS_100T4)
71 printf("T4");
72 ft= 0;
74 if (stat & (MII_STATUS_100XFD | MII_STATUS_100XHD))
76 if (!ft)
77 printf(", ");
78 ft= 0;
79 printf("TX-");
80 switch(stat & (MII_STATUS_100XFD|MII_STATUS_100XHD))
82 case MII_STATUS_100XFD: printf("FD"); break;
83 case MII_STATUS_100XHD: printf("HD"); break;
84 default: printf("FD/HD"); break;
87 if (stat & (MII_STATUS_100T2FD | MII_STATUS_100T2HD))
89 if (!ft)
90 printf(", ");
91 ft= 0;
92 printf("T2-");
93 switch(stat & (MII_STATUS_100T2FD|MII_STATUS_100T2HD))
95 case MII_STATUS_100T2FD: printf("FD"); break;
96 case MII_STATUS_100T2HD: printf("HD"); break;
97 default: printf("FD/HD"); break;
101 if (stat & (MII_STATUS_10FD | MII_STATUS_10HD))
103 if (!fs)
104 printf(", ");
105 printf("10 Mbps: ");
106 fs= 0;
107 printf("T-");
108 switch(stat & (MII_STATUS_10FD|MII_STATUS_10HD))
110 case MII_STATUS_10FD: printf("FD"); break;
111 case MII_STATUS_10HD: printf("HD"); break;
112 default: printf("FD/HD"); break;
117 /*===========================================================================*
118 * mii_print_techab *
119 *===========================================================================*/
120 void mii_print_techab(u16_t techab)
122 int fs, ft;
124 if ((techab & MII_ANA_SEL_M) != MII_ANA_SEL_802_3)
126 printf("strange selector 0x%x, value 0x%x",
127 techab & MII_ANA_SEL_M,
128 (techab & MII_ANA_TAF_M) >> MII_ANA_TAF_S);
129 return;
131 fs= 1;
132 if (techab & (MII_ANA_100T4 | MII_ANA_100TXFD | MII_ANA_100TXHD))
134 printf("100 Mbps: ");
135 fs= 0;
136 ft= 1;
137 if (techab & MII_ANA_100T4)
139 printf("T4");
140 ft= 0;
142 if (techab & (MII_ANA_100TXFD | MII_ANA_100TXHD))
144 if (!ft)
145 printf(", ");
146 ft= 0;
147 printf("TX-");
148 switch(techab & (MII_ANA_100TXFD|MII_ANA_100TXHD))
150 case MII_ANA_100TXFD: printf("FD"); break;
151 case MII_ANA_100TXHD: printf("HD"); break;
152 default: printf("FD/HD"); break;
156 if (techab & (MII_ANA_10TFD | MII_ANA_10THD))
158 if (!fs)
159 printf(", ");
160 printf("10 Mbps: ");
161 fs= 0;
162 printf("T-");
163 switch(techab & (MII_ANA_10TFD|MII_ANA_10THD))
165 case MII_ANA_10TFD: printf("FD"); break;
166 case MII_ANA_10THD: printf("HD"); break;
167 default: printf("FD/HD"); break;
170 if (techab & MII_ANA_PAUSE_SYM)
172 if (!fs)
173 printf(", ");
174 fs= 0;
175 printf("pause(SYM)");
177 if (techab & MII_ANA_PAUSE_ASYM)
179 if (!fs)
180 printf(", ");
181 fs= 0;
182 printf("pause(ASYM)");
184 if (techab & MII_ANA_TAF_RES)
186 if (!fs)
187 printf(", ");
188 fs= 0;
189 printf("0x%x", (techab & MII_ANA_TAF_RES) >> MII_ANA_TAF_S);
194 * $PchId: mii.c,v 1.2 2005/01/31 22:17:26 philip Exp $