abcminiuser / lufa

LUFA - the Lightweight USB Framework for AVRs.
http://www.lufa-lib.org
1.03k stars 321 forks source link

blocking mode for bulk transfers possible? #163

Closed khimaros closed 4 years ago

khimaros commented 4 years ago

i am creating a CDC class device and would like endpoint bulk writes from the host to block until they have been processed by the device. is there any way to achieve this with LUFA?

abcminiuser commented 4 years ago

That's really up to the host driver implementation, but generally speaking, no. Bulk transfers are enqueued on the host side in advance and scheduled/sent via the low level USB controller driver via DMA as bus bandwidth permits. That's how bulk transfers end up having larger thoughput than other fixed interval endpoint types at the expense of higher latency.

The best way to approach this would be to add in an application level command/response layer above the CDC layer, so you can send (potentially multiple) commands with a given sequence number and have the device reply back with an acknowledges for each command that has been processed.