Stream buffers are an RTOS task to RTOS task, and interrupt to task communication primitives.
More...
|
| stream_buffer (size_type size, size_type triggerLevel) noexcept |
| Creates a new stream buffer using dynamically allocated memory.
|
|
| stream_buffer (stream_buffer &&other)=delete |
|
| stream_buffer (stream_buffer const &other)=delete |
|
| ~stream_buffer () noexcept |
| Deletes a stream buffer, then the allocated memory is freed.
|
|
auto | bytes_available () const noexcept -> size_type |
| Queries a stream buffer to see how much data it contains, which is equal to the number of bytes that can be read from the stream buffer before the stream buffer would be empty.
|
|
auto | empty () const noexcept -> bool |
| Queries a stream buffer to see if it is empty. A stream buffer is empty if it does not contain any data.
|
|
auto | full () const noexcept -> bool |
| 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.
|
|
auto | native_handle () const noexcept -> StreamBufferHandle_t |
| Returns the native FreeRTOS handle to the stream_buffer.
|
|
auto | operator= (stream_buffer &&other) -> stream_buffer &=delete |
|
auto | operator= (stream_buffer const &other) -> stream_buffer &=delete |
|
auto | read (net::mutable_buffer data, TickType_t ticks) -> size_type |
| Receives bytes from a stream buffer.
|
|
auto | read_from_isr (net::mutable_buffer data, BaseType_t *prio) -> size_type |
| Receives bytes from a stream buffer.
|
|
auto | reset () noexcept -> void |
| Resets a stream buffer to its initial, empty, state. Any data that was in the stream buffer is discarded. A stream buffer can only be reset if there are no tasks blocked waiting to either send to or receive from the stream buffer.
|
|
auto | space_available () const noexcept -> size_type |
| Queries a stream buffer to see how much free space it contains, which is equal to the amount of data that can be sent to the stream buffer before it is full.
|
|
auto | trigger_level (size_type triggerLevel) noexcept -> void |
| A stream buffer's trigger level is the number of bytes that must be in the stream buffer before a task that is blocked on the stream buffer to wait for data is moved out of the blocked state.
|
|
auto | write (net::const_buffer data, TickType_t ticks) -> size_type |
| Sends bytes to a stream buffer. The bytes are copied into the stream buffer.
|
|
auto | write_from_isr (net::const_buffer data, BaseType_t *prio) -> size_type |
| Interrupt safe version of the API function that sends a stream of bytes to the stream buffer.
|
|
Stream buffers are an RTOS task to RTOS task, and interrupt to task communication primitives.
Unlike most other FreeRTOS communications primitives, they are optimised for single reader single writer scenarios, such as passing data from an interrupt service routine to a task, or from one microcontroller core to another on dual core CPUs. Data is passed by copy - the data is copied into the buffer by the sender and out of the buffer by the read.
https://www.freertos.org/RTOS-stream-buffer-API.html https://www.freertos.org/RTOS-stream-message-buffers.html
auto trigger_level |
( |
size_type | triggerLevel | ) |
-> void |
|
inlinenoexcept |
A stream buffer's trigger level is the number of bytes that must be in the stream buffer before a task that is blocked on the stream buffer to wait for data is moved out of the blocked state.
For example, if a task is blocked on a read of an empty stream buffer that has a trigger level of 1 then the task will be unblocked when a single byte is written to the buffer or the task's block time expires. As another example, if a task is blocked on a read of an empty stream buffer that has a trigger level of 10 then the task will not be unblocked until the stream buffer contains at least 10 bytes or the task's block time expires. If a reading task's block time expires before the trigger level is reached then the task will still receive however many bytes are actually available. Setting a trigger level of 0 will result in a trigger level of 1 being used. It is not valid to specify a trigger level that is greater than the buffer size.
https://www.freertos.org/xStreamBufferSetTriggerLevel.html