38 memcpy(buf, start, msg_len);
46 int nb_bytes = msg_len;
64 if ((
int)len >= available) {
void circular_buffer_init(struct circular_buffer *cb, uint8_t *buffer, size_t len)
initialize a circular buffer.
int circular_buffer_put(struct circular_buffer *cb, uint8_t *buf, size_t len)
Copy buf in the circular buffer.
int circular_buffer_get(struct circular_buffer *cb, uint8_t *buf, size_t len)
copy the next buffer available in cb to buf.
@ CIR_ERROR_NO_MSG
circular buffer is empty
@ CIR_ERROR_NO_SPACE_AVAILABLE
no space available in the circular buffer
@ CIR_ERROR_BUFFER_TOO_SMALL
destination buffer is too small
This is a general purpose circular buffer for storing buffers in a FIFO order.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.