Skip to content

Commit a1fbf3a

Browse files
Merge branch 'main' into lr02
2 parents b5b0dc6 + 2b7ab23 commit a1fbf3a

File tree

39 files changed

+197
-235
lines changed

39 files changed

+197
-235
lines changed

source/FreeRTOS_DNS_Cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
pxIP->xIPAddress.ulIP_IPv4 = 0U;
221221
}
222222

223-
ulCurrentTimeSeconds = ( uint32_t ) ( ( xCurrentTickCount / portTICK_PERIOD_MS ) / 1000U );
223+
ulCurrentTimeSeconds = ( uint32_t ) ( ( xCurrentTickCount / configTICK_RATE_HZ ) );
224224
xResult = prvFindEntryIndex( pcName, pxIP, &uxIndex );
225225

226226
if( xResult == pdTRUE )

source/FreeRTOS_DNS_Callback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
* @param[in] pcHostName The hostname whose IP address is being searched for.
126126
* @param[in] pvSearchID The search ID of the DNS callback function to set.
127127
* @param[in] pCallbackFunction The callback function pointer.
128-
* @param[in] uxTimeout Timeout of the callback function.
128+
* @param[in] uxTimeout Timeout of the callback function in ms.
129129
* @param[in] uxIdentifier Random number used as ID in the DNS message.
130130
* @param[in] xIsIPv6 pdTRUE if the address type should be IPv6.
131131
*/
@@ -145,7 +145,7 @@
145145
DNSCallback_t * pxCallback = ( ( DNSCallback_t * ) pvPortMalloc( sizeof( *pxCallback ) + lLength ) );
146146

147147
/* Translate from ms to number of clock ticks. */
148-
uxTimeout /= portTICK_PERIOD_MS;
148+
uxTimeout = pdMS_TO_TICKS( uxTimeout );
149149

150150
if( pxCallback != NULL )
151151
{

source/FreeRTOS_TCP_WIN.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@
374374
TickType_t uxNow = xTaskGetTickCount();
375375
TickType_t uxDiff = uxNow - pxTimer->uxBorn;
376376

377-
return ( uint32_t ) ( uxDiff * portTICK_PERIOD_MS );
377+
return ( uint32_t ) pdTICKS_TO_MS( uxDiff );
378378
}
379379
/*-----------------------------------------------------------*/
380380

source/FreeRTOS_Tiny_TCP.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
TickType_t uxNow = xTaskGetTickCount();
125125
TickType_t uxDiff = uxNow - pxTimer->uxBorn;
126126

127-
return uxDiff * portTICK_PERIOD_MS;
127+
return pdTICKS_TO_MS( uxDiff );
128128
}
129129
/*-----------------------------------------------------------*/
130130

source/include/FreeRTOSIPConfigDefaults.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
* Type: TickType_t
309309
* Unit: milliseconds
310310
* Minimum: 0
311-
* Maximum: portMAX_DELAY * portTICK_PERIOD_MS
311+
* Maximum: ( portMAX_DELAY / configTICK_RATE_HZ ) * 1000
312312
*
313313
* Sets the timeout to wait for a response to a router
314314
* solicitation message.
@@ -322,7 +322,7 @@
322322
#error ipconfigRA_SEARCH_TIME_OUT_MSEC must be at least 0
323323
#endif
324324

325-
STATIC_ASSERT( ipconfigRA_SEARCH_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PERIOD_MS ) );
325+
STATIC_ASSERT( pdMS_TO_TICKS( ipconfigRA_SEARCH_TIME_OUT_MSEC ) <= portMAX_DELAY );
326326

327327
/*---------------------------------------------------------------------------*/
328328

@@ -357,7 +357,7 @@ STATIC_ASSERT( ipconfigRA_SEARCH_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PER
357357
* Type: TickType_t
358358
* Unit: milliseconds
359359
* Minimum: 0
360-
* Maximum: portMAX_DELAY * portTICK_PERIOD_MS
360+
* Maximum: ( portMAX_DELAY / configTICK_RATE_HZ ) * 1000
361361
*
362362
* Sets the timeout to wait for a response to a neighbour solicitation message.
363363
*/
@@ -370,7 +370,7 @@ STATIC_ASSERT( ipconfigRA_SEARCH_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PER
370370
#error ipconfigRA_IP_TEST_TIME_OUT_MSEC must be at least 0
371371
#endif
372372

373-
STATIC_ASSERT( ipconfigRA_IP_TEST_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PERIOD_MS ) );
373+
STATIC_ASSERT( pdMS_TO_TICKS( ipconfigRA_IP_TEST_TIME_OUT_MSEC ) <= portMAX_DELAY );
374374

375375
/*---------------------------------------------------------------------------*/
376376

@@ -1726,8 +1726,7 @@ STATIC_ASSERT( ipconfigTCP_KEEP_ALIVE_INTERVAL <= ( portMAX_DELAY / configTICK_R
17261726
* network buffers are themselves blocked waiting for a network buffer.
17271727
*
17281728
* ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
1729-
* milliseconds can be converted to a time in ticks by dividing the time in
1730-
* milliseconds by portTICK_PERIOD_MS.
1729+
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().
17311730
*/
17321731

17331732
#ifndef ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS

source/portable/NetworkInterface/SH2A/NetworkInterface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
* task performing the transmit will block for niTX_BUFFER_FREE_WAIT
5656
* milliseconds. It will do this a maximum of niMAX_TX_ATTEMPTS before giving
5757
* up. */
58-
#define niTX_BUFFER_FREE_WAIT ( ( TickType_t ) 2UL / portTICK_PERIOD_MS )
58+
#define niTX_BUFFER_FREE_WAIT ( pdMS_TO_TICKS( 2UL ) )
5959
#define niMAX_TX_ATTEMPTS ( 5 )
6060

6161
/* The length of the queue used to send interrupt status words from the

test/Coverity/ConfigFiles/FreeRTOSIPConfig.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,9 @@
116116
* maximum allowable send block time prevents prevents a deadlock occurring when
117117
* all the network buffers are in use and the tasks that process (and subsequently
118118
* free) the network buffers are themselves blocked waiting for a network buffer.
119-
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
120-
* milliseconds can be converted to a time in ticks by dividing the time in
121-
* milliseconds by portTICK_PERIOD_MS. */
122-
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
119+
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
120+
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
121+
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )
123122

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

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

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

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

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

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

191189
/* A FreeRTOS queue is used to send events from application tasks to the IP
192190
* stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can

test/build-combination/AllDisable/FreeRTOSIPConfig.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,9 @@
112112
* maximum allowable send block time prevents prevents a deadlock occurring when
113113
* all the network buffers are in use and the tasks that process (and subsequently
114114
* free) the network buffers are themselves blocked waiting for a network buffer.
115-
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
116-
* milliseconds can be converted to a time in ticks by dividing the time in
117-
* milliseconds by portTICK_PERIOD_MS. */
118-
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
115+
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
116+
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
117+
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )
119118

120119
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
121120
* address, netmask, DNS server address and gateway address from a DHCP server. If

test/build-combination/AllEnable/FreeRTOSIPConfig.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,9 @@
143143
* maximum allowable send block time prevents prevents a deadlock occurring when
144144
* all the network buffers are in use and the tasks that process (and subsequently
145145
* free) the network buffers are themselves blocked waiting for a network buffer.
146-
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
147-
* milliseconds can be converted to a time in ticks by dividing the time in
148-
* milliseconds by portTICK_PERIOD_MS. */
149-
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
146+
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
147+
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
148+
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )
150149

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

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

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

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

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

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

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

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

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

test/build-combination/Enable_IPv4/FreeRTOSIPConfig.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,9 @@
146146
* maximum allowable send block time prevents prevents a deadlock occurring when
147147
* all the network buffers are in use and the tasks that process (and subsequently
148148
* free) the network buffers are themselves blocked waiting for a network buffer.
149-
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
150-
* milliseconds can be converted to a time in ticks by dividing the time in
151-
* milliseconds by portTICK_PERIOD_MS. */
152-
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
149+
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
150+
* milliseconds can be converted to a time in ticks using pdMS_TO_TICKS().*/
151+
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000U )
153152

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)