mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 17:17:44 -04:00
Remove unnecessary length arg from prvReadMessageFromBuffer
This commit is contained in:
parent
ee82c9f34b
commit
1ffa6c7ebe
1 changed files with 7 additions and 9 deletions
|
@ -184,8 +184,7 @@ static size_t prvWriteBytesToBuffer( StreamBuffer_t * const pxStreamBuffer,
|
||||||
static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer,
|
static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer,
|
||||||
void * pvRxData,
|
void * pvRxData,
|
||||||
size_t xBufferLengthBytes,
|
size_t xBufferLengthBytes,
|
||||||
size_t xBytesAvailable,
|
size_t xBytesAvailable ) PRIVILEGED_FUNCTION;
|
||||||
size_t xBytesToStoreMessageLength ) PRIVILEGED_FUNCTION;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the stream buffer is being used as a message buffer, then writes an entire
|
* If the stream buffer is being used as a message buffer, then writes an entire
|
||||||
|
@ -839,7 +838,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
|
||||||
* read bytes from the buffer. */
|
* read bytes from the buffer. */
|
||||||
if( xBytesAvailable > xBytesToStoreMessageLength )
|
if( xBytesAvailable > xBytesToStoreMessageLength )
|
||||||
{
|
{
|
||||||
xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable, xBytesToStoreMessageLength );
|
xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable );
|
||||||
|
|
||||||
/* Was a task waiting for space in the buffer? */
|
/* Was a task waiting for space in the buffer? */
|
||||||
if( xReceivedLength != ( size_t ) 0 )
|
if( xReceivedLength != ( size_t ) 0 )
|
||||||
|
@ -941,7 +940,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
* read bytes from the buffer. */
|
* read bytes from the buffer. */
|
||||||
if( xBytesAvailable > xBytesToStoreMessageLength )
|
if( xBytesAvailable > xBytesToStoreMessageLength )
|
||||||
{
|
{
|
||||||
xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable, xBytesToStoreMessageLength );
|
xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable);
|
||||||
|
|
||||||
/* Was a task waiting for space in the buffer? */
|
/* Was a task waiting for space in the buffer? */
|
||||||
if( xReceivedLength != ( size_t ) 0 )
|
if( xReceivedLength != ( size_t ) 0 )
|
||||||
|
@ -967,25 +966,24 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer,
|
static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer,
|
||||||
void * pvRxData,
|
void * pvRxData,
|
||||||
size_t xBufferLengthBytes,
|
size_t xBufferLengthBytes,
|
||||||
size_t xBytesAvailable,
|
size_t xBytesAvailable )
|
||||||
size_t xBytesToStoreMessageLength )
|
|
||||||
{
|
{
|
||||||
size_t xOriginalTail, xReceivedLength, xNextMessageLength;
|
size_t xOriginalTail, xReceivedLength, xNextMessageLength;
|
||||||
configMESSAGE_BUFFER_LENGTH_TYPE xTempNextMessageLength;
|
configMESSAGE_BUFFER_LENGTH_TYPE xTempNextMessageLength;
|
||||||
|
|
||||||
if( xBytesToStoreMessageLength != ( size_t ) 0 )
|
if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )
|
||||||
{
|
{
|
||||||
/* A discrete message is being received. First receive the length
|
/* A discrete message is being received. First receive the length
|
||||||
* of the message. A copy of the tail is stored so the buffer can be
|
* of the message. A copy of the tail is stored so the buffer can be
|
||||||
* returned to its prior state if the length of the message is too
|
* returned to its prior state if the length of the message is too
|
||||||
* large for the provided buffer. */
|
* large for the provided buffer. */
|
||||||
xOriginalTail = pxStreamBuffer->xTail;
|
xOriginalTail = pxStreamBuffer->xTail;
|
||||||
( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempNextMessageLength, xBytesToStoreMessageLength, xBytesAvailable );
|
( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempNextMessageLength, sbBYTES_TO_STORE_MESSAGE_LENGTH, xBytesAvailable );
|
||||||
xNextMessageLength = ( size_t ) xTempNextMessageLength;
|
xNextMessageLength = ( size_t ) xTempNextMessageLength;
|
||||||
|
|
||||||
/* Reduce the number of bytes available by the number of bytes just
|
/* Reduce the number of bytes available by the number of bytes just
|
||||||
* read out. */
|
* read out. */
|
||||||
xBytesAvailable -= xBytesToStoreMessageLength;
|
xBytesAvailable -= sbBYTES_TO_STORE_MESSAGE_LENGTH;
|
||||||
|
|
||||||
/* Check there is enough space in the buffer provided by the
|
/* Check there is enough space in the buffer provided by the
|
||||||
* user. */
|
* user. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue