6#ifndef ZEPHYR_INCLUDE_SYS_MPSC_PBUF_H_
7#define ZEPHYR_INCLUDE_SYS_MPSC_PBUF_H_
52#define MPSC_PBUF_SIZE_POW2 BIT(0)
59#define MPSC_PBUF_MODE_OVERWRITE BIT(1)
62#define MPSC_PBUF_MAX_UTILIZATION BIT(2)
65#define MPSC_PBUF_FULL BIT(3)
ZTEST_BMEM int timeout
Definition main.c:31
uint32_t(* mpsc_pbuf_get_wlen)(const union mpsc_pbuf_generic *packet)
Callback prototype for getting length of a packet.
Definition mpsc_pbuf.h:78
bool mpsc_pbuf_is_pending(struct mpsc_pbuf_buffer *buffer)
Check if there are any message pending.
union mpsc_pbuf_generic * mpsc_pbuf_alloc(struct mpsc_pbuf_buffer *buffer, size_t wlen, k_timeout_t timeout)
Allocate a packet.
void mpsc_pbuf_init(struct mpsc_pbuf_buffer *buffer, const struct mpsc_pbuf_buffer_config *config)
Initialize a packet buffer.
void mpsc_pbuf_free(struct mpsc_pbuf_buffer *buffer, const union mpsc_pbuf_generic *packet)
Free a packet.
void mpsc_pbuf_get_utilization(struct mpsc_pbuf_buffer *buffer, uint32_t *size, uint32_t *now)
Get current memory utilization.
void mpsc_pbuf_put_data(struct mpsc_pbuf_buffer *buffer, const uint32_t *data, size_t wlen)
Put a packet into a buffer.
void mpsc_pbuf_put_word_ext(struct mpsc_pbuf_buffer *buffer, const union mpsc_pbuf_generic word, const void *data)
Put a packet consisting of a word and a pointer.
void(* mpsc_pbuf_notify_drop)(const struct mpsc_pbuf_buffer *buffer, const union mpsc_pbuf_generic *packet)
Callback called when packet is dropped.
Definition mpsc_pbuf.h:86
int mpsc_pbuf_get_max_utilization(struct mpsc_pbuf_buffer *buffer, uint32_t *max)
Get maximum memory utilization.
const union mpsc_pbuf_generic * mpsc_pbuf_claim(struct mpsc_pbuf_buffer *buffer)
Claim the first pending packet.
void mpsc_pbuf_commit(struct mpsc_pbuf_buffer *buffer, union mpsc_pbuf_generic *packet)
Commit a packet.
void mpsc_pbuf_put_word(struct mpsc_pbuf_buffer *buffer, const union mpsc_pbuf_generic word)
Put single word packet into a buffer.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Kernel Spin Lock.
Definition spinlock.h:45
Kernel timeout type.
Definition sys_clock.h:65
MPSC packet buffer configuration.
Definition mpsc_pbuf.h:131
uint32_t * buf
Definition mpsc_pbuf.h:133
mpsc_pbuf_notify_drop notify_drop
Definition mpsc_pbuf.h:139
mpsc_pbuf_get_wlen get_wlen
Definition mpsc_pbuf.h:140
uint32_t flags
Definition mpsc_pbuf.h:143
uint32_t size
Definition mpsc_pbuf.h:136
MPSC packet buffer structure.
Definition mpsc_pbuf.h:90
uint32_t flags
Flags.
Definition mpsc_pbuf.h:104
struct k_spinlock lock
Lock.
Definition mpsc_pbuf.h:107
uint32_t * buf
Definition mpsc_pbuf.h:119
uint32_t wr_idx
Write index.
Definition mpsc_pbuf.h:95
uint32_t tmp_wr_idx
Temporary write index.
Definition mpsc_pbuf.h:92
uint32_t size
Definition mpsc_pbuf.h:122
mpsc_pbuf_notify_drop notify_drop
User callback called whenever packet is dropped.
Definition mpsc_pbuf.h:113
mpsc_pbuf_get_wlen get_wlen
Callback for getting packet length.
Definition mpsc_pbuf.h:116
uint32_t max_usage
Definition mpsc_pbuf.h:125
struct k_sem sem
Definition mpsc_pbuf.h:127
uint32_t tmp_rd_idx
Temporary read index.
Definition mpsc_pbuf.h:98
uint32_t rd_idx
Read index.
Definition mpsc_pbuf.h:101
static fdata_t data[2]
Definition test_fifo_contexts.c:15
static ZTEST_BMEM char buffer[8]
Definition test_mbox_api.c:433
static uint32_t now
Definition main.c:25
Generic packet header.
Definition mpsc_packet.h:49