Skip to content

Commit a004a21

Browse files
Remove ipLOCAL_MAC_ADDRESS from demo files (FreeRTOS#1244)
* Remove ipLOCAL_MAC_ADDRESS from demo files * Add return variable for IP_Init fucntions
1 parent 8582188 commit a004a21

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Posix/main_networking.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ static UBaseType_t ulNextRand;
135135

136136
void main_tcp_echo_client_tasks( void )
137137
{
138+
BaseType_t xResult;
138139
const uint32_t ulLongTime_ms = pdMS_TO_TICKS( 1000UL );
139140

140141
/*
@@ -157,8 +158,6 @@ void main_tcp_echo_client_tasks( void )
157158
/* Initialise the network interface.*/
158159
FreeRTOS_debug_printf( ( "FreeRTOS_IPInit\r\n" ) );
159160

160-
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
161-
162161
#if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 )
163162
extern NetworkInterface_t * pxLibslirp_FillInterfaceDescriptor( BaseType_t xEMACIndex,
164163
NetworkInterface_t * pxInterface );
@@ -173,12 +172,14 @@ void main_tcp_echo_client_tasks( void )
173172
}
174173
#endif /* ( ipconfigUSE_DHCP != 0 ) */
175174

176-
FreeRTOS_IPInit_Multi();
175+
xResult = FreeRTOS_IPInit_Multi();
177176
#else /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
178177
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
179-
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
178+
xResult = FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
180179
#endif /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
181180

181+
configASSERT( xResult == pdTRUE );
182+
182183
/* Start the RTOS scheduler. */
183184
FreeRTOS_debug_printf( ( "vTaskStartScheduler\n" ) );
184185
vTaskStartScheduler();

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/main_networking.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ static UBaseType_t ulNextRand;
140140

141141
void main_tcp_echo_client_tasks( void )
142142
{
143+
BaseType_t xReturn;
143144
const uint32_t ulLongTime_ms = pdMS_TO_TICKS( 1000UL );
144145

145146
/*
@@ -180,12 +181,13 @@ void main_tcp_echo_client_tasks( void )
180181
}
181182
#endif /* ( ipconfigUSE_DHCP != 0 ) */
182183

183-
FreeRTOS_IPInit_Multi();
184+
xReturn = FreeRTOS_IPInit_Multi();
184185
#else /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
185186
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
186-
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
187+
xReturn = FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
187188
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
188189

190+
configASSERT( xReturn == pdTRUE );
189191

190192
/* Start the RTOS scheduler. */
191193
FreeRTOS_debug_printf( ( "vTaskStartScheduler\n" ) );

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_IPv6_Demo/IPv6_Multi_WinSim_demo/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ NetworkInterface_t * pxWinPcap_FillInterfaceDescriptor( BaseType_t xEMACIndex,
189189

190190
int main( void )
191191
{
192+
BaseType_t xReturn;
192193
const uint32_t ulLongTime_ms = pdMS_TO_TICKS( 1000UL );
193194

194195
/*
@@ -314,7 +315,9 @@ int main( void )
314315
}
315316
#endif /* ( mainNETWORK_UP_COUNT >= 3U ) */
316317

317-
FreeRTOS_IPInit_Multi();
318+
xReturn = FreeRTOS_IPInit_Multi();
319+
320+
configASSERT( xReturn == pdTRUE );
318321

319322
/* Start the RTOS scheduler. */
320323
FreeRTOS_debug_printf( ( "vTaskStartScheduler\r\n" ) );

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_UDP_Mode_CLI_Windows_Simulator/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ static UBaseType_t ulNextRand;
130130

131131
int main( void )
132132
{
133+
BaseType_t xResult;
133134
const uint32_t ulLongTime_ms = 250UL;
134135

135136
/* Create a mutex that is used to guard against the console being accessed
@@ -157,13 +158,15 @@ int main( void )
157158
xEndPoints[ 0 ].bits.bWantDHCP = pdTRUE;
158159
}
159160
#endif /* ( ipconfigUSE_DHCP != 0 ) */
160-
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
161-
FreeRTOS_IPInit_Multi();
161+
162+
xResult = FreeRTOS_IPInit_Multi();
162163
#else /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
163164
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */
164-
FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
165+
xResult = FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );
165166
#endif /* defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
166167

168+
configASSERT( xResult == pdTRUE );
169+
167170
/* Initialise the logging. */
168171
uint32_t ulLoggingIPAddress;
169172

FreeRTOS-Plus/VisualStudio_StaticProjects/FreeRTOS+TCP/plus_tcp_hooks_winsim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void vPlatformInitIpStack( void )
228228
xEndPoints[ 0 ].bits.bWantDHCP = pdTRUE;
229229
}
230230
#endif /* ( ipconfigUSE_DHCP != 0 ) */
231-
memcpy( ipLOCAL_MAC_ADDRESS, ucMACAddress, sizeof( ucMACAddress ) );
231+
232232
xResult = FreeRTOS_IPInit_Multi();
233233
#else /* if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 0 ) */
234234
/* Using the old /single /IPv4 library, or using backward compatible mode of the new /multi library. */

0 commit comments

Comments
 (0)