From e963de9aa152bad80e51ff28d1159fd0fa0443df Mon Sep 17 00:00:00 2001 From: aozima Date: Fri, 16 May 2014 18:37:13 +0800 Subject: [PATCH] update stm32f107 ethernet driver: add more debug cmd. --- bsp/stm32f107/drivers/stm32_eth.c | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/bsp/stm32f107/drivers/stm32_eth.c b/bsp/stm32f107/drivers/stm32_eth.c index 1870ac355f..f0de9a60d3 100644 --- a/bsp/stm32f107/drivers/stm32_eth.c +++ b/bsp/stm32f107/drivers/stm32_eth.c @@ -3606,3 +3606,56 @@ void rt_hw_stm32_eth_init() eth_device_init(&(stm32_eth_device.parent), "e0"); } +#ifdef RT_USING_FINSH +#include +static void phy_search(void) +{ + int i; + int value; + + for(i=0; i<32; i++) + { + value = ETH_ReadPHYRegister(i, 2); + rt_kprintf("addr %02d: %04X\n", i, value); + } +} +FINSH_FUNCTION_EXPORT(phy_search, search phy use MDIO); + +static void phy_dump(int addr) +{ + int i; + int value; + + rt_kprintf("dump phy addr %d\n", addr); + + for(i=0; i<32; i++) + { + value = ETH_ReadPHYRegister(addr, i); + rt_kprintf("reg %02d: %04X\n", i, value); + } +} +FINSH_FUNCTION_EXPORT(phy_dump, dump PHY register); + +static void phy_write(int addr, int reg, int value) +{ + ETH_WritePHYRegister(addr, reg ,value); +} +FINSH_FUNCTION_EXPORT(phy_write, write PHY register); + +static void emac_dump(int addr) +{ + int i; + int value; + int *p = (int *)ETH; + + rt_kprintf("dump EAMC reg %d\n", addr); + + for(i=0; i