Skip to content
Snippets Groups Projects
Unverified Commit b60bb03f authored by Kaspar Schleiser's avatar Kaspar Schleiser Committed by GitHub
Browse files

Merge pull request #7901 from kroesche/feature/ringbuf_doc_update

ringbuffer: add hint about tsrb to doc
parents d9bb0062 abb69134
No related branches found
No related tags found
No related merge requests found
/** /*
* Ringbuffer header
*
* Copyright (C) 2013 Freie Universität Berlin * Copyright (C) 2013 Freie Universität Berlin
* Copyright (C) 2013 INRIA * Copyright (C) 2013 INRIA
* *
* This file is subject to the terms and conditions of the GNU Lesser * This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level * General Public License v2.1. See the file LICENSE in the top level
* directory for more details. * directory for more details.
* */
/**
* @ingroup core_util * @ingroup core_util
* @{ * @{
* @file * @file
* @author Kaspar Schleiser <kaspar@schleiser.de> * @author Kaspar Schleiser <kaspar@schleiser.de>
* @author René Kijewski <rene.kijewski@fu-berlin.de> * @author René Kijewski <rene.kijewski@fu-berlin.de>
*
* @brief A utility for storing and retrieving byte data using a ring buffer.
*
* @details The ringbuffer is useful for buffering data in the same
* thread context but it is not thread-safe. For a thread-safe ring
* buffer, see @ref sys_tsrb in the System library.
* @} * @}
*/ */
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
* @brief Thread-safe ringbuffer implementation * @brief Thread-safe ringbuffer implementation
* @{ * @{
* *
* @file
* @brief Thread-safe ringbuffer interface definition
*
* @note This ringbuffer implementation can be used without locking if * @note This ringbuffer implementation can be used without locking if
* there's only one producer and one consumer. * there's only one producer and one consumer.
* *
* @attention Buffer size must be a power of two! * @attention Buffer size must be a power of two!
* *
* @file
* @brief Thread-safe ringbuffer interface definition
*
* @author Kaspar Schleiser <kaspar@schleiser.de> * @author Kaspar Schleiser <kaspar@schleiser.de>
*/ */
...@@ -38,7 +38,7 @@ extern "C" { ...@@ -38,7 +38,7 @@ extern "C" {
*/ */
typedef struct tsrb { typedef struct tsrb {
char *buf; /**< Buffer to operate on. */ char *buf; /**< Buffer to operate on. */
unsigned int size; /**< Size of buf. */ unsigned int size; /**< Size of buffer, must be power of 2. */
volatile unsigned reads; /**< total number of reads */ volatile unsigned reads; /**< total number of reads */
volatile unsigned writes; /**< total number of writes */ volatile unsigned writes; /**< total number of writes */
} tsrb_t; } tsrb_t;
...@@ -52,7 +52,7 @@ typedef struct tsrb { ...@@ -52,7 +52,7 @@ typedef struct tsrb {
* @brief Initialize a tsrb. * @brief Initialize a tsrb.
* @param[out] rb Datum to initialize. * @param[out] rb Datum to initialize.
* @param[in] buffer Buffer to use by tsrb. * @param[in] buffer Buffer to use by tsrb.
* @param[in] bufsize `sizeof (buffer)` * @param[in] bufsize `sizeof (buffer)`, must be power of 2.
*/ */
static inline void tsrb_init(tsrb_t *rb, char *buffer, unsigned bufsize) static inline void tsrb_init(tsrb_t *rb, char *buffer, unsigned bufsize)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment