summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-12 21:22:25 +0700
committerhathach <[email protected]>2025-11-12 21:22:25 +0700
commitf11adb02ebc0c594a7114b08585b8af18c3ee6d6 (patch)
treef0165f7ec3b276d99dbfd8f087cadb145ff9c9db /src/common
parent8b8f1f80b4f01fc0fc56ad58af9b784e161636b0 (diff)
migrate cdc device to use edpt stream API
tu_edpt_stream_open() does not clear fifo, allow for persistent stream when disconnect/reconnect
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_private.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/tusb_private.h b/src/common/tusb_private.h
index 367209e57..f82f87b6f 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,15 @@ 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
//--------------------------------------------------------------------+