summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-22 17:31:31 +0700
committerhathach <[email protected]>2025-11-22 17:31:31 +0700
commitb98127fba2b198130eb8868defcf117c6b5ea231 (patch)
tree36d95a57994f3c7d0b1376228ffba26ee4c7c389
parentb7bf1d9835b0fab2da581df8d81686509d155e15 (diff)
hil stress test cdc
-rw-r--r--src/class/cdc/cdc_device.c2
-rw-r--r--src/common/tusb_fifo.c2
-rwxr-xr-xtest/hil/hil_test.py2
-rw-r--r--test/unit-test/test/test_fifo.c6
4 files changed, 6 insertions, 6 deletions
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index 3f860a657..2ab592bca 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -513,7 +513,7 @@ bool cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
for (uint32_t i = 0; i < xferred_bytes; i++) {
if (p_cdc->wanted_char == (char)*ptr) {
tud_cdc_rx_wanted_cb(itf, p_cdc->wanted_char);
- break; // only invoke once per transfer, even multiple wanted chars are present
+ break; // only invoke once per transfer, even if multiple wanted chars are present
}
if (ptr == buf_info.ptr_wrap) {
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index f09fcbafa..0c44cbd76 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -400,7 +400,7 @@ uint16_t tu_fifo_write_n_access(tu_fifo_t *f, const void *data, uint16_t n, tu_f
const uint8_t *buf8 = (const uint8_t *)data;
TU_LOG(TU_FIFO_DBG, "rd = %3u, wr = %3u, count = %3u, remain = %3u, n = %3u: ", rd_idx, wr_idx,
- _ff_count(f->depth, wr_idx, rd_idx), _ff_remaining(f->depth, wr_idx, rd_idx), n);
+ tu_ff_overflow_count(f->depth, wr_idx, rd_idx), tu_ff_remaining_local(f->depth, wr_idx, rd_idx), n);
if (!f->overwritable) {
// limit up to full
diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py
index aabf8a449..238d452e8 100755
--- a/test/hil/hil_test.py
+++ b/test/hil/hil_test.py
@@ -437,7 +437,7 @@ def test_device_cdc_msc(board):
ser.write(test_str)
ser.flush()
rd_str = ser.read(len(test_str))
- assert rd_str == test_str, f'CDC wrong data ({size} bytes): expected: {test_str[:16]}... was {rd_str[:16]}'
+ assert rd_str == test_str, f'CDC wrong data ({size} bytes):\n expected: {test_str}\n was: {rd_str}'
ser.close()
diff --git a/test/unit-test/test/test_fifo.c b/test/unit-test/test/test_fifo.c
index 83db10454..d1049b81d 100644
--- a/test/unit-test/test/test_fifo.c
+++ b/test/unit-test/test/test_fifo.c
@@ -182,10 +182,10 @@ static uint16_t help_write(uint16_t total, uint16_t n) {
}
void test_write_overwritable2(void) {
-tu_fifo_set_overwritable(ff, true);
+ tu_fifo_set_overwritable(ff, true);
-// based on actual crash tests detected by fuzzing
-uint16_t total = 0;
+ // based on actual crash tests detected by fuzzing
+ uint16_t total = 0;
total = help_write(total, 12);
total = help_write(total, 55);