#include <stdarg.h>
#include <zrtos/types.h>
#include <zrtos/error.h>
#include <zrtos/list.h>
#include <zrtos/malloc_limit.h>
#include <zrtos/assert.h>
#include <zrtos/cast.h>
Go to the source code of this file.
|
| ZRTOS_ASSERT__STATIC_IS_POWER_OF_TWO (ZRTOS_CBUFFER__CFG_DATA_LENGTH) |
|
zrtos_cbuffer_node_t * | zrtos_cbuffer__get_first_node (zrtos_cbuffer_t *thiz) |
|
zrtos_cbuffer_node_t * | zrtos_cbuffer__get_last_node (zrtos_cbuffer_t *thiz) |
|
zrtos_cbuffer_node_t * | zrtos_cbuffer_node__get_next_node (zrtos_cbuffer_node_t *thiz) |
|
bool | zrtos_cbuffer_node__init (zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx) |
|
zrtos_cbuffer_node_t * | zrtos_cbuffer_node__new (zrtos_cbuffer_t *ctx) |
|
void | zrtos_cbuffer_node__free (zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx) |
|
bool | zrtos_cbuffer__init (zrtos_cbuffer_t *thiz) |
|
void | zrtos_cbuffer__deinit_callback (zrtos_list_t *thiz, zrtos_list_node_t *node) |
|
void | zrtos_cbuffer__deinit (zrtos_cbuffer_t *thiz) |
|
void | zrtos_cbuffer__start_write_transaction (zrtos_cbuffer_t *thiz, zrtos_cbuffer_write_transaction_t *txn) |
|
void | zrtos_cbuffer__rollback_write_transaction (zrtos_cbuffer_t *thiz, zrtos_cbuffer_write_transaction_t *txn) |
|
static size_t | zrtos_cbuffer_node__get_length (zrtos_cbuffer_node_t *thiz) |
|
bool | zrtos_cbuffer_node__is_empty (zrtos_cbuffer_node_t *thiz) |
|
static size_t | zrtos_cbuffer_node__get_free_space (zrtos_cbuffer_node_t *thiz) |
|
zrtos_error_t | zrtos_cbuffer_node__put (zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx, uint8_t val) |
|
zrtos_error_t | zrtos_cbuffer_node__get (zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx, uint8_t *out) |
|
zrtos_error_t | zrtos_cbuffer_node__peek (zrtos_cbuffer_node_t *thiz, uint8_t *out) |
|
zrtos_error_t | zrtos_cbuffer__hash (zrtos_cbuffer_t *thiz, size_t length, void(*callback)(void *callback_args, uint8_t ch), void *callback_args) |
|
zrtos_error_t | zrtos_cbuffer__put (zrtos_cbuffer_t *thiz, uint8_t val) |
|
zrtos_error_t | zrtos_cbuffer__put_ex (zrtos_cbuffer_t *thiz, size_t len, size_t *outlen,...) |
|
zrtos_error_t | zrtos_cbuffer__peek (zrtos_cbuffer_t *thiz, uint8_t *out) |
|
zrtos_error_t | zrtos_cbuffer__get (zrtos_cbuffer_t *thiz, uint8_t *out) |
|
zrtos_error_t | zrtos_cbuffer__get_ex (zrtos_cbuffer_t *thiz, void *data, size_t len, size_t *outlen) |
|
zrtos_error_t | zrtos_cbuffer__pop (zrtos_cbuffer_t *thiz) |
|
bool | zrtos_cbuffer__is_empty (zrtos_cbuffer_t *thiz) |
|
void | zrtos_cbuffer__clear (zrtos_cbuffer_t *thiz) |
|
zrtos_error_t | zrtos_cbuffer__can_read (zrtos_cbuffer_t *thiz) |
|
bool | zrtos_cbuffer__can_read_length (zrtos_cbuffer_t *thiz, size_t length) |
|
size_t | zrtos_cbuffer__get_length (zrtos_cbuffer_t *thiz) |
|
zrtos_error_t | zrtos_cbuffer__can_write (zrtos_cbuffer_t *thiz) |
|
zrtos_error_t | zrtos_cbuffer__pipe (zrtos_cbuffer_t *thiz, zrtos_cbuffer_t *src, size_t length, size_t *outlen) |
|
◆ ZRTOS_CBUFFER__CFG_DATA_LENGTH
#define ZRTOS_CBUFFER__CFG_DATA_LENGTH 16 |
◆ ZRTOS_CBUFFER__CFG_MALLOC_LIMIT
#define ZRTOS_CBUFFER__CFG_MALLOC_LIMIT 200 |
◆ zrtos_cbuffer_node_t
◆ zrtos_cbuffer_t
◆ zrtos_cbuffer_write_transaction_t
◆ ZRTOS_ASSERT__STATIC_IS_POWER_OF_TWO()
◆ zrtos_cbuffer__can_read()
Definition at line 373 of file cbuffer.h.
bool zrtos_cbuffer__is_empty(zrtos_cbuffer_t *thiz)
Successful program execution status.
◆ zrtos_cbuffer__can_read_length()
Definition at line 382 of file cbuffer.h.
zrtos_cbuffer_node_t * zrtos_cbuffer__get_first_node(zrtos_cbuffer_t *thiz)
#define ZRTOS_TYPES__MIN(a, b)
bool zrtos_cbuffer_node__is_empty(zrtos_cbuffer_node_t *thiz)
zrtos_cbuffer_node_t * zrtos_cbuffer_node__get_next_node(zrtos_cbuffer_node_t *thiz)
◆ zrtos_cbuffer__can_write()
Definition at line 415 of file cbuffer.h.
Successful program execution status.
◆ zrtos_cbuffer__clear()
Definition at line 362 of file cbuffer.h.
bool zrtos_list_node__has_next_node(zrtos_list_node_t *node)
zrtos_cbuffer_node_t * zrtos_cbuffer__get_first_node(zrtos_cbuffer_t *thiz)
void zrtos_cbuffer_node__free(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx)
◆ zrtos_cbuffer__deinit()
Definition at line 140 of file cbuffer.h.
void zrtos_cbuffer__deinit_callback(zrtos_list_t *thiz, zrtos_list_node_t *node)
void zrtos_list__deinit(zrtos_list_t *thiz, void(*callback)(zrtos_list_t *thiz, zrtos_list_node_t *node))
◆ zrtos_cbuffer__deinit_callback()
Definition at line 122 of file cbuffer.h.
#define zrtos_types__get_container_of(ptr, type, member)
void zrtos_cbuffer_node__free(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx)
◆ zrtos_cbuffer__get()
Definition at line 327 of file cbuffer.h.
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
#define zrtos_types__get_container_of(ptr, type, member)
zrtos_error_t zrtos_cbuffer_node__get(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx, uint8_t *out)
◆ zrtos_cbuffer__get_ex()
Definition at line 336 of file cbuffer.h.
#define ZRTOS_CAST(type, value)
zrtos_error_t zrtos_cbuffer__get(zrtos_cbuffer_t *thiz, uint8_t *out)
size_t zrtos_types__ptr_get_byte_distance(void *bigger, void *smaller)
Successful program execution status.
◆ zrtos_cbuffer__get_first_node()
Definition at line 57 of file cbuffer.h.
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
#define zrtos_types__get_container_of(ptr, type, member)
◆ zrtos_cbuffer__get_last_node()
Definition at line 66 of file cbuffer.h.
zrtos_list_node_t * zrtos_list__get_last_node(zrtos_list_t *thiz)
#define zrtos_types__get_container_of(ptr, type, member)
◆ zrtos_cbuffer__get_length()
Definition at line 401 of file cbuffer.h.
zrtos_cbuffer_node_t * zrtos_cbuffer__get_first_node(zrtos_cbuffer_t *thiz)
zrtos_cbuffer_node_t * zrtos_cbuffer_node__get_next_node(zrtos_cbuffer_node_t *thiz)
static size_t zrtos_cbuffer_node__get_length(zrtos_cbuffer_node_t *thiz)
◆ zrtos_cbuffer__hash()
Definition at line 245 of file cbuffer.h.
255 while(node && length){
259 while(tail != head && length--){
260 callback(callback_args,node->
data[tail++]);
zrtos_cbuffer_node_t * zrtos_cbuffer__get_first_node(zrtos_cbuffer_t *thiz)
Successful program execution status.
uint8_t data[ZRTOS_CBUFFER__CFG_DATA_LENGTH]
zrtos_cbuffer_node_t * zrtos_cbuffer_node__get_next_node(zrtos_cbuffer_node_t *thiz)
◆ zrtos_cbuffer__init()
Definition at line 115 of file cbuffer.h.
zrtos_cbuffer_node_t * zrtos_cbuffer_node__new(zrtos_cbuffer_t *ctx)
bool zrtos_list__init(zrtos_list_t *thiz)
◆ zrtos_cbuffer__is_empty()
Definition at line 357 of file cbuffer.h.
zrtos_cbuffer_node_t * zrtos_cbuffer__get_first_node(zrtos_cbuffer_t *thiz)
bool zrtos_cbuffer_node__is_empty(zrtos_cbuffer_node_t *thiz)
◆ zrtos_cbuffer__peek()
Definition at line 318 of file cbuffer.h.
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
#define zrtos_types__get_container_of(ptr, type, member)
zrtos_error_t zrtos_cbuffer_node__peek(zrtos_cbuffer_node_t *thiz, uint8_t *out)
◆ zrtos_cbuffer__pipe()
Definition at line 421 of file cbuffer.h.
zrtos_error_t zrtos_cbuffer__put(zrtos_cbuffer_t *thiz, uint8_t val)
zrtos_error_t zrtos_cbuffer__pop(zrtos_cbuffer_t *thiz)
zrtos_error_t zrtos_cbuffer__peek(zrtos_cbuffer_t *thiz, uint8_t *out)
bool zrtos_error__is_success(zrtos_error_t thiz)
Successful program execution status.
◆ zrtos_cbuffer__pop()
Definition at line 352 of file cbuffer.h.
zrtos_error_t zrtos_cbuffer__get(zrtos_cbuffer_t *thiz, uint8_t *out)
◆ zrtos_cbuffer__put()
Definition at line 269 of file cbuffer.h.
zrtos_list_node_t * zrtos_list__get_last_node(zrtos_list_t *thiz)
#define zrtos_types__get_container_of(ptr, type, member)
zrtos_error_t zrtos_cbuffer_node__put(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx, uint8_t val)
◆ zrtos_cbuffer__put_ex()
Definition at line 278 of file cbuffer.h.
294 va_start(args,outlen);
300 data_len = va_arg(args,
size_t);
#define ZRTOS_CAST(type, value)
void zrtos_cbuffer__rollback_write_transaction(zrtos_cbuffer_t *thiz, zrtos_cbuffer_write_transaction_t *txn)
zrtos_error_t zrtos_cbuffer__put(zrtos_cbuffer_t *thiz, uint8_t val)
bool zrtos_error__is_error(zrtos_error_t thiz)
void zrtos_cbuffer__start_write_transaction(zrtos_cbuffer_t *thiz, zrtos_cbuffer_write_transaction_t *txn)
bool zrtos_error__is_success(zrtos_error_t thiz)
Successful program execution status.
◆ zrtos_cbuffer__rollback_write_transaction()
Definition at line 154 of file cbuffer.h.
zrtos_cbuffer_node_t * zrtos_cbuffer__get_last_node(zrtos_cbuffer_t *thiz)
zrtos_cbuffer_node_t * zrtos_cbuffer_node__get_next_node(zrtos_cbuffer_node_t *thiz)
void zrtos_cbuffer_node__free(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx)
◆ zrtos_cbuffer__start_write_transaction()
Definition at line 146 of file cbuffer.h.
zrtos_cbuffer_node_t * zrtos_cbuffer__get_last_node(zrtos_cbuffer_t *thiz)
◆ zrtos_cbuffer_node__free()
Definition at line 110 of file cbuffer.h.
void zrtos_list__delete(zrtos_list_t *thiz, zrtos_list_node_t *node)
void zrtos_malloc_limit__free(zrtos_malloc_limit_t *thiz, void *ptr)
zrtos_malloc_limit_t zrtos_cbuffer__malloc_limit
◆ zrtos_cbuffer_node__get()
Definition at line 213 of file cbuffer.h.
#define ZRTOS_CBUFFER__CFG_DATA_LENGTH
bool zrtos_list_node__has_next_node(zrtos_list_node_t *node)
Successful program execution status.
bool zrtos_cbuffer_node__is_empty(zrtos_cbuffer_node_t *thiz)
uint8_t data[ZRTOS_CBUFFER__CFG_DATA_LENGTH]
void zrtos_cbuffer_node__free(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx)
◆ zrtos_cbuffer_node__get_free_space()
Definition at line 180 of file cbuffer.h.
#define ZRTOS_CBUFFER__CFG_DATA_LENGTH
static size_t zrtos_cbuffer_node__get_length(zrtos_cbuffer_node_t *thiz)
◆ zrtos_cbuffer_node__get_length()
Definition at line 169 of file cbuffer.h.
#define ZRTOS_CBUFFER__CFG_DATA_LENGTH
◆ zrtos_cbuffer_node__get_next_node()
Definition at line 75 of file cbuffer.h.
zrtos_list_node_t * zrtos_list_node__get_next_node(zrtos_list_node_t *node)
#define zrtos_types__get_container_of(ptr, type, member)
◆ zrtos_cbuffer_node__init()
Definition at line 84 of file cbuffer.h.
bool zrtos_list_node__init(zrtos_list_node_t *thiz)
bool zrtos_list__push(zrtos_list_t *thiz, zrtos_list_node_t *node)
◆ zrtos_cbuffer_node__is_empty()
◆ zrtos_cbuffer_node__new()
Definition at line 95 of file cbuffer.h.
#define ZRTOS_CAST(type, value)
bool zrtos_cbuffer_node__init(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx)
zrtos_malloc_limit_t zrtos_cbuffer__malloc_limit
#define ZRTOS_CBUFFER__CFG_MALLOC_LIMIT
void * zrtos_malloc_limit__malloc(zrtos_malloc_limit_t *thiz, size_t length, size_t limit)
◆ zrtos_cbuffer_node__peek()
Definition at line 232 of file cbuffer.h.
Successful program execution status.
bool zrtos_cbuffer_node__is_empty(zrtos_cbuffer_node_t *thiz)
uint8_t data[ZRTOS_CBUFFER__CFG_DATA_LENGTH]
◆ zrtos_cbuffer_node__put()
Definition at line 188 of file cbuffer.h.
#define ZRTOS_CBUFFER__CFG_DATA_LENGTH
zrtos_cbuffer_node_t * zrtos_cbuffer_node__new(zrtos_cbuffer_t *ctx)
Successful program execution status.
static size_t zrtos_cbuffer_node__get_free_space(zrtos_cbuffer_node_t *thiz)
uint8_t data[ZRTOS_CBUFFER__CFG_DATA_LENGTH]
zrtos_error_t zrtos_cbuffer_node__put(zrtos_cbuffer_node_t *thiz, zrtos_cbuffer_t *ctx, uint8_t val)
◆ zrtos_cbuffer__malloc_limit
- Todo:
- mutex lock zrtos_cbuffer__malloc_limit
Definition at line 55 of file cbuffer.h.