mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Fix xStreamBufferCreateStatic() API for buffer size 1 (#793)
This commit is contained in:
parent
2f94b181a2
commit
26c48dec46
|
@ -417,10 +417,16 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
||||||
xTriggerLevelBytes = ( size_t ) 1;
|
xTriggerLevelBytes = ( size_t ) 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* In case the stream buffer is going to be used as a message buffer
|
||||||
|
* (that is, it will hold discrete messages with a little meta data that
|
||||||
|
* says how big the next message is) check the buffer will be large enough
|
||||||
|
* to hold at least one message. */
|
||||||
|
|
||||||
if( xIsMessageBuffer != pdFALSE )
|
if( xIsMessageBuffer != pdFALSE )
|
||||||
{
|
{
|
||||||
/* Statically allocated message buffer. */
|
/* Statically allocated message buffer. */
|
||||||
ucFlags = sbFLAGS_IS_MESSAGE_BUFFER | sbFLAGS_IS_STATICALLY_ALLOCATED;
|
ucFlags = sbFLAGS_IS_MESSAGE_BUFFER | sbFLAGS_IS_STATICALLY_ALLOCATED;
|
||||||
|
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -428,12 +434,6 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
||||||
ucFlags = sbFLAGS_IS_STATICALLY_ALLOCATED;
|
ucFlags = sbFLAGS_IS_STATICALLY_ALLOCATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In case the stream buffer is going to be used as a message buffer
|
|
||||||
* (that is, it will hold discrete messages with a little meta data that
|
|
||||||
* says how big the next message is) check the buffer will be large enough
|
|
||||||
* to hold at least one message. */
|
|
||||||
configASSERT( xBufferSizeBytes > sbBYTES_TO_STORE_MESSAGE_LENGTH );
|
|
||||||
|
|
||||||
#if ( configASSERT_DEFINED == 1 )
|
#if ( configASSERT_DEFINED == 1 )
|
||||||
{
|
{
|
||||||
/* Sanity check that the size of the structure used to declare a
|
/* Sanity check that the size of the structure used to declare a
|
||||||
|
|
Loading…
Reference in a new issue