change tu_fifo_clear()/tu_edpt_stream_clear() from return bool to void

This commit is contained in:
hathach
2025-12-10 14:45:06 +07:00
parent 0e48fe8622
commit f1fc4c9c79
8 changed files with 27 additions and 27 deletions

4
.gitignore vendored
View File

@ -30,7 +30,8 @@ settings/
/examples/*/*/build*
test_old/
tests_obsolete/
_build
_build/
build/
/examples/*/*/ses
/examples/*/*/ozone
/examples/obsolete
@ -47,7 +48,6 @@ cmake-build-*
sdkconfig
.PVS-Studio
.vscode/
build
CMakeFiles
Debug
RelWithDebInfo

View File

@ -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) {

View File

@ -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;
}
//--------------------------------------------------------------------+

View File

@ -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;
}
//--------------------------------------------------------------------+

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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