From 3baa7c8fbafd2cbccc5810626ebbfaa50c0ea4da Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 11 Aug 2026 17:07:23 +0700 Subject: sysview: instrument usbd/usbh, dcd/hcd and class-driver call sites Level 2 marks the stack's task-side entry points (tud_task/tuh_task inner loop, usbd_edpt_xfer, control transfers); level 3 adds the class drivers (cdc, msc) and the rp2040 dcd/hcd as the reference portable layer. All call sites compile away below their level. --- src/class/cdc/cdc_device.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/class/cdc/cdc_device.c') diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c index ed050ad03..0684710dd 100644 --- a/src/class/cdc/cdc_device.c +++ b/src/class/cdc/cdc_device.c @@ -11,6 +11,7 @@ #include "device/usbd.h" #include "device/usbd_pvt.h" +#include "common/tusb_sysview.h" #include "cdc_device.h" @@ -174,8 +175,11 @@ uint32_t tud_cdc_n_available(uint8_t itf) { uint32_t tud_cdc_n_read(uint8_t itf, void* buffer, uint32_t bufsize) { TU_VERIFY(itf < CFG_TUD_CDC, 0); + TUD_SYSVIEW_CALL(CFG_TUSB_SYSVIEW_LEVEL_CLASS, TU_SV_ID_CDC_READ); cdcd_interface_t *p_cdc = &_cdcd_itf[itf]; - return tu_edpt_stream_read(&p_cdc->rx_stream, buffer, bufsize); + uint32_t const ret = tu_edpt_stream_read(&p_cdc->rx_stream, buffer, bufsize); + TUD_SYSVIEW_RET(CFG_TUSB_SYSVIEW_LEVEL_CLASS, TU_SV_ID_CDC_READ); + return ret; } bool tud_cdc_n_peek(uint8_t itf, uint8_t *chr) { @@ -201,8 +205,11 @@ uint32_t tud_cdc_n_write(uint8_t itf, const void* buffer, uint32_t bufsize) { uint32_t tud_cdc_n_write_flush(uint8_t itf) { TU_VERIFY(itf < CFG_TUD_CDC, 0); + TUD_SYSVIEW_CALL(CFG_TUSB_SYSVIEW_LEVEL_CLASS, TU_SV_ID_CDC_FLUSH); cdcd_interface_t *p_cdc = &_cdcd_itf[itf]; - return tu_edpt_stream_write_xfer(&p_cdc->tx_stream); + uint32_t const ret = tu_edpt_stream_write_xfer(&p_cdc->tx_stream); + TUD_SYSVIEW_RET(CFG_TUSB_SYSVIEW_LEVEL_CLASS, TU_SV_ID_CDC_FLUSH); + return ret; } uint32_t tud_cdc_n_write_available(uint8_t itf) { -- cgit v1.3.1