summaryrefslogtreecommitdiff
path: root/src
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
parent0e48fe862292bb7b3e526a4b42bfa588d97d105e (diff)
change tu_fifo_clear()/tu_edpt_stream_clear() from return bool to void
Diffstat (limited to 'src')
-rw-r--r--src/class/audio/audio_device.c6
-rw-r--r--src/class/cdc/cdc_device.c3
-rw-r--r--src/class/cdc/cdc_host.c7
-rw-r--r--src/common/tusb_fifo.c3
-rw-r--r--src/common/tusb_fifo.h2
-rw-r--r--src/common/tusb_private.h16
-rw-r--r--src/tusb.c13
7 files changed, 25 insertions, 25 deletions
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c
index 1dda8af99..77ef54222 100644
--- a/src/class/audio/audio_device.c
+++ b/src/class/audio/audio_device.c
@@ -485,7 +485,8 @@ uint16_t tud_audio_n_read(uint8_t func_id, void *buffer, uint16_t bufsize) {
bool tud_audio_n_clear_ep_out_ff(uint8_t func_id) {
TU_VERIFY(func_id < CFG_TUD_AUDIO && _audiod_fct[func_id].p_desc != NULL);
- return tu_fifo_clear(&_audiod_fct[func_id].ep_out_ff);
+ tu_fifo_clear(&_audiod_fct[func_id].ep_out_ff);
+ return true;
}
tu_fifo_t *tud_audio_n_get_ep_out_ff(uint8_t func_id) {
@@ -536,7 +537,8 @@ uint16_t tud_audio_n_write(uint8_t func_id, const void *data, uint16_t len) {
bool tud_audio_n_clear_ep_in_ff(uint8_t func_id) {
TU_VERIFY(func_id < CFG_TUD_AUDIO && _audiod_fct[func_id].p_desc != NULL);
- return tu_fifo_clear(&_audiod_fct[func_id].ep_in_ff);
+ tu_fifo_clear(&_audiod_fct[func_id].ep_in_ff);
+ return true;
}
tu_fifo_t *tud_audio_n_get_ep_in_ff(uint8_t func_id) {
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index d7792afe4..a446782e3 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -244,7 +244,8 @@ uint32_t tud_cdc_n_write_available(uint8_t itf) {
bool tud_cdc_n_write_clear(uint8_t itf) {
TU_VERIFY(itf < CFG_TUD_CDC);
cdcd_interface_t *p_cdc = &_cdcd_itf[itf];
- return tu_edpt_stream_clear(&p_cdc->stream.tx);
+ tu_edpt_stream_clear(&p_cdc->stream.tx);
+ return true;
}
//--------------------------------------------------------------------+
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c
index 35717ddf6..e069d9f71 100644
--- a/src/class/cdc/cdc_host.c
+++ b/src/class/cdc/cdc_host.c
@@ -482,7 +482,8 @@ uint32_t tuh_cdc_write_flush(uint8_t idx) {
bool tuh_cdc_write_clear(uint8_t idx) {
cdch_interface_t * p_cdc = get_itf(idx);
TU_VERIFY(p_cdc);
- return tu_edpt_stream_clear(&p_cdc->stream.tx);
+ tu_edpt_stream_clear(&p_cdc->stream.tx);
+ return true;
}
uint32_t tuh_cdc_write_available(uint8_t idx) {
@@ -517,9 +518,9 @@ bool tuh_cdc_read_clear (uint8_t idx) {
cdch_interface_t * p_cdc = get_itf(idx);
TU_VERIFY(p_cdc);
- bool ret = tu_edpt_stream_clear(&p_cdc->stream.rx);
+ tu_edpt_stream_clear(&p_cdc->stream.rx);
(void)tu_edpt_stream_read_xfer(p_cdc->daddr, &p_cdc->stream.rx);
- return ret;
+ return true;
}
//--------------------------------------------------------------------+
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) {
diff --git a/src/tusb.c b/src/tusb.c
index ecdd569c4..fef5b1b75 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -358,19 +358,6 @@ bool tu_edpt_stream_init(tu_edpt_stream_t* s, bool is_host, bool is_tx, bool ove
return true;
}
-bool 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
- return true;
-}
-
static bool stream_claim(uint8_t hwid, tu_edpt_stream_t *s) {
if (s->is_host) {
#if CFG_TUH_ENABLED