Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 5 additions & 6 deletions source/include/FreeRTOSIPConfigDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
* Type: TickType_t
* Unit: milliseconds
* Minimum: 0
* Maximum: portMAX_DELAY * portTICK_PERIOD_MS
* Maximum: ( portMAX_DELAY / configTICK_RATE_HZ ) * 1000
*
* Sets the timeout to wait for a response to a router
* solicitation message.
Expand All @@ -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 @@ -357,7 +357,7 @@ STATIC_ASSERT( ipconfigRA_SEARCH_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PER
* Type: TickType_t
* Unit: milliseconds
* Minimum: 0
* Maximum: portMAX_DELAY * portTICK_PERIOD_MS
* Maximum: ( portMAX_DELAY / configTICK_RATE_HZ ) * 1000
*
* Sets the timeout to wait for a response to a neighbour solicitation message.
*/
Expand All @@ -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 Expand Up @@ -1726,8 +1726,7 @@ STATIC_ASSERT( ipconfigTCP_KEEP_ALIVE_INTERVAL <= ( portMAX_DELAY / configTICK_R
* network buffers are themselves blocked waiting for a network buffer.
*
* ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS.
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().
*/

#ifndef ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
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
20 changes: 9 additions & 11 deletions test/Coverity/ConfigFiles/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@
* maximum allowable send block time prevents prevents a deadlock occurring when
* all the network buffers are in use and the tasks that process (and subsequently
* free) the network buffers are themselves blocked waiting for a network buffer.
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )

/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If
Expand All @@ -144,8 +143,7 @@
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000U / portTICK_PERIOD_MS )
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD pdMS_TO_TICKS( 120000U )

/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC
Expand All @@ -156,19 +154,19 @@
* cache then the UDP message is replaced by a ARP message that solicits the
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
* number of entries that can exist in the ARP table at any one time. */
#define ipconfigARP_CACHE_ENTRIES 6
#define ipconfigARP_CACHE_ENTRIES 6

/* ARP requests that do not result in an ARP response will be re-transmitted a
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
* aborted. */
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )

/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
* table being created or refreshed and the entry being removed because it is stale.
* New ARP requests are sent for ARP cache entries that are nearing their maximum
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
* equal to 1500 seconds (or 25 minutes). */
#define ipconfigMAX_ARP_AGE 150
#define ipconfigMAX_ARP_AGE 150

/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
* routines, which are relatively large. To save code space the full
Expand All @@ -180,13 +178,13 @@
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
#define ipconfigINCLUDE_FULL_INET_ADDR 1
#define ipconfigINCLUDE_FULL_INET_ADDR 1

/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
* are available to the IP stack. The total number of network buffers is limited
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
* to a pre-determinable value. */
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60U
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60U

/* A FreeRTOS queue is used to send events from application tasks to the IP
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
Expand Down
7 changes: 3 additions & 4 deletions test/build-combination/AllDisable/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@
* maximum allowable send block time prevents prevents a deadlock occurring when
* all the network buffers are in use and the tasks that process (and subsequently
* free) the network buffers are themselves blocked waiting for a network buffer.
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )

/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If
Expand Down
22 changes: 10 additions & 12 deletions test/build-combination/AllEnable/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@
* maximum allowable send block time prevents prevents a deadlock occurring when
* all the network buffers are in use and the tasks that process (and subsequently
* free) the network buffers are themselves blocked waiting for a network buffer.
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )

/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If
Expand All @@ -171,8 +170,7 @@
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000U / portTICK_PERIOD_MS )
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD pdMS_TO_TICKS( 120000U )

/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC
Expand All @@ -183,19 +181,19 @@
* cache then the UDP message is replaced by a ARP message that solicits the
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
* number of entries that can exist in the ARP table at any one time. */
#define ipconfigARP_CACHE_ENTRIES 6
#define ipconfigARP_CACHE_ENTRIES 6

/* ARP requests that do not result in an ARP response will be re-transmitted a
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
* aborted. */
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )

/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
* table being created or refreshed and the entry being removed because it is stale.
* New ARP requests are sent for ARP cache entries that are nearing their maximum
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
* equal to 1500 seconds (or 25 minutes). */
#define ipconfigMAX_ARP_AGE 150
#define ipconfigMAX_ARP_AGE 150

/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
* routines, which are relatively large. To save code space the full
Expand All @@ -207,13 +205,13 @@
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
#define ipconfigINCLUDE_FULL_INET_ADDR 1
#define ipconfigINCLUDE_FULL_INET_ADDR 1

/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
* are available to the IP stack. The total number of network buffers is limited
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
* to a pre-determinable value. */
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60

/* A FreeRTOS queue is used to send events from application tasks to the IP
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
Expand Down Expand Up @@ -287,7 +285,7 @@

/* The windows simulator cannot really simulate MAC interrupts, and needs to
* block occasionally to allow other tasks to run. */
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY pdMS_TO_TICKS( 20 )

/* Advanced only: in order to access 32-bit fields in the IP packets with
* 32-bit memory instructions, all packets will be stored 32-bit-aligned,
Expand Down
22 changes: 10 additions & 12 deletions test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@
* maximum allowable send block time prevents prevents a deadlock occurring when
* all the network buffers are in use and the tasks that process (and subsequently
* free) the network buffers are themselves blocked waiting for a network buffer.
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )

/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If
Expand All @@ -174,8 +173,7 @@
* static IP address passed as a parameter to FreeRTOS_IPInit() if the
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000U / portTICK_PERIOD_MS )
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD pdMS_TO_TICKS( 120000U )

/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC
Expand All @@ -186,19 +184,19 @@
* cache then the UDP message is replaced by a ARP message that solicits the
* required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum
* number of entries that can exist in the ARP table at any one time. */
#define ipconfigARP_CACHE_ENTRIES 6
#define ipconfigARP_CACHE_ENTRIES 6

/* ARP requests that do not result in an ARP response will be re-transmitted a
* maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is
* aborted. */
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )
#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 )

/* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP
* table being created or refreshed and the entry being removed because it is stale.
* New ARP requests are sent for ARP cache entries that are nearing their maximum
* age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is
* equal to 1500 seconds (or 25 minutes). */
#define ipconfigMAX_ARP_AGE 150
#define ipconfigMAX_ARP_AGE 150

/* Implementing FreeRTOS_inet_addr() necessitates the use of string handling
* routines, which are relatively large. To save code space the full
Expand All @@ -210,13 +208,13 @@
* ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and
* FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is
* not set to 1 then only FreeRTOS_indet_addr_quick() is available. */
#define ipconfigINCLUDE_FULL_INET_ADDR 1
#define ipconfigINCLUDE_FULL_INET_ADDR 1

/* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that
* are available to the IP stack. The total number of network buffers is limited
* to ensure the total amount of RAM that can be consumed by the IP stack is capped
* to a pre-determinable value. */
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 60

/* A FreeRTOS queue is used to send events from application tasks to the IP
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can
Expand Down Expand Up @@ -290,7 +288,7 @@

/* The windows simulator cannot really simulate MAC interrupts, and needs to
* block occasionally to allow other tasks to run. */
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY pdMS_TO_TICKS( 20 )

/* Advanced only: in order to access 32-bit fields in the IP packets with
* 32-bit memory instructions, all packets will be stored 32-bit-aligned,
Expand Down
2 changes: 1 addition & 1 deletion test/build-combination/Enable_IPv4_IPv6/FreeRTOSIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@

/* The windows simulator cannot really simulate MAC interrupts, and needs to
* block occasionally to allow other tasks to run. */
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS )
#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY pdMS_TO_TICKS( 20 )

/* Advanced only: in order to access 32-bit fields in the IP packets with
* 32-bit memory instructions, all packets will be stored 32-bit-aligned,
Expand Down
Loading