summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_fifo.c19
-rw-r--r--src/common/tusb_fifo.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index 6ab158cca..fdd8c3e35 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -319,3 +319,22 @@ bool tu_fifo_clear(tu_fifo_t *f)
return true;
}
+
+/******************************************************************************/
+/*!
+ @brief Change the fifo mode to overwritable or not overwritable
+
+ @param[in] f
+ Pointer to the FIFO buffer to manipulate
+*/
+/******************************************************************************/
+bool tu_fifo_change_mode(tu_fifo_t *f, bool overwritable)
+{
+ tu_fifo_lock(f);
+
+ f->overwritable = overwritable;
+
+ tu_fifo_unlock(f);
+
+ return true;
+}
diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h
index fb0c896f3..7957d83af 100644
--- a/src/common/tusb_fifo.h
+++ b/src/common/tusb_fifo.h
@@ -76,6 +76,7 @@ typedef struct
.overwritable = _overwritable, \
}
+bool tu_fifo_change_mode(tu_fifo_t *f, bool overwritable);
bool tu_fifo_clear(tu_fifo_t *f);
bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_size, bool overwritable);