Skip to content

Avoid portTICK_PERIOD_MS usage in library code #1242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/FreeRTOS_DNS_Cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
pxIP->xIPAddress.ulIP_IPv4 = 0U;
}

ulCurrentTimeSeconds = ( uint32_t ) ( ( xCurrentTickCount / portTICK_PERIOD_MS ) / 1000U );
ulCurrentTimeSeconds = ( uint32_t ) ( ( xCurrentTickCount / configTICK_RATE_HZ ) );
xResult = prvFindEntryIndex( pcName, pxIP, &uxIndex );

if( xResult == pdTRUE )
Expand Down
4 changes: 2 additions & 2 deletions source/FreeRTOS_DNS_Callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
* @param[in] pcHostName The hostname whose IP address is being searched for.
* @param[in] pvSearchID The search ID of the DNS callback function to set.
* @param[in] pCallbackFunction The callback function pointer.
* @param[in] uxTimeout Timeout of the callback function.
* @param[in] uxTimeout Timeout of the callback function in ms.
* @param[in] uxIdentifier Random number used as ID in the DNS message.
* @param[in] xIsIPv6 pdTRUE if the address type should be IPv6.
*/
Expand All @@ -145,7 +145,7 @@
DNSCallback_t * pxCallback = ( ( DNSCallback_t * ) pvPortMalloc( sizeof( *pxCallback ) + lLength ) );

/* Translate from ms to number of clock ticks. */
uxTimeout /= portTICK_PERIOD_MS;
uxTimeout = pdMS_TO_TICKS( uxTimeout );

if( pxCallback != NULL )
{
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_TCP_WIN.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
TickType_t uxNow = xTaskGetTickCount();
TickType_t uxDiff = uxNow - pxTimer->uxBorn;

return ( uint32_t ) ( uxDiff * portTICK_PERIOD_MS );
return ( uint32_t ) pdTICKS_TO_MS( uxDiff );
}
/*-----------------------------------------------------------*/

Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_Tiny_TCP.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
TickType_t uxNow = xTaskGetTickCount();
TickType_t uxDiff = uxNow - pxTimer->uxBorn;

return uxDiff * portTICK_PERIOD_MS;
return pdTICKS_TO_MS( uxDiff );
}
/*-----------------------------------------------------------*/

Expand Down
4 changes: 2 additions & 2 deletions source/include/FreeRTOSIPConfigDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
#error ipconfigRA_SEARCH_TIME_OUT_MSEC must be at least 0
#endif

STATIC_ASSERT( ipconfigRA_SEARCH_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PERIOD_MS ) );
STATIC_ASSERT( pdMS_TO_TICKS( ipconfigRA_SEARCH_TIME_OUT_MSEC ) <= portMAX_DELAY );

/*---------------------------------------------------------------------------*/

Expand Down Expand Up @@ -370,7 +370,7 @@ STATIC_ASSERT( ipconfigRA_SEARCH_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PER
#error ipconfigRA_IP_TEST_TIME_OUT_MSEC must be at least 0
#endif

STATIC_ASSERT( ipconfigRA_IP_TEST_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PERIOD_MS ) );
STATIC_ASSERT( pdMS_TO_TICKS( ipconfigRA_IP_TEST_TIME_OUT_MSEC ) <= portMAX_DELAY );

/*---------------------------------------------------------------------------*/

Expand Down
2 changes: 1 addition & 1 deletion source/portable/NetworkInterface/SH2A/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* task performing the transmit will block for niTX_BUFFER_FREE_WAIT
* milliseconds. It will do this a maximum of niMAX_TX_ATTEMPTS before giving
* up. */
#define niTX_BUFFER_FREE_WAIT ( ( TickType_t ) 2UL / portTICK_PERIOD_MS )
#define niTX_BUFFER_FREE_WAIT ( pdMS_TO_TICKS ( 2UL ) )
#define niMAX_TX_ATTEMPTS ( 5 )

/* The length of the queue used to send interrupt status words from the
Expand Down
Loading