Skip to content

Commit

Permalink
Update deprecated macros in network driver files (FreeRTOS#579)
Browse files Browse the repository at this point in the history
* Update deprecated macros in network driver files

* Fix typo in RX driver.

* Replace #warning with #error on test for deprecated macro.

* Fix doxygen check

Co-authored-by: PeterB <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>
  • Loading branch information
3 people authored and moninom1 committed Mar 15, 2023
1 parent d99fbf8 commit 4e4991d
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
fi
doxygen:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run doxygen build
Expand Down
24 changes: 14 additions & 10 deletions source/portable/NetworkInterface/ATSAM4E/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,20 @@
#define BMSR_LINK_STATUS 0x0004 /*!< Link status */
#endif

#ifndef PHY_LS_HIGH_CHECK_TIME_MS
#if defined( PHY_LS_HIGH_CHECK_TIME_MS ) || defined( PHY_LS_LOW_CHECK_TIME_MS )
#error please use the new defines with 'ipconfig' prefix
#endif

#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS

/* Check if the LinkSStatus in the PHY is still high after 15 seconds of not
/* Check if the LinkStatus in the PHY is still high after 15 seconds of not
* receiving packets. */
#define PHY_LS_HIGH_CHECK_TIME_MS 15000
#define ipconfigPHY_LS_HIGH_CHECK_TIME_MS 15000U
#endif

#ifndef PHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkSStatus in the PHY is still low every second. */
#define PHY_LS_LOW_CHECK_TIME_MS 1000
#ifndef ipconfigPHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkStatus in the PHY is still low every second. */
#define ipconfigPHY_LS_LOW_CHECK_TIME_MS 1000U
#endif

/* Interrupt events to process. Currently only the Rx event is processed
Expand Down Expand Up @@ -533,7 +537,7 @@ static void prvEMACHandlerTask( void * pvParameters )
configASSERT( xEMACTaskHandle != NULL );

vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );

for( ; ; )
{
Expand Down Expand Up @@ -624,7 +628,7 @@ static void prvEMACHandlerTask( void * pvParameters )
/* A packet was received. No need to check for the PHY status now,
* but set a timer to check it later on. */
vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
xResult = 0;
}
else if( xTaskCheckForTimeOut( &xPhyTime, &xPhyRemTime ) != pdFALSE )
Expand All @@ -642,11 +646,11 @@ static void prvEMACHandlerTask( void * pvParameters )

if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != 0 )
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
}
else
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/portable/NetworkInterface/Common/phyHandling.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#define phyMAX_PHY_ADDRESS 31

#if defined( PHY_LS_HIGH_CHECK_TIME_MS ) || defined( PHY_LS_LOW_CHECK_TIME_MS )
#warning please use the new defines with 'ipconfig' prefix
#error please use the new defines with 'ipconfig' prefix
#endif

#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS
Expand Down
25 changes: 15 additions & 10 deletions source/portable/NetworkInterface/LPC18xx/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,23 @@
/* The size of the stack allocated to the task that handles Rx packets. */
#define nwRX_TASK_STACK_SIZE 140

#ifndef PHY_LS_HIGH_CHECK_TIME_MS
#if defined( PHY_LS_HIGH_CHECK_TIME_MS ) || defined( PHY_LS_LOW_CHECK_TIME_MS )
#error please use the new defines with 'ipconfig' prefix
#endif

#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS

/* Check if the LinkSStatus in the PHY is still high after 15 seconds of not
/* Check if the LinkStatus in the PHY is still high after 15 seconds of not
* receiving packets. */
#define PHY_LS_HIGH_CHECK_TIME_MS 15000
#define ipconfigPHY_LS_HIGH_CHECK_TIME_MS 15000U
#endif

#ifndef PHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkSStatus in the PHY is still low every second. */
#define PHY_LS_LOW_CHECK_TIME_MS 1000
#ifndef ipconfigPHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkStatus in the PHY is still low every second. */
#define ipconfigPHY_LS_LOW_CHECK_TIME_MS 1000U
#endif


#ifndef configUSE_RMII
#define configUSE_RMII 1
#endif
Expand Down Expand Up @@ -1000,7 +1005,7 @@ static void prvEMACHandlerTask( void * pvParameters )
iptraceEMAC_TASK_STARTING();

vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );

for( ; ; )
{
Expand Down Expand Up @@ -1064,7 +1069,7 @@ static void prvEMACHandlerTask( void * pvParameters )
/* A packet was received. No need to check for the PHY status now,
* but set a timer to check it later on. */
vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
xResult = 0;
}
else if( xTaskCheckForTimeOut( &xPhyTime, &xPhyRemTime ) != pdFALSE )
Expand All @@ -1081,11 +1086,11 @@ static void prvEMACHandlerTask( void * pvParameters )

if( ( ulPHYLinkStatus & PHY_LINK_CONNECTED ) != 0 )
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
}
else
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
}
}
}
Expand Down
25 changes: 15 additions & 10 deletions source/portable/NetworkInterface/RX/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,23 @@
#endif
#endif /* if defined( BSP_MCU_RX65N ) || defined( BSP_MCU_RX64M ) || defined( BSP_MCU_RX71M ) */

#ifndef PHY_LS_HIGH_CHECK_TIME_MS
#if defined( PHY_LS_HIGH_CHECK_TIME_MS ) || defined( PHY_LS_LOW_CHECK_TIME_MS )
#error please use the new defines with 'ipconfig' prefix
#endif

#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS

/* Check if the LinkSStatus in the PHY is still high after 2 seconds of not
/* Check if the LinkStatus in the PHY is still high after 2 seconds of not
* receiving packets. */
#define PHY_LS_HIGH_CHECK_TIME_MS 2000
#define ipconfigPHY_LS_HIGH_CHECK_TIME_MS 2000U
#endif

#ifndef PHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkSStatus in the PHY is still low every second. */
#define PHY_LS_LOW_CHECK_TIME_MS 1000
#ifndef ipconfigPHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkStatus in the PHY is still low every second. */
#define ipconfigPHY_LS_LOW_CHECK_TIME_MS 1000U
#endif


/***********************************************************************************************************************
* Private global variables and functions
**********************************************************************************************************************/
Expand Down Expand Up @@ -225,7 +230,7 @@ static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )
const TickType_t ulMaxBlockTime = pdMS_TO_TICKS( 100UL );

vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );

FreeRTOS_printf( ( "Deferred Interrupt Handler Task started\n" ) );
xTaskToNotify = ether_receive_check_task_handle;
Expand Down Expand Up @@ -334,7 +339,7 @@ static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )
/* A packet was received. No need to check for the PHY status now,
* but set a timer to check it later on. */
vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );

/* Indicate that the Link Status is high, so that
* xNetworkInterfaceOutput() can send packets. */
Expand All @@ -358,11 +363,11 @@ static void prvEMACDeferredInterruptHandlerTask( void * pvParameters )

if( xPHYLinkStatus != 0 )
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
}
else
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
}
}
}
Expand Down
25 changes: 15 additions & 10 deletions source/portable/NetworkInterface/Zynq/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,23 @@

#define niBMSR_LINK_STATUS 0x0004uL

#ifndef PHY_LS_HIGH_CHECK_TIME_MS
#if defined( PHY_LS_HIGH_CHECK_TIME_MS ) || defined( PHY_LS_LOW_CHECK_TIME_MS )
#error please use the new defines with 'ipconfig' prefix
#endif

#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS

/* Check if the LinkSStatus in the PHY is still high after 15 seconds of not
/* Check if the LinkStatus in the PHY is still high after 15 seconds of not
* receiving packets. */
#define PHY_LS_HIGH_CHECK_TIME_MS 15000
#define ipconfigPHY_LS_HIGH_CHECK_TIME_MS 15000U
#endif

#ifndef PHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkSStatus in the PHY is still low every second. */
#define PHY_LS_LOW_CHECK_TIME_MS 1000
#ifndef ipconfigPHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkStatus in the PHY is still low every second. */
#define ipconfigPHY_LS_LOW_CHECK_TIME_MS 1000U
#endif


/* The size of each buffer when BufferAllocation_1 is used:
* http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/Embedded_Ethernet_Buffer_Management.html */
#define niBUFFER_1_PACKET_SIZE 1536
Expand Down Expand Up @@ -595,7 +600,7 @@ static void prvEMACHandlerTask( void * pvParameters )
iptraceEMAC_TASK_STARTING();

vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
FreeRTOS_printf( ( "prvEMACHandlerTask[ %ld ] started running\n", xEMACIndex ) );

for( ; ; )
Expand Down Expand Up @@ -638,7 +643,7 @@ static void prvEMACHandlerTask( void * pvParameters )
/* A packet was received. No need to check for the PHY status now,
* but set a timer to check it later on. */
vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
xResult = 0;
ulPHYLinkStates[ xEMACIndex ] |= niBMSR_LINK_STATUS;
}
Expand All @@ -656,11 +661,11 @@ static void prvEMACHandlerTask( void * pvParameters )

if( ( ulPHYLinkStates[ xEMACIndex ] & niBMSR_LINK_STATUS ) != 0 )
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
}
else
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
}
}
}
Expand Down
25 changes: 15 additions & 10 deletions source/portable/NetworkInterface/ksz8851snl/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,23 @@

#define BMSR_LINK_STATUS 0x0004 /*!< Link status */

#ifndef PHY_LS_HIGH_CHECK_TIME_MS
#if defined( PHY_LS_HIGH_CHECK_TIME_MS ) || defined( PHY_LS_LOW_CHECK_TIME_MS )
#error please use the new defines with 'ipconfig' prefix
#endif

#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS

/* Check if the LinkSStatus in the PHY is still high after 15 seconds of not
/* Check if the LinkStatus in the PHY is still high after 15 seconds of not
* receiving packets. */
#define PHY_LS_HIGH_CHECK_TIME_MS 15000
#define ipconfigPHY_LS_HIGH_CHECK_TIME_MS 15000U
#endif

#ifndef PHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkSStatus in the PHY is still low every second. */
#define PHY_LS_LOW_CHECK_TIME_MS 1000
#ifndef ipconfigPHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkStatus in the PHY is still low every second. */
#define ipconfigPHY_LS_LOW_CHECK_TIME_MS 1000U
#endif


/* Interrupt events to process. Currently only the Rx event is processed
* although code for other events is included to allow for possible future
* expansion. */
Expand Down Expand Up @@ -1225,7 +1230,7 @@ static void prvEMACHandlerTask( void * pvParameters )
configASSERT( xEMACTaskHandle != NULL );

vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
xLoggingTime = xTaskGetTickCount();

for( ; ; )
Expand Down Expand Up @@ -1301,7 +1306,7 @@ static void prvEMACHandlerTask( void * pvParameters )
/* A packet was received. No need to check for the PHY status now,
* but set a timer to check it later on. */
vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
xResult = 0;
}
else if( ( xTaskCheckForTimeOut( &xPhyTime, &xPhyRemTime ) != pdFALSE ) &&
Expand All @@ -1320,11 +1325,11 @@ static void prvEMACHandlerTask( void * pvParameters )

if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != 0 )
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
}
else
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,23 @@

#define niBMSR_LINK_STATUS 0x0004uL

#ifndef PHY_LS_HIGH_CHECK_TIME_MS
#if defined( PHY_LS_HIGH_CHECK_TIME_MS ) || defined( PHY_LS_LOW_CHECK_TIME_MS )
#error please use the new defines with 'ipconfig' prefix
#endif

#ifndef ipconfigPHY_LS_HIGH_CHECK_TIME_MS

/* Check if the LinkSStatus in the PHY is still high after 15 seconds of not
/* Check if the LinkStatus in the PHY is still high after 15 seconds of not
* receiving packets. */
#define PHY_LS_HIGH_CHECK_TIME_MS 15000
#define ipconfigPHY_LS_HIGH_CHECK_TIME_MS 15000U
#endif

#ifndef PHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkSStatus in the PHY is still low every second. */
#define PHY_LS_LOW_CHECK_TIME_MS 1000
#ifndef ipconfigPHY_LS_LOW_CHECK_TIME_MS
/* Check if the LinkStatus in the PHY is still low every second. */
#define ipconfigPHY_LS_LOW_CHECK_TIME_MS 1000U
#endif


#if ( ipconfigNETWORK_MTU > 1526 )
#warning the use of Jumbo Frames has not been tested sufficiently yet.
#define USE_JUMBO_FRAMES 1
Expand Down Expand Up @@ -470,7 +475,7 @@ static void prvEMACHandlerTask( void * pvParameters )
iptraceEMAC_TASK_STARTING();

vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );

for( ; ; )
{
Expand Down Expand Up @@ -512,7 +517,7 @@ static void prvEMACHandlerTask( void * pvParameters )
/* A packet was received. No need to check for the PHY status now,
* but set a timer to check it later on. */
vTaskSetTimeOutState( &xPhyTime );
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
xResult = 0;

if( ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) == 0uL )
Expand All @@ -537,11 +542,11 @@ static void prvEMACHandlerTask( void * pvParameters )

if( ( ulPHYLinkStatus & niBMSR_LINK_STATUS ) != 0uL )
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS );
}
else
{
xPhyRemTime = pdMS_TO_TICKS( PHY_LS_LOW_CHECK_TIME_MS );
xPhyRemTime = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS );
}
}
}
Expand Down

0 comments on commit 4e4991d

Please sign in to comment.