MCPcopy Create free account
hub / github.com/Santroller/Santroller / ring_buffer_init

Function ring_buffer_init

lib/ring_buffer/ring_buffer.c:37–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35void ring_buffer_init(ring_buffer_t *ring_buf, char* buf, RING_BUFFER_SIZE_TYPE buf_len, uint lock_num)
36#else
37void ring_buffer_init(ring_buffer_t *ring_buf, char* buf, RING_BUFFER_SIZE_TYPE buf_len, uint32_t critical_section_data)
38#endif
39{
40 assert(ring_buf);
41 assert(buf);
42 assert(buf_len > 0);
43 ring_buf->buf = buf;
44 ring_buf->bufsize = buf_len;
45 ring_buf->in_idx = 0;
46 ring_buf->out_idx = 0;
47 ring_buf->num_buffered = 0;
48#if RING_BUFFER_MULTICORE_SUPPORT
49 critical_section_init_with_lock_num(&ring_buf->crit, lock_num);
50#else
51 ring_buf->critical_section_data = critical_section_data;
52#endif
53}
54
55static RING_BUFFER_SIZE_TYPE ring_buffer_push_core(ring_buffer_t *ring_buf, const char *vals, RING_BUFFER_SIZE_TYPE nvals)
56{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected