-
Notifications
You must be signed in to change notification settings - Fork 251
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
refactor esp-wifi to ease using external task scheduler #3106
refactor esp-wifi to ease using external task scheduler #3106
Conversation
// Time keeping | ||
pub const TICKS_PER_SECOND: u64 = 1_000_000; | ||
|
||
/// Current systimer count value |
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.
this function was identical for riscv and xtensa. the comments are a mix. I don't know which statements are true for either architecture.
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.
Nice, this change will probably make it simpler to just throw all this out in favour of esp_hal::time::* :)
8dd4e1c
to
92139a7
Compare
Very nice! Lots of things I wanted to do for quite some time - from my side this looks already mergeable |
92139a7
to
02e25cc
Compare
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!
Should I rebase this to main? |
No need, it will merge cleanly, just needs a +1 from someone else, ideally @bjoernQ :) |
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.
Changes LGTM, but will let Bjoern have the final say before merging. Thanks!
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!
Thanks for the quick review! |
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
This is my attempt at using Ariel OS threads instead of the slim scheduler that ships with esp-wifi.
Mostly, this refactors the
preempt
&timer
modules:the
timer
module is split intotime
, providing the generic time functions)radio
, this has the previous radio isr setup stuffpreempt::timer
, containing the task switching related timer setupall scheduler setup / teardown is now handled in
preempt::setup()
andpreempt::disable()
.the radio ISRs are configured independently from that (the radio module now exposes the
setup_radio_isr()
/disable_radio_isr()
Basically, all task switching / scheduling code is split into
preempt
.With that in place, replacing those guts with e.g., the Ariel scheduler is actually quite simple, by just disabling the preempt module and providing the functions elsewhere.
This is WIP, please ignore the OptionalPeripherals commit, and Im just importing the ariel code into preempt_custom.rs for local testing. I expect that integration to change. I've tested this with the old scheduler from esp-hal, and the hacked-in Ariel
preempt_custom.rs`, on an s3 devkit.I hope the refactoring and moving code is not too intimidating.
I was struggling a bit before the refactor. E.g.,
setup_timer_isr()
was a bit overloaded, and it took a while to see what's used by the scheduler and whats needed elsewhere.IIUC, at least this is not user-facing.
Let me know what you think, if this direction might be doable!
update I've rebased this on current main, and dropped the ariel support for now.
Testing
Describe how you tested your changes.