Chapter 2. API Reference
• pxHigherPriorityTaskWoken: *pxHigherPriorityTaskWoken should be initialised to
pdFALSE before it is passed into xStreamBufferSendCompletedFromISR(). If calling xStream-
BufferSendCompletedFromISR() removes a task from the Blocked state, and the task has a priority
above the priority of the currently running task, then *pxHigherPriorityTaskWoken will get set to
pdTRUE indicating that a context switch should be performed before exiting the ISR.
BaseType_t xStreamBufferReceiveCompletedFromISR(StreamBufferHandle_t
xStreamBuffer, BaseType_t
*pxHigherPriorityTaskWoken)
For advanced users only.
The sbRECEIVE_COMPLETED() macro is called from within the FreeRTOS APIs when data is read out of
a message buffer or stream buffer. If there was a task that was blocked on the message or stream buffer waiting
for data to arrive then the sbRECEIVE_COMPLETED() macro sends a notification to the task to remove it
from the Blocked state. xStreamBufferReceiveCompletedFromISR() does the same thing. It is provided to
enable application writers to implement their own version of sbRECEIVE_COMPLETED(), and MUST NOT
BE USED AT ANY OTHER TIME.
See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for additional information.
Return If a task was removed from the Blocked state then pdTRUE is returned. Otherwise pdFALSE is
returned.
Parameters
• xStreamBuffer: The handle of the stream buffer from which data was read.
• pxHigherPriorityTaskWoken: *pxHigherPriorityTaskWoken should be initialised to
pdFALSE before it is passed into xStreamBufferReceiveCompletedFromISR(). If calling xStream-
BufferReceiveCompletedFromISR() removes a task from the Blocked state, and the task has a pri-
ority above the priority of the currently running task, then *pxHigherPriorityTaskWoken will get set
to pdTRUE indicating that a context switch should be performed before exiting the ISR.
Macros
xStreamBufferCreate(xBufferSizeBytes, xTriggerLevelBytes)
Creates a new stream buffer using dynamically allocated memory. See xStreamBufferCreateStatic() for a ver-
sion that uses statically allocated memory (memory that is allocated at compile time).
configSUPPORT_DYNAMIC_ALLOCATION must be set to 1 or left undefined in FreeRTOSConfig.h for
xStreamBufferCreate() to be available.
Example use:
void vAFunction( void )
{
StreamBufferHandle_t xStreamBuffer;
const size_t xStreamBufferSizeBytes = 100, xTriggerLevel = 10;
// Create a stream buffer that can hold 100 bytes. The memory used to hold
// both the stream buffer structure and the data in the stream buffer is
// allocated dynamically.
xStreamBuffer = xStreamBufferCreate( xStreamBufferSizeBytes, xTriggerLevel );
if( xStreamBuffer == NULL )
{
// There was not enough heap memory space available to create the
// stream buffer.
}
else
{
// The stream buffer was created successfully and can now be used.
}
}
Return If NULL is returned, then the stream buffer cannot be created because there is insufficient heap
Espressif Systems 945
Submit Document Feedback
Release v4.4