7#ifndef ZEPHYR_INCLUDE_SYS_SPSC_PBUF_H_
8#define ZEPHYR_INCLUDE_SYS_SPSC_PBUF_H_
29#define SPSC_PBUF_CACHE BIT(0)
32#define SPSC_PBUF_UTILIZATION_BITS 24
35#define SPSC_PBUF_UTILIZATION_OFFSET 8
39#if CONFIG_DCACHE_LINE_SIZE != 0
40#define Z_SPSC_PBUF_LOCAL_DCACHE_LINE CONFIG_DCACHE_LINE_SIZE
42#define Z_SPSC_PBUF_LOCAL_DCACHE_LINE DT_PROP_OR(CPU, d_cache_line_size, 0)
45#ifndef CONFIG_SPSC_PBUF_REMOTE_DCACHE_LINE
46#define CONFIG_SPSC_PBUF_REMOTE_DCACHE_LINE 0
49#define Z_SPSC_PBUF_DCACHE_LINE \
50 MAX(CONFIG_SPSC_PBUF_REMOTE_DCACHE_LINE, Z_SPSC_PBUF_LOCAL_DCACHE_LINE)
53#define SPSC_PBUF_MAX_LEN 0xFF00
69#define Z_SPSC_PBUF_PADDING \
70 MAX(0, Z_SPSC_PBUF_DCACHE_LINE - (int)sizeof(struct spsc_pbuf_common))
static uint32_t spsc_pbuf_capacity(struct spsc_pbuf *pb)
Get buffer capacity.
Definition: spsc_pbuf.h:119
int spsc_pbuf_read(struct spsc_pbuf *pb, char *buf, uint16_t len)
Read specified amount of data from the packet buffer.
void spsc_pbuf_free(struct spsc_pbuf *pb, uint16_t len)
Free the packet to the buffer.
int spsc_pbuf_alloc(struct spsc_pbuf *pb, uint16_t len, char **buf)
Allocate space in 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.
void spsc_pbuf_commit(struct spsc_pbuf *pb, uint16_t len)
Commit packet to the buffer.
uint16_t spsc_pbuf_claim(struct spsc_pbuf *pb, char **buf)
Claim packet from the buffer.
struct spsc_pbuf * spsc_pbuf_init(void *buf, size_t blen, uint32_t flags)
Initialize the packet buffer.
int spsc_pbuf_get_utilization(struct spsc_pbuf *pb)
Get maximum utilization of the packet buffer.
flags
Definition: parser.h:96
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
First part of packet buffer control block.
Definition: spsc_pbuf.h:62
uint32_t len
Definition: spsc_pbuf.h:63
uint32_t flags
Definition: spsc_pbuf.h:64
uint32_t rd_idx
Definition: spsc_pbuf.h:65
Remaining part of a packet buffer when cache is used.
Definition: spsc_pbuf.h:77
uint32_t wr_idx
Definition: spsc_pbuf.h:79
uint8_t data[]
Definition: spsc_pbuf.h:80
uint8_t reserved[MAX(0, MAX(0, DT_PROP_OR(CPU, d_cache_line_size, 0)) -(int) sizeof(struct spsc_pbuf_common))]
Definition: spsc_pbuf.h:78
Remaining part of a packet buffer when cache is not used.
Definition: spsc_pbuf.h:84
uint8_t data[]
Definition: spsc_pbuf.h:86
uint32_t wr_idx
Definition: spsc_pbuf.h:85
Single producer, single consumer packet buffer.
Definition: spsc_pbuf.h:101
struct spsc_pbuf_common common
Definition: spsc_pbuf.h:102
union spsc_pbuf::@395 ext