diff --git a/source/include/FreeRTOSIPConfigDefaults.h b/source/include/FreeRTOSIPConfigDefaults.h index b3d08e3cc..3dfddd0bc 100644 --- a/source/include/FreeRTOSIPConfigDefaults.h +++ b/source/include/FreeRTOSIPConfigDefaults.h @@ -80,10 +80,10 @@ #define ASSERT_CONCAT( a, b ) ASSERT_CONCAT_( a, b ) #ifdef __COUNTER__ #define STATIC_ASSERT( e ) \ - ; enum { ASSERT_CONCAT( static_assert_, __COUNTER__ ) = ( 1 / ( int ) ( !!( e ) ) ) } + enum { ASSERT_CONCAT( static_assert_, __COUNTER__ ) = ( 1 / ( int ) ( !!( e ) ) ) } #else #define STATIC_ASSERT( e ) \ - ; enum { ASSERT_CONCAT( assert_line_, __LINE__ ) = ( 1 / ( int ) ( !!( e ) ) ) } + enum { ASSERT_CONCAT( assert_line_, __LINE__ ) = ( 1 / ( int ) ( !!( e ) ) ) } #endif #endif /* ifdef static_assert */ @@ -136,19 +136,51 @@ /*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* MACROS */ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/*---------------------------------------------------------------------------*/ +/*===========================================================================*/ +/* FreeRTOSConfig CHECKS */ +/*===========================================================================*/ + +/*---------------------------------------------------------------------------*/ + /* * pdFREERTOS_ERRNO_EAFNOSUPPORT * * Address family not supported by protocol. * - * Note: Now included in FreeRTOS-Kernel/projdefs.h, so this serves as a - * temporary kernel version check. To be removed in a future version. + * Note: pdFREERTOS_ERRNO_EAFNOSUPPORT is now included in + * FreeRTOS-Kernel/projdefs.h, defined here for backwards compatibility. */ +#ifndef pdFREERTOS_ERRNO_EAFNOSUPPORT + #define pdFREERTOS_ERRNO_EAFNOSUPPORT 97 +#endif + +#if ( INCLUDE_vTaskDelay == 0 ) + #error INCLUDE_vTaskDelay must be set to 1 +#endif + +#if ( INCLUDE_xTaskGetCurrentTaskHandle == 0 ) + #error INCLUDE_xTaskGetCurrentTaskHandle must be set to 1 +#endif + +#if ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) + #error configSUPPORT_DYNAMIC_ALLOCATION must be set to 1 +#endif + +#if ( configUSE_COUNTING_SEMAPHORES == 0 ) + #error configUSE_COUNTING_SEMAPHORES must be set to 1 +#endif + /*---------------------------------------------------------------------------*/ /*===========================================================================*/ -/* MACROS */ +/* FreeRTOSConfig CHECKS */ /*===========================================================================*/ /*---------------------------------------------------------------------------*/ /*===========================================================================*/ @@ -315,9 +347,7 @@ #error ipconfigRA_SEARCH_TIME_OUT_MSEC must be at least 0 #endif -#if ( ipconfigRA_SEARCH_TIME_OUT_MSEC > SIZE_MAX ) - #error ipconfigRA_SEARCH_TIME_OUT_MSEC must be at most portMAX_DELAY * portTICK_PERIOD_MS -#endif +STATIC_ASSERT( ipconfigRA_SEARCH_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PERIOD_MS ) ); /*---------------------------------------------------------------------------*/ @@ -365,9 +395,7 @@ #error ipconfigRA_IP_TEST_TIME_OUT_MSEC must be at least 0 #endif -#if ( ipconfigRA_IP_TEST_TIME_OUT_MSEC > SIZE_MAX ) - #error ipconfigRA_IP_TEST_TIME_OUT_MSEC must be at most portMAX_DELAY * portTICK_PERIOD_MS -#endif +STATIC_ASSERT( ipconfigRA_IP_TEST_TIME_OUT_MSEC <= ( portMAX_DELAY * portTICK_PERIOD_MS ) ); /*---------------------------------------------------------------------------*/ @@ -463,6 +491,8 @@ #define ipconfigMAX_IP_TASK_SLEEP_TIME pdMS_TO_TICKS( 10000 ) #endif +STATIC_ASSERT( ipconfigMAX_IP_TASK_SLEEP_TIME <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /*===========================================================================*/ @@ -981,6 +1011,12 @@ #define ipconfigPHY_LS_HIGH_CHECK_TIME_MS ( 15000 ) #endif +#if ( ipconfigPHY_LS_HIGH_CHECK_TIME_MS < 0 ) + #error ipconfigPHY_LS_HIGH_CHECK_TIME_MS must be at least 0 +#endif + +STATIC_ASSERT( pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS ) <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /* @@ -996,6 +1032,12 @@ #define ipconfigPHY_LS_LOW_CHECK_TIME_MS ( 1000 ) #endif +#if ( ipconfigPHY_LS_LOW_CHECK_TIME_MS < 0 ) + #error ipconfigPHY_LS_LOW_CHECK_TIME_MS must be at least 0 +#endif + +STATIC_ASSERT( pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS ) <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /* @@ -1015,7 +1057,7 @@ * * Type: size_t * Unit: count of ports - * Minimum: 0 + * Minimum: 1 * Maximum: 32 * * There can be at most 32 PHY ports, but in most cases there are 4 or less. @@ -1025,6 +1067,14 @@ #define ipconfigPHY_MAX_PORTS ( 4 ) #endif +#if ( ipconfigPHY_MAX_PORTS < 1 ) + #error ipconfigPHY_MAX_PORTS must be at least 1 +#endif + +#if ( ipconfigPHY_MAX_PORTS > 32 ) + #error ipconfigPHY_MAX_PORTS must be at most 32 +#endif + /*---------------------------------------------------------------------------*/ /*===========================================================================*/ @@ -1136,6 +1186,10 @@ #define ipconfigIP_TASK_STACK_SIZE_WORDS configMINIMAL_STACK_SIZE #endif +STATIC_ASSERT( ipconfigIP_TASK_STACK_SIZE_WORDS >= configMINIMAL_STACK_SIZE ); + +STATIC_ASSERT( ipconfigIP_TASK_STACK_SIZE_WORDS <= SIZE_MAX ); + /*---------------------------------------------------------------------------*/ /* @@ -1310,9 +1364,7 @@ #error ipconfigTCP_HANG_PROTECTION_TIME must be at least 0 #endif -#if ( ipconfigTCP_HANG_PROTECTION_TIME > SIZE_MAX ) - #error ipconfigTCP_HANG_PROTECTION_TIME must be at most portMAX_DELAY / configTICK_RATE_HZ -#endif +STATIC_ASSERT( ipconfigTCP_HANG_PROTECTION_TIME <= ( portMAX_DELAY / configTICK_RATE_HZ ) ); /*---------------------------------------------------------------------------*/ @@ -1379,9 +1431,7 @@ #error ipconfigTCP_KEEP_ALIVE_INTERVAL must be at least 0 #endif -#if ( ipconfigTCP_KEEP_ALIVE_INTERVAL > SIZE_MAX ) - #error ipconfigTCP_KEEP_ALIVE_INTERVAL must be at most portMAX_DELAY / configTICK_RATE_HZ -#endif +STATIC_ASSERT( ipconfigTCP_KEEP_ALIVE_INTERVAL <= ( portMAX_DELAY / configTICK_RATE_HZ ) ); /*---------------------------------------------------------------------------*/ @@ -1713,6 +1763,8 @@ #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 20 ) #endif +STATIC_ASSERT( ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /* @@ -1850,6 +1902,12 @@ #error Invalid ipconfigSELECT_USES_NOTIFY configuration #endif +#if ipconfigIS_ENABLED( ipconfigSELECT_USES_NOTIFY ) + #if ( configUSE_TASK_NOTIFICATIONS == 0 ) + #error configUSE_TASK_NOTIFICATIONS must be 1 if ipconfigSELECT_USES_NOTIFY is enabled + #endif +#endif + /*---------------------------------------------------------------------------*/ /* @@ -1894,6 +1952,8 @@ #define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME portMAX_DELAY #endif +STATIC_ASSERT( ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /* @@ -1920,6 +1980,8 @@ #define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME portMAX_DELAY #endif +STATIC_ASSERT( ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /* @@ -2156,7 +2218,6 @@ #endif #if ( ( ipconfigUSE_DHCP != ipconfigDISABLE ) && ( ipconfigNETWORK_MTU < 586 ) ) - #error ipconfigNETWORK_MTU needs to be at least 586 to use DHCP #endif @@ -2308,6 +2369,8 @@ #endif #endif +STATIC_ASSERT( ipconfigMAXIMUM_DISCOVER_TX_PERIOD <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /*===========================================================================*/ @@ -2504,6 +2567,8 @@ #define ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS pdMS_TO_TICKS( 5000 ) #endif +STATIC_ASSERT( ipconfigDNS_RECEIVE_BLOCK_TIME_TICKS <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /* @@ -2525,6 +2590,8 @@ #define ipconfigDNS_SEND_BLOCK_TIME_TICKS pdMS_TO_TICKS( 500 ) #endif +STATIC_ASSERT( ipconfigDNS_SEND_BLOCK_TIME_TICKS <= portMAX_DELAY ); + /*---------------------------------------------------------------------------*/ /*