-
Notifications
You must be signed in to change notification settings - Fork 367
Fix S2 systimers #1979
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
Fix S2 systimers #1979
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f4453ff
Add basic systimer interrupt tests
bugadani c38ddcc
Remove unnecessary condition
bugadani ff551b6
Fix edge interrupt bitmasks
bugadani 804a040
Modify target_conf in critical section
bugadani d725936
Remove unnecessary fn call
bugadani 7615979
Fix test
bugadani 29d9b19
Add failing test case
bugadani e912eb0
Fix S2 systimer interrupts being fired unexpectedly
bugadani 01661d0
Add changelog entry
bugadani f78817f
Format
bugadani 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
Modify target_conf in critical section
- Loading branch information
commit 804a0402f93b57a33c512307a66dbb8835b816d6
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
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.
Why move this into the critical section? The register isn't shared on the S2.
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.
The better question is, why wasn't this (and, like all other operations) in a critical section? Every method needs a shared reference only, what prevents users from shooting themselves in the foot by doing things in interrupts that they shouldn't?
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.
Sharing with interrupts requires
Sync, whichComparators aren't (or at least, shouldn't be).The shared reference thing let's you give multiple objects on the same "thread" (interrupt counts as a separate thread) access to the object.
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.
Alarm is Sync as things currently stand :)
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.
Ah yeah that needs fixing. Either by adding critical sections in
Alarmor markingAlarms as not Sync.The latter is easier (and maybe also the right way) since
esp-wifiandesp-hal-embassydon't take advantage of theSync, they onlySendthe alarms around.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.
Why would you prefer
!Syncover&mut selfmethods?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.
I think
&mut selfis artificially restrictive. At the end of the day the volatile registers are basically glorifiedCells.I really don't want to have to pull out
RefCell,Cell, etc. to share what is already aCellamongst objects in the same thread.imo, if an exclusive reference isn't needed it shouldn't be required.
If users want to enforce an invariant that requires exclusive access then they can use the Rust tool for that, either by taking ownership of the object or taking a mutable reference to the object. (This is done in
FronzenUnitfor example)Side note there's also this part of the API GUIDELINES.
(Though I suppose pointing it out doesn't matter since we're questioning the guideline itself)