添加了牛皮藓,主要方便不知情的人联系我。有洁癖者自己去除代码,在
[ddnasgpl.git] / diag / diag_gbe.c
blob523af000c196bdaa8d2d076e7b9a5cf2ae3e4b92
1 #include <common.h>
3 #include "diag.h"
4 #include "eth-phy/mvEthPhy.h"
5 #include "mvBoardEnvLib.h"
7 /*******************************************************************************
9 * Name : gbe_link_detect_test
10 * Description : GbE Link Detection Test
12 * Input arg : None
13 * Output arg : None
14 * Return : Returns 1 on failure, else 0
15 *******************************************************************************/
17 int gbe_link_detect_test()
19 unsigned int val = 0;
20 unsigned int result = 0;
22 /* read specific status reg */
23 if( mvEthPhyRegRead( mvBoardPhyAddrGet(0), ETH_PHY_SPEC_STATUS_REG, &val) != MV_OK )
24 return MV_ERROR;
26 switch (val & ETH_PHY_SPEC_STATUS_SPEED_MASK)
28 case ETH_PHY_SPEC_STATUS_SPEED_1000MBPS:
29 printf( "\tSpeed: 1000 Mbps, " );
30 break;
31 case ETH_PHY_SPEC_STATUS_SPEED_100MBPS:
32 printf( "\tSpeed: 100 Mbps, " );
33 break;
34 case ETH_PHY_SPEC_STATUS_SPEED_10MBPS:
35 printf( "\tSpeed: 10 Mbps, " );
36 default:
37 printf( "\tSpeed: Uknown, " );
38 break;
41 if( val & ETH_PHY_SPEC_STATUS_DUPLEX_MASK )
43 printf( "Duplex: Full, " );
45 else
47 printf( "Duplex: Half, " );
50 if( val & ETH_PHY_SPEC_STATUS_LINK_MASK )
52 printf("Link: up\n");
53 result = 1;
55 else
57 printf("Link: down\n");
58 result = 0;
60 printf("\tGbE link detect test ");
61 printf(((result)? "PASSED\n":"FAILED\n"));
63 return 0;
66 /*******************************************************************************
68 * Name : gbe_mac_loopback_test
69 * Description : GbE MAC Loopback Test
71 * Input arg : None
72 * Output arg : None
73 * Return : Returns 1 on failure, else 0
74 *******************************************************************************/
76 int gbe_mac_loopback_test(void)
78 printf("\tGbE mac loopback test ");
80 printf("PASSED\n");
81 return 0;
84 /*******************************************************************************
86 * Name : gbe_external_loopback_test
87 * Description : GbE External Loopback Test
88 * Input arg : None
89 * Output arg : None
90 * Return : Returns 1 on failure, else 0
91 *******************************************************************************/
93 int gbe_external_loopback_test(void)
95 printf("\tGbE external loopback test ");
97 printf("PASSED\n");
98 return 0;