summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
Diffstat (limited to 'src/class')
-rw-r--r--src/class/vendor/vendor_device.c6
-rw-r--r--src/class/vendor/vendor_device.h7
2 files changed, 13 insertions, 0 deletions
diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c
index 9972911e0..ced3c0d71 100644
--- a/src/class/vendor/vendor_device.c
+++ b/src/class/vendor/vendor_device.c
@@ -160,6 +160,12 @@ uint32_t tud_vendor_n_write_available(uint8_t idx) {
vendord_interface_t *p_itf = &_vendord_itf[idx];
return tu_edpt_stream_write_available(&p_itf->stream.tx);
}
+
+uint32_t tud_vendor_n_write_clear(uint8_t idx) {
+ TU_VERIFY(idx < CFG_TUD_VENDOR, 0);
+ vendord_interface_t *p_itf = &_vendord_itf[idx];
+ return tu_edpt_stream_count_and_clear(&p_itf->stream.tx);
+}
#endif
//--------------------------------------------------------------------+
diff --git a/src/class/vendor/vendor_device.h b/src/class/vendor/vendor_device.h
index d59c885d2..878d7aee0 100644
--- a/src/class/vendor/vendor_device.h
+++ b/src/class/vendor/vendor_device.h
@@ -91,6 +91,9 @@ uint32_t tud_vendor_n_write_flush(uint8_t idx);
// Return number of bytes available for writing in TX FIFO
uint32_t tud_vendor_n_write_available(uint8_t idx);
+
+// Clear the write buffer and return the number of elements cleared
+uint32_t tud_vendor_n_write_clear(uint8_t idx);
#endif
// Write a null-terminated string to TX FIFO
@@ -148,6 +151,10 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t tud_vendor_write_flush(void) {
TU_ATTR_ALWAYS_INLINE static inline uint32_t tud_vendor_write_available(void) {
return tud_vendor_n_write_available(0);
}
+
+TU_ATTR_ALWAYS_INLINE static inline uint32_t tud_vendor_write_clear(void) {
+ return tud_vendor_n_write_clear(0);
+}
#endif
// backward compatible