8000 Fix slow CDC OUT by NAKing by tannewt · Pull Request #46 · hathach/tinyusb · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 1 commit into from
Mar 24, 2019
Merged

Fix slow CDC OUT by NAKing #46

merged 1 commit into from
Mar 24, 2019

Conversation

tannewt
Copy link
Collaborator
@tannewt tannewt commented Mar 21, 2019

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.

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.
Copy link
Owner
@hathach hathach left a 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) {
Copy link
Owner

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) {
Copy link
Owner

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

@tannewt
Copy link
Collaborator Author
tannewt commented Mar 22, 2019

Thanks for the quick review! I'll address the comments early next week when I'm back from travelling. Thanks!

@hathach
Copy link
Owner
hathach commented Mar 22, 2019

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

@dhalbert
Copy link
Contributor

@tannewt I can get CircuitPython updated if @hathach's propsosals are fine with you, and you wish to proceed.

@tannewt
Copy link
Collaborator Author
tannewt commented Mar 23, 2019 via email

@hathach
Copy link
Owner
hathach commented Mar 24, 2019

@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 :)

@hathach hathach merged commit fad8720 into hathach:master Mar 24, 2019
hathach added a commit that referenced this pull request Mar 25, 2019
@hathach hathach mentioned this pull request Mar 25, 2019
hathach added a commit that referenced this pull request Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0