-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix slow CDC OUT by NAKing #46
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
This NAKs CDC OUT packets when the ring buffer doesn't have enough space for it. This makes CDC OUT reliable rather than allowing overwriting into the ring buffer.
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.
thanks for PR, it is never easy to avoid buffer/fifo related issue :D. Please check out my 2 comments below
@@ -87,6 +87,24 @@ typedef struct | |||
//--------------------------------------------------------------------+ | |||
CFG_TUSB_MEM_SECTION static cdcd_interface_t _cdcd_itf[CFG_TUD_CDC] = { { 0 } }; | |||
|
|||
bool pending_read_from_host; | |||
static void _prep_next_transaction(void) { |
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.
we should have itf
passed to this prepare function. Although it is assumed to zero for now in some functions, those are top-level (require a bit of code to detect the interface number).
cdcd_interface_t* p_cdc = &_cdcd_itf[itf]; | ||
|
||
// skip if previous transfer not complete | ||
if (pending_read_from_host) { |
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.
we can use dcd_edpt_busy() function for checking if we already queued an IN transfer
Thanks for the quick review! I'll address the comments early next week when I'm back from travelling. Thanks! |
If you are busy and like it to merge asap, I could merge and update it as well. Just give me your thought on my comment above |
Yup I’m fine with both. Just didn’t have time to change and test before travel. Will do it Tuesday if you haven’t beaten me to it. Thanks!
…On Fri, Mar 22, 2019, at 8:17 AM, Dan Halbert wrote:
@tannewt <https://github.com/tannewt> I can get CircuitPython updated if @hathach <https://github.com/hathach>'s propsosals are fine with you, and you wish to proceed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#46 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AADNqZr1pE6XI_cBOIQcne9rXJXt9dHkks5vZMnugaJpZM4cCdHc>.
|
@tannewt I merged it now and make modification as above comment and will carry out the test. Working on the stack anyway for another issue adafruit/circuitpython#1617 . Enjoy your time :) |
This NAKs CDC OUT packets when the ring buffer doesn't have
enough space for it. This makes CDC OUT reliable rather than
allowing overwriting into the ring buffer.