Skip to content

Commit 9d9dbeb

Browse files
authored
Merge pull request #5 from bjsowa/dev-stm32-network-down
Support network down event and reinitialization
2 parents 0265752 + 41d699c commit 9d9dbeb

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

source/portable/NetworkInterface/STM32/NetworkInterface.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ static BaseType_t xSTM32_NetworkInterfaceInitialise( NetworkInterface_t * pxInte
395395

396396
case eMACInitComplete:
397397
configASSERT( xEthHandle.gState != HAL_ETH_STATE_ERROR );
398-
xInitResult = pdPASS;
398+
399+
if( xSTM32_GetPhyLinkStatus( pxInterface ) == pdPASS )
400+
{
401+
xInitResult = pdPASS;
402+
}
399403
}
400404

401405
return xInitResult;
@@ -696,16 +700,6 @@ static void prvEMACHandlerTask( void * pvParameters )
696700
if( xPhyCheckLinkStatus( &xPhyObject, xResult ) != pdFALSE )
697701
{
698702
prvEthernetUpdateConfig();
699-
700-
/*
701-
#if ( ipconfigSUPPORT_NETWORK_DOWN_EVENT != 0 )
702-
{
703-
if( xGetPhyLinkStatus() == pdFALSE )
704-
{
705-
FreeRTOS_NetworkDown();
706-
}
707-
}
708-
*/
709703
}
710704
}
711705
}
@@ -792,6 +786,10 @@ static void prvEthernetUpdateConfig( void )
792786
/* iptraceNETWORK_INTERFACE_STATUS_CHANGE(); */
793787
xHalResult = HAL_ETH_Stop_IT( &xEthHandle );
794788
configASSERT( xHalResult == HAL_OK );
789+
790+
#if ( ipconfigSUPPORT_NETWORK_DOWN_EVENT != 0 )
791+
FreeRTOS_NetworkDown( pxMyInterface );
792+
#endif
795793
}
796794
}
797795

0 commit comments

Comments
 (0)