change tud_vendor_rx_cb() behavior, buffer and bufsize only available when CFG_TUD_VENDOR_RX_BUFSIZE = 0

update vendor device to omit ep buf when dedicated hwfifo is supported
This commit is contained in:
hathach
2025-11-27 18:41:57 +07:00
parent f3dc2186ae
commit 9a9bf0fd7b
6 changed files with 73 additions and 37 deletions

View File

@ -211,15 +211,16 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
return false;
}
void tud_vendor_rx_cb(uint8_t idx, const uint8_t *buffer, uint16_t bufsize) {
void tud_vendor_rx_cb(uint8_t idx, const uint8_t *buffer, uint32_t bufsize) {
(void)idx;
(void)buffer;
(void)bufsize;
// since we used data without pulling it from RX FIFO, we need to discard number of items used
#if CFG_TUD_VENDOR_RX_BUFSIZE > 0
tud_vendor_read_discard(bufsize);
#endif
echo_all(buffer, bufsize);
while (tud_vendor_available()) {
uint8_t buf[64];
const uint32_t count = tud_vendor_read(buf, sizeof(buf));
echo_all(buf, count);
}
}
//--------------------------------------------------------------------+