diff options
| author | Ha Thach <[email protected]> | 2025-11-14 14:23:46 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-14 14:23:46 +0700 |
| commit | a3a5a41be8e22f529a8941c107ec32d48faa6ff2 (patch) | |
| tree | bc8a4c397b957cd0d86b35e0d0f9ba7eacefcd30 /src/common | |
| parent | 8b8f1f80b4f01fc0fc56ad58af9b784e161636b0 (diff) | |
| parent | c9a9e94ae554c3d545b5eb795f81fa9216a93e4f (diff) | |
Merge pull request #3339 from hathach/cdc-edpt-stream
migrate cdc device to edpt stream API
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/tusb_common.h | 2 | ||||
| -rw-r--r-- | src/common/tusb_private.h | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index 7aa42a2d7..f377d5272 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -354,7 +354,7 @@ TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_desc_subtype(void const* desc) { return ((uint8_t const*) desc)[DESC_OFFSET_SUBTYPE]; } -TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_desc_in_bounds(uint8_t const* p_desc, uint8_t const* desc_end) { +TU_ATTR_ALWAYS_INLINE static inline bool tu_desc_in_bounds(const uint8_t *p_desc, const uint8_t *desc_end) { if (p_desc >= desc_end) { return false; } diff --git a/src/common/tusb_private.h b/src/common/tusb_private.h index 367209e57..be1264a71 100644 --- a/src/common/tusb_private.h +++ b/src/common/tusb_private.h @@ -100,7 +100,6 @@ bool tu_edpt_stream_deinit(tu_edpt_stream_t* s); // Open an stream for an endpoint TU_ATTR_ALWAYS_INLINE static inline void tu_edpt_stream_open(tu_edpt_stream_t* s, tusb_desc_endpoint_t const *desc_ep) { - tu_fifo_clear(&s->ff); s->ep_addr = desc_ep->bEndpointAddress; s->is_mps512 = tu_edpt_packet_size(desc_ep) == 512; } @@ -113,11 +112,14 @@ TU_ATTR_ALWAYS_INLINE static inline void tu_edpt_stream_close(tu_edpt_stream_t* s->ep_addr = 0; } -// Clear fifo 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 bool tu_edpt_stream_empty(tu_edpt_stream_t *s) { + return tu_fifo_empty(&s->ff); +} + //--------------------------------------------------------------------+ // Stream Write //--------------------------------------------------------------------+ |
