mirror of
https://github.com/hathach/tinyusb.git
synced 2026-02-04 14:45:40 +00:00
change tu_fifo_clear()/tu_edpt_stream_clear() from return bool to void
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -30,7 +30,8 @@ settings/
|
|||||||
/examples/*/*/build*
|
/examples/*/*/build*
|
||||||
test_old/
|
test_old/
|
||||||
tests_obsolete/
|
tests_obsolete/
|
||||||
_build
|
_build/
|
||||||
|
build/
|
||||||
/examples/*/*/ses
|
/examples/*/*/ses
|
||||||
/examples/*/*/ozone
|
/examples/*/*/ozone
|
||||||
/examples/obsolete
|
/examples/obsolete
|
||||||
@ -47,7 +48,6 @@ cmake-build-*
|
|||||||
sdkconfig
|
sdkconfig
|
||||||
.PVS-Studio
|
.PVS-Studio
|
||||||
.vscode/
|
.vscode/
|
||||||
build
|
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
Debug
|
Debug
|
||||||
RelWithDebInfo
|
RelWithDebInfo
|
||||||
|
|||||||
@ -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) {
|
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);
|
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) {
|
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) {
|
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);
|
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) {
|
tu_fifo_t *tud_audio_n_get_ep_in_ff(uint8_t func_id) {
|
||||||
|
|||||||
@ -244,7 +244,8 @@ uint32_t tud_cdc_n_write_available(uint8_t itf) {
|
|||||||
bool tud_cdc_n_write_clear(uint8_t itf) {
|
bool tud_cdc_n_write_clear(uint8_t itf) {
|
||||||
TU_VERIFY(itf < CFG_TUD_CDC);
|
TU_VERIFY(itf < CFG_TUD_CDC);
|
||||||
cdcd_interface_t *p_cdc = &_cdcd_itf[itf];
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|||||||
@ -482,7 +482,8 @@ uint32_t tuh_cdc_write_flush(uint8_t idx) {
|
|||||||
bool tuh_cdc_write_clear(uint8_t idx) {
|
bool tuh_cdc_write_clear(uint8_t idx) {
|
||||||
cdch_interface_t * p_cdc = get_itf(idx);
|
cdch_interface_t * p_cdc = get_itf(idx);
|
||||||
TU_VERIFY(p_cdc);
|
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) {
|
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);
|
cdch_interface_t * p_cdc = get_itf(idx);
|
||||||
TU_VERIFY(p_cdc);
|
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);
|
(void)tu_edpt_stream_read_xfer(p_cdc->daddr, &p_cdc->stream.rx);
|
||||||
return ret;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|||||||
@ -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
|
// 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_wr);
|
||||||
ff_lock(f->mutex_rd);
|
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_wr);
|
||||||
ff_unlock(f->mutex_rd);
|
ff_unlock(f->mutex_rd);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the fifo overwritable mode
|
// Change the fifo overwritable mode
|
||||||
|
|||||||
@ -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_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_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
|
#if OSAL_MUTEX_REQUIRED
|
||||||
TU_ATTR_ALWAYS_INLINE static inline
|
TU_ATTR_ALWAYS_INLINE static inline
|
||||||
|
|||||||
@ -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);
|
void* ff_buf, uint16_t ff_bufsize, uint8_t* ep_buf, uint16_t ep_bufsize);
|
||||||
|
|
||||||
// Deinit an endpoint stream
|
// 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
|
// 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) {
|
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;
|
s->ep_addr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TU_ATTR_ALWAYS_INLINE static inline bool tu_edpt_stream_clear(tu_edpt_stream_t* s) {
|
TU_ATTR_ALWAYS_INLINE static inline void tu_edpt_stream_clear(tu_edpt_stream_t *s) {
|
||||||
return tu_fifo_clear(&s->ff);
|
tu_fifo_clear(&s->ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
TU_ATTR_ALWAYS_INLINE static inline bool tu_edpt_stream_empty(tu_edpt_stream_t *s) {
|
TU_ATTR_ALWAYS_INLINE static inline bool tu_edpt_stream_empty(tu_edpt_stream_t *s) {
|
||||||
|
|||||||
13
src/tusb.c
13
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;
|
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) {
|
static bool stream_claim(uint8_t hwid, tu_edpt_stream_t *s) {
|
||||||
if (s->is_host) {
|
if (s->is_host) {
|
||||||
#if CFG_TUH_ENABLED
|
#if CFG_TUH_ENABLED
|
||||||
|
|||||||
Reference in New Issue
Block a user