mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-05-12 11:42:57 -04:00
Merge 4df89dcf5e into a8c9d35152
This commit is contained in:
commit
f423257a48
1 changed files with 40 additions and 2 deletions
|
|
@ -256,6 +256,15 @@ typedef struct StreamBufferDef_t
|
|||
*/
|
||||
static size_t prvBytesInBuffer( const StreamBuffer_t * const pxStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Returns pdTRUE when the amount of buffered data should unblock a task that
|
||||
* is waiting to receive data. Stream batching buffers require the buffered
|
||||
* data to exceed the trigger level, whereas stream and message buffers unblock
|
||||
* when the trigger level is reached.
|
||||
*/
|
||||
static BaseType_t prvBytesInBufferMeetTriggerLevel( const StreamBuffer_t * const pxStreamBuffer,
|
||||
size_t xBytesInBuffer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Add xCount bytes from pucData into the pxStreamBuffer's data storage area.
|
||||
* This function does not update the buffer's xHead pointer, so multiple writes
|
||||
|
|
@ -919,7 +928,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
|
|||
traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn );
|
||||
|
||||
/* Was a task waiting for the data? */
|
||||
if( prvBytesInBuffer( pxStreamBuffer ) >= pxStreamBuffer->xTriggerLevelBytes )
|
||||
if( prvBytesInBufferMeetTriggerLevel( pxStreamBuffer, prvBytesInBuffer( pxStreamBuffer ) ) != pdFALSE )
|
||||
{
|
||||
prvSEND_COMPLETED( pxStreamBuffer );
|
||||
}
|
||||
|
|
@ -976,7 +985,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
|
|||
if( xReturn > ( size_t ) 0 )
|
||||
{
|
||||
/* Was a task waiting for the data? */
|
||||
if( prvBytesInBuffer( pxStreamBuffer ) >= pxStreamBuffer->xTriggerLevelBytes )
|
||||
if( prvBytesInBufferMeetTriggerLevel( pxStreamBuffer, prvBytesInBuffer( pxStreamBuffer ) ) != pdFALSE )
|
||||
{
|
||||
/* MISRA Ref 4.7.1 [Return value shall be checked] */
|
||||
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#dir-47 */
|
||||
|
|
@ -1587,6 +1596,35 @@ static size_t prvBytesInBuffer( const StreamBuffer_t * const pxStreamBuffer )
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static BaseType_t prvBytesInBufferMeetTriggerLevel( const StreamBuffer_t * const pxStreamBuffer,
|
||||
size_t xBytesInBuffer )
|
||||
{
|
||||
BaseType_t xReturn = pdFALSE;
|
||||
|
||||
if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_BATCHING_BUFFER ) != ( uint8_t ) 0 )
|
||||
{
|
||||
if( xBytesInBuffer > pxStreamBuffer->xTriggerLevelBytes )
|
||||
{
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
else if( xBytesInBuffer >= pxStreamBuffer->xTriggerLevelBytes )
|
||||
{
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
|
||||
uint8_t * const pucBuffer,
|
||||
size_t xBufferSizeBytes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue