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: 2 additions & 0 deletions .github/lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ gmacsa
gpio
gpl
gratuitous
greaterthan
grr
gswutr
gw
Expand Down Expand Up @@ -457,6 +458,7 @@ ldistance
leds
len
lendofframe
lessthan
letbase
linkcurr
linklayer
Expand Down
6 changes: 3 additions & 3 deletions FreeRTOS_TCP_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -3967,9 +3967,9 @@
vTCPStateChange( pxSocket, eCLOSED );
}
/* Otherwise, check whether the packet is within the receive window. */
else if( ( ulSequenceNumber > pxSocket->u.xTCP.xTCPWindow.rx.ulCurrentSequenceNumber ) &&
( ulSequenceNumber < ( pxSocket->u.xTCP.xTCPWindow.rx.ulCurrentSequenceNumber +
pxSocket->u.xTCP.xTCPWindow.xSize.ulRxWindowLength ) ) )
else if( ( xSequenceGreaterThan( ulSequenceNumber, pxSocket->u.xTCP.xTCPWindow.rx.ulCurrentSequenceNumber ) != pdFALSE ) &&
( xSequenceLessThan( ulSequenceNumber, pxSocket->u.xTCP.xTCPWindow.rx.ulCurrentSequenceNumber +
pxSocket->u.xTCP.xTCPWindow.xSize.ulRxWindowLength ) != pdFALSE ) )
{
/* Send a challenge ACK. */
( void ) prvTCPSendChallengeAck( pxNetworkBuffer );
Expand Down
54 changes: 22 additions & 32 deletions FreeRTOS_TCP_WIN.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@
#endif /* ipconfigUSE_TCP_WIN */
/*-----------------------------------------------------------*/

#if ( ipconfigUSE_TCP_WIN == 1 )
static portINLINE BaseType_t xSequenceLessThan( uint32_t a,
uint32_t b );

/**
* @brief Check if a < b.
*
Expand All @@ -272,26 +268,21 @@
*
* @return pdTRUE when "( b - ( a + 1 ) ) < 0x80000000", else pdFALSE.
*/
static portINLINE BaseType_t xSequenceLessThan( uint32_t a,
uint32_t b )
{
BaseType_t xResult = pdFALSE;

/* Test if a < b */
if( ( ( b - ( a + 1U ) ) & 0x80000000U ) == 0U )
{
xResult = pdTRUE;
}
BaseType_t xSequenceLessThan( uint32_t a,
uint32_t b )
{
BaseType_t xResult = pdFALSE;

return xResult;
/* Test if a < b */
if( ( ( b - ( a + 1U ) ) & 0x80000000U ) == 0U )
{
xResult = pdTRUE;
}

#endif /* ipconfigUSE_TCP_WIN */
/*-----------------------------------------------------------*/
return xResult;
}

#if ( ipconfigUSE_TCP_WIN == 1 )
static portINLINE BaseType_t xSequenceGreaterThan( uint32_t a,
uint32_t b );
/*-----------------------------------------------------------*/

/**
* @brief Check if a > b.
Expand All @@ -301,21 +292,20 @@
*
* @return pdTRUE when "( a - b ) < 0x80000000", else pdFALSE.
*/
static portINLINE BaseType_t xSequenceGreaterThan( uint32_t a,
uint32_t b )
{
BaseType_t xResult = pdFALSE;

/* Test if a > b */
if( ( ( a - ( b + 1U ) ) & 0x80000000U ) == 0U )
{
xResult = pdTRUE;
}
BaseType_t xSequenceGreaterThan( uint32_t a,
uint32_t b )
{
BaseType_t xResult = pdFALSE;

return xResult;
/* Test if a > b */
if( ( ( a - ( b + 1U ) ) & 0x80000000U ) == 0U )
{
xResult = pdTRUE;
}

#endif /* ipconfigUSE_TCP_WIN */
return xResult;
}


/*-----------------------------------------------------------*/
static portINLINE BaseType_t xSequenceGreaterThanOrEqual( uint32_t a,
Expand Down
25 changes: 25 additions & 0 deletions include/FreeRTOS_TCP_WIN.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,31 @@
uint32_t ulFirst,
uint32_t ulLast );

/**
* @brief Check if a > b, where a and b are rolling counters.
*
* @param[in] a: The value on the left-hand side.
* @param[in] b: The value on the right-hand side.
*
* @return pdTRUE if a > b, otherwise pdFALSE.
*
* @note GreaterThan is calculated as "( a - ( b + 1U ) ) < 0x80000000".
*/
BaseType_t xSequenceGreaterThan( uint32_t a,
uint32_t b );

/**
* @brief Check if a < b, where a and b are rolling counters.
*
* @param[in] a: The value on the left-hand side.
* @param[in] b: The value on the right-hand side.
*
* @return pdTRUE if a < b, otherwise pdFALSE.
*
* @note LessThan is implemented as "( b - ( a + 1 ) ) < 0x80000000".
*/
BaseType_t xSequenceLessThan( uint32_t a,
uint32_t b );

#ifdef __cplusplus
} /* extern "C" */
Expand Down