Skip to content

Commit

Permalink
sync latest version of FreeRTOS+TCP from https://github.com/FreeRTOS/…
Browse files Browse the repository at this point in the history
  • Loading branch information
cobusve committed Sep 6, 2020
1 parent 88c6952 commit b9bc646
Show file tree
Hide file tree
Showing 100 changed files with 33,036 additions and 32,207 deletions.
220 changes: 155 additions & 65 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_ARP.c

Large diffs are not rendered by default.

656 changes: 357 additions & 299 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DHCP.c

Large diffs are not rendered by default.

1,224 changes: 762 additions & 462 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DNS.c

Large diffs are not rendered by default.

1,431 changes: 978 additions & 453 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.c

Large diffs are not rendered by default.

2,035 changes: 1,237 additions & 798 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_Sockets.c

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_Stream_Buffer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* FreeRTOS+TCP V2.2.0
* FreeRTOS+TCP V2.2.1
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down Expand Up @@ -44,9 +44,10 @@
* will be used when TCP data is received while earlier data is still missing.
* If 'pucData' equals NULL, the function is called to advance 'uxHead' only.
*/
size_t uxStreamBufferAdd( StreamBuffer_t *pxBuffer, size_t uxOffset, const uint8_t *pucData, size_t uxCount )
size_t uxStreamBufferAdd( StreamBuffer_t *pxBuffer, size_t uxOffset, const uint8_t *pucData, size_t uxByteCount )
{
size_t uxSpace, uxNextHead, uxFirst;
size_t uxCount = uxByteCount;

uxSpace = uxStreamBufferGetSpace( pxBuffer );

Expand All @@ -57,18 +58,18 @@ size_t uxSpace, uxNextHead, uxFirst;
}
else
{
uxSpace = 0u;
uxSpace = 0U;
}

/* The number of bytes that can be written is the minimum of the number of
bytes requested and the number available. */
uxCount = FreeRTOS_min_uint32( uxSpace, uxCount );

if( uxCount != 0u )
if( uxCount != 0U )
{
uxNextHead = pxBuffer->uxHead;

if( uxOffset != 0u )
if( uxOffset != 0U )
{
/* ( uxOffset > 0 ) means: write in front if the uxHead marker */
uxNextHead += uxOffset;
Expand All @@ -86,19 +87,19 @@ size_t uxSpace, uxNextHead, uxFirst;
uxFirst = FreeRTOS_min_uint32( pxBuffer->LENGTH - uxNextHead, uxCount );

/* Write as many bytes as can be written in the first write. */
memcpy( ( void* ) ( pxBuffer->ucArray + uxNextHead ), pucData, uxFirst );
( void ) memcpy( &( pxBuffer->ucArray[ uxNextHead ] ), pucData, uxFirst );

/* If the number of bytes written was less than the number that
could be written in the first write... */
if( uxCount > uxFirst )
{
/* ...then write the remaining bytes to the start of the
buffer. */
memcpy( ( void * )pxBuffer->ucArray, pucData + uxFirst, uxCount - uxFirst );
( void ) memcpy( pxBuffer->ucArray, &( pucData[ uxFirst ] ), uxCount - uxFirst );
}
}

if( uxOffset == 0u )
if( uxOffset == 0U )
{
/* ( uxOffset == 0 ) means: write at uxHead position */
uxNextHead += uxCount;
Expand Down Expand Up @@ -140,17 +141,17 @@ size_t uxSize, uxCount, uxFirst, uxNextTail;
}
else
{
uxSize = 0u;
uxSize = 0U;
}

/* Use the minimum of the wanted bytes and the available bytes. */
uxCount = FreeRTOS_min_uint32( uxSize, uxMaxCount );

if( uxCount > 0u )
if( uxCount > 0U )
{
uxNextTail = pxBuffer->uxTail;

if( uxOffset != 0u )
if( uxOffset != 0U )
{
uxNextTail += uxOffset;
if( uxNextTail >= pxBuffer->LENGTH )
Expand All @@ -168,14 +169,14 @@ size_t uxSize, uxCount, uxFirst, uxNextTail;

/* Obtain the number of bytes it is possible to obtain in the first
read. */
memcpy( pucData, pxBuffer->ucArray + uxNextTail, uxFirst );
( void ) memcpy( pucData, &( pxBuffer->ucArray[ uxNextTail ] ), uxFirst );

/* If the total number of wanted bytes is greater than the number
that could be read in the first read... */
if( uxCount > uxFirst )
{
/*...then read the remaining bytes from the start of the buffer. */
memcpy( pucData + uxFirst, pxBuffer->ucArray, uxCount - uxFirst );
( void ) memcpy( &( pucData[ uxFirst ] ), pxBuffer->ucArray, uxCount - uxFirst );
}
}

Expand Down
Loading

0 comments on commit b9bc646

Please sign in to comment.