ringbuf: Fixes to header files for better understanding

1. Usage of this module required applications to include additional
files. What files to include is not very intuitive. Instead, it is
better for the header file itself to include other files as required.
2. Even though it may seem logical, it is better to explicitly mention
that an item needs to be "Returned" after a Receive

Signed-off-by: Piyush Shah <piyush@espressif.com>
This commit is contained in:
Piyush Shah 2017-11-17 15:50:49 +05:30
parent 62f44e45df
commit 7dd9c4f57f

View File

@ -36,6 +36,8 @@ maximum size is (buffer_size/2)-8 bytes. The bytebuf can fill the entire buffer
no overhead. no overhead.
*/ */
#include <freertos/queue.h>
//An opaque handle for a ringbuff object. //An opaque handle for a ringbuff object.
typedef void * RingbufHandle_t; typedef void * RingbufHandle_t;
@ -110,6 +112,8 @@ BaseType_t xRingbufferSendFromISR(RingbufHandle_t ringbuf, void *data, size_t da
/** /**
* @brief Retrieve an item from the ring buffer * @brief Retrieve an item from the ring buffer
* *
* @note A call to vRingbufferReturnItem() is required after this to free up the data received.
*
* @param ringbuf - Ring buffer to retrieve the item from * @param ringbuf - Ring buffer to retrieve the item from
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written. * @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
* @param xTicksToWait - Ticks to wait for items in the ringbuffer. * @param xTicksToWait - Ticks to wait for items in the ringbuffer.
@ -123,6 +127,8 @@ void *xRingbufferReceive(RingbufHandle_t ringbuf, size_t *item_size, TickType_t
/** /**
* @brief Retrieve an item from the ring buffer from an ISR * @brief Retrieve an item from the ring buffer from an ISR
* *
* @note A call to vRingbufferReturnItemFromISR() is required after this to free up the data received
*
* @param ringbuf - Ring buffer to retrieve the item from * @param ringbuf - Ring buffer to retrieve the item from
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written. * @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
* *
@ -135,6 +141,8 @@ void *xRingbufferReceiveFromISR(RingbufHandle_t ringbuf, size_t *item_size);
/** /**
* @brief Retrieve bytes from a ByteBuf type of ring buffer, specifying the maximum amount of bytes * @brief Retrieve bytes from a ByteBuf type of ring buffer, specifying the maximum amount of bytes
* to return * to return
* @note A call to vRingbufferReturnItem() is required after this to free up the data received.
* *
* @param ringbuf - Ring buffer to retrieve the item from * @param ringbuf - Ring buffer to retrieve the item from
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written. * @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
@ -150,6 +158,8 @@ void *xRingbufferReceiveUpTo(RingbufHandle_t ringbuf, size_t *item_size, TickTyp
* @brief Retrieve bytes from a ByteBuf type of ring buffer, specifying the maximum amount of bytes * @brief Retrieve bytes from a ByteBuf type of ring buffer, specifying the maximum amount of bytes
* to return. Call this from an ISR. * to return. Call this from an ISR.
* *
* @note A call to vRingbufferReturnItemFromISR() is required after this to free up the data received
*
* @param ringbuf - Ring buffer to retrieve the item from * @param ringbuf - Ring buffer to retrieve the item from
* @param item_size - Pointer to a variable to which the size of the retrieved item will be written. * @param item_size - Pointer to a variable to which the size of the retrieved item will be written.
* *