Lines Matching full:buffer

30  * @defgroup ring_buffer_apis Ring Buffer APIs
33 * @brief Simple ring buffer implementation.
39 * @brief A structure to represent a ring buffer
43 uint8_t *buffer; member
66 * @brief Define and initialize a ring buffer for byte data.
68 * This macro establishes a ring buffer of an arbitrary size.
71 * The ring buffer can be accessed outside the module where it is defined
76 * @param name Name of the ring buffer.
77 * @param size8 Size of ring buffer (in bytes).
84 .buffer = _ring_buffer_data_##name, \
89 * @brief Define and initialize an "item based" ring buffer.
91 * This macro establishes an "item based" ring buffer. Each data item is
95 * The ring buffer can be accessed outside the module where it is defined
100 * @param name Name of the ring buffer.
101 * @param size32 Size of ring buffer (in 32-bit words).
108 .buffer = (uint8_t *) _ring_buffer_data_##name, \
113 * @brief Define and initialize an "item based" ring buffer.
118 * @param name Name of the ring buffer.
119 * @param size32 Size of ring buffer (in 32-bit words).
125 * @brief Define and initialize a power-of-2 sized "item based" ring buffer.
127 * This macro establishes an "item based" ring buffer by specifying its
131 * @param name Name of the ring buffer.
132 * @param pow Ring buffer size exponent.
138 * @brief Compute the ring buffer size in 32-bit needed to store an element
148 * @brief Initialize a ring buffer for byte data.
150 * This routine initializes a ring buffer, prior to its first use. It is only
153 * @param buf Address of ring buffer.
154 * @param size Ring buffer size (in bytes).
155 * @param data Ring buffer data area (uint8_t data[size]).
164 buf->buffer = data; in ring_buf_init()
169 * @brief Initialize an "item based" ring buffer.
171 * This routine initializes a ring buffer, prior to its first use. It is only
177 * @param buf Address of ring buffer.
178 * @param size Ring buffer size (in 32-bit words)
179 * @param data Ring buffer data area (uint32_t data[size]).
190 * @brief Determine if a ring buffer is empty.
192 * @param buf Address of ring buffer.
194 * @return true if the ring buffer is empty, or false if not.
202 * @brief Reset ring buffer state.
204 * @param buf Address of ring buffer.
212 * @brief Determine free space in a ring buffer.
214 * @param buf Address of ring buffer.
216 * @return Ring buffer free space (in bytes).
224 * @brief Determine free space in an "item based" ring buffer.
226 * @param buf Address of ring buffer.
228 * @return Ring buffer free space (in 32-bit words).
236 * @brief Return ring buffer capacity.
238 * @param buf Address of ring buffer.
240 * @return Ring buffer capacity (in bytes).
248 * @brief Determine used space in a ring buffer.
250 * @param buf Address of ring buffer.
252 * @return Ring buffer space used (in bytes).
260 * @brief Allocate buffer for writing data to a ring buffer.
262 * With this routine, memory copying can be reduced since internal ring buffer
267 * Use cases involving multiple writers to the ring buffer must prevent
269 * being preempted or by using a mutex to govern writes to the ring buffer.
272 * Ring buffer instance should not mix byte access and item access
275 * @param[in] buf Address of ring buffer.
277 * ring buffer.
280 * @return Size of allocated buffer which can be smaller than requested if
281 * there is not enough free space or buffer wraps.
292 * bytes will be returned to the available free buffer space.
295 * Use cases involving multiple writers to the ring buffer must prevent
297 * being preempted or by using a mutex to govern writes to the ring buffer.
300 * Ring buffer instance should not mix byte access and item access
303 * @param buf Address of ring buffer.
307 * @retval -EINVAL Provided @a size exceeds free space in the ring buffer.
312 * @brief Write (copy) data to a ring buffer.
314 * This routine writes data to a ring buffer @a buf.
317 * Use cases involving multiple writers to the ring buffer must prevent
319 * being preempted or by using a mutex to govern writes to the ring buffer.
322 * Ring buffer instance should not mix byte access and item access
325 * @param buf Address of ring buffer.
334 * @brief Get address of a valid data in a ring buffer.
336 * With this routine, memory copying can be reduced since internal ring buffer
341 * Use cases involving multiple reads of the ring buffer must prevent
343 * being preempted or by using a mutex to govern reads to the ring buffer.
346 * Ring buffer instance should not mix byte access and item access
349 * @param[in] buf Address of ring buffer.
351 * ring buffer.
354 * @return Number of valid bytes in the provided buffer which can be smaller
355 * than requested if there is not enough free space or buffer wraps.
362 * @brief Indicate number of bytes read from claimed buffer.
366 * bytes will remain available in the buffer.
369 * Use cases involving multiple reads of the ring buffer must prevent
371 * being preempted or by using a mutex to govern reads to the ring buffer.
374 * Ring buffer instance should not mix byte access and item mode
377 * @param buf Address of ring buffer.
381 * @retval -EINVAL Provided @a size exceeds valid bytes in the ring buffer.
386 * @brief Read data from a ring buffer.
388 * This routine reads data from a ring buffer @a buf.
391 * Use cases involving multiple reads of the ring buffer must prevent
393 * being preempted or by using a mutex to govern reads to the ring buffer.
396 * Ring buffer instance should not mix byte access and item mode
399 * @param buf Address of ring buffer.
400 * @param data Address of the output buffer. Can be NULL to discard data.
403 * @retval Number of bytes written to the output buffer.
408 * @brief Peek at data from a ring buffer.
410 * This routine reads data from a ring buffer @a buf without removal.
413 * Use cases involving multiple reads of the ring buffer must prevent
415 * being preempted or by using a mutex to govern reads to the ring buffer.
418 * Ring buffer instance should not mix byte access and item mode
427 * @param buf Address of ring buffer.
428 * @param data Address of the output buffer. Cannot be NULL.
431 * @retval Number of bytes written to the output buffer.
436 * @brief Write a data item to a ring buffer.
438 * This routine writes a data item to ring buffer @a buf. The data item
443 * Use cases involving multiple writers to the ring buffer must prevent
445 * being preempted or by using a mutex to govern writes to the ring buffer.
447 * @param buf Address of ring buffer.
454 * @retval -EMSGSIZE Ring buffer has insufficient free space.
460 * @brief Read a data item from a ring buffer.
462 * This routine reads a data item from ring buffer @a buf. The data item
467 * Use cases involving multiple reads of the ring buffer must prevent
469 * being preempted or by using a mutex to govern reads to the ring buffer.
471 * @param buf Address of ring buffer.
479 * @retval -EAGAIN Ring buffer is empty.