MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / list_eth

Function list_eth

bsp/efm32/drv_ethernet.c:1021–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1019#include <finsh.h>
1020
1021void list_eth(void)
1022{
1023 rt_uint16_t reg_phy;
1024 rt_uint8_t data;
1025
1026 rt_kprintf(" ENC28J60 on %s\n", ETH_USING_DEVICE_NAME);
1027 rt_kprintf(" ------------------------------\n");
1028 reg_phy = efm_eth_readPhy(PHSTAT2);
1029 if (reg_phy & PHSTAT2_PLRITY)
1030 {
1031 rt_kprintf(" Cable polarity is reversed\n");
1032 }
1033 else
1034 {
1035 rt_kprintf(" Cable polarity is correct\n");
1036 }
1037 if (reg_phy & PHSTAT2_DPXSTAT)
1038 {
1039 rt_kprintf(" Full-duplex mode\n");
1040 }
1041 else
1042 {
1043 rt_kprintf(" Half-duplex mode\n");
1044 }
1045 if (reg_phy & PHSTAT2_LSTAT)
1046 {
1047 rt_kprintf(" Link is up\n");
1048 }
1049 else
1050 {
1051 rt_kprintf(" Link is down\n");
1052 }
1053 if (reg_phy & PHSTAT2_COLSTAT)
1054 {
1055 rt_kprintf(" Collision is occuring\n");
1056 }
1057 else
1058 {
1059 rt_kprintf(" No collision\n");
1060 }
1061 if (reg_phy & PHSTAT2_RXSTAT)
1062 {
1063 rt_kprintf(" RX is busy\n");
1064 }
1065 else
1066 {
1067 rt_kprintf(" RX is idle\n");
1068 }
1069 if (reg_phy & PHSTAT2_TXSTAT)
1070 {
1071 rt_kprintf(" TX is busy\n");
1072 }
1073 else
1074 {
1075 rt_kprintf(" TX is idle\n");
1076 }
1077}
1078FINSH_FUNCTION_EXPORT(list_eth, list the Ethernet device status.)

Callers

nothing calls this directly

Calls 2

rt_kprintfFunction · 0.85
efm_eth_readPhyFunction · 0.85

Tested by

no test coverage detected