mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-28 21:33:32 +00:00
freertos/ringbuf: Add an API xRingbufferIsNextItemWrapped()
Useful to check if the next item to receive is wrapped or not. This is valid only if the ring buffer is initialised with type RINGBUF_TYPE_ALLOWSPLIT. This is as per the feature request here: https://github.com/espressif/esp-idf/issues/806 Signed-off-by: Piyush Shah <piyush@espressif.com>
This commit is contained in:
@@ -110,6 +110,23 @@ size_t xRingbufferGetMaxItemSize(RingbufHandle_t ringbuf);
|
||||
*/
|
||||
size_t xRingbufferGetCurFreeSize(RingbufHandle_t ringbuf);
|
||||
|
||||
/**
|
||||
* @brief Check if the next item is wrapped
|
||||
*
|
||||
* This API tells if the next item that is available for a Receive is wrapped
|
||||
* or not. This is valid only if the ring buffer type is RINGBUF_TYPE_ALLOWSPLIT
|
||||
*
|
||||
* @note This API is not thread safe. So, if multiple threads are accessing the same
|
||||
* ring buffer, it is the application's responsibility to ensure atomic access to this
|
||||
* API and the subsequent Receive
|
||||
*
|
||||
* @param ringbuf - Ring buffer to query
|
||||
*
|
||||
* @return true if the next item is wrapped around
|
||||
* @return false if the next item is not wrapped
|
||||
*/
|
||||
bool xRingbufferIsNextItemWrapped(RingbufHandle_t ringbuf);
|
||||
|
||||
/**
|
||||
* @brief Insert an item into the ring buffer
|
||||
*
|
||||
|
Reference in New Issue
Block a user