OVMS3-idf/docs/_static/diagrams/ring-buffer/ring_buffer_wrap_byte_buf.diag

23 lines
575 B
Plaintext
Raw Normal View History

freeRTOS/Re-factor ring buffers This fixes multiple bugs with ring buffers and re-factors the code. The public API has not changed, however the underlying implementation have various private functions have been changed. The following behavioral changes have been made - Size of ring buffers for No-Split/Allow-Split buffers will not be rounded up to the nearest 32-bit aligned size. This was done to simplify the implementation - Item size for No-Split/Allow-Split buffers will also be rounded up to the nearest 32-bit aligned size. The following bugs have been fixed - In copyItemToRingbufAllowSplit(), when copying an item where the aligned size is smaller than the remaining length, the function does not consider the case where the true size of the item is less than 4 bytes. - The copy functions will automatically wrap around the write pointers when the remaining length of the buffer is not large enough to fit a header, but does not consider if wrapping around will cause an overlap with the read pointer. This will make a full buffer be mistaken for an empty buffer closes #1711 - xRingbufferSend() can get stuck in a infinite loop when the size of the free memory is larger than the needed_size, but too small to fit in the ring buffer due to alignment and extra overhead of wrapping around. closes #1846 - Fixed documentation with ring buffer queue set API - Adding and removing from queue set does not consider the case where the read/write semaphores actually hold a value. The following functions have been deprecated - xRingbufferIsNextItemWrapped() due to lack of thread safety - xRingbufferAddToQueueSetWrite() and xRingbufferRemoveFromQueueSetWrite() as adding the queue sets only work under receive operations. The following functions have been added - xRingbufferReceiveSplit() and xRingbufferReceiveSplitFromISR() as a thread safe way to receive from allow-split buffers - vRingbufferGetInfo() Documentation for ring buffers has also been added.
2018-04-18 17:20:34 +00:00
#Diagram demonstrating wrap around in byte buffer
#Buffer of 128 bytes, with 56 bytes free, and 28 bytes sent
packetdiag ring_buffer_wrap_byte_buf {
node_width = 6
node_height = 24
default_fontsize = 12
colwidth = 128
#Initial state
0-39: 40 Free
40-111: 72 [color = lightyellow];
112-127: 16 Free
#Fill up free space at the end of the buffer
128-167: 40 Free
168-255: 88 [color = lightyellow];
#Wrap around remaining data
256-267: 12 [color = lightyellow];
268-295: 28 Free
296-383: 88 [color = lightyellow];
}