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

Make software interrupts shareable #1500

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

Dominaezzz
Copy link
Contributor

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • My changes were added to the CHANGELOG.md in the proper section.

Extra:

Pull Request Details 📖

Description

My immediate use case for this is #1476 where I want to be able to raise() the interrupt from any core.
It feels silly to have to pull out a RefCell or Mutex just to ultimately toggle a volatile register.
I think it makes sense for this to be shareable within Rust rules. Exclusive access can still be achieved with a mutable reference.

Testing

CI

Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good idea!

I think I made a mistake with changing the Alarm methods from systimer to &mut in #1455 , I didn't consider the usability of doing so. Luckily we're developing a better general timer API in #1479 so we can fix that there :D.

This should be safe because each software interrupt is a singleton, meaning only one of each can exist anyway and in this case modifications are atomic/stateless (just plain register write with no side effects). In other words calling these methods reentrantly would never result in bad state/memory.

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MabezDev MabezDev added this pull request to the merge queue Apr 23, 2024
Merged via the queue into esp-rs:main with commit e5b46b5 Apr 23, 2024
21 checks passed
@Dominaezzz Dominaezzz deleted the shared_interrupts branch April 24, 2024 23:16
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.

None yet

3 participants