Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Nov 15, 2020
2 parents 695cd91 + d90d842 commit 601bc87
Show file tree
Hide file tree
Showing 26 changed files with 186 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
author = 'Tilen MAJERLE'

# The full version, including alpha/beta/rc tags
version = '2.0.0'
version = '2.0.1'

# Try to get branch at which this is running
# and try to determine which version to display in sphinx
Expand Down
2 changes: 1 addition & 1 deletion docs/examples_src/example_advance_1.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Declare buffer variables */
/* Declare rb instance & raw data */
lwrb_t buff;
uint8_t buff_data[8];

Expand Down
10 changes: 5 additions & 5 deletions docs/examples_src/example_advance_2.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "lwrb/lwrb.h"

/* Buffer variables */
lwrb_t buff; /* Declare ring buffer structure */
uint8_t buff_data[8]; /* Declare raw buffer data array */
/* Declare rb instance & raw data */
lwrb_t buff;
uint8_t buff_data[8];

/* Application variables
uint8_t data[2]; /* Application working data */
/* Application variables */
uint8_t data[2];

/* Application code ... */
lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */
Expand Down
2 changes: 1 addition & 1 deletion docs/examples_src/example_dma_skip.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Buffer */
/* Declare rb instance & raw data */
lwrb_t buff;
uint8_t buff_data[8];

Expand Down
8 changes: 4 additions & 4 deletions docs/examples_src/example_index.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* Buffer variables */
lwrb_t buff; /* Declare ring buffer structure */
uint8_t buff_data[8]; /* Declare raw buffer data array */
/* Declare rb instance & raw data */
lwrb_t buff;
uint8_t buff_data[8];

/* Application variables */
uint8_t data[2]; /* Application working data */
uint8_t data[2];
size_t len;

/* Application code ... */
Expand Down
10 changes: 5 additions & 5 deletions docs/examples_src/example_minimal.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "lwrb/lwrb.h"

/* Buffer variables */
lwrb_t buff; /* Declare ring buffer structure */
uint8_t buff_data[8]; /* Declare raw buffer data array */
/* Declare rb instance & raw data */
lwrb_t buff;
uint8_t buff_data[8];

/* Application variables
uint8_t data[2]; /* Application working data */
/* Application variables */
uint8_t data[2]; /* Application working data */

/* Application code ... */
lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */
Expand Down
3 changes: 1 addition & 2 deletions docs/examples_src/example_skip_1.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

#include "lwrb/lwrb.h"

/* Declare buffer variables */
/* Declare rb instance & raw data */
lwrb_t buff;
uint8_t buff_data[8];

Expand Down
3 changes: 2 additions & 1 deletion docs/examples_src/example_skip_2.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* Initialization part skipped */

/* Get length of linear memory at read pointer */
/* When function returns 0, there is no memory available in the buffer for read anymore */
/* When function returns 0, there is no memory
available in the buffer for read anymore */
while ((len = lwrb_get_linear_block_read_length(&buff)) > 0) {
/* Get pointer to first element in linear block at read address */
data = lwrb_get_linear_block_read_address(&buff);
Expand Down
47 changes: 47 additions & 0 deletions docs/examples_src/example_thread_safety.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* Declare variables */
lwrb_t rb;

/* 2 mutexes, one for write operations,
one for read operations */
mutex_t m_w, m_r;

/* 4 threads below, 2 for write, 2 for read */
void
thread_write_1(void* arg) {
/* Use write mutex */
while (1) {
mutex_get(&m_w);
lwrb_write(&rb, ...);
mutex_give(&m_w);
}
}

void
thread_write_2(void* arg) {
/* Use write mutex */
while (1) {
mutex_get(&m_w);
lwrb_write(&rb, ...);
mutex_give(&m_w);
}
}

void
thread_read_1(void* arg) {
/* Use read mutex */
while (1) {
mutex_get(&m_r);
lwrb_read(&rb, ...);
mutex_give(&m_r);
}
}

void
thread_read_2(void* arg) {
/* Use read mutex */
while (1) {
mutex_get(&m_r);
lwrb_read(&rb, ...);
mutex_give(&m_r);
}
}
3 changes: 2 additions & 1 deletion docs/examples_src/example_tt_buff_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ uint32_t d[2];
lwrb_t buff_1;
lwrb_t buff_2;

/* Create data for buffers. Use sizeof structure, multiplied by N (for N instances) */
/* Create data for buffers. Use sizeof structure,
multiplied by N (for N instances) */
/* Buffer with + 1 bytes bigger memory */
uint8_t buff_data_1[sizeof(d) * N + 1];
/* Buffer without + 1 at the end */
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LwRB is a generic *FIFO* (First In; First Out) buffer library optimized for embe
.. rst-class:: center
.. rst-class:: index_links

:ref:`download_library` · :ref:`getting_started` · `Open Github <https://github.com/MaJerle/lwrb>`_
:ref:`download_library` :ref:`getting_started` `Open Github <https://github.com/MaJerle/lwrb>`_

Features
^^^^^^^^
Expand Down
6 changes: 6 additions & 0 deletions docs/static/css/common.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/static/images/buff_thread_safety_2_main_irq_write.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/static/images/buff_thread_safety_2_main_irq_write.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2020-07-12T09:40:52.011Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.3.2 Chrome/78.0.3904.113 Electron/7.1.2 Safari/537.36" etag="j1j50cUtcakPpFB5q8eu" version="12.3.2" type="device" pages="1"><diagram id="-rsuYHbGqsa_XvOsthcc" name="Page-1">7ZfbcpswEIafhst0DAJMLoMPaSbJ9OBpYl/KaG00lZFHyKc8fUWQOBg8dlrXnTa9Cvtrd0Hf/hHYQr3F9lbgZfzICTDL6ZCthfqW49idrqv+ZMouV649LxfmghKdVAoj+gKmUqsrSiCtJUrOmaTLuhjxJIFI1jQsBN/U02ac1e+6xHNoCKMIs6b6TImMczXwOqX+Eeg8Nne2O3plgU2yFtIYE76pSGhgoZ7gXOZXi20PWAbPcMnrhgdWiwcTkMhTCtDtE0mGwd14PAsfnkYvchxOrnSXNWYrvWH9sHJnCAi+SghkTToWCjcxlTBa4ihb3aiZKy2WC6YiW13OKGM9zrhQccITlRQSnMav5dl6KgX/DibDctDgxg99X63oBwEhYXtwh3bBTRkO+AKk2KkUU+Br1NprjpnFppyc7Wotrk7NJGLtlnnRuwSqLjTTdr5fBBqKKzF5uO+tP02u7/s4/NbC9xHTRCmM8+X5UCuQBEMwi9oQ+1EA01mBuMGzhfphxN09xHYLYqcFsfu7CDsNwneJBCFWS5kfC2pn8l8g7f1p0qhB+mt4XrAeBMRtAxs4U1Q5JX4JLLL3wKIm2OCSXN2LnRGzIIKo1bnTwHO9znkAuycAvqxzveNvOUjITfa5oKKI4TSlUZ2kwiF2Y039NZhkwQfPhP1tdbG/M9GWyrHpoa4rVSoqi7LA1BycQcpXIoLjrxuJxRzk8X9lILWPn+ZEKxPzWgZmNAEMS7qufzK1TVHf4TOniawcdV7dMKi7Z4R837qq+omz16h44ZtGzl6jHEyj0aupim3/vM/89+Iz56/0WXGs7x9Mb/VZ4SvTyL+sz7rvxWfoRJ+5/332Np+psPzlmaeXv9/R4Ac=</diagram></mxfile>
3 changes: 3 additions & 0 deletions docs/static/images/buff_thread_safety_2_thread_read.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/static/images/buff_thread_safety_2_thread_read.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2020-07-12T09:41:15.697Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.3.2 Chrome/78.0.3904.113 Electron/7.1.2 Safari/537.36" etag="fegna7Adfaxn-QJceuXr" version="12.3.2" type="device" pages="1"><diagram id="cyf46QluELBuy1FbUENl" name="Page-1">7VdNc9owEP01HNOxLduYY/govXSSlkwKR2GtsSfCYmQBJr++Mpb8zQAZmqTTnqx90q6tt2+1Vg+N1umU4034nRGgPcsgaQ+Ne5ZlGn1bPjLkkCMDx8mBFY+IWlQCs+gVtKdCtxGBpLZQMEZFtKmDPotj8EUNw5yzfX1ZwGj9rRu8ghYw8zFto78iIsIc9RyjxL9BtAr1m01DzayxXqyAJMSE7SsQmvTQiDMm8tE6HQHNyNO85H5fT8wWH8YhFpc49F+f2cN44IyG3jy0Ar576s/vVJQdplu14UfOyNYHnhEdcsBEfb04aEo428YEsqhGDw33YSRgtsF+NruXIpBYKNZUWqYcBhGlI0YZP/oigsELfIkngrMXqMy4vgfLQM6096U/EriAtAKpfU6BrUHwg1yiZ13FuRJdkYN9mUJTY2ElfbbCsFLNqghdEisHitsreLZaPP8c3pZYBzxidxHrWUvkurchFhnnifXek1fU4vVJidYwb8pv4Pngdwp36Tm2Y9yGX7vJr/HRwrVbBLdohZjcZyettHyKkyTy60xKOvhhrlg/GovM+OJoc5xWJ8cHbaWRmOsYclzxklbplBna52QOErblPpw/CQXmKxDnKxlIrW+0M1rJmNORMI1xoFhEu3q36cqiesMji+TOypPOrgsGuQ0h5PtWXtXu0Aw0aAQyG4FyYlqBjqIqtv12nTn/is6sC3WGPpXOrP6Jg/9anRW60oGc99WZe7phtBX3FzYM+6MbRv9/IXcq7pMUMhqcqb9LC9luFjL6Y4X89LyY8rsf/cnLw1hgMV2M57Tj5nK78o1ZLBcNCU7Co7vZVcaTe3dY+a9u1WyHqk7/VzeyUnTjahnbHaoorptX1LE0y1tnno7y7o4mvwE=</diagram></mxfile>
Loading

0 comments on commit 601bc87

Please sign in to comment.