-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
machine: add USBDevice.Attach and USBDevice.Detach #5563
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
Open
sago35
wants to merge
1
commit into
dev
Choose a base branch
from
usbdev-attach-detach
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
RP2040/RP2350 provide atomic bitmask set/clear aliases at +0x2000 and
+0x3000 (RP2040 datasheet 2.1.2, p.18:
https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf), which
modify only the selected bits. SIE_CTRL is also touched from the ISR,
so this avoids the read-modify-write. Could we use those aliases here
for PULLUP_EN?
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 the great suggestion. I think we can definitely use it here, but it would probably be better handled in a separate PR—for example, by integrating it into implementations like
SetBits()/ClearBits()/ ....However, this suggested approach might only work for registers and not for standard RAM. If that’s the case, we might need to consider a slightly more complex approach.
Since that change would have a broad impact, it's likely better to target the
devbranch right after the upcoming release, rather than squeezing it intoTinyGo 0.42.Would you be open to creating a separate PR for that?
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.
I created Issue #5564
Uh oh!
There was an error while loading. Please reload this page.
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.
Understood. I'll look into a more general solution, although it may take some time.
For this PR, could we keep the change local and use the atomic aliases directly?
For example:
And similarly for RP2350.
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.
I don't think there is a need to change to a new method in this PR.
This code is a new change and has no impact on other parts. Furthermore, by using
SetBits()and similar functions, the internal implementation will be updated to a better form. There is no reason to leave open the possibility of an implementation that differs from the futureSetBits().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. Understood. I still think this should use the atomic write even temporarily, but it's your call.