Zephyr API 3.6.99
Loading...
Searching...
No Matches
mpsc_pbuf.h File Reference
#include <zephyr/kernel.h>
#include <zephyr/sys/mpsc_packet.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  mpsc_pbuf_buffer
 MPSC packet buffer structure. More...
 
struct  mpsc_pbuf_buffer_config
 MPSC packet buffer configuration. More...
 

Macros

#define MPSC_PBUF_SIZE_POW2   BIT(0)
 Flag indicating that buffer size is power of 2.
 
#define MPSC_PBUF_MODE_OVERWRITE   BIT(1)
 Flag indicating buffer full policy.
 
#define MPSC_PBUF_MAX_UTILIZATION   BIT(2)
 Flag indicating that maximum buffer usage is tracked.
 
#define MPSC_PBUF_FULL   BIT(3)
 Flag indicated that buffer is currently full.
 

Typedefs

typedef uint32_t(* mpsc_pbuf_get_wlen) (const union mpsc_pbuf_generic *packet)
 Callback prototype for getting length of a packet.
 
typedef void(* mpsc_pbuf_notify_drop) (const struct mpsc_pbuf_buffer *buffer, const union mpsc_pbuf_generic *packet)
 Callback called when packet is dropped.
 

Functions

void mpsc_pbuf_init (struct mpsc_pbuf_buffer *buffer, const struct mpsc_pbuf_buffer_config *config)
 Initialize a packet buffer.
 
union mpsc_pbuf_genericmpsc_pbuf_alloc (struct mpsc_pbuf_buffer *buffer, size_t wlen, k_timeout_t timeout)
 Allocate a 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.
 
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_put_data (struct mpsc_pbuf_buffer *buffer, const uint32_t *data, size_t wlen)
 Put a packet into a buffer.
 
const union mpsc_pbuf_genericmpsc_pbuf_claim (struct mpsc_pbuf_buffer *buffer)
 Claim the first pending packet.
 
void mpsc_pbuf_free (struct mpsc_pbuf_buffer *buffer, const union mpsc_pbuf_generic *packet)
 Free a packet.
 
bool mpsc_pbuf_is_pending (struct mpsc_pbuf_buffer *buffer)
 Check if there are any message pending.
 
void mpsc_pbuf_get_utilization (struct mpsc_pbuf_buffer *buffer, uint32_t *size, uint32_t *now)
 Get current memory utilization.
 
int mpsc_pbuf_get_max_utilization (struct mpsc_pbuf_buffer *buffer, uint32_t *max)
 Get maximum memory utilization.