-
Notifications
You must be signed in to change notification settings - Fork 0
Ring buffers
Ring buffer is a FIFO that can be used to store data temporary, write it to the end and read from the head.
LVS_DEFINE_RINGBUF(name, size) Define ring buffer. Shall be used once
LVS_RINGBUF_INIT(name) Initialize the ring buffer. Shall be used once in the initialization function
LVS_RINGBUF(name) Get ring buffer handler structure by name
int lvs_RingbufGetFreeSpace(LVS_RINGBUF_T* rb) Get amount of the free space remaining in the buffer
int lvs_RingbufGetSize(LVS_RINGBUF_T* rb) Get current size of space used in the buffer
int lvs_RingbufGetTotalSize(LVS_RINGBUF_T* rb) Get total size allocated for the buffer
LVS_ERROR_T lvs_RingbufWriteByte(LVS_RINGBUF_T* rb, unsigned char data) Write a single byte to the end of buffer
LVS_ERROR_T lvs_RingbufWrite(LVS_RINGBUF_T* rb, unsigned char* data, int size) Write a byte sequence to the end of the buffer
LVS_ERROR_T lvs_RingbufReadByte(LVS_RINGBUF_T* rb, unsigned char* data) Read single byte from the head of the buffer
LVS_ERROR_T lvs_RingbufRead(LVS_RINGBUF_T* rb, unsigned char* data, int size) Read a sequence from the head of the buffer
LVS_ERROR_T lvs_RingbufPeek(LVS_RINGBUF_T* rb, unsigned char* data) Retrieve single byte from the buffer without changing read position