Lines Matching full:buf

12 uint32_t ring_buf_put_claim(struct ring_buf *buf, uint8_t **data, uint32_t size)  in ring_buf_put_claim()  argument
17 base = buf->put_base; in ring_buf_put_claim()
18 wrap_size = buf->put_head - base; in ring_buf_put_claim()
19 if (unlikely(wrap_size >= buf->size)) { in ring_buf_put_claim()
21 wrap_size -= buf->size; in ring_buf_put_claim()
22 base += buf->size; in ring_buf_put_claim()
24 wrap_size = buf->size - wrap_size; in ring_buf_put_claim()
26 free_space = ring_buf_space_get(buf); in ring_buf_put_claim()
30 *data = &buf->buffer[buf->put_head - base]; in ring_buf_put_claim()
31 buf->put_head += size; in ring_buf_put_claim()
36 int ring_buf_put_finish(struct ring_buf *buf, uint32_t size) in ring_buf_put_finish() argument
40 finish_space = buf->put_head - buf->put_tail; in ring_buf_put_finish()
45 buf->put_tail += size; in ring_buf_put_finish()
46 buf->put_head = buf->put_tail; in ring_buf_put_finish()
48 wrap_size = buf->put_tail - buf->put_base; in ring_buf_put_finish()
49 if (unlikely(wrap_size >= buf->size)) { in ring_buf_put_finish()
51 buf->put_base += buf->size; in ring_buf_put_finish()
57 uint32_t ring_buf_put(struct ring_buf *buf, const uint8_t *data, uint32_t size) in ring_buf_put() argument
65 partial_size = ring_buf_put_claim(buf, &dst, size); in ring_buf_put()
72 err = ring_buf_put_finish(buf, total_size); in ring_buf_put()
79 uint32_t ring_buf_get_claim(struct ring_buf *buf, uint8_t **data, uint32_t size) in ring_buf_get_claim() argument
84 base = buf->get_base; in ring_buf_get_claim()
85 wrap_size = buf->get_head - base; in ring_buf_get_claim()
86 if (unlikely(wrap_size >= buf->size)) { in ring_buf_get_claim()
88 wrap_size -= buf->size; in ring_buf_get_claim()
89 base += buf->size; in ring_buf_get_claim()
91 wrap_size = buf->size - wrap_size; in ring_buf_get_claim()
93 available_size = ring_buf_size_get(buf); in ring_buf_get_claim()
97 *data = &buf->buffer[buf->get_head - base]; in ring_buf_get_claim()
98 buf->get_head += size; in ring_buf_get_claim()
103 int ring_buf_get_finish(struct ring_buf *buf, uint32_t size) in ring_buf_get_finish() argument
107 finish_space = buf->get_head - buf->get_tail; in ring_buf_get_finish()
112 buf->get_tail += size; in ring_buf_get_finish()
113 buf->get_head = buf->get_tail; in ring_buf_get_finish()
115 wrap_size = buf->get_tail - buf->get_base; in ring_buf_get_finish()
116 if (unlikely(wrap_size >= buf->size)) { in ring_buf_get_finish()
118 buf->get_base += buf->size; in ring_buf_get_finish()
124 uint32_t ring_buf_get(struct ring_buf *buf, uint8_t *data, uint32_t size) in ring_buf_get() argument
132 partial_size = ring_buf_get_claim(buf, &src, size); in ring_buf_get()
141 err = ring_buf_get_finish(buf, total_size); in ring_buf_get()
148 uint32_t ring_buf_peek(struct ring_buf *buf, uint8_t *data, uint32_t size) in ring_buf_peek() argument
155 size = MIN(size, ring_buf_size_get(buf)); in ring_buf_peek()
158 partial_size = ring_buf_get_claim(buf, &src, size); in ring_buf_peek()
167 err = ring_buf_get_finish(buf, 0); in ring_buf_peek()
186 int ring_buf_item_put(struct ring_buf *buf, uint16_t type, uint8_t value, in ring_buf_item_put() argument
194 space = ring_buf_space_get(buf); in ring_buf_item_put()
200 err = ring_buf_put_claim(buf, &dst, sizeof(struct ring_element)); in ring_buf_item_put()
210 partial_size = ring_buf_put_claim(buf, &dst, size); in ring_buf_item_put()
218 err = ring_buf_put_finish(buf, total_size); in ring_buf_item_put()
225 int ring_buf_item_get(struct ring_buf *buf, uint16_t *type, uint8_t *value, in ring_buf_item_get() argument
233 if (ring_buf_is_empty(buf)) { in ring_buf_item_get()
237 err = ring_buf_get_claim(buf, &src, sizeof(struct ring_element)); in ring_buf_item_get()
244 ring_buf_get_finish(buf, 0); in ring_buf_item_get()
256 partial_size = ring_buf_get_claim(buf, &src, size); in ring_buf_item_get()
265 err = ring_buf_get_finish(buf, total_size); in ring_buf_item_get()