git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8032 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
Giovanni Di Sirio 2015-06-13 17:49:39 +00:00
parent f1b303a997
commit 02a30eeeac
3 changed files with 15 additions and 17 deletions

View File

@ -123,22 +123,20 @@ static void mii_find_phy(MACDriver *macp) {
uint32_t i; uint32_t i;
#if STM32_MAC_PHY_TIMEOUT > 0 #if STM32_MAC_PHY_TIMEOUT > 0
rtcnt_t start = chSysGetRealtimeCounterX(); unsigned n = STM32_MAC_PHY_TIMEOUT;
rtcnt_t timeout = start + MS2RTC(STM32_HCLK,STM32_MAC_PHY_TIMEOUT); do {
rtcnt_t time = start;
while (chSysIsCounterWithinX(time, start, timeout)) {
#endif #endif
for (i = 0; i < 31; i++) { for (i = 0U; i < 31U; i++) {
macp->phyaddr = i << 11; macp->phyaddr = i << 11U;
ETH->MACMIIDR = (i << 6) | MACMIIDR_CR; ETH->MACMIIDR = (i << 6U) | MACMIIDR_CR;
if ((mii_read(macp, MII_PHYSID1) == (BOARD_PHY_ID >> 16)) && if ((mii_read(macp, MII_PHYSID1) == (BOARD_PHY_ID >> 16U)) &&
((mii_read(macp, MII_PHYSID2) & 0xFFF0) == (BOARD_PHY_ID & 0xFFF0))) { ((mii_read(macp, MII_PHYSID2) & 0xFFF0U) == (BOARD_PHY_ID & 0xFFF0U))) {
return; return;
} }
} }
#if STM32_MAC_PHY_TIMEOUT > 0 #if STM32_MAC_PHY_TIMEOUT > 0
time = chSysGetRealtimeCounterX(); n--;
} } while (n > 0U);
#endif #endif
/* Wrong or defective board.*/ /* Wrong or defective board.*/
osalSysHalt("MAC failure"); osalSysHalt("MAC failure");

View File

@ -144,12 +144,11 @@
/** /**
* @brief PHY detection timeout. * @brief PHY detection timeout.
* @details Timeout, in milliseconds, for PHY address detection, if a PHY * @details Timeout for PHY address detection, the scan for a PHY is performed
* is not detected within the timeout then the driver halts during * the specified number of times before invoking the failure handler.
* initialization. This setting applies only if the PHY address is * This setting applies only if the PHY address is not explicitly
* not explicitly set in the board header file using * set in the board header file using @p BOARD_PHY_ADDRESS. A zero
* @p BOARD_PHY_ADDRESS. A zero value disables the timeout and a * value disables the timeout and a single search is performed.
* single search path is performed.
*/ */
#if !defined(STM32_MAC_PHY_TIMEOUT) || defined(__DOXYGEN__) #if !defined(STM32_MAC_PHY_TIMEOUT) || defined(__DOXYGEN__)
#define STM32_MAC_PHY_TIMEOUT 100 #define STM32_MAC_PHY_TIMEOUT 100

View File

@ -80,6 +80,7 @@
- NIL: Added INTC priorities check to the e200z port. - NIL: Added INTC priorities check to the e200z port.
- RT: Added INTC priorities check to the e200z port. - RT: Added INTC priorities check to the e200z port.
- HAL: Added support for extra DMA channels in STM32F072 devices. - HAL: Added support for extra DMA channels in STM32F072 devices.
- HAL: Fixed dependency between STM32 MAC driver and RT (bug #606).
- HAL: Fixed wrong macro names in STM32F0xx HAL driver (bug #605). - HAL: Fixed wrong macro names in STM32F0xx HAL driver (bug #605).
- HAL: Fixed wrong check on ADC3 in STM32F3xx ADC driver (bug #604). - HAL: Fixed wrong check on ADC3 in STM32F3xx ADC driver (bug #604).
- HAL: Fixed wrong macro names in STM32F3xx HAL driver (bug #603). - HAL: Fixed wrong macro names in STM32F3xx HAL driver (bug #603).