Skip to content
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

WIP use more low-level API for control transfers #18

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tlyu
Copy link

@tlyu tlyu commented Nov 25, 2022

Working proof of concept. This is kind of mixed up with trace logging code for now, but I'll clean it up in a bit.

Drawbacks include some stricter constraints on the callers of USBCore_::recvControl: the destination can't be of automatic duration, and the call will complete before the read actually occurs.

@tlyu tlyu force-pushed the wip-moar-ll branch 2 times, most recently from 75ca72f to 95ab0e5 Compare November 25, 2022 22:50
@tlyu
Copy link
Author

tlyu commented Nov 27, 2022

On further reflection, maybe we should rename recvControl if we're going to choose this approach. The resulting API behavior is really different from the stream-based API of the AVR Arduino core. In particular, the destination buffer for the receive isn't filled until some unknown time after the recvControl call returns.

@obra
Copy link
Member

obra commented Nov 30, 2022

For 3988c50, can you update it to talk about the why of the changes?

@tlyu
Copy link
Author

tlyu commented Nov 30, 2022

For 3988c50, can you update it to talk about the why of the changes?

Done. I also took a closer look and decided that some of those changes were fine after all (avoiding changing a disabled endpoint). The change that really needed to be undone was only clearing the halt condition if the endpoint status was set to STALL.

@tlyu tlyu force-pushed the wip-moar-ll branch 4 times, most recently from 80bc571 to 2629cf2 Compare December 1, 2022 21:12
@tlyu
Copy link
Author

tlyu commented Dec 1, 2022

This is almost in a state suitable for use in an experimental snapshot. I've conditionalized the trace logging under -DUSBCORE_TRACE, so it won't slow things down when used with Chrysalis.

@tlyu tlyu force-pushed the wip-moar-ll branch 11 times, most recently from 750f349 to 9128955 Compare February 24, 2023 21:08
@tlyu tlyu force-pushed the wip-moar-ll branch 2 times, most recently from 9bc76df to e3f8643 Compare March 6, 2023 23:52
@tlyu tlyu force-pushed the wip-moar-ll branch 4 times, most recently from e7d070d to a5ba581 Compare March 15, 2023 01:44
@tlyu tlyu force-pushed the wip-moar-ll branch 5 times, most recently from 75ff8f6 to 9bd4db9 Compare March 17, 2023 01:30
tlyu added 5 commits March 17, 2023 17:23
This prevents some spurious wakeup interrupts. Mostly, it helps keep
debug counters looking reasonable given what's actually happening on
the bus.
Add error logging hooks for USB. This is conditionalized on
-DUSBCORE_ERROR_HOOKS, because they can cause slowdowns in USB
environments with lots of errors.
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.

2 participants