mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
Add Stream Batching Buffer (#916)
The difference between a stream buffer and a stream batching buffer is when a task performs read on a non-empty buffer: - The task reading from a non-empty stream buffer returns immediately regardless of the amount of data in the buffer. - The task reading from a non-empty steam batching buffer blocks until the amount of data in the buffer exceeds the trigger level or the block time expires.
This commit is contained in:
parent
5a72344c9a
commit
f69b1db45c
7 changed files with 260 additions and 44 deletions
|
@ -2404,14 +2404,14 @@
|
|||
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) )
|
||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
||||
size_t xTriggerLevelBytes,
|
||||
BaseType_t xIsMessageBuffer,
|
||||
BaseType_t xStreamBufferType,
|
||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) /* FREERTOS_SYSTEM_CALL */
|
||||
{
|
||||
StreamBufferHandle_t xReturn;
|
||||
|
||||
/**
|
||||
* Streambuffer application level callback functionality is disabled for MPU
|
||||
* Stream buffer application level callback functionality is disabled for MPU
|
||||
* enabled ports.
|
||||
*/
|
||||
configASSERT( ( pxSendCompletedCallback == NULL ) &&
|
||||
|
@ -2427,7 +2427,7 @@
|
|||
|
||||
xReturn = xStreamBufferGenericCreate( xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer,
|
||||
xStreamBufferType,
|
||||
NULL,
|
||||
NULL );
|
||||
portMEMORY_BARRIER();
|
||||
|
@ -2439,14 +2439,14 @@
|
|||
{
|
||||
xReturn = xStreamBufferGenericCreate( xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer,
|
||||
xStreamBufferType,
|
||||
NULL,
|
||||
NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer );
|
||||
traceSTREAM_BUFFER_CREATE_FAILED( xStreamBufferType );
|
||||
xReturn = NULL;
|
||||
}
|
||||
|
||||
|
@ -2458,7 +2458,7 @@
|
|||
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) )
|
||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
||||
size_t xTriggerLevelBytes,
|
||||
BaseType_t xIsMessageBuffer,
|
||||
BaseType_t xStreamBufferType,
|
||||
uint8_t * const pucStreamBufferStorageArea,
|
||||
StaticStreamBuffer_t * const pxStaticStreamBuffer,
|
||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||
|
@ -2467,7 +2467,7 @@
|
|||
StreamBufferHandle_t xReturn;
|
||||
|
||||
/**
|
||||
* Streambuffer application level callback functionality is disabled for MPU
|
||||
* Stream buffer application level callback functionality is disabled for MPU
|
||||
* enabled ports.
|
||||
*/
|
||||
configASSERT( ( pxSendCompletedCallback == NULL ) &&
|
||||
|
@ -2483,7 +2483,7 @@
|
|||
|
||||
xReturn = xStreamBufferGenericCreateStatic( xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer,
|
||||
xStreamBufferType,
|
||||
pucStreamBufferStorageArea,
|
||||
pxStaticStreamBuffer,
|
||||
NULL,
|
||||
|
@ -2497,7 +2497,7 @@
|
|||
{
|
||||
xReturn = xStreamBufferGenericCreateStatic( xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer,
|
||||
xStreamBufferType,
|
||||
pucStreamBufferStorageArea,
|
||||
pxStaticStreamBuffer,
|
||||
NULL,
|
||||
|
@ -2506,7 +2506,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer );
|
||||
traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xStreamBufferType );
|
||||
xReturn = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -4662,7 +4662,7 @@
|
|||
|
||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
||||
size_t xTriggerLevelBytes,
|
||||
BaseType_t xIsMessageBuffer,
|
||||
BaseType_t xStreamBufferType,
|
||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) /* PRIVILEGED_FUNCTION */
|
||||
{
|
||||
|
@ -4686,7 +4686,7 @@
|
|||
{
|
||||
xInternalStreamBufferHandle = xStreamBufferGenericCreate( xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer,
|
||||
xStreamBufferType,
|
||||
NULL,
|
||||
NULL );
|
||||
|
||||
|
@ -4703,7 +4703,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer );
|
||||
traceSTREAM_BUFFER_CREATE_FAILED( xStreamBufferType );
|
||||
xExternalStreamBufferHandle = NULL;
|
||||
}
|
||||
|
||||
|
@ -4717,7 +4717,7 @@
|
|||
|
||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
||||
size_t xTriggerLevelBytes,
|
||||
BaseType_t xIsMessageBuffer,
|
||||
BaseType_t xStreamBufferType,
|
||||
uint8_t * const pucStreamBufferStorageArea,
|
||||
StaticStreamBuffer_t * const pxStaticStreamBuffer,
|
||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||
|
@ -4743,7 +4743,7 @@
|
|||
{
|
||||
xInternalStreamBufferHandle = xStreamBufferGenericCreateStatic( xBufferSizeBytes,
|
||||
xTriggerLevelBytes,
|
||||
xIsMessageBuffer,
|
||||
xStreamBufferType,
|
||||
pucStreamBufferStorageArea,
|
||||
pxStaticStreamBuffer,
|
||||
NULL,
|
||||
|
@ -4762,7 +4762,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer );
|
||||
traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xStreamBufferType );
|
||||
xExternalStreamBufferHandle = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue