-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add tud_vendor_n_write_zlp_if_needed to write zlp when TX FIFO disabled. #3403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The users can write ZLP like this: void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes) {
// other logic...
if(sendFinished){
tud_vendor_write_zlp_if_needed(sent_bytes);
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/class/vendor/vendor_device.h
Outdated
| // Write to TX FIFO. This can be buffered and not sent immediately unless buffered bytes >= USB endpoint size | ||
| uint32_t tud_vendor_n_write(uint8_t idx, const void *buffer, uint32_t bufsize); | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, could you remove extra spaces ?
|
maybe we should update the write() to allow zlp instead, let me check that option first. |
|
Remove this line should be OK? Line 453 in 6482079
Will this affect other logic? I tried this method. It works fine. void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes) {
// other logic...
if(sendFinished){
if(sent_bytes&&(sent_bytes%MAX_PACKET_SIZE)==0){
tud_vendor_write(NULL,0);
}
}
} |
|
Or we can only check buffer length when FIFO enabled. |
|
Could you check https://github.com/hathach/tinyusb/tree/stream_write |
|
Thank you! I will test it on my board on Monday. |
Describe the PR
When
CFG_TUD_VENDOR_TX_BUFSIZEset to 0. User should write ZLP by themselves. But there is no way to write ZLP. This check point not supports ZLP. I think exposetu_edpt_stream_write_zlp_if_neededis a good way.Additional context
If applicable, add any other context about the PR and/or screenshots here.