Lines Matching refs:flags

20 #define GET_UTILIZATION(flags) \  argument
21 (((flags) >> SPSC_PBUF_UTILIZATION_OFFSET) & BIT_MASK(SPSC_PBUF_UTILIZATION_BITS))
23 #define SET_UTILIZATION(flags, val) \ argument
24 ((flags & ~(BIT_MASK(SPSC_PBUF_UTILIZATION_BITS) << \
46 static inline void cache_wb(void *data, size_t len, uint32_t flags) in cache_wb() argument
49 (IS_ENABLED(CONFIG_SPSC_PBUF_CACHE_FLAG) && (flags & SPSC_PBUF_CACHE))) { in cache_wb()
54 static inline void cache_inv(void *data, size_t len, uint32_t flags) in cache_inv() argument
57 (IS_ENABLED(CONFIG_SPSC_PBUF_CACHE_FLAG) && (flags & SPSC_PBUF_CACHE))) { in cache_inv()
62 static uint32_t *get_rd_idx_loc(struct spsc_pbuf *pb, uint32_t flags) in get_rd_idx_loc() argument
67 static uint32_t *get_wr_idx_loc(struct spsc_pbuf *pb, uint32_t flags) in get_wr_idx_loc() argument
70 (IS_ENABLED(CONFIG_SPSC_PBUF_CACHE_FLAG) && (flags & SPSC_PBUF_CACHE))) { in get_wr_idx_loc()
77 static uint8_t *get_data_loc(struct spsc_pbuf *pb, uint32_t flags) in get_data_loc() argument
80 (IS_ENABLED(CONFIG_SPSC_PBUF_CACHE_FLAG) && (flags & SPSC_PBUF_CACHE))) { in get_data_loc()
87 static uint32_t get_len(size_t blen, uint32_t flags) in get_len() argument
92 (IS_ENABLED(CONFIG_SPSC_PBUF_CACHE_FLAG) && (flags & SPSC_PBUF_CACHE))) { in get_len()
99 static bool check_alignment(void *buf, uint32_t flags) in check_alignment() argument
102 (IS_ENABLED(CONFIG_SPSC_PBUF_CACHE_FLAG) && (flags & SPSC_PBUF_CACHE)))) { in check_alignment()
109 struct spsc_pbuf *spsc_pbuf_init(void *buf, size_t blen, uint32_t flags) in spsc_pbuf_init() argument
111 if (!check_alignment(buf, flags)) { in spsc_pbuf_init()
120 uint32_t *wr_idx_loc = get_wr_idx_loc(pb, flags); in spsc_pbuf_init()
124 pb->common.len = get_len(blen, flags); in spsc_pbuf_init()
126 pb->common.flags = flags; in spsc_pbuf_init()
130 cache_wb(&pb->common, sizeof(pb->common), flags); in spsc_pbuf_init()
131 cache_wb(wr_idx_loc, sizeof(*wr_idx_loc), flags); in spsc_pbuf_init()
140 const uint32_t flags = pb->common.flags; in spsc_pbuf_alloc() local
141 uint32_t *rd_idx_loc = get_rd_idx_loc(pb, flags); in spsc_pbuf_alloc()
142 uint32_t *wr_idx_loc = get_wr_idx_loc(pb, flags); in spsc_pbuf_alloc()
143 uint8_t *data_loc = get_data_loc(pb, flags); in spsc_pbuf_alloc()
152 cache_inv(rd_idx_loc, sizeof(*rd_idx_loc), flags); in spsc_pbuf_alloc()
182 cache_wb(&data_loc[wr_idx], sizeof(uint8_t), flags); in spsc_pbuf_alloc()
209 const uint32_t flags = pb->common.flags; in spsc_pbuf_commit() local
210 uint32_t *wr_idx_loc = get_wr_idx_loc(pb, flags); in spsc_pbuf_commit()
211 uint8_t *data_loc = get_data_loc(pb, flags); in spsc_pbuf_commit()
217 cache_wb(&data_loc[wr_idx], len + LEN_SZ, flags); in spsc_pbuf_commit()
225 cache_wb(wr_idx_loc, sizeof(*wr_idx_loc), flags); in spsc_pbuf_commit()
253 const uint32_t flags = pb->common.flags; in spsc_pbuf_claim() local
254 uint32_t *rd_idx_loc = get_rd_idx_loc(pb, flags); in spsc_pbuf_claim()
255 uint32_t *wr_idx_loc = get_wr_idx_loc(pb, flags); in spsc_pbuf_claim()
256 uint8_t *data_loc = get_data_loc(pb, flags); in spsc_pbuf_claim()
258 cache_inv(wr_idx_loc, sizeof(*wr_idx_loc), flags); in spsc_pbuf_claim()
274 if (IS_ENABLED(CONFIG_SPSC_PBUF_UTILIZATION) && (bytes_stored > GET_UTILIZATION(flags))) { in spsc_pbuf_claim()
276 pb->common.flags = SET_UTILIZATION(flags, bytes_stored); in spsc_pbuf_claim()
278 cache_wb(&pb->common.flags, sizeof(pb->common.flags), flags); in spsc_pbuf_claim()
284 cache_inv(&data_loc[rd_idx], LEN_SZ, flags); in spsc_pbuf_claim()
292 cache_inv(wr_idx_loc, sizeof(*wr_idx_loc), flags); in spsc_pbuf_claim()
299 cache_wb(rd_idx_loc, sizeof(*rd_idx_loc), flags); in spsc_pbuf_claim()
305 cache_inv(&data_loc[rd_idx], sizeof(len), flags); in spsc_pbuf_claim()
313 cache_inv(&data_loc[rd_idx + LEN_SZ], len, flags); in spsc_pbuf_claim()
323 const uint32_t flags = pb->common.flags; in spsc_pbuf_free() local
324 uint32_t *rd_idx_loc = get_rd_idx_loc(pb, flags); in spsc_pbuf_free()
325 uint32_t *wr_idx_loc = get_wr_idx_loc(pb, flags); in spsc_pbuf_free()
327 uint8_t *data_loc = get_data_loc(pb, flags); in spsc_pbuf_free()
332 cache_inv(&data_loc[rd_idx], sizeof(uint8_t), flags); in spsc_pbuf_free()
334 cache_inv(wr_idx_loc, sizeof(*wr_idx_loc), flags); in spsc_pbuf_free()
349 cache_wb(rd_idx_loc, sizeof(*rd_idx_loc), flags); in spsc_pbuf_free()
382 cache_inv(&pb->common.flags, sizeof(pb->common.flags), pb->common.flags); in spsc_pbuf_get_utilization()
385 return GET_UTILIZATION(pb->common.flags); in spsc_pbuf_get_utilization()