Espressif ESP32-S2 Programming Manual page 954

Table of Contents

Advertisement

Chapter 2. API Reference
if( xReceivedBytes
{
//
ucRxData contains xReceivedBytes read
//
Process the stream
}
//
If xHigherPriorityTaskWoken was
//
xStreamBufferReceiveFromISR() then a task that has a priority above the
//
priority of the currently executing task was unblocked
//
switch should be performed to ensure the ISR returns to the unblocked
// task.
In most FreeRTOS ports this
//
xHigherPriorityTaskWoken into taskYIELD_FROM_ISR(), which will test the
//
variables value,
//
documentation
taskYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
Return The number of bytes read from the stream buffer, if any.
Parameters
• xStreamBuffer: The handle of the stream buffer from which a stream is being received.
• pvRxData: A pointer to the buffer into which the received bytes are copied.
• xBufferLengthBytes: The length of the buffer pointed to by the pvRxData parameter. This
sets the maximum number of bytes to receive in one call. xStreamBufferReceive will return as many
bytes as possible up to a maximum set by xBufferLengthBytes.
• pxHigherPriorityTaskWoken: It is possible that a stream buffer will have a task blocked
on it waiting for space to become available. Calling xStreamBufferReceiveFromISR() can make
space available, and so cause a task that is waiting for space to leave the Blocked state. If call-
ing xStreamBufferReceiveFromISR() causes a task to leave the Blocked state, and the unblocked
task has a priority higher than the currently executing task (the task that was interrupted), then,
internally, xStreamBufferReceiveFromISR() will set *pxHigherPriorityTaskWoken to pdTRUE. If
xStreamBufferReceiveFromISR() sets this value to pdTRUE, then normally a context switch should
be performed before the interrupt is exited. That will ensure the interrupt returns directly to the
highest priority Ready state task. *pxHigherPriorityTaskWoken should be set to pdFALSE before
it is passed into the function. See the code example below for an example.
void
vStreamBufferDelete(StreamBufferHandle_t
Deletes a stream buffer that was previously created using a call to xStreamBufferCreate() or xStreamBuffer-
CreateStatic(). If the stream buffer was created using dynamic memory (that is, by xStreamBufferCreate()),
then the allocated memory is freed.
A stream buffer handle must not be used after the stream buffer has been deleted.
Parameters
• xStreamBuffer: The handle of the stream buffer to be deleted.
BaseType_t
xStreamBufferIsFull(StreamBufferHandle_t
Queries a stream buffer to see if it is full. A stream buffer is full if it does not have any free space, and therefore
cannot accept any more data.
Return If the stream buffer is full then pdTRUE is returned. Otherwise pdFALSE is returned.
Parameters
• xStreamBuffer: The handle of the stream buffer being queried.
BaseType_t
xStreamBufferIsEmpty(StreamBufferHandle_t
Queries a stream buffer to see if it is empty. A stream buffer is empty if it does not contain any data.
Return If the stream buffer is empty then pdTRUE is returned. Otherwise pdFALSE is returned.
Parameters
• xStreamBuffer: The handle of the stream buffer being queried.
Espressif Systems
>
0
)
here....
set
and
perform the context switch
for
the port
in
use
943
Submit Document Feedback
sizeof( ucRxData ),
&xHigherPriorityTaskWoken );
from
the
stream
to pdTRUE inside
is
done by simply passing
if
necessary.
for
port specific
instructions.
xStreamBuffer)
xStreamBuffer)
xStreamBuffer)
(continued from previous page)
buffer.
and
a context
Check the
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF