summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-12-10 14:45:06 +0700
committerhathach <[email protected]>2025-12-10 14:45:06 +0700
commitf1fc4c9c796e25111ad8249a4dab9245f5091c25 (patch)
tree81930d68082612c85bb03f5e3b9829eb6ef6f294 /src/common
parent0e48fe862292bb7b3e526a4b42bfa588d97d105e (diff)
change tu_fifo_clear()/tu_edpt_stream_clear() from return bool to void
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_fifo.c3
-rw-r--r--src/common/tusb_fifo.h2
-rw-r--r--src/common/tusb_private.h16
3 files changed, 15 insertions, 6 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index 06b0d6a58..1313fc328 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -84,7 +84,7 @@ bool tu_fifo_config(tu_fifo_t *f, void *buffer, uint16_t depth, uint16_t item_si
}
// clear fifo by resetting read and write indices
-bool tu_fifo_clear(tu_fifo_t *f) {
+void tu_fifo_clear(tu_fifo_t *f) {
ff_lock(f->mutex_wr);
ff_lock(f->mutex_rd);
@@ -93,7 +93,6 @@ bool tu_fifo_clear(tu_fifo_t *f) {
ff_unlock(f->mutex_wr);
ff_unlock(f->mutex_rd);
- return true;
}
// Change the fifo overwritable mode
diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h
index 94ab421bb..5bc05b56c 100644
--- a/src/common/tusb_fifo.h
+++ b/src/common/tusb_fifo.h
@@ -158,7 +158,7 @@ typedef enum {
//--------------------------------------------------------------------+
bool tu_fifo_config(tu_fifo_t *f, void *buffer, uint16_t depth, uint16_t item_size, bool overwritable);
bool tu_fifo_set_overwritable(tu_fifo_t *f, bool overwritable);
-bool tu_fifo_clear(tu_fifo_t *f);
+void tu_fifo_clear(tu_fifo_t *f);
#if OSAL_MUTEX_REQUIRED
TU_ATTR_ALWAYS_INLINE static inline
diff --git a/src/common/tusb_private.h b/src/common/tusb_private.h
index 0e9eef732..df518d5ff 100644
--- a/src/common/tusb_private.h
+++ b/src/common/tusb_private.h
@@ -108,7 +108,17 @@ bool tu_edpt_stream_init(tu_edpt_stream_t* s, bool is_host, bool is_tx, bool ove
void* ff_buf, uint16_t ff_bufsize, uint8_t* ep_buf, uint16_t ep_bufsize);
// Deinit an endpoint stream
-bool tu_edpt_stream_deinit(tu_edpt_stream_t* s);
+TU_ATTR_ALWAYS_INLINE static inline void tu_edpt_stream_deinit(tu_edpt_stream_t *s) {
+ (void)s;
+#if OSAL_MUTEX_REQUIRED
+ if (s->ff.mutex_wr) {
+ osal_mutex_delete(s->ff.mutex_wr);
+ }
+ if (s->ff.mutex_rd) {
+ osal_mutex_delete(s->ff.mutex_rd);
+ }
+#endif
+}
// Open an endpoint stream
TU_ATTR_ALWAYS_INLINE static inline void tu_edpt_stream_open(tu_edpt_stream_t* s, tusb_desc_endpoint_t const *desc_ep) {
@@ -124,8 +134,8 @@ TU_ATTR_ALWAYS_INLINE static inline void tu_edpt_stream_close(tu_edpt_stream_t*
s->ep_addr = 0;
}
-TU_ATTR_ALWAYS_INLINE static inline bool tu_edpt_stream_clear(tu_edpt_stream_t* s) {
- return tu_fifo_clear(&s->ff);
+TU_ATTR_ALWAYS_INLINE static inline void tu_edpt_stream_clear(tu_edpt_stream_t *s) {
+ tu_fifo_clear(&s->ff);
}
TU_ATTR_ALWAYS_INLINE static inline bool tu_edpt_stream_empty(tu_edpt_stream_t *s) {