summaryrefslogtreecommitdiff
path: root/src/device/usbd.c
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-01-31 19:08:23 +0100
committerReinhard Panhuber <[email protected]>2021-01-31 19:08:23 +0100
commit84406f1654ca757ecd7294f4b98b56146583be49 (patch)
treeccfdc6719a7d48781fe59e0b9284f4e64af0060f /src/device/usbd.c
parentf1551d7a5fe5faccad9c1ef3f5d374869a1874e6 (diff)
Rework audio driver
Diffstat (limited to 'src/device/usbd.c')
-rw-r--r--src/device/usbd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 4e18df757..2e2f9cf65 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -1206,12 +1206,16 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
}
}
-bool usbd_edpt_iso_xfer(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff)
+// The number of bytes has to be given explicitly to allow more flexible control of how many
+// bytes should be written and second to keep the return value free to give back a boolean
+// success message. If total_bytes is too big, the FIFO will copy only what is available
+// into the USB buffer!
+bool usbd_edpt_iso_xfer(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes)
{
uint8_t const epnum = tu_edpt_number(ep_addr);
uint8_t const dir = tu_edpt_dir(ep_addr);
- TU_LOG2(" Queue ISO EP %02X with %u bytes ... ", ep_addr, tu_fifo_count(ff));
+ TU_LOG2(" Queue ISO EP %02X with %u bytes ... ", ep_addr, count);
// Attempt to transfer on a busy endpoint, sound like an race condition !
TU_ASSERT(_usbd_dev.ep_status[epnum][dir].busy == 0);
@@ -1220,7 +1224,7 @@ bool usbd_edpt_iso_xfer(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff)
// and usbd task can preempt and clear the busy
_usbd_dev.ep_status[epnum][dir].busy = true;
- if ( dcd_edpt_iso_xfer(rhport, ep_addr, ff) )
+ if (dcd_edpt_iso_xfer(rhport, ep_addr, ff, total_bytes))
{
TU_LOG2("OK\r\n");
return true;