Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions source/FreeRTOS_Stream_Buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,15 @@ size_t uxStreamBufferAdd( StreamBuffer_t * const pxBuffer,
const size_t uxFirst = FreeRTOS_min_size_t( uxLength - uxNextHead, uxCount );

/* Write as many bytes as can be written in the first write. */
( void ) memcpy( &( pxBuffer->ucArray[ uxNextHead ] ), pucData, uxFirst );
( void ) pvPortMemCpyStreamBuffer( &( 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. */
( void ) memcpy( pxBuffer->ucArray, &( pucData[ uxFirst ] ), uxCount - uxFirst );
( void ) pvPortMemCpyStreamBuffer( pxBuffer->ucArray, &( pucData[ uxFirst ] ), uxCount - uxFirst );
}
}

Expand Down Expand Up @@ -394,14 +394,14 @@ size_t uxStreamBufferGet( StreamBuffer_t * const pxBuffer,

/* Obtain the number of bytes it is possible to obtain in the first
* read. */
( void ) memcpy( pucData, &( pxBuffer->ucArray[ uxNextTail ] ), uxFirst );
( void ) pvPortMemCpyStreamBuffer( 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. */
( void ) memcpy( &( pucData[ uxFirst ] ), pxBuffer->ucArray, uxCount - uxFirst );
( void ) pvPortMemCpyStreamBuffer( &( pucData[ uxFirst ] ), pxBuffer->ucArray, uxCount - uxFirst );
}
}

Expand Down
25 changes: 24 additions & 1 deletion source/include/FreeRTOSIPConfigDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -2151,10 +2151,33 @@ STATIC_ASSERT( ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME <= portMAX_DELAY );
#define vPortFreeSocket( ptr ) vPortFree( ptr )
#endif

/*===========================================================================*/
/* SOCKET CONFIG */
/*===========================================================================*/
/*---------------------------------------------------------------------------*/
/*===========================================================================*/
/*---------------------------------------------------------------------------*/
/*===========================================================================*/
/* STREAM BUFFER CONFIG */
/*===========================================================================*/

/*---------------------------------------------------------------------------*/

/*
* pvPortMemCpyStreamBuffer
*
* Function to copy data into the stream buffer when sending
* and copy data from the stream buffer when receiving.
*/

#ifndef pvPortMemCpyStreamBuffer
#define pvPortMemCpyStreamBuffer( dst, src, count ) memcpy( dst, src, count )
#endif

/*---------------------------------------------------------------------------*/

/*===========================================================================*/
/* SOCKET CONFIG */
/* STREAM BUFFER CONFIG */
/*===========================================================================*/
/*---------------------------------------------------------------------------*/
/*===========================================================================*/
Expand Down
Loading