From c342818d5dd9ba1a5dbfd86699fae30167f6d676 Mon Sep 17 00:00:00 2001 From: bkleiner Date: Fri, 11 Aug 2023 16:29:05 +0200 Subject: [PATCH] move ring buffer functions to ram --- src/util/ring_buffer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/ring_buffer.c b/src/util/ring_buffer.c index 7bbdfe7e5..7b9b199a1 100644 --- a/src/util/ring_buffer.c +++ b/src/util/ring_buffer.c @@ -9,7 +9,7 @@ uint32_t ring_buffer_free(ring_buffer_t *c) { return (c->tail - c->head); } -uint8_t ring_buffer_write(ring_buffer_t *c, uint8_t data) { +RAM_FUNC uint8_t ring_buffer_write(ring_buffer_t *c, uint8_t data) { const uint32_t next = (c->head + 1) % c->size; if (next == c->tail) return 0; @@ -19,7 +19,7 @@ uint8_t ring_buffer_write(ring_buffer_t *c, uint8_t data) { return 1; } -uint32_t ring_buffer_write_multi(ring_buffer_t *c, const uint8_t *data, const uint32_t len) { +RAM_FUNC uint32_t ring_buffer_write_multi(ring_buffer_t *c, const uint8_t *data, const uint32_t len) { for (uint32_t i = 0; i < len; i++) { const uint32_t next = (c->head + 1) % c->size; if (next == c->tail) { @@ -32,14 +32,14 @@ uint32_t ring_buffer_write_multi(ring_buffer_t *c, const uint8_t *data, const ui return len; } -uint32_t ring_buffer_available(ring_buffer_t *c) { +RAM_FUNC uint32_t ring_buffer_available(ring_buffer_t *c) { if (c->head >= c->tail) { return c->head - c->tail; } return c->size + c->head - c->tail; } -uint8_t ring_buffer_read(ring_buffer_t *c, uint8_t *data) { +RAM_FUNC uint8_t ring_buffer_read(ring_buffer_t *c, uint8_t *data) { if (c->head == c->tail) return 0; @@ -48,7 +48,7 @@ uint8_t ring_buffer_read(ring_buffer_t *c, uint8_t *data) { return 1; } -uint32_t ring_buffer_read_multi(ring_buffer_t *c, uint8_t *data, const uint32_t len) { +RAM_FUNC uint32_t ring_buffer_read_multi(ring_buffer_t *c, uint8_t *data, const uint32_t len) { for (uint32_t i = 0; i < len; i++) { if (c->head == c->tail) return i;