24#include <zephyr/kernel.h>
44#define DATA_FIFO_DEFINE(name, elements_max_in, block_size_max_in) \
45 char __aligned(WB_UP( \
46 1)) _msgq_buffer_##name[(elements_max_in) * sizeof(struct data_fifo_msgq)] = {0}; \
47 char __aligned(WB_UP(1)) _slab_buffer_##name[(elements_max_in) * (block_size_max_in)] = { \
49 struct data_fifo name = {.msgq_buffer = _msgq_buffer_##name, \
50 .slab_buffer = _slab_buffer_##name, \
51 .block_size_max = block_size_max_in, \
52 .elements_max = elements_max_in, \
117 k_timeout_t timeout);
142 uint32_t *locked_num);
int data_fifo_empty(struct data_fifo *data_fifo)
Empty all items from data_fifo.
int data_fifo_num_used_get(struct data_fifo *data_fifo, uint32_t *alloced_num, uint32_t *locked_num)
See how many alloced and locked blocks are in the system.
void data_fifo_block_free(struct data_fifo *data_fifo, void *data)
Free the data block after reading.
bool data_fifo_state(struct data_fifo *data_fifo)
Test if the data_fifo state.
int data_fifo_block_lock(struct data_fifo *data_fifo, void **data, size_t size)
Confirm that the memory block use has finished and the block is put into the message queue.
int data_fifo_uninit(struct data_fifo *data_fifo)
Deinitialize data_fifo.
int data_fifo_pointer_last_filled_get(struct data_fifo *data_fifo, void **data, size_t *size, k_timeout_t timeout)
Get pointer to first (oldest) filled block in slab.
int data_fifo_init(struct data_fifo *data_fifo)
Initialize the data_fifo.
int data_fifo_pointer_first_vacant_get(struct data_fifo *data_fifo, void **data, k_timeout_t timeout)
Get pointer to the first vacant block in slab.
void * block_ptr
Definition: data_fifo.h:30
size_t size
Definition: data_fifo.h:31
Definition: data_fifo.h:29
uint32_t elements_max
Definition: data_fifo.h:39
char * slab_buffer
Definition: data_fifo.h:36
struct k_mem_slab mem_slab
Definition: data_fifo.h:37
char * msgq_buffer
Definition: data_fifo.h:35
struct k_msgq msgq
Definition: data_fifo.h:38
bool initialized
Definition: data_fifo.h:41
size_t block_size_max
Definition: data_fifo.h:40
Definition: data_fifo.h:34