From 47afec670a94ee18b6eafa2e69bc83fc9370274c Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Tue, 12 May 2020 10:42:58 +0200 Subject: [PATCH 01/12] Add is_ready check for buffer --- ringbuff/src/include/ringbuff/ringbuff.h | 1 + ringbuff/src/ringbuff/ringbuff.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/ringbuff/src/include/ringbuff/ringbuff.h b/ringbuff/src/include/ringbuff/ringbuff.h index 41bf1e2..7459fd3 100644 --- a/ringbuff/src/include/ringbuff/ringbuff.h +++ b/ringbuff/src/include/ringbuff/ringbuff.h @@ -88,6 +88,7 @@ typedef struct ringbuff { } ringbuff_t; uint8_t ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size); +uint8_t ringbuff_is_ready(RINGBUFF_VOLATILE ringbuff_t* buff); void ringbuff_free(RINGBUFF_VOLATILE ringbuff_t* buff); void ringbuff_reset(RINGBUFF_VOLATILE ringbuff_t* buff); void ringbuff_set_evt_fn(RINGBUFF_VOLATILE ringbuff_t* buff, ringbuff_evt_fn fn); diff --git a/ringbuff/src/ringbuff/ringbuff.c b/ringbuff/src/ringbuff/ringbuff.c index 3d799cd..f60074a 100644 --- a/ringbuff/src/ringbuff/ringbuff.c +++ b/ringbuff/src/ringbuff/ringbuff.c @@ -63,6 +63,16 @@ ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size) { return 1; } +/** + * \brief Check if ringbuff is initialized and ready to use + * \param[in] buff: Buffer handle + * \return `1` if ready, `0` otherwise + */ +uint8_t +ringbuff_is_ready(RINGBUFF_VOLATILE ringbuff_t* buff) { + return BUF_IS_VALID(buff); +} + /** * \brief Free buffer memory * \note Since implementation does not use dynamic allocation, From 05bc01fa1272c6b8d4e6c03a6071f5005582d695 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Tue, 12 May 2020 14:50:38 +0200 Subject: [PATCH 02/12] Add magic keyword to detect memory corruption --- ringbuff/src/include/ringbuff/ringbuff.h | 12 ++++++++++++ ringbuff/src/ringbuff/ringbuff.c | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/ringbuff/src/include/ringbuff/ringbuff.h b/ringbuff/src/include/ringbuff/ringbuff.h index 7459fd3..d97fdb9 100644 --- a/ringbuff/src/include/ringbuff/ringbuff.h +++ b/ringbuff/src/include/ringbuff/ringbuff.h @@ -53,6 +53,12 @@ extern "C" { */ #define RINGBUFF_VOLATILE /* volatile */ +/** + * \brief Adds 2 magic words to make sure if memory is corrupted + * application can detect wrong data pointer and maximum size + */ +#define RINGBUFF_USE_MAGIC 1 + /** * \brief Event type for buffer operations */ @@ -79,12 +85,18 @@ typedef void (*ringbuff_evt_fn)(RINGBUFF_VOLATILE struct ringbuff* buff, ringbuf * \brief Buffer structure */ typedef struct ringbuff { +#ifdef RINGBUFF_USE_MAGIC + uint32_t magic1; /*!< Magic 1 word */ +#endif /* RINGBUFF_USE_MAGIC */ uint8_t* buff; /*!< Pointer to buffer data. Buffer is considered initialized when `buff != NULL` and `size > 0` */ size_t size; /*!< Size of buffer data. Size of actual buffer is `1` byte less than value holds */ size_t r; /*!< Next read pointer. Buffer is considered empty when `r == w` and full when `w == r - 1` */ size_t w; /*!< Next write pointer. Buffer is considered empty when `r == w` and full when `w == r - 1` */ ringbuff_evt_fn evt_fn; /*!< Pointer to event callback function */ +#ifdef RINGBUFF_USE_MAGIC + uint32_t magic2; /*!< Magic 2 word */ +#endif /* RINGBUFF_USE_MAGIC */ } ringbuff_t; uint8_t ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size); diff --git a/ringbuff/src/ringbuff/ringbuff.c b/ringbuff/src/ringbuff/ringbuff.c index f60074a..99b7959 100644 --- a/ringbuff/src/ringbuff/ringbuff.c +++ b/ringbuff/src/ringbuff/ringbuff.c @@ -36,7 +36,12 @@ /* Memory set and copy functions */ #define BUF_MEMSET memset #define BUF_MEMCPY memcpy + +#ifdef RINGBUFF_USE_MAGIC +#define BUF_IS_VALID(b) ((b) != NULL && (b)->magic1 == 0xDEADBEEF && (b)->magic2 == ~0xDEADBEEF && (b)->buff != NULL && (b)->size > 0) +#else #define BUF_IS_VALID(b) ((b) != NULL && (b)->buff != NULL && (b)->size > 0) +#endif /* RINGBUFF_USE_MAGIC */ #define BUF_MIN(x, y) ((x) < (y) ? (x) : (y)) #define BUF_MAX(x, y) ((x) > (y) ? (x) : (y)) #define BUF_SEND_EVT(b, type, bp) do { if ((b)->evt_fn != NULL) { (b)->evt_fn((b), (type), (bp)); } } while (0) @@ -60,6 +65,11 @@ ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size) { buff->size = size; buff->buff = buffdata; +#ifdef RINGBUFF_USE_MAGIC + buff->magic1 = 0xDEADBEEF; + buff->magic2 = ~0xDEADBEEF; +#endif /* RINGBUFF_USE_MAGIC */ + return 1; } From f6cefb173d74aa59438b9f9111fde5e72f926aa2 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Tue, 12 May 2020 15:01:25 +0200 Subject: [PATCH 03/12] Remove #ifdef and replace with #if --- ringbuff/src/include/ringbuff/ringbuff.h | 4 ++-- ringbuff/src/ringbuff/ringbuff.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ringbuff/src/include/ringbuff/ringbuff.h b/ringbuff/src/include/ringbuff/ringbuff.h index d97fdb9..e4ec368 100644 --- a/ringbuff/src/include/ringbuff/ringbuff.h +++ b/ringbuff/src/include/ringbuff/ringbuff.h @@ -85,7 +85,7 @@ typedef void (*ringbuff_evt_fn)(RINGBUFF_VOLATILE struct ringbuff* buff, ringbuf * \brief Buffer structure */ typedef struct ringbuff { -#ifdef RINGBUFF_USE_MAGIC +#if RINGBUFF_USE_MAGIC uint32_t magic1; /*!< Magic 1 word */ #endif /* RINGBUFF_USE_MAGIC */ uint8_t* buff; /*!< Pointer to buffer data. @@ -94,7 +94,7 @@ typedef struct ringbuff { size_t r; /*!< Next read pointer. Buffer is considered empty when `r == w` and full when `w == r - 1` */ size_t w; /*!< Next write pointer. Buffer is considered empty when `r == w` and full when `w == r - 1` */ ringbuff_evt_fn evt_fn; /*!< Pointer to event callback function */ -#ifdef RINGBUFF_USE_MAGIC +#if RINGBUFF_USE_MAGIC uint32_t magic2; /*!< Magic 2 word */ #endif /* RINGBUFF_USE_MAGIC */ } ringbuff_t; diff --git a/ringbuff/src/ringbuff/ringbuff.c b/ringbuff/src/ringbuff/ringbuff.c index 99b7959..a6e6b1c 100644 --- a/ringbuff/src/ringbuff/ringbuff.c +++ b/ringbuff/src/ringbuff/ringbuff.c @@ -37,7 +37,7 @@ #define BUF_MEMSET memset #define BUF_MEMCPY memcpy -#ifdef RINGBUFF_USE_MAGIC +#if RINGBUFF_USE_MAGIC #define BUF_IS_VALID(b) ((b) != NULL && (b)->magic1 == 0xDEADBEEF && (b)->magic2 == ~0xDEADBEEF && (b)->buff != NULL && (b)->size > 0) #else #define BUF_IS_VALID(b) ((b) != NULL && (b)->buff != NULL && (b)->size > 0) @@ -65,7 +65,7 @@ ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size) { buff->size = size; buff->buff = buffdata; -#ifdef RINGBUFF_USE_MAGIC +#if RINGBUFF_USE_MAGIC buff->magic1 = 0xDEADBEEF; buff->magic2 = ~0xDEADBEEF; #endif /* RINGBUFF_USE_MAGIC */ From 24cef842089929e5bdf75cadfd923ccf13191b43 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Thu, 2 Jul 2020 23:22:37 +0200 Subject: [PATCH 04/12] Apply astyle config --- ringbuff/src/include/ringbuff/ringbuff.h | 4 ++-- ringbuff/src/ringbuff/ringbuff.c | 10 +++++----- third_party/Embedded_Libs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ringbuff/src/include/ringbuff/ringbuff.h b/ringbuff/src/include/ringbuff/ringbuff.h index e4ec368..243cd61 100644 --- a/ringbuff/src/include/ringbuff/ringbuff.h +++ b/ringbuff/src/include/ringbuff/ringbuff.h @@ -115,12 +115,12 @@ size_t ringbuff_get_free(RINGBUFF_VOLATILE ringbuff_t* buff); size_t ringbuff_get_full(RINGBUFF_VOLATILE ringbuff_t* buff); /* Read data block management */ -void * ringbuff_get_linear_block_read_address(RINGBUFF_VOLATILE ringbuff_t* buff); +void* ringbuff_get_linear_block_read_address(RINGBUFF_VOLATILE ringbuff_t* buff); size_t ringbuff_get_linear_block_read_length(RINGBUFF_VOLATILE ringbuff_t* buff); size_t ringbuff_skip(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len); /* Write data block management */ -void * ringbuff_get_linear_block_write_address(RINGBUFF_VOLATILE ringbuff_t* buff); +void* ringbuff_get_linear_block_write_address(RINGBUFF_VOLATILE ringbuff_t* buff); size_t ringbuff_get_linear_block_write_length(RINGBUFF_VOLATILE ringbuff_t* buff); size_t ringbuff_advance(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len); diff --git a/ringbuff/src/ringbuff/ringbuff.c b/ringbuff/src/ringbuff/ringbuff.c index a6e6b1c..c1571f9 100644 --- a/ringbuff/src/ringbuff/ringbuff.c +++ b/ringbuff/src/ringbuff/ringbuff.c @@ -60,7 +60,7 @@ ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size) { return 0; } - BUF_MEMSET((void *)buff, 0x00, sizeof(*buff)); + BUF_MEMSET((void*)buff, 0x00, sizeof(*buff)); buff->size = size; buff->buff = buffdata; @@ -167,7 +167,7 @@ ringbuff_write(RINGBUFF_VOLATILE ringbuff_t* buff, const void* data, size_t btw) size_t ringbuff_read(RINGBUFF_VOLATILE ringbuff_t* buff, void* data, size_t btr) { size_t tocopy, full; - uint8_t *d = data; + uint8_t* d = data; if (!BUF_IS_VALID(buff) || data == NULL || btr == 0) { return 0; @@ -211,7 +211,7 @@ ringbuff_read(RINGBUFF_VOLATILE ringbuff_t* buff, void* data, size_t btr) { size_t ringbuff_peek(RINGBUFF_VOLATILE ringbuff_t* buff, size_t skip_count, void* data, size_t btp) { size_t full, tocopy, r; - uint8_t *d = data; + uint8_t* d = data; if (!BUF_IS_VALID(buff) || data == NULL || btp == 0) { return 0; @@ -322,7 +322,7 @@ ringbuff_reset(RINGBUFF_VOLATILE ringbuff_t* buff) { * \param[in] buff: Buffer handle * \return Linear buffer start address */ -void * +void* ringbuff_get_linear_block_read_address(RINGBUFF_VOLATILE ringbuff_t* buff) { if (!BUF_IS_VALID(buff)) { return NULL; @@ -388,7 +388,7 @@ ringbuff_skip(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len) { * \param[in] buff: Buffer handle * \return Linear buffer start address */ -void * +void* ringbuff_get_linear_block_write_address(RINGBUFF_VOLATILE ringbuff_t* buff) { if (!BUF_IS_VALID(buff)) { return NULL; diff --git a/third_party/Embedded_Libs b/third_party/Embedded_Libs index 17bace4..b92511a 160000 --- a/third_party/Embedded_Libs +++ b/third_party/Embedded_Libs @@ -1 +1 @@ -Subproject commit 17bace494f81a6640200dbf3c8345291daa8765e +Subproject commit b92511a69ee11f11efe3fb27adf53cf841291a5e From 3c8d3396e0c5c2cb4a63528811fa4c65f2c34f48 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 16:24:51 +0200 Subject: [PATCH 05/12] Add first lwrb files --- .../ringbuff.h => lwrb/src/include/lwrb/lwrb.h | 10 +++++----- .../src/ringbuff/ringbuff.c => lwrb/src/lwrb/lwrb.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) rename ringbuff/src/include/ringbuff/ringbuff.h => lwrb/src/include/lwrb/lwrb.h (95%) rename ringbuff/src/ringbuff/ringbuff.c => lwrb/src/lwrb/lwrb.c (99%) diff --git a/ringbuff/src/include/ringbuff/ringbuff.h b/lwrb/src/include/lwrb/lwrb.h similarity index 95% rename from ringbuff/src/include/ringbuff/ringbuff.h rename to lwrb/src/include/lwrb/lwrb.h index 243cd61..c2c7381 100644 --- a/ringbuff/src/include/ringbuff/ringbuff.h +++ b/lwrb/src/include/lwrb/lwrb.h @@ -1,6 +1,6 @@ /** - * \file ringbuff.h - * \brief Ring buffer manager + * \file lwrb.h + * \brief LwRB - Lightweight ring buffer */ /* @@ -26,7 +26,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * This file is part of ring buffer library. + * This file is part of LwRB - Lightweight ring buffer library. * * Author: Tilen MAJERLE * Version: v1.3.1 @@ -42,8 +42,8 @@ extern "C" { #endif /* __cplusplus */ /** - * \defgroup RINGBUFF Ring buffer - * \brief Generic ring buffer manager + * \defgroup RINGBUFF Lightweight ring buffer manager + * \brief Lightweight ring buffer manager * \{ */ diff --git a/ringbuff/src/ringbuff/ringbuff.c b/lwrb/src/lwrb/lwrb.c similarity index 99% rename from ringbuff/src/ringbuff/ringbuff.c rename to lwrb/src/lwrb/lwrb.c index c1571f9..9b3f161 100644 --- a/ringbuff/src/ringbuff/ringbuff.c +++ b/lwrb/src/lwrb/lwrb.c @@ -1,6 +1,6 @@ /** - * \file ringbuff.c - * \brief Ring buffer manager + * \file lwrb.c + * \brief Lightweight ring buffer */ /* @@ -26,7 +26,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * This file is part of ring buffer library. + * This file is part of LwRB - Lightweight ring buffer library. * * Author: Tilen MAJERLE * Version: v1.3.1 From 79c74a987598054ed8d8ae4623c275b462e0e3cf Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 18:11:42 +0200 Subject: [PATCH 06/12] Prepare dev app --- dev/VisualStudio/{ringbuff_dev.sln => lwrb_dev.sln} | 6 +++--- dev/VisualStudio/{ringbuff_dev.vcxproj => lwrb_dev.vcxproj} | 6 +++--- ...ingbuff_dev.vcxproj.filters => lwrb_dev.vcxproj.filters} | 0 3 files changed, 6 insertions(+), 6 deletions(-) rename dev/VisualStudio/{ringbuff_dev.sln => lwrb_dev.sln} (89%) rename dev/VisualStudio/{ringbuff_dev.vcxproj => lwrb_dev.vcxproj} (97%) rename dev/VisualStudio/{ringbuff_dev.vcxproj.filters => lwrb_dev.vcxproj.filters} (100%) diff --git a/dev/VisualStudio/ringbuff_dev.sln b/dev/VisualStudio/lwrb_dev.sln similarity index 89% rename from dev/VisualStudio/ringbuff_dev.sln rename to dev/VisualStudio/lwrb_dev.sln index c99019c..c95a533 100644 --- a/dev/VisualStudio/ringbuff_dev.sln +++ b/dev/VisualStudio/lwrb_dev.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28803.452 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ringbuff_dev", "ringbuff_dev.vcxproj", "{65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwrb_dev", "lwrb_dev.vcxproj", "{65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,8 +13,8 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}.Debug|x64.ActiveCfg = Debug|Win32 - {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}.Debug|x64.Build.0 = Debug|Win32 + {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}.Debug|x64.ActiveCfg = Debug|x64 + {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}.Debug|x64.Build.0 = Debug|x64 {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}.Debug|x86.ActiveCfg = Debug|Win32 {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}.Debug|x86.Build.0 = Debug|Win32 {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B}.Release|x64.ActiveCfg = Release|x64 diff --git a/dev/VisualStudio/ringbuff_dev.vcxproj b/dev/VisualStudio/lwrb_dev.vcxproj similarity index 97% rename from dev/VisualStudio/ringbuff_dev.vcxproj rename to dev/VisualStudio/lwrb_dev.vcxproj index 1f03649..bf2c2d4 100644 --- a/dev/VisualStudio/ringbuff_dev.vcxproj +++ b/dev/VisualStudio/lwrb_dev.vcxproj @@ -22,7 +22,7 @@ 15.0 {65B0BF4D-8CA6-48F2-8B0B-6BFD456AA57B} Win32Proj - ringbuff_dev + lwrb_dev 10.0 @@ -72,7 +72,7 @@ true - ..\..\ringbuff\src\include\;$(IncludePath) + ..\..\lwrb\src\include\;$(IncludePath) true @@ -143,7 +143,7 @@ - + diff --git a/dev/VisualStudio/ringbuff_dev.vcxproj.filters b/dev/VisualStudio/lwrb_dev.vcxproj.filters similarity index 100% rename from dev/VisualStudio/ringbuff_dev.vcxproj.filters rename to dev/VisualStudio/lwrb_dev.vcxproj.filters From f07f2893fb712865ce4dd94380148503982ef27b Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 18:28:42 +0200 Subject: [PATCH 07/12] Migrate to LwRB name --- dev/VisualStudio/lwrb_dev.vcxproj.filters | 2 +- dev/VisualStudio/main.c | 54 ++++++++-------- docs/api-reference/index.rst | 2 +- docs/api-reference/lwrb.rst | 6 ++ docs/api-reference/ringbuff.rst | 6 -- docs/conf.py | 8 +-- docs/doxyfile.doxy | 6 +- docs/examples_src/example_advance_1.c | 16 ++--- docs/examples_src/example_advance_2.c | 10 +-- docs/examples_src/example_dma_skip.c | 12 ++-- docs/examples_src/example_events.c | 14 ++--- docs/examples_src/example_index.c | 8 +-- docs/examples_src/example_minimal.c | 10 +-- docs/examples_src/example_skip_1.c | 18 +++--- docs/examples_src/example_skip_2.c | 6 +- docs/examples_src/example_tt_buff_size.c | 14 ++--- docs/get-started/index.rst | 18 +++--- docs/index.rst | 2 +- docs/user-manual/events.rst | 4 +- docs/user-manual/hw-dma-usage.rst | 22 +++---- lwrb/src/include/lwrb/lwrb.h | 70 ++++++++++----------- lwrb/src/lwrb/lwrb.c | 76 +++++++++++------------ 22 files changed, 192 insertions(+), 192 deletions(-) create mode 100644 docs/api-reference/lwrb.rst delete mode 100644 docs/api-reference/ringbuff.rst diff --git a/dev/VisualStudio/lwrb_dev.vcxproj.filters b/dev/VisualStudio/lwrb_dev.vcxproj.filters index e86dfdc..429bdfc 100644 --- a/dev/VisualStudio/lwrb_dev.vcxproj.filters +++ b/dev/VisualStudio/lwrb_dev.vcxproj.filters @@ -21,7 +21,7 @@ Source Files - + Source Files diff --git a/dev/VisualStudio/main.c b/dev/VisualStudio/main.c index 0a17045..0450409 100644 --- a/dev/VisualStudio/main.c +++ b/dev/VisualStudio/main.c @@ -1,28 +1,28 @@ -// ringbuff_dev.cpp : Defines the entry point for the console application. +// lwrb_dev.cpp : Defines the entry point for the console application. // #include #include -#include "ringbuff/ringbuff.h" +#include "lwrb/lwrb.h" /* Create data array and buffer */ -uint8_t ringbuff_data[8 + 1]; -ringbuff_t buff; +uint8_t lwrb_data[8 + 1]; +lwrb_t buff; static void debug_buff(uint8_t cmp, size_t r_w, size_t r_r, size_t r_f, size_t r_e); uint8_t tmp[8]; void -my_buff_evt_fn(ringbuff_t* buff, ringbuff_evt_type_t type, size_t len) { +my_buff_evt_fn(lwrb_t* buff, lwrb_evt_type_t type, size_t len) { switch (type) { - case RINGBUFF_EVT_RESET: + case LWRB_EVT_RESET: printf("[EVT] Buffer reset event!\r\n"); break; - case RINGBUFF_EVT_READ: + case LWRB_EVT_READ: printf("[EVT] Buffer read event: %d byte(s)!\r\n", (int)len); break; - case RINGBUFF_EVT_WRITE: + case LWRB_EVT_WRITE: printf("[EVT] Buffer write event: %d byte(s)!\r\n", (int)len); break; default: break; @@ -34,38 +34,38 @@ main() { size_t len; /* Init buffer */ - ringbuff_init(&buff, ringbuff_data, sizeof(ringbuff_data)); - ringbuff_set_evt_fn(&buff, my_buff_evt_fn); + lwrb_init(&buff, lwrb_data, sizeof(lwrb_data)); + lwrb_set_evt_fn(&buff, my_buff_evt_fn); - ringbuff_write(&buff, "abc", 3); - ringbuff_write(&buff, "abc", 3); - ringbuff_write(&buff, "abc", 3); - len = ringbuff_read(&buff, tmp, 9); + lwrb_write(&buff, "abc", 3); + lwrb_write(&buff, "abc", 3); + lwrb_write(&buff, "abc", 3); + len = lwrb_read(&buff, tmp, 9); buff.r = 0; buff.w = 0; - memset(ringbuff_get_linear_block_write_address(&buff), 'A', ringbuff_get_linear_block_write_length(&buff)); - ringbuff_advance(&buff, ringbuff_get_linear_block_write_length(&buff)); + memset(lwrb_get_linear_block_write_address(&buff), 'A', lwrb_get_linear_block_write_length(&buff)); + lwrb_advance(&buff, lwrb_get_linear_block_write_length(&buff)); buff.r = 2; buff.w = 0; - memset(ringbuff_get_linear_block_write_address(&buff), 'B', ringbuff_get_linear_block_write_length(&buff)); - ringbuff_advance(&buff, ringbuff_get_linear_block_write_length(&buff)); + memset(lwrb_get_linear_block_write_address(&buff), 'B', lwrb_get_linear_block_write_length(&buff)); + lwrb_advance(&buff, lwrb_get_linear_block_write_length(&buff)); buff.r = 3; buff.w = 3; - memset(ringbuff_get_linear_block_write_address(&buff), 'C', ringbuff_get_linear_block_write_length(&buff)); - ringbuff_advance(&buff, ringbuff_get_linear_block_write_length(&buff)); + memset(lwrb_get_linear_block_write_address(&buff), 'C', lwrb_get_linear_block_write_length(&buff)); + lwrb_advance(&buff, lwrb_get_linear_block_write_length(&buff)); - ringbuff_reset(&buff); + lwrb_reset(&buff); - //for (size_t r = 0; r < sizeof(ringbuff_data); ++r) { + //for (size_t r = 0; r < sizeof(lwrb_data); ++r) { // void* ptr; - // for (size_t w = 0; w < sizeof(ringbuff_data); ++w) { + // for (size_t w = 0; w < sizeof(lwrb_data); ++w) { // buff.r = r; // buff.w = w; - // ptr = ringbuff_get_linear_block_write_address(&buff); - // len = ringbuff_get_linear_block_write_length(&buff); + // ptr = lwrb_get_linear_block_write_address(&buff); + // len = lwrb_get_linear_block_write_length(&buff); // printf("W: %3d, R: %3d, LEN: %3d\r\n", (int)w, (int)r, (int)len); // } //} @@ -81,8 +81,8 @@ debug_buff(uint8_t cmp, size_t r_w, size_t r_r, size_t r_f, size_t r_e) { r = buff.r; w = buff.w; - f = ringbuff_get_full(&buff); - e = ringbuff_get_free(&buff); + f = lwrb_get_full(&buff); + e = lwrb_get_free(&buff); printf("R: %3d, W: %3d, F: %3d, E: %3d\r\n", (int)r, (int)w, (int)f, (int)e); } diff --git a/docs/api-reference/index.rst b/docs/api-reference/index.rst index 83b7f74..d6683a2 100644 --- a/docs/api-reference/index.rst +++ b/docs/api-reference/index.rst @@ -8,4 +8,4 @@ List of all the modules: .. toctree:: :maxdepth: 2 - ringbuff \ No newline at end of file + lwrb \ No newline at end of file diff --git a/docs/api-reference/lwrb.rst b/docs/api-reference/lwrb.rst new file mode 100644 index 0000000..b48317d --- /dev/null +++ b/docs/api-reference/lwrb.rst @@ -0,0 +1,6 @@ +.. _api_lwrb: + +LwRB +==== + +.. doxygengroup:: LWRB \ No newline at end of file diff --git a/docs/api-reference/ringbuff.rst b/docs/api-reference/ringbuff.rst deleted file mode 100644 index 6af4f3f..0000000 --- a/docs/api-reference/ringbuff.rst +++ /dev/null @@ -1,6 +0,0 @@ -.. _api_ringbuff: - -Ring buffer -=========== - -.. doxygengroup:: RINGBUFF \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 69832f1..61fbb21 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -100,8 +100,8 @@ 'titles_only': False } html_logo = 'static/images/logo.svg' -github_url = 'https://github.com/MaJerle/ringbuff' -html_baseurl = 'https://docs.majerle.eu/projects/ringbuff/' +github_url = 'https://github.com/MaJerle/lwrb' +html_baseurl = 'https://docs.majerle.eu/projects/lwrb/' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -123,7 +123,7 @@ # # breathe_projects = { - "ringbuff": "_build/xml/" + "lwrb": "_build/xml/" } -breathe_default_project = "ringbuff" +breathe_default_project = "lwrb" breathe_default_members = ('members', 'undoc-members') \ No newline at end of file diff --git a/docs/doxyfile.doxy b/docs/doxyfile.doxy index 1a76299..4145e04 100644 --- a/docs/doxyfile.doxy +++ b/docs/doxyfile.doxy @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "Ring buffer" +PROJECT_NAME = "LwRB" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -44,7 +44,7 @@ PROJECT_NUMBER = "" # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Generic FIFO buffer" +PROJECT_BRIEF = "Lightweight ring buffer manager" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -775,7 +775,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = "../ringbuff/" +INPUT = "../lwrb/" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/docs/examples_src/example_advance_1.c b/docs/examples_src/example_advance_1.c index db2ab11..e1e02b0 100644 --- a/docs/examples_src/example_advance_1.c +++ b/docs/examples_src/example_advance_1.c @@ -1,12 +1,12 @@ /* Declare buffer variables */ -ringbuff_t buff; +lwrb_t buff; uint8_t buff_data[8]; size_t len; uint8_t* data; /* Initialize buffer, use buff_data as data array */ -ringbuff_init(&buff, buff_data, sizeof(buff_data)); +lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Use write, read operations, process data */ /* ... */ @@ -19,10 +19,10 @@ ringbuff_init(&buff, buff_data, sizeof(buff_data)); /* Get length of linear memory at write pointer */ /* Function returns 4 as we can write 4 bytes to buffer in sequence */ /* When function returns 0, there is no memory available in the buffer for write anymore */ -if ((len = ringbuff_get_linear_block_write_length(&buff)) > 0) { +if ((len = lwrb_get_linear_block_write_length(&buff)) > 0) { /* Get pointer to first element in linear block at write address */ /* Function returns &buff_data[4] */ - data = ringbuff_get_linear_block_write_address(&buff); + data = lwrb_get_linear_block_write_address(&buff); /* Receive data via DMA and wait to finish (for sake of example) */ /* Any other hardware may directly write to data array */ @@ -32,7 +32,7 @@ if ((len = ringbuff_get_linear_block_write_length(&buff)) > 0) { /* Now advance buffer for written bytes to buffer = move write pointer */ /* Write pointer is moved for len bytes */ - ringbuff_advance(&buff, len); + lwrb_advance(&buff, len); /* Now W points to top of buffer, W = 0 */ /* At this point, we are at image part B */ @@ -43,10 +43,10 @@ if ((len = ringbuff_get_linear_block_write_length(&buff)) > 0) { /* Get length of linear memory at write pointer */ /* Function returns 3 as we can write 3 bytes to buffer in sequence */ /* When function returns 0, there is no memory available in the buffer for write anymore */ -if ((len = ringbuff_get_linear_block_read_length(&buff)) > 0) { +if ((len = lwrb_get_linear_block_read_length(&buff)) > 0) { /* Get pointer to first element in linear block at write address */ /* Function returns &buff_data[0] */ - data = ringbuff_get_linear_block_read_address(&buff); + data = lwrb_get_linear_block_read_address(&buff); /* Receive data via DMA and wait to finish (for sake of example) */ /* Any other hardware may directly write to data array */ @@ -56,7 +56,7 @@ if ((len = ringbuff_get_linear_block_read_length(&buff)) > 0) { /* Now advance buffer for written bytes to buffer = move write pointer */ /* Write pointer is moved for len bytes */ - ringbuff_advance(&buff, len); + lwrb_advance(&buff, len); /* Now W points to 3, R points to 4, that is R == W + 1 and buffer is now full */ /* At this point, we are at image part C */ diff --git a/docs/examples_src/example_advance_2.c b/docs/examples_src/example_advance_2.c index 999f1ba..300660b 100644 --- a/docs/examples_src/example_advance_2.c +++ b/docs/examples_src/example_advance_2.c @@ -1,19 +1,19 @@ -#include "ringbuff/ringbuff.h" +#include "lwrb/lwrb.h" /* Buffer variables */ -ringbuff_t buff; /* Declare ring buffer structure */ +lwrb_t buff; /* Declare ring buffer structure */ uint8_t buff_data[8]; /* Declare raw buffer data array */ /* Application variables uint8_t data[2]; /* Application working data */ /* Application code ... */ -ringbuff_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */ +lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */ /* Write 4 bytes of data */ -ringbuff_write(&buff, "0123", 4); +lwrb_write(&buff, "0123", 4); /* Print number of bytes in buffer */ -printf("Bytes in buffer: %d\r\n", (int)ringbuff_get_full(&buff)); +printf("Bytes in buffer: %d\r\n", (int)lwrb_get_full(&buff)); /* Will print "4" */ \ No newline at end of file diff --git a/docs/examples_src/example_dma_skip.c b/docs/examples_src/example_dma_skip.c index d450805..ed2c333 100644 --- a/docs/examples_src/example_dma_skip.c +++ b/docs/examples_src/example_dma_skip.c @@ -1,5 +1,5 @@ /* Buffer */ -ringbuff_t buff; +lwrb_t buff; uint8_t buff_data[8]; /* Working data length */ @@ -11,10 +11,10 @@ void send_data(void); int main(void) { /* Initialize buffer */ - ringbuff_init(&buff, buff_data, sizeof(buff_data)); + lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Write 4 bytes of data */ - ringbuff_write(&buff, "0123", 4); + lwrb_write(&buff, "0123", 4); /* Send data over DMA */ send_data(); @@ -31,10 +31,10 @@ send_data(void) { } /* Get maximal length of buffer to read data as linear memory */ - len = ringbuff_get_linear_block_read_length(&buff); + len = lwrb_get_linear_block_read_length(&buff); if (len > 0) { /* Get pointer to read memory */ - uint8_t* data = ringbuff_get_linear_block_read_address(&buff); + uint8_t* data = lwrb_get_linear_block_read_address(&buff); /* Start DMA transfer */ start_dma_transfer(data, len); @@ -50,7 +50,7 @@ DMA_Interrupt_handler(void) { /* Transfer finished */ if (len > 0) { /* Now skip the data (move read pointer) as they were successfully transferred over DMA */ - ringbuff_skip(&buff, len); + lwrb_skip(&buff, len); /* Reset length = DMA is not active */ len = 0; diff --git a/docs/examples_src/example_events.c b/docs/examples_src/example_events.c index 2fe1571..378bf88 100644 --- a/docs/examples_src/example_events.c +++ b/docs/examples_src/example_events.c @@ -2,15 +2,15 @@ * \brief Buffer event function */ void -my_buff_evt_fn(ringbuff_t* buff, ringbuff_evt_type_t type, size_t len) { +my_buff_evt_fn(lwrb_t* buff, lwrb_evt_type_t type, size_t len) { switch (type) { - case RINGBUFF_EVT_RESET: + case LWRB_EVT_RESET: printf("[EVT] Buffer reset event!\r\n"); break; - case RINGBUFF_EVT_READ: + case LWRB_EVT_READ: printf("[EVT] Buffer read event: %d byte(s)!\r\n", (int)len); break; - case RINGBUFF_EVT_WRITE: + case LWRB_EVT_WRITE: printf("[EVT] Buffer write event: %d byte(s)!\r\n", (int)len); break; default: break; @@ -18,9 +18,9 @@ my_buff_evt_fn(ringbuff_t* buff, ringbuff_evt_type_t type, size_t len) { } /* Later in the code... */ -ringbuff_t buff; +lwrb_t buff; uint8_t buff_data[8]; /* Init buffer and set event function */ -ringbuff_init(&buff, buff_data, sizeof(buff_data)); -ringbuff_set_evt_fn(&buff, my_buff_evt_fn); +lwrb_init(&buff, buff_data, sizeof(buff_data)); +lwrb_set_evt_fn(&buff, my_buff_evt_fn); diff --git a/docs/examples_src/example_index.c b/docs/examples_src/example_index.c index 1a1b39f..d6bc961 100644 --- a/docs/examples_src/example_index.c +++ b/docs/examples_src/example_index.c @@ -1,5 +1,5 @@ /* Buffer variables */ -ringbuff_t buff; /* Declare ring buffer structure */ +lwrb_t buff; /* Declare ring buffer structure */ uint8_t buff_data[8]; /* Declare raw buffer data array */ /* Application variables */ @@ -7,14 +7,14 @@ uint8_t data[2]; /* Application working data */ size_t len; /* Application code ... */ -ringbuff_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */ +lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */ /* Write 4 bytes of data */ -ringbuff_write(&buff, "0123", 4); +lwrb_write(&buff, "0123", 4); /* Try to read buffer */ /* len holds number of bytes read */ /* Read until len == 0, when buffer is empty */ -while ((len = ringbuff_read(&buff, data, sizeof(data))) > 0) { +while ((len = lwrb_read(&buff, data, sizeof(data))) > 0) { printf("Successfully read %d bytes\r\n", (int)len); } \ No newline at end of file diff --git a/docs/examples_src/example_minimal.c b/docs/examples_src/example_minimal.c index 999f1ba..300660b 100644 --- a/docs/examples_src/example_minimal.c +++ b/docs/examples_src/example_minimal.c @@ -1,19 +1,19 @@ -#include "ringbuff/ringbuff.h" +#include "lwrb/lwrb.h" /* Buffer variables */ -ringbuff_t buff; /* Declare ring buffer structure */ +lwrb_t buff; /* Declare ring buffer structure */ uint8_t buff_data[8]; /* Declare raw buffer data array */ /* Application variables uint8_t data[2]; /* Application working data */ /* Application code ... */ -ringbuff_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */ +lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */ /* Write 4 bytes of data */ -ringbuff_write(&buff, "0123", 4); +lwrb_write(&buff, "0123", 4); /* Print number of bytes in buffer */ -printf("Bytes in buffer: %d\r\n", (int)ringbuff_get_full(&buff)); +printf("Bytes in buffer: %d\r\n", (int)lwrb_get_full(&buff)); /* Will print "4" */ \ No newline at end of file diff --git a/docs/examples_src/example_skip_1.c b/docs/examples_src/example_skip_1.c index f7f05de..6a49096 100644 --- a/docs/examples_src/example_skip_1.c +++ b/docs/examples_src/example_skip_1.c @@ -1,15 +1,15 @@ -#include "ringbuff/ringbuff.h" +#include "lwrb/lwrb.h" /* Declare buffer variables */ -ringbuff_t buff; +lwrb_t buff; uint8_t buff_data[8]; size_t len; uint8_t* data; /* Initialize buffer, use buff_data as data array */ -ringbuff_init(&buff, buff_data, sizeof(buff_data)); +lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Use write, read operations, process data */ /* ... */ @@ -22,16 +22,16 @@ ringbuff_init(&buff, buff_data, sizeof(buff_data)); /* Get length of linear memory at read pointer */ /* Function returns 3 as we can read 3 bytes from buffer in sequence */ /* When function returns 0, there is no memory available in the buffer for read anymore */ -if ((len = ringbuff_get_linear_block_read_length(&buff)) > 0) { +if ((len = lwrb_get_linear_block_read_length(&buff)) > 0) { /* Get pointer to first element in linear block at read address */ /* Function returns &buff_data[5] */ - data = ringbuff_get_linear_block_read_address(&buff); + data = lwrb_get_linear_block_read_address(&buff); /* Send data via DMA and wait to finish (for sake of example) */ send_data(data, len); /* Now skip sent bytes from buffer = move read pointer */ - ringbuff_skip(&buff, len); + lwrb_skip(&buff, len); /* Now R points to top of buffer, R = 0 */ /* At this point, we are at image part B */ @@ -42,17 +42,17 @@ if ((len = ringbuff_get_linear_block_read_length(&buff)) > 0) { /* Get length of linear memory at read pointer */ /* Function returns 4 as we can read 4 bytes from buffer in sequence */ /* When function returns 0, there is no memory available in the buffer for read anymore */ -if ((len = ringbuff_get_linear_block_read_length(&buff)) > 0) { +if ((len = lwrb_get_linear_block_read_length(&buff)) > 0) { /* Get pointer to first element in linear block at read address */ /* Function returns &buff_data[0] */ - data = ringbuff_get_linear_block_read_address(&buff); + data = lwrb_get_linear_block_read_address(&buff); /* Send data via DMA and wait to finish (for sake of example) */ send_data(data, len); /* Now skip sent bytes from buffer = move read pointer */ /* Read pointer is moved for len bytes */ - ringbuff_skip(&buff, len); + lwrb_skip(&buff, len); /* Now R points to 4, that is R == W and buffer is now empty */ /* At this point, we are at image part C */ diff --git a/docs/examples_src/example_skip_2.c b/docs/examples_src/example_skip_2.c index ee977eb..035f790 100644 --- a/docs/examples_src/example_skip_2.c +++ b/docs/examples_src/example_skip_2.c @@ -2,9 +2,9 @@ /* Get length of linear memory at read pointer */ /* When function returns 0, there is no memory available in the buffer for read anymore */ -while ((len = ringbuff_get_linear_block_read_length(&buff)) > 0) { +while ((len = lwrb_get_linear_block_read_length(&buff)) > 0) { /* Get pointer to first element in linear block at read address */ - data = ringbuff_get_linear_block_read_address(&buff); + data = lwrb_get_linear_block_read_address(&buff); /* If max length needs to be considered */ /* simply decrease it and use smaller len on skip function */ @@ -16,5 +16,5 @@ while ((len = ringbuff_get_linear_block_read_length(&buff)) > 0) { send_data(data, len); /* Now skip sent bytes from buffer = move read pointer */ - ringbuff_skip(&buff, len); + lwrb_skip(&buff, len); } \ No newline at end of file diff --git a/docs/examples_src/example_tt_buff_size.c b/docs/examples_src/example_tt_buff_size.c index 47e86b9..72e73d7 100644 --- a/docs/examples_src/example_tt_buff_size.c +++ b/docs/examples_src/example_tt_buff_size.c @@ -1,4 +1,4 @@ -#include "ringbuff/ringbuff.h" +#include "lwrb/lwrb.h" /* Number of data blocks to write */ #define N 3 @@ -8,8 +8,8 @@ uint32_t d[2]; /* Create buffer structures */ -ringbuff_t buff_1; -ringbuff_t buff_2; +lwrb_t buff_1; +lwrb_t buff_2; /* Create data for buffers. Use sizeof structure, multiplied by N (for N instances) */ /* Buffer with + 1 bytes bigger memory */ @@ -22,8 +22,8 @@ size_t len_1; size_t len_2; /* Initialize buffers */ -ringbuff_init(&buff_1, buff_data_1, sizeof(buff_data_1)); -ringbuff_init(&buff_2, buff_data_2, sizeof(buff_data_2)); +lwrb_init(&buff_1, buff_data_1, sizeof(buff_data_1)); +lwrb_init(&buff_2, buff_data_2, sizeof(buff_data_2)); /* Write data to buffer */ for (size_t i = 0; i < N; ++i) { @@ -32,8 +32,8 @@ for (size_t i = 0; i < N; ++i) { d.b = i * 2; /* Write data to both buffers, memory copy from d to buffer */ - len_1 = ringbuff_write(&buff_1, d, sizeof(d)); - len_2 = ringbuff_write(&buff_2, d, sizeof(d)); + len_1 = lwrb_write(&buff_1, d, sizeof(d)); + len_2 = lwrb_write(&buff_2, d, sizeof(d)); /* Print results */ printf("Write buffer 1: %d/%d bytes; buffer 2: %d/%d\r\n", diff --git a/docs/get-started/index.rst b/docs/get-started/index.rst index 32724e9..4a255de 100644 --- a/docs/get-started/index.rst +++ b/docs/get-started/index.rst @@ -8,15 +8,15 @@ Getting started Download library ^^^^^^^^^^^^^^^^ -Library is primarly hosted on `Github `_. +Library is primarly hosted on `Github `_. -* Download latest release from `releases area `_ on Github +* Download latest release from `releases area `_ on Github * Clone `develop` branch for latest development Download from releases ********************** -All releases are available on Github `releases area `_. +All releases are available on Github `releases area `_. Clone from Github ***************** @@ -28,9 +28,9 @@ First-time clone * Open console and navigate to path in the system to clone repository to. Use command ``cd your_path`` * Clone repository with one of available ``3`` options - * Run ``git clone --recurse-submodules https://github.com/MaJerle/ringbuff`` command to clone entire repository, including submodules - * Run ``git clone --recurse-submodules --branch develop https://github.com/MaJerle/ringbuff`` to clone `development` branch, including submodules - * Run ``git clone --recurse-submodules --branch master https://github.com/MaJerle/ringbuff`` to clone `latest stable` branch, including submodules + * Run ``git clone --recurse-submodules https://github.com/MaJerle/lwrb`` command to clone entire repository, including submodules + * Run ``git clone --recurse-submodules --branch develop https://github.com/MaJerle/lwrb`` to clone `development` branch, including submodules + * Run ``git clone --recurse-submodules --branch master https://github.com/MaJerle/lwrb`` to clone `latest stable` branch, including submodules * Navigate to ``examples`` directory and run favourite example @@ -50,9 +50,9 @@ Add library to project At this point it is assumed that you have successfully download library, either cloned it or from releases page. -* Copy ``ringbuff`` folder to your project -* Add ``ringbuff/src/include`` folder to `include path` of your toolchain -* Add source files from ``ringbuff/src/`` folder to toolchain build +* Copy ``lwrb`` folder to your project +* Add ``lwrb/src/include`` folder to `include path` of your toolchain +* Add source files from ``lwrb/src/`` folder to toolchain build * Build the project Minimal example code diff --git a/docs/index.rst b/docs/index.rst index 43daddc..d33a59c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,7 @@ Ring buffer is a generic *FIFO* (First In; First Out) buffer library optimized f .. rst-class:: center .. rst-class:: index_links - :ref:`download_library` · :ref:`getting_started` · `Open Github `_ + :ref:`download_library` · :ref:`getting_started` · `Open Github `_ Features ^^^^^^^^ diff --git a/docs/user-manual/events.rst b/docs/user-manual/events.rst index 04a4af5..b55f67f 100644 --- a/docs/user-manual/events.rst +++ b/docs/user-manual/events.rst @@ -3,7 +3,7 @@ Events ====== -When using ringbuffer in the application, it may be useful to get notification on different events, +When using LwRB in the application, it may be useful to get notification on different events, such as info when something has been written or read to/from buffer. Library has support for events that get called each time there has been a modification @@ -11,7 +11,7 @@ in the buffer data, that means on every read or write operation. Some use cases: -* Notify application layer that ringbuffer operation has been executed and send debug message +* Notify application layer that LwRB operation has been executed and send debug message * Unlock semaphore when sufficient amount of bytes have been written/read from/to buffer when application uses operating system * Write notification to message queue at operating system level to wakeup another task diff --git a/docs/user-manual/hw-dma-usage.rst b/docs/user-manual/hw-dma-usage.rst index 2d7d949..621edc9 100644 --- a/docs/user-manual/hw-dma-usage.rst +++ b/docs/user-manual/hw-dma-usage.rst @@ -1,27 +1,27 @@ DMA on embedded systems ======================= -One of the key features of ringbuffer library is that it can be seamlessly integrated with DMA controllers on embedded systems. +One of the key features of LwRB library is that it can be seamlessly integrated with DMA controllers on embedded systems. .. note:: - + DMA stands for *Direct Memory Access* controller and is usually used to off-load CPU. More about DMA is available on `Wikipedia `_. DMA controllers normally use source and destination memory addresses to transfer data in-between. -This features, together with ringbuffer, allows seamless integration and zero-copy of application data at interrupts after DMA transfer has been completed. +This features, together with LwRB, allows seamless integration and zero-copy of application data at interrupts after DMA transfer has been completed. Some manual work is necessary to be handled, but this is very minor in comparison of writing byte-by-byte to buffer at (for example) each received character. Below are ``2`` common use cases: -* DMA transfers data from ringbuffer memory to (usually) some hardware IP +* DMA transfers data from LwRB memory to (usually) some hardware IP * DMA transfers data from hardware IP to memory Zero-copy data from memory ^^^^^^^^^^^^^^^^^^^^^^^^^^ -This describes how to pass ringbuffer output memory address as pointer to DMA (or any other processing function). -After all the data are successfully processed, application can skip processed data and free ringbuff for new data being written to it. +This describes how to pass LwRB output memory address as pointer to DMA (or any other processing function). +After all the data are successfully processed, application can skip processed data and free buff for new data being written to it. .. figure:: ../static/images/buff_lin_read_skip.svg :align: center @@ -40,8 +40,8 @@ Code example: :linenos: :caption: Skip buffer data after usage -Part **A** on image clearly shows that not all data bytes are linked in single contiguous block of memory. -To send all bytes from ringbuff, it might be necessary to repeat procedure multiple times +Part **A** on image clearly shows that not all data bytes are linked in single contiguous block of memory. +To send all bytes from lwrb, it might be necessary to repeat procedure multiple times .. literalinclude:: ../examples_src/example_skip_2.c :language: c @@ -51,7 +51,7 @@ To send all bytes from ringbuff, it might be necessary to repeat procedure multi Zero-copy data to memory ^^^^^^^^^^^^^^^^^^^^^^^^ -Similar to reading data from buffer with zero-copy overhead, it is possible to write to ringbuff with zero-copy overhead too. +Similar to reading data from buffer with zero-copy overhead, it is possible to write to lwrb with zero-copy overhead too. Only difference is that application now needs pointer to write memory address and length of maximal number of bytes to directly copy in buffer. After processing is successful, buffer advance operation is necessary to manually increase write pointer and to increase number of bytes in buffer. @@ -60,7 +60,7 @@ After processing is successful, buffer advance operation is necessary to manuall :alt: Data transfer from memory to hardware IP * Case **A**: Initial state, buffer is empty as ``R == W`` - + * Based on ``W`` pointer position, application could write ``4`` bytes to contiguous block of memory * Case **B**: State after advancing `W` pointer for `4` bytes. Buffer now holds `4` bytes and has ``3`` remaining available * Case **C**: Buffer is full, no more free memory available for write operation @@ -76,7 +76,7 @@ Example for DMA transfer from memory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is an example showing pseudo code for implementing data transfer using DMA with zero-copy overhead. -For read operation purposes, application gets direct access to ringbuffer read pointer and length of contigouos memory. +For read operation purposes, application gets direct access to LwRB read pointer and length of contigouos memory. It is assumed that after DMA transfer completes, interrupt is generated (embedded system) and buffer is skipped in the interrupt. diff --git a/lwrb/src/include/lwrb/lwrb.h b/lwrb/src/include/lwrb/lwrb.h index c2c7381..a7244b2 100644 --- a/lwrb/src/include/lwrb/lwrb.h +++ b/lwrb/src/include/lwrb/lwrb.h @@ -31,8 +31,8 @@ * Author: Tilen MAJERLE * Version: v1.3.1 */ -#ifndef RINGBUFF_HDR_H -#define RINGBUFF_HDR_H +#ifndef LWRB_HDR_H +#define LWRB_HDR_H #include #include @@ -42,7 +42,7 @@ extern "C" { #endif /* __cplusplus */ /** - * \defgroup RINGBUFF Lightweight ring buffer manager + * \defgroup LWRB Lightweight ring buffer manager * \brief Lightweight ring buffer manager * \{ */ @@ -51,27 +51,27 @@ extern "C" { * \brief Enable buffer structure pointer parameter as volatile * To use this feature, uncomment keyword below */ -#define RINGBUFF_VOLATILE /* volatile */ +#define LWRB_VOLATILE /* volatile */ /** * \brief Adds 2 magic words to make sure if memory is corrupted * application can detect wrong data pointer and maximum size */ -#define RINGBUFF_USE_MAGIC 1 +#define LWRB_USE_MAGIC 1 /** * \brief Event type for buffer operations */ typedef enum { - RINGBUFF_EVT_READ, /*!< Read event */ - RINGBUFF_EVT_WRITE, /*!< Write event */ - RINGBUFF_EVT_RESET, /*!< Reset event */ -} ringbuff_evt_type_t; + LWRB_EVT_READ, /*!< Read event */ + LWRB_EVT_WRITE, /*!< Write event */ + LWRB_EVT_RESET, /*!< Reset event */ +} lwrb_evt_type_t; /** * \brief Buffer structure forward declaration */ -struct ringbuff; +struct lwrb; /** * \brief Event callback function type @@ -79,50 +79,50 @@ struct ringbuff; * \param[in] evt: Event type * \param[in] bp: Number of bytes written or read (when used), depends on event type */ -typedef void (*ringbuff_evt_fn)(RINGBUFF_VOLATILE struct ringbuff* buff, ringbuff_evt_type_t evt, size_t bp); +typedef void (*lwrb_evt_fn)(LWRB_VOLATILE struct lwrb* buff, lwrb_evt_type_t evt, size_t bp); /** * \brief Buffer structure */ -typedef struct ringbuff { -#if RINGBUFF_USE_MAGIC +typedef struct lwrb { +#if LWRB_USE_MAGIC uint32_t magic1; /*!< Magic 1 word */ -#endif /* RINGBUFF_USE_MAGIC */ +#endif /* LWRB_USE_MAGIC */ uint8_t* buff; /*!< Pointer to buffer data. Buffer is considered initialized when `buff != NULL` and `size > 0` */ size_t size; /*!< Size of buffer data. Size of actual buffer is `1` byte less than value holds */ size_t r; /*!< Next read pointer. Buffer is considered empty when `r == w` and full when `w == r - 1` */ size_t w; /*!< Next write pointer. Buffer is considered empty when `r == w` and full when `w == r - 1` */ - ringbuff_evt_fn evt_fn; /*!< Pointer to event callback function */ -#if RINGBUFF_USE_MAGIC + lwrb_evt_fn evt_fn; /*!< Pointer to event callback function */ +#if LWRB_USE_MAGIC uint32_t magic2; /*!< Magic 2 word */ -#endif /* RINGBUFF_USE_MAGIC */ -} ringbuff_t; +#endif /* LWRB_USE_MAGIC */ +} lwrb_t; -uint8_t ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size); -uint8_t ringbuff_is_ready(RINGBUFF_VOLATILE ringbuff_t* buff); -void ringbuff_free(RINGBUFF_VOLATILE ringbuff_t* buff); -void ringbuff_reset(RINGBUFF_VOLATILE ringbuff_t* buff); -void ringbuff_set_evt_fn(RINGBUFF_VOLATILE ringbuff_t* buff, ringbuff_evt_fn fn); +uint8_t lwrb_init(LWRB_VOLATILE lwrb_t* buff, void* buffdata, size_t size); +uint8_t lwrb_is_ready(LWRB_VOLATILE lwrb_t* buff); +void lwrb_free(LWRB_VOLATILE lwrb_t* buff); +void lwrb_reset(LWRB_VOLATILE lwrb_t* buff); +void lwrb_set_evt_fn(LWRB_VOLATILE lwrb_t* buff, lwrb_evt_fn fn); /* Read/Write functions */ -size_t ringbuff_write(RINGBUFF_VOLATILE ringbuff_t* buff, const void* data, size_t btw); -size_t ringbuff_read(RINGBUFF_VOLATILE ringbuff_t* buff, void* data, size_t btr); -size_t ringbuff_peek(RINGBUFF_VOLATILE ringbuff_t* buff, size_t skip_count, void* data, size_t btp); +size_t lwrb_write(LWRB_VOLATILE lwrb_t* buff, const void* data, size_t btw); +size_t lwrb_read(LWRB_VOLATILE lwrb_t* buff, void* data, size_t btr); +size_t lwrb_peek(LWRB_VOLATILE lwrb_t* buff, size_t skip_count, void* data, size_t btp); /* Buffer size information */ -size_t ringbuff_get_free(RINGBUFF_VOLATILE ringbuff_t* buff); -size_t ringbuff_get_full(RINGBUFF_VOLATILE ringbuff_t* buff); +size_t lwrb_get_free(LWRB_VOLATILE lwrb_t* buff); +size_t lwrb_get_full(LWRB_VOLATILE lwrb_t* buff); /* Read data block management */ -void* ringbuff_get_linear_block_read_address(RINGBUFF_VOLATILE ringbuff_t* buff); -size_t ringbuff_get_linear_block_read_length(RINGBUFF_VOLATILE ringbuff_t* buff); -size_t ringbuff_skip(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len); +void* lwrb_get_linear_block_read_address(LWRB_VOLATILE lwrb_t* buff); +size_t lwrb_get_linear_block_read_length(LWRB_VOLATILE lwrb_t* buff); +size_t lwrb_skip(LWRB_VOLATILE lwrb_t* buff, size_t len); /* Write data block management */ -void* ringbuff_get_linear_block_write_address(RINGBUFF_VOLATILE ringbuff_t* buff); -size_t ringbuff_get_linear_block_write_length(RINGBUFF_VOLATILE ringbuff_t* buff); -size_t ringbuff_advance(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len); +void* lwrb_get_linear_block_write_address(LWRB_VOLATILE lwrb_t* buff); +size_t lwrb_get_linear_block_write_length(LWRB_VOLATILE lwrb_t* buff); +size_t lwrb_advance(LWRB_VOLATILE lwrb_t* buff, size_t len); /** * \} @@ -132,4 +132,4 @@ size_t ringbuff_advance(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len); } #endif /* __cplusplus */ -#endif /* RINGBUFF_HDR_H */ +#endif /* LWRB_HDR_H */ diff --git a/lwrb/src/lwrb/lwrb.c b/lwrb/src/lwrb/lwrb.c index 9b3f161..c044733 100644 --- a/lwrb/src/lwrb/lwrb.c +++ b/lwrb/src/lwrb/lwrb.c @@ -31,17 +31,17 @@ * Author: Tilen MAJERLE * Version: v1.3.1 */ -#include "ringbuff/ringbuff.h" +#include "lwrb/lwrb.h" /* Memory set and copy functions */ #define BUF_MEMSET memset #define BUF_MEMCPY memcpy -#if RINGBUFF_USE_MAGIC +#if LWRB_USE_MAGIC #define BUF_IS_VALID(b) ((b) != NULL && (b)->magic1 == 0xDEADBEEF && (b)->magic2 == ~0xDEADBEEF && (b)->buff != NULL && (b)->size > 0) #else #define BUF_IS_VALID(b) ((b) != NULL && (b)->buff != NULL && (b)->size > 0) -#endif /* RINGBUFF_USE_MAGIC */ +#endif /* LWRB_USE_MAGIC */ #define BUF_MIN(x, y) ((x) < (y) ? (x) : (y)) #define BUF_MAX(x, y) ((x) > (y) ? (x) : (y)) #define BUF_SEND_EVT(b, type, bp) do { if ((b)->evt_fn != NULL) { (b)->evt_fn((b), (type), (bp)); } } while (0) @@ -55,7 +55,7 @@ * \return `1` on success, `0` otherwise */ uint8_t -ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size) { +lwrb_init(LWRB_VOLATILE lwrb_t* buff, void* buffdata, size_t size) { if (buff == NULL || buffdata == NULL || size == 0) { return 0; } @@ -65,21 +65,21 @@ ringbuff_init(RINGBUFF_VOLATILE ringbuff_t* buff, void* buffdata, size_t size) { buff->size = size; buff->buff = buffdata; -#if RINGBUFF_USE_MAGIC +#if LWRB_USE_MAGIC buff->magic1 = 0xDEADBEEF; buff->magic2 = ~0xDEADBEEF; -#endif /* RINGBUFF_USE_MAGIC */ +#endif /* LWRB_USE_MAGIC */ return 1; } /** - * \brief Check if ringbuff is initialized and ready to use + * \brief Check if buff is initialized and ready to use * \param[in] buff: Buffer handle * \return `1` if ready, `0` otherwise */ uint8_t -ringbuff_is_ready(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_is_ready(LWRB_VOLATILE lwrb_t* buff) { return BUF_IS_VALID(buff); } @@ -90,7 +90,7 @@ ringbuff_is_ready(RINGBUFF_VOLATILE ringbuff_t* buff) { * \param[in] buff: Buffer handle */ void -ringbuff_free(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_free(LWRB_VOLATILE lwrb_t* buff) { if (BUF_IS_VALID(buff)) { buff->buff = NULL; } @@ -102,7 +102,7 @@ ringbuff_free(RINGBUFF_VOLATILE ringbuff_t* buff) { * \param[in] evt_fn: Callback function */ void -ringbuff_set_evt_fn(RINGBUFF_VOLATILE ringbuff_t* buff, ringbuff_evt_fn evt_fn) { +lwrb_set_evt_fn(LWRB_VOLATILE lwrb_t* buff, lwrb_evt_fn evt_fn) { if (BUF_IS_VALID(buff)) { buff->evt_fn = evt_fn; } @@ -120,7 +120,7 @@ ringbuff_set_evt_fn(RINGBUFF_VOLATILE ringbuff_t* buff, ringbuff_evt_fn evt_fn) * to copy full data array */ size_t -ringbuff_write(RINGBUFF_VOLATILE ringbuff_t* buff, const void* data, size_t btw) { +lwrb_write(LWRB_VOLATILE lwrb_t* buff, const void* data, size_t btw) { size_t tocopy, free; const uint8_t* d = data; @@ -129,7 +129,7 @@ ringbuff_write(RINGBUFF_VOLATILE ringbuff_t* buff, const void* data, size_t btw) } /* Calculate maximum number of bytes available to write */ - free = ringbuff_get_free(buff); + free = lwrb_get_free(buff); btw = BUF_MIN(free, btw); if (btw == 0) { return 0; @@ -151,7 +151,7 @@ ringbuff_write(RINGBUFF_VOLATILE ringbuff_t* buff, const void* data, size_t btw) if (buff->w >= buff->size) { buff->w = 0; } - BUF_SEND_EVT(buff, RINGBUFF_EVT_WRITE, tocopy + btw); + BUF_SEND_EVT(buff, LWRB_EVT_WRITE, tocopy + btw); return tocopy + btw; } @@ -165,7 +165,7 @@ ringbuff_write(RINGBUFF_VOLATILE ringbuff_t* buff, const void* data, size_t btw) * \return Number of bytes read and copied to data array */ size_t -ringbuff_read(RINGBUFF_VOLATILE ringbuff_t* buff, void* data, size_t btr) { +lwrb_read(LWRB_VOLATILE lwrb_t* buff, void* data, size_t btr) { size_t tocopy, full; uint8_t* d = data; @@ -174,7 +174,7 @@ ringbuff_read(RINGBUFF_VOLATILE ringbuff_t* buff, void* data, size_t btr) { } /* Calculate maximum number of bytes available to read */ - full = ringbuff_get_full(buff); + full = lwrb_get_full(buff); btr = BUF_MIN(full, btr); if (btr == 0) { return 0; @@ -196,7 +196,7 @@ ringbuff_read(RINGBUFF_VOLATILE ringbuff_t* buff, void* data, size_t btr) { if (buff->r >= buff->size) { buff->r = 0; } - BUF_SEND_EVT(buff, RINGBUFF_EVT_READ, tocopy + btr); + BUF_SEND_EVT(buff, LWRB_EVT_READ, tocopy + btr); return tocopy + btr; } @@ -209,7 +209,7 @@ ringbuff_read(RINGBUFF_VOLATILE ringbuff_t* buff, void* data, size_t btr) { * \return Number of bytes peeked and written to output array */ size_t -ringbuff_peek(RINGBUFF_VOLATILE ringbuff_t* buff, size_t skip_count, void* data, size_t btp) { +lwrb_peek(LWRB_VOLATILE lwrb_t* buff, size_t skip_count, void* data, size_t btp) { size_t full, tocopy, r; uint8_t* d = data; @@ -220,7 +220,7 @@ ringbuff_peek(RINGBUFF_VOLATILE ringbuff_t* buff, size_t skip_count, void* data, r = buff->r; /* Calculate maximum number of bytes available to read */ - full = ringbuff_get_full(buff); + full = lwrb_get_full(buff); /* Skip beginning of buffer */ if (skip_count >= full) { @@ -256,7 +256,7 @@ ringbuff_peek(RINGBUFF_VOLATILE ringbuff_t* buff, size_t skip_count, void* data, * \return Number of free bytes in memory */ size_t -ringbuff_get_free(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_get_free(LWRB_VOLATILE lwrb_t* buff) { size_t size, w, r; if (!BUF_IS_VALID(buff)) { @@ -284,7 +284,7 @@ ringbuff_get_free(RINGBUFF_VOLATILE ringbuff_t* buff) { * \return Number of bytes ready to be read */ size_t -ringbuff_get_full(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_get_full(LWRB_VOLATILE lwrb_t* buff) { size_t w, r, size; if (!BUF_IS_VALID(buff)) { @@ -309,11 +309,11 @@ ringbuff_get_full(RINGBUFF_VOLATILE ringbuff_t* buff) { * \param[in] buff: Buffer handle */ void -ringbuff_reset(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_reset(LWRB_VOLATILE lwrb_t* buff) { if (BUF_IS_VALID(buff)) { buff->w = 0; buff->r = 0; - BUF_SEND_EVT(buff, RINGBUFF_EVT_RESET, 0); + BUF_SEND_EVT(buff, LWRB_EVT_RESET, 0); } } @@ -323,7 +323,7 @@ ringbuff_reset(RINGBUFF_VOLATILE ringbuff_t* buff) { * \return Linear buffer start address */ void* -ringbuff_get_linear_block_read_address(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_get_linear_block_read_address(LWRB_VOLATILE lwrb_t* buff) { if (!BUF_IS_VALID(buff)) { return NULL; } @@ -336,7 +336,7 @@ ringbuff_get_linear_block_read_address(RINGBUFF_VOLATILE ringbuff_t* buff) { * \return Linear buffer size in units of bytes for read operation */ size_t -ringbuff_get_linear_block_read_length(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_get_linear_block_read_length(LWRB_VOLATILE lwrb_t* buff) { size_t w, r, len; if (!BUF_IS_VALID(buff)) { @@ -366,20 +366,20 @@ ringbuff_get_linear_block_read_length(RINGBUFF_VOLATILE ringbuff_t* buff) { * \return Number of bytes skipped */ size_t -ringbuff_skip(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len) { +lwrb_skip(LWRB_VOLATILE lwrb_t* buff, size_t len) { size_t full; if (!BUF_IS_VALID(buff) || len == 0) { return 0; } - full = ringbuff_get_full(buff); /* Get buffer used length */ - len = BUF_MIN(len, full); /* Calculate max skip */ - buff->r += len; /* Advance read pointer */ - if (buff->r >= buff->size) { /* Subtract possible overflow */ + full = lwrb_get_full(buff); + len = BUF_MIN(len, full); + buff->r += len; + if (buff->r >= buff->size) { buff->r -= buff->size; } - BUF_SEND_EVT(buff, RINGBUFF_EVT_READ, len); + BUF_SEND_EVT(buff, LWRB_EVT_READ, len); return len; } @@ -389,7 +389,7 @@ ringbuff_skip(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len) { * \return Linear buffer start address */ void* -ringbuff_get_linear_block_write_address(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_get_linear_block_write_address(LWRB_VOLATILE lwrb_t* buff) { if (!BUF_IS_VALID(buff)) { return NULL; } @@ -402,7 +402,7 @@ ringbuff_get_linear_block_write_address(RINGBUFF_VOLATILE ringbuff_t* buff) { * \return Linear buffer size in units of bytes for write operation */ size_t -ringbuff_get_linear_block_write_length(RINGBUFF_VOLATILE ringbuff_t* buff) { +lwrb_get_linear_block_write_length(LWRB_VOLATILE lwrb_t* buff) { size_t w, r, len; if (!BUF_IS_VALID(buff)) { @@ -444,19 +444,19 @@ ringbuff_get_linear_block_write_length(RINGBUFF_VOLATILE ringbuff_t* buff) { * \return Number of bytes advanced for write operation */ size_t -ringbuff_advance(RINGBUFF_VOLATILE ringbuff_t* buff, size_t len) { +lwrb_advance(LWRB_VOLATILE lwrb_t* buff, size_t len) { size_t free; if (!BUF_IS_VALID(buff) || len == 0) { return 0; } - free = ringbuff_get_free(buff); /* Get buffer free length */ - len = BUF_MIN(len, free); /* Calculate max advance */ - buff->w += len; /* Advance write pointer */ - if (buff->w >= buff->size) { /* Subtract possible overflow */ + free = lwrb_get_free(buff); + len = BUF_MIN(len, free); + buff->w += len; + if (buff->w >= buff->size) { buff->w -= buff->size; } - BUF_SEND_EVT(buff, RINGBUFF_EVT_WRITE, len); + BUF_SEND_EVT(buff, LWRB_EVT_WRITE, len); return len; } From 3ab7603cdb16ebc922729c589468b3cea0c29a61 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 18:33:35 +0200 Subject: [PATCH 08/12] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e129b5..7360452 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Generic ring buffer manager +# Lightweight ring buffer manager Library provides generic FIFO ring buffer implementation. -

Read first: Documentation

+

Read first: Documentation

## Features From 1d6612d8101102b4a0c10b87008cca3dafde5454 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 18:39:54 +0200 Subject: [PATCH 09/12] Fix all docs --- docs/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index d33a59c..2ba7d15 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,9 +1,9 @@ -Ringbuffer |version| documentation -================================== +LwRB |version| documentation +============================ Welcome to the documentation for version |version|. -Ring buffer is a generic *FIFO* (First In; First Out) buffer library optimized for embedded systems. +LwRB is a generic *FIFO* (First In; First Out) buffer library optimized for embedded systems. .. image:: static/images/logo.svg :align: center From 5af48186ce53ec96625b1620858d409f4ccff274 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 19:02:05 +0200 Subject: [PATCH 10/12] Set name to LwRB --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 61fbb21..3c579e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ subprocess.call('doxygen doxyfile.doxy', shell=True) # -- Project information ----------------------------------------------------- -project = 'Ringbuffer' +project = 'LwRB' copyright = '2020, Tilen MAJERLE' author = 'Tilen MAJERLE' From 10cf1f72117b5f6871af6d0395bccd881ffcc0f3 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 19:02:57 +0200 Subject: [PATCH 11/12] Remove embedded libs --- third_party/Embedded_Libs | 1 - 1 file changed, 1 deletion(-) delete mode 160000 third_party/Embedded_Libs diff --git a/third_party/Embedded_Libs b/third_party/Embedded_Libs deleted file mode 160000 index b92511a..0000000 --- a/third_party/Embedded_Libs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b92511a69ee11f11efe3fb27adf53cf841291a5e From b7d88a58ff5741479fa2dfe9dc5125e147c0d619 Mon Sep 17 00:00:00 2001 From: Tilen Majerle Date: Fri, 3 Jul 2020 19:31:01 +0200 Subject: [PATCH 12/12] Set version to 2.0.0 --- docs/conf.py | 2 +- lwrb/src/include/lwrb/lwrb.h | 2 +- lwrb/src/lwrb/lwrb.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 3c579e0..b02c82e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,7 +27,7 @@ author = 'Tilen MAJERLE' # The full version, including alpha/beta/rc tags -version = '1.3.1' +version = '2.0.0' # Try to get branch at which this is running # and try to determine which version to display in sphinx diff --git a/lwrb/src/include/lwrb/lwrb.h b/lwrb/src/include/lwrb/lwrb.h index a7244b2..db04782 100644 --- a/lwrb/src/include/lwrb/lwrb.h +++ b/lwrb/src/include/lwrb/lwrb.h @@ -29,7 +29,7 @@ * This file is part of LwRB - Lightweight ring buffer library. * * Author: Tilen MAJERLE - * Version: v1.3.1 + * Version: v2.0.0 */ #ifndef LWRB_HDR_H #define LWRB_HDR_H diff --git a/lwrb/src/lwrb/lwrb.c b/lwrb/src/lwrb/lwrb.c index c044733..a54df1c 100644 --- a/lwrb/src/lwrb/lwrb.c +++ b/lwrb/src/lwrb/lwrb.c @@ -29,7 +29,7 @@ * This file is part of LwRB - Lightweight ring buffer library. * * Author: Tilen MAJERLE - * Version: v1.3.1 + * Version: v2.0.0 */ #include "lwrb/lwrb.h"