This file implements the concept of a buffer stream. More...
#include <furi.h>
Go to the source code of this file.
Typedefs | |
typedef struct Buffer | Buffer |
typedef struct BufferStream | BufferStream |
Functions | |
uint8_t * | buffer_get_data (Buffer *buffer) |
Get buffer data pointer. | |
size_t | buffer_get_size (Buffer *buffer) |
Get buffer size. | |
void | buffer_reset (Buffer *buffer) |
Reset buffer and send to free buffer pool. | |
BufferStream * | buffer_stream_alloc (size_t buffer_size, size_t buffers_count) |
Allocate a new BufferStream instance. | |
void | buffer_stream_free (BufferStream *buffer_stream) |
Free a BufferStream instance. | |
bool | buffer_stream_send_from_isr (BufferStream *buffer_stream, const uint8_t *data, size_t size) |
Write data to buffer stream, from ISR context Data will be written to the buffer until the buffer is full, and only then will the buffer be sent. | |
Buffer * | buffer_stream_receive (BufferStream *buffer_stream, uint32_t timeout) |
Receive buffer from stream. | |
size_t | buffer_stream_get_overrun_count (BufferStream *buffer_stream) |
Get stream overrun count. | |
void | buffer_stream_reset (BufferStream *buffer_stream) |
Reset stream and buffer pool. | |
This file implements the concept of a buffer stream.
Data is written to the buffer until the buffer is full. Then the buffer pointer is written to the stream, and the new write buffer is taken from the buffer pool. After the buffer has been read by the receiving thread, it is sent to the free buffer pool.
This will speed up sending large chunks of data between threads, compared to using a stream directly.
uint8_t * buffer_get_data | ( | Buffer * | buffer | ) |
Get buffer data pointer.
buffer |
size_t buffer_get_size | ( | Buffer * | buffer | ) |
Get buffer size.
buffer |
void buffer_reset | ( | Buffer * | buffer | ) |
Reset buffer and send to free buffer pool.
buffer |
BufferStream * buffer_stream_alloc | ( | size_t | buffer_size, |
size_t | buffers_count ) |
Allocate a new BufferStream instance.
buffer_size | |
buffers_count |
void buffer_stream_free | ( | BufferStream * | buffer_stream | ) |
Free a BufferStream instance.
buffer_stream |
size_t buffer_stream_get_overrun_count | ( | BufferStream * | buffer_stream | ) |
Get stream overrun count.
buffer_stream |
Buffer * buffer_stream_receive | ( | BufferStream * | buffer_stream, |
uint32_t | timeout ) |
Receive buffer from stream.
buffer_stream | |
timeout |
void buffer_stream_reset | ( | BufferStream * | buffer_stream | ) |
Reset stream and buffer pool.
buffer_stream |
bool buffer_stream_send_from_isr | ( | BufferStream * | buffer_stream, |
const uint8_t * | data, | ||
size_t | size ) |
Write data to buffer stream, from ISR context Data will be written to the buffer until the buffer is full, and only then will the buffer be sent.
buffer_stream | |
data | |
size |