Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
spsc_pbuf.h File Reference
#include <zephyr/cache.h>
#include <zephyr/devicetree.h>

Go to the source code of this file.

Data Structures

struct  spsc_pbuf_common
 First part of packet buffer control block. More...
 
struct  spsc_pbuf_ext_cache
 Remaining part of a packet buffer when cache is used. More...
 
struct  spsc_pbuf_ext_nocache
 Remaining part of a packet buffer when cache is not used. More...
 
struct  spsc_pbuf
 Single producer, single consumer packet buffer. More...
 

Macros

#define SPSC_PBUF_CACHE   BIT(0)
 Flag indicating that cache shall be handled.
 
#define SPSC_PBUF_UTILIZATION_BITS   24
 Size of the field which stores maximum utilization.
 
#define SPSC_PBUF_UTILIZATION_OFFSET   8
 Offset of the field which stores maximum utilization.
 
#define CONFIG_SPSC_PBUF_REMOTE_DCACHE_LINE   0
 
#define SPSC_PBUF_MAX_LEN   0xFF00
 Maximum packet length.
 

Functions

static uint32_t spsc_pbuf_capacity (struct spsc_pbuf *pb)
 Get buffer capacity.
 
struct spsc_pbufspsc_pbuf_init (void *buf, size_t blen, uint32_t flags)
 Initialize the packet buffer.
 
int spsc_pbuf_write (struct spsc_pbuf *pb, const char *buf, uint16_t len)
 Write specified amount of data to the packet buffer.
 
int spsc_pbuf_alloc (struct spsc_pbuf *pb, uint16_t len, char **buf)
 Allocate space in the packet buffer.
 
void spsc_pbuf_commit (struct spsc_pbuf *pb, uint16_t len)
 Commit packet to the buffer.
 
int spsc_pbuf_read (struct spsc_pbuf *pb, char *buf, uint16_t len)
 Read specified amount of data from the packet buffer.
 
uint16_t spsc_pbuf_claim (struct spsc_pbuf *pb, char **buf)
 Claim packet from the buffer.
 
void spsc_pbuf_free (struct spsc_pbuf *pb, uint16_t len)
 Free the packet to the buffer.
 
int spsc_pbuf_get_utilization (struct spsc_pbuf *pb)
 Get maximum utilization of the packet buffer.