MISRA compliance changes in FreeRTOS_Sockets{.c/.h} (#161)

* MISRA changes Sockets

* add other changes

* Update FreeRTOSIPConfig.h

* Update FreeRTOSIPConfig.h

* Update FreeRTOSIPConfig.h

* Update FreeRTOSIPConfig.h

* correction

* Add 'U'

* Update FreeRTOS_Sockets.h

* Update FreeRTOS_Sockets.h

* Update FreeRTOS_Sockets.c

* Update FreeRTOS_Sockets.h

* Update after Gary's comments

* Correction reverted
This commit is contained in:
Aniruddha Kanhere 2020-07-29 15:38:37 -07:00 committed by GitHub
parent ae4d4d38d9
commit f2611cc5e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 337 additions and 330 deletions

View file

@ -137,7 +137,7 @@ 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 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 can be converted to a time in ticks by dividing the time in
milliseconds by portTICK_PERIOD_MS. */ milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* 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 address, netmask, DNS server address and gateway address from a DHCP server. If
@ -155,7 +155,7 @@ ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
static IP address passed as a parameter to FreeRTOS_IPInit() if the static IP address passed as a parameter to FreeRTOS_IPInit() if the
re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
a DHCP reply being received. */ a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS ) #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* 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 stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -233,7 +233,7 @@ contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
lower value can save RAM, depending on the buffer management scheme used. If lower value can save RAM, depending on the buffer management scheme used. If
ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
be divisible by 8. */ be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
through the FreeRTOS_gethostbyname() API function. */ through the FreeRTOS_gethostbyname() API function. */
@ -274,7 +274,7 @@ block occasionally to allow other tasks to run. */
32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
This has to do with the contents of the IP-packets: all 32-bit fields are This has to do with the contents of the IP-packets: all 32-bit fields are
32-bit-aligned, plus 16-bit(!) */ 32-bit-aligned, plus 16-bit(!) */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -648,9 +648,10 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
if( prvValidSocket( pxSocket, FREERTOS_IPPROTO_UDP, pdTRUE ) == pdFALSE ) if( prvValidSocket( pxSocket, FREERTOS_IPPROTO_UDP, pdTRUE ) == pdFALSE )
{ {
return -pdFREERTOS_ERRNO_EINVAL; lReturn = -pdFREERTOS_ERRNO_EINVAL;
} }
else
{
lPacketCount = ( BaseType_t ) listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) ); lPacketCount = ( BaseType_t ) listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) );
/* The function prototype is designed to maintain the expected Berkeley /* The function prototype is designed to maintain the expected Berkeley
@ -780,8 +781,6 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
the received data can be copied, but a pointer that must be set to the received data can be copied, but a pointer that must be set to
point to the buffer in which the received data has already been point to the buffer in which the received data has already been
placed. */ placed. */
/* 9079: (Note -- conversion from pointer to void to pointer to other type [MISRA 2012 Rule 11.5, advisory]) */
/* 9087: (Note -- cast performed between a pointer to object type and a pointer to a different object type [MISRA 2012 Rule 11.3, required]) */
*( ( void** ) pvBuffer ) = ipPOINTER_CAST( void *, &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] ) ); *( ( void** ) pvBuffer ) = ipPOINTER_CAST( void *, &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] ) );
} }
@ -798,6 +797,7 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
lReturn = -pdFREERTOS_ERRNO_EWOULDBLOCK; lReturn = -pdFREERTOS_ERRNO_EWOULDBLOCK;
iptraceRECVFROM_TIMEOUT(); iptraceRECVFROM_TIMEOUT();
} }
}
return lReturn; return lReturn;
} }
@ -1070,13 +1070,17 @@ struct freertos_sockaddr * pxAddress = pxBindAddress;
#else #else
if( pxAddress != NULL ) if( pxAddress != NULL )
#endif #endif
{
/* Add a do-while loop to facilitate use of 'break' statements. */
do
{ {
if( pxAddress->sin_port == 0U ) if( pxAddress->sin_port == 0U )
{ {
pxAddress->sin_port = prvGetPrivatePortNumber( ( BaseType_t ) pxSocket->ucProtocol ); pxAddress->sin_port = prvGetPrivatePortNumber( ( BaseType_t ) pxSocket->ucProtocol );
if( pxAddress->sin_port == ( uint16_t ) 0U ) if( pxAddress->sin_port == ( uint16_t ) 0U )
{ {
return -pdFREERTOS_ERRNO_EADDRNOTAVAIL; xReturn = -pdFREERTOS_ERRNO_EADDRNOTAVAIL;
break;
} }
} }
@ -1125,6 +1129,7 @@ struct freertos_sockaddr * pxAddress = pxBindAddress;
#endif /* ipconfigETHERNET_DRIVER_FILTERS_PACKETS */ #endif /* ipconfigETHERNET_DRIVER_FILTERS_PACKETS */
} }
} }
} while( ipFALSE_BOOL );
} }
#if( ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND == 0 ) #if( ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND == 0 )
else else
@ -1351,8 +1356,7 @@ BaseType_t xReturn;
( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) ); ( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) );
xReturn = -pdFREERTOS_ERRNO_EINVAL; xReturn = -pdFREERTOS_ERRNO_EINVAL;
} }
else else if( ( ( lOptionName == FREERTOS_SO_SNDBUF ) && ( pxSocket->u.xTCP.txStream != NULL ) ) ||
if( ( ( lOptionName == FREERTOS_SO_SNDBUF ) && ( pxSocket->u.xTCP.txStream != NULL ) ) ||
( ( lOptionName == FREERTOS_SO_RCVBUF ) && ( pxSocket->u.xTCP.rxStream != NULL ) ) ) ( ( lOptionName == FREERTOS_SO_RCVBUF ) && ( pxSocket->u.xTCP.rxStream != NULL ) ) )
{ {
FreeRTOS_debug_printf( ( "Set SO_%sBUF: buffer already created\n", FreeRTOS_debug_printf( ( "Set SO_%sBUF: buffer already created\n",
@ -1361,7 +1365,7 @@ BaseType_t xReturn;
} }
else else
{ {
ulNewValue = *( ipPOINTER_CAST( uint32_t *, pvOptionValue ) ); ulNewValue = *( ipPOINTER_CAST( const uint32_t *, pvOptionValue ) );
if( lOptionName == FREERTOS_SO_SNDBUF ) if( lOptionName == FREERTOS_SO_SNDBUF )
{ {
@ -1386,7 +1390,6 @@ BaseType_t FreeRTOS_setsockopt( Socket_t xSocket, int32_t lLevel, int32_t lOptio
{ {
/* The standard Berkeley function returns 0 for success. */ /* The standard Berkeley function returns 0 for success. */
BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL; BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL;
BaseType_t lOptionValue;
FreeRTOS_Socket_t *pxSocket; FreeRTOS_Socket_t *pxSocket;
pxSocket = ( FreeRTOS_Socket_t * ) xSocket; pxSocket = ( FreeRTOS_Socket_t * ) xSocket;
@ -1443,11 +1446,10 @@ FreeRTOS_Socket_t *pxSocket;
#endif /* ipconfigUDP_MAX_RX_PACKETS */ #endif /* ipconfigUDP_MAX_RX_PACKETS */
case FREERTOS_SO_UDPCKSUM_OUT : case FREERTOS_SO_UDPCKSUM_OUT :
/* Turn calculating of the UDP checksum on/off for this socket. */ /* Turn calculating of the UDP checksum on/off for this socket. If pvOptionValue
/* The expression "pvOptionValue" of type "void const *" is cast to type "BaseType_t". */ * is anything else than NULL, the checksum generation will be turned on. */
lOptionValue = ipNUMERIC_CAST( BaseType_t, pvOptionValue );
if( lOptionValue == 0 ) if( pvOptionValue == NULL )
{ {
pxSocket->ucSocketOptions &= ~( ( uint8_t ) FREERTOS_SO_UDPCKSUM_OUT ); pxSocket->ucSocketOptions &= ~( ( uint8_t ) FREERTOS_SO_UDPCKSUM_OUT );
} }
@ -1540,7 +1542,7 @@ FreeRTOS_Socket_t *pxSocket;
when there is an event the socket's owner might want to when there is an event the socket's owner might want to
process. */ process. */
/* The type cast of the pointer expression "A" to type "B" removes const qualifier from the pointed to type. */ /* The type cast of the pointer expression "A" to type "B" removes const qualifier from the pointed to type. */
pxSocket->pxUserWakeCallback = ( SocketWakeupCallback_t ) pvOptionValue; pxSocket->pxUserWakeCallback = ( const SocketWakeupCallback_t ) pvOptionValue;
xReturn = 0; xReturn = 0;
} }
break; break;
@ -1548,7 +1550,7 @@ FreeRTOS_Socket_t *pxSocket;
case FREERTOS_SO_SET_LOW_HIGH_WATER: case FREERTOS_SO_SET_LOW_HIGH_WATER:
{ {
const LowHighWater_t *pxLowHighWater = ipPOINTER_CAST( LowHighWater_t *, pvOptionValue ); const LowHighWater_t *pxLowHighWater = ipPOINTER_CAST( const LowHighWater_t *, pvOptionValue );
if( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_TCP ) if( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_TCP )
{ {
@ -1594,7 +1596,7 @@ FreeRTOS_Socket_t *pxSocket;
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
pxProps = ipPOINTER_CAST( WinProperties_t *, pvOptionValue ); pxProps = ipPOINTER_CAST( const WinProperties_t *, pvOptionValue );
xReturn = prvSockopt_so_buffer( pxSocket, FREERTOS_SO_SNDBUF, &( pxProps->lTxBufSize ) ); xReturn = prvSockopt_so_buffer( pxSocket, FREERTOS_SO_SNDBUF, &( pxProps->lTxBufSize ) );
if ( xReturn != 0 ) if ( xReturn != 0 )
@ -1638,7 +1640,7 @@ FreeRTOS_Socket_t *pxSocket;
{ {
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE; pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE;
} }
@ -1657,7 +1659,7 @@ FreeRTOS_Socket_t *pxSocket;
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE; pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE;
} }
@ -1676,7 +1678,7 @@ FreeRTOS_Socket_t *pxSocket;
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE; pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE;
} }
@ -1702,7 +1704,7 @@ FreeRTOS_Socket_t *pxSocket;
{ {
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.bits.bRxStopped = pdTRUE; pxSocket->u.xTCP.bits.bRxStopped = pdTRUE;
} }
@ -1850,7 +1852,7 @@ const char *pcResult = pcBuffer;
const socklen_t uxSize = 16; const socklen_t uxSize = 16;
/* Each nibble is expressed in at most 3 digits, like e.g. "192". */ /* Each nibble is expressed in at most 3 digits, like e.g. "192". */
#define sockDIGIT_COUNT 3 #define sockDIGIT_COUNT ( 3U )
for( uxNibble = 0; uxNibble < ipSIZE_OF_IPv4_ADDRESS; uxNibble++ ) for( uxNibble = 0; uxNibble < ipSIZE_OF_IPv4_ADDRESS; uxNibble++ )
{ {
@ -2072,7 +2074,7 @@ uint32_t ulReturn = 0UL;
/* Function to get the local address and IP port */ /* Function to get the local address and IP port */
size_t FreeRTOS_GetLocalAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ) size_t FreeRTOS_GetLocalAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
@ -2725,7 +2727,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
/* Get a direct pointer to the circular transmit buffer. /* Get a direct pointer to the circular transmit buffer.
'*pxLength' will contain the number of bytes that may be written. */ '*pxLength' will contain the number of bytes that may be written. */
uint8_t *FreeRTOS_get_tx_head( Socket_t xSocket, BaseType_t *pxLength ) uint8_t *FreeRTOS_get_tx_head( ConstSocket_t xSocket, BaseType_t *pxLength )
{ {
uint8_t *pucReturn = NULL; uint8_t *pucReturn = NULL;
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
@ -3186,10 +3188,11 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* For the web server: borrow the circular Rx buffer for inspection
const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( Socket_t xSocket ) * HTML driver wants to see if a sequence of 13/10/13/10 is available. */
const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( ConstSocket_t xSocket )
{ {
FreeRTOS_Socket_t const * pxSocket = ( FreeRTOS_Socket_t const * )xSocket; const FreeRTOS_Socket_t * pxSocket = ( const FreeRTOS_Socket_t * )xSocket;
const struct xSTREAM_BUFFER *pxReturn = NULL; const struct xSTREAM_BUFFER *pxReturn = NULL;
/* Confirm that this is a TCP socket before dereferencing structure /* Confirm that this is a TCP socket before dereferencing structure
@ -3288,7 +3291,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
int32_t lTCPAddRxdata( FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount ) int32_t lTCPAddRxdata( FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount )
{ {
StreamBuffer_t *pxStream = pxSocket->u.xTCP.rxStream; StreamBuffer_t *pxStream = pxSocket->u.xTCP.rxStream;
int32_t xResult; int32_t xResult = 0;
#if( ipconfigUSE_CALLBACKS == 1 ) #if( ipconfigUSE_CALLBACKS == 1 )
BaseType_t bHasHandler = ipconfigIS_VALID_PROG_ADDRESS( pxSocket->u.xTCP.pxHandleReceive ) ? pdTRUE : pdFALSE; BaseType_t bHasHandler = ipconfigIS_VALID_PROG_ADDRESS( pxSocket->u.xTCP.pxHandleReceive ) ? pdTRUE : pdFALSE;
const uint8_t *pucBuffer = NULL; const uint8_t *pucBuffer = NULL;
@ -3304,10 +3307,12 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
pxStream = prvTCPCreateStream( pxSocket, pdTRUE ); pxStream = prvTCPCreateStream( pxSocket, pdTRUE );
if( pxStream == NULL ) if( pxStream == NULL )
{ {
return -1; xResult = -1;
} }
} }
if( xResult >= 0 )
{
#if( ipconfigUSE_CALLBACKS == 1 ) #if( ipconfigUSE_CALLBACKS == 1 )
{ {
if( ( bHasHandler != pdFALSE ) && ( uxStreamBufferGetSize( pxStream ) == 0U ) && ( uxOffset == 0UL ) && ( pcData != NULL ) ) if( ( bHasHandler != pdFALSE ) && ( uxStreamBufferGetSize( pxStream ) == 0U ) && ( uxOffset == 0UL ) && ( pcData != NULL ) )
@ -3401,6 +3406,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#endif #endif
} }
} }
}
return xResult; return xResult;
} }
@ -3411,7 +3417,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* Function to get the remote address and IP port */ /* Function to get the remote address and IP port */
BaseType_t FreeRTOS_GetRemoteAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ) BaseType_t FreeRTOS_GetRemoteAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xResult; BaseType_t xResult;
@ -3443,7 +3449,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* Returns the number of bytes that may be added to txStream */ /* Returns the number of bytes that may be added to txStream */
BaseType_t FreeRTOS_maywrite( Socket_t xSocket ) BaseType_t FreeRTOS_maywrite( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xResult; BaseType_t xResult;
@ -3480,7 +3486,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
BaseType_t FreeRTOS_tx_space( Socket_t xSocket ) BaseType_t FreeRTOS_tx_space( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3509,7 +3515,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
BaseType_t FreeRTOS_tx_size( Socket_t xSocket ) BaseType_t FreeRTOS_tx_size( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3539,7 +3545,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* Returns pdTRUE if TCP socket is connected. */ /* Returns pdTRUE if TCP socket is connected. */
BaseType_t FreeRTOS_issocketconnected( Socket_t xSocket ) BaseType_t FreeRTOS_issocketconnected( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn = pdFALSE; BaseType_t xReturn = pdFALSE;
@ -3567,8 +3573,8 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* returns the actual size of MSS being used */ /* Returns the actual size of MSS being used. */
BaseType_t FreeRTOS_mss( Socket_t xSocket ) BaseType_t FreeRTOS_mss( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3593,8 +3599,8 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* HT: for internal use only: return the connection status */ /* For internal use only: return the connection status. */
BaseType_t FreeRTOS_connstatus( Socket_t xSocket ) BaseType_t FreeRTOS_connstatus( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3605,7 +3611,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
} }
else else
{ {
/* Cast it to BaseType_t */ /* Cast it to BaseType_t. */
xReturn = ( BaseType_t ) ( pxSocket->u.xTCP.ucTCPState ); xReturn = ( BaseType_t ) ( pxSocket->u.xTCP.ucTCPState );
} }
@ -3620,7 +3626,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
/* /*
* Returns the number of bytes which can be read. * Returns the number of bytes which can be read.
*/ */
BaseType_t FreeRTOS_rx_size( Socket_t xSocket ) BaseType_t FreeRTOS_rx_size( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;

View file

@ -203,6 +203,7 @@ extern const char *FreeRTOS_inet_ntoa( uint32_t ulIPAddress, char *pcBuffer );
/* The socket type itself. */ /* The socket type itself. */
struct xSOCKET; struct xSOCKET;
typedef struct xSOCKET *Socket_t; typedef struct xSOCKET *Socket_t;
typedef struct xSOCKET const * ConstSocket_t;
#if( ipconfigSUPPORT_SELECT_FUNCTION == 1 ) #if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
/* The SocketSet_t type is the equivalent to the fd_set type used by the /* The SocketSet_t type is the equivalent to the fd_set type used by the
@ -222,7 +223,7 @@ int32_t FreeRTOS_sendto( Socket_t xSocket, const void *pvBuffer, size_t uxTotalD
BaseType_t FreeRTOS_bind( Socket_t xSocket, struct freertos_sockaddr const * pxAddress, socklen_t xAddressLength ); BaseType_t FreeRTOS_bind( Socket_t xSocket, struct freertos_sockaddr const * pxAddress, socklen_t xAddressLength );
/* function to get the local address and IP port */ /* function to get the local address and IP port */
size_t FreeRTOS_GetLocalAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ); size_t FreeRTOS_GetLocalAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress );
#if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 ) #if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 )
/* Returns true if an UDP socket exists bound to mentioned port number. */ /* Returns true if an UDP socket exists bound to mentioned port number. */
@ -248,23 +249,23 @@ BaseType_t FreeRTOS_shutdown (Socket_t xSocket, BaseType_t xHow);
#endif /* ipconfigSUPPORT_SIGNALS */ #endif /* ipconfigSUPPORT_SIGNALS */
/* Return the remote address and IP port. */ /* Return the remote address and IP port. */
BaseType_t FreeRTOS_GetRemoteAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ); BaseType_t FreeRTOS_GetRemoteAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress );
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* returns pdTRUE if TCP socket is connected */ /* Returns pdTRUE if TCP socket is connected. */
BaseType_t FreeRTOS_issocketconnected( Socket_t xSocket ); BaseType_t FreeRTOS_issocketconnected( ConstSocket_t xSocket );
/* returns the actual size of MSS being used */ /* Returns the actual size of MSS being used. */
BaseType_t FreeRTOS_mss( Socket_t xSocket ); BaseType_t FreeRTOS_mss( ConstSocket_t xSocket );
#endif #endif
/* for internal use only: return the connection status */ /* For internal use only: return the connection status. */
BaseType_t FreeRTOS_connstatus( Socket_t xSocket ); BaseType_t FreeRTOS_connstatus( ConstSocket_t xSocket );
/* Returns the number of bytes that may be added to txStream */ /* Returns the number of bytes that may be added to txStream */
BaseType_t FreeRTOS_maywrite( Socket_t xSocket ); BaseType_t FreeRTOS_maywrite( ConstSocket_t xSocket );
/* /*
* Two helper functions, mostly for testing * Two helper functions, mostly for testing
@ -272,9 +273,9 @@ BaseType_t FreeRTOS_maywrite( Socket_t xSocket );
* tx_space returns the free space in the Tx buffer * tx_space returns the free space in the Tx buffer
*/ */
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
BaseType_t FreeRTOS_rx_size( Socket_t xSocket ); BaseType_t FreeRTOS_rx_size( ConstSocket_t xSocket );
BaseType_t FreeRTOS_tx_space( Socket_t xSocket ); BaseType_t FreeRTOS_tx_space( ConstSocket_t xSocket );
BaseType_t FreeRTOS_tx_size( Socket_t xSocket ); BaseType_t FreeRTOS_tx_size( ConstSocket_t xSocket );
#endif #endif
/* Returns the number of outstanding bytes in txStream. */ /* Returns the number of outstanding bytes in txStream. */
@ -292,7 +293,7 @@ FreeRTOS_rx_size(). */
* Get a direct pointer to the circular transmit buffer. * Get a direct pointer to the circular transmit buffer.
* '*pxLength' will contain the number of bytes that may be written. * '*pxLength' will contain the number of bytes that may be written.
*/ */
uint8_t *FreeRTOS_get_tx_head( Socket_t xSocket, BaseType_t *pxLength ); uint8_t *FreeRTOS_get_tx_head( ConstSocket_t xSocket, BaseType_t *pxLength );
#endif /* ipconfigUSE_TCP */ #endif /* ipconfigUSE_TCP */
@ -382,7 +383,7 @@ const char *FreeRTOS_inet_ntop4( const void *pvSource, char *pcDestination, sock
* For the web server: borrow the circular Rx buffer for inspection * For the web server: borrow the circular Rx buffer for inspection
* HTML driver wants to see if a sequence of 13/10/13/10 is available * HTML driver wants to see if a sequence of 13/10/13/10 is available
*/ */
const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( Socket_t xSocket ); const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( ConstSocket_t xSocket );
void FreeRTOS_netstat( void ); void FreeRTOS_netstat( void );

View file

@ -119,7 +119,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * 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 can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* 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 * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -145,7 +145,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* 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 * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -225,7 +225,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -266,7 +266,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -140,7 +140,7 @@ 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 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 can be converted to a time in ticks by dividing the time in
milliseconds by portTICK_PERIOD_MS. */ milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* 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 address, netmask, DNS server address and gateway address from a DHCP server. If
@ -158,7 +158,7 @@ ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
static IP address passed as a parameter to FreeRTOS_IPInit() if the static IP address passed as a parameter to FreeRTOS_IPInit() if the
re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
a DHCP reply being received. */ a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS ) #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* 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 stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -236,7 +236,7 @@ contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
lower value can save RAM, depending on the buffer management scheme used. If lower value can save RAM, depending on the buffer management scheme used. If
ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
be divisible by 8. */ be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
through the FreeRTOS_gethostbyname() API function. */ through the FreeRTOS_gethostbyname() API function. */
@ -277,7 +277,7 @@ block occasionally to allow other tasks to run. */
32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
This has to do with the contents of the IP-packets: all 32-bit fields are This has to do with the contents of the IP-packets: all 32-bit fields are
32-bit-aligned, plus 16-bit(!) */ 32-bit-aligned, plus 16-bit(!) */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -123,7 +123,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * 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 can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* 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 * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -149,7 +149,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* 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 * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -229,7 +229,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -270,7 +270,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -119,7 +119,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * 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 can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* 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 * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -145,7 +145,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* 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 * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -225,7 +225,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -266,7 +266,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -137,7 +137,7 @@ 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 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 can be converted to a time in ticks by dividing the time in
milliseconds by portTICK_PERIOD_MS. */ milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* 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 address, netmask, DNS server address and gateway address from a DHCP server. If
@ -155,7 +155,7 @@ ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
static IP address passed as a parameter to FreeRTOS_IPInit() if the static IP address passed as a parameter to FreeRTOS_IPInit() if the
re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
a DHCP reply being received. */ a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS ) #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* 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 stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -233,7 +233,7 @@ contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
lower value can save RAM, depending on the buffer management scheme used. If lower value can save RAM, depending on the buffer management scheme used. If
ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
be divisible by 8. */ be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
through the FreeRTOS_gethostbyname() API function. */ through the FreeRTOS_gethostbyname() API function. */
@ -274,7 +274,7 @@ block occasionally to allow other tasks to run. */
32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
This has to do with the contents of the IP-packets: all 32-bit fields are This has to do with the contents of the IP-packets: all 32-bit fields are
32-bit-aligned, plus 16-bit(!) */ 32-bit-aligned, plus 16-bit(!) */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -119,7 +119,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * 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 can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* 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 * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -145,7 +145,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* 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 * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -227,7 +227,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -268,7 +268,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6