-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embassy enable thread and interrupt by default, enable embassy when b…
…uilding docs (#1485) * Remove interrupt and thread executor embassy features * Reserve sw interrupt 3 (4) instead of 0 for multicore systems with the embassy feature enabled * Remove uneeded #[feature()] from examples * Fix HIL tests * Add thread mode context id and fix up examples * improve embassy module docs * changelog * fixup hil tests * Fixup usb examples
- Loading branch information
Showing
31 changed files
with
146 additions
and
204 deletions.
There are no files selected for viewing
This file contains 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,26 @@ | ||
#[cfg(feature = "embassy-executor-thread")] | ||
pub mod thread; | ||
mod interrupt; | ||
mod thread; | ||
|
||
#[cfg(feature = "embassy-executor-thread")] | ||
pub use thread::*; | ||
|
||
#[cfg(feature = "embassy-executor-interrupt")] | ||
pub mod interrupt; | ||
|
||
#[cfg(feature = "embassy-executor-interrupt")] | ||
pub use interrupt::*; | ||
pub use thread::*; | ||
|
||
#[cfg(any( | ||
feature = "embassy-executor-thread", | ||
feature = "embassy-executor-interrupt", | ||
))] | ||
#[export_name = "__pender"] | ||
fn __pender(context: *mut ()) { | ||
#[cfg(feature = "embassy-executor-interrupt")] | ||
use crate::system::SoftwareInterrupt; | ||
|
||
let context = (context as usize).to_le_bytes(); | ||
|
||
cfg_if::cfg_if! { | ||
if #[cfg(feature = "embassy-executor-interrupt")] { | ||
match context[0] { | ||
#[cfg(feature = "embassy-executor-thread")] | ||
0 => thread::pend_thread_mode(context[1] as usize), | ||
|
||
#[cfg(not(feature = "embassy-executor-thread"))] | ||
0 => unsafe { SoftwareInterrupt::<0>::steal().raise() }, | ||
1 => unsafe { SoftwareInterrupt::<1>::steal().raise() }, | ||
2 => unsafe { SoftwareInterrupt::<2>::steal().raise() }, | ||
3 => unsafe { SoftwareInterrupt::<3>::steal().raise() }, | ||
_ => {} | ||
} | ||
} else { | ||
pend_thread_mode(context[1] as usize); | ||
match context[0] { | ||
// For interrupt executors, the context value is the | ||
// software interrupt number | ||
0 => unsafe { SoftwareInterrupt::<0>::steal().raise() }, | ||
1 => unsafe { SoftwareInterrupt::<1>::steal().raise() }, | ||
2 => unsafe { SoftwareInterrupt::<2>::steal().raise() }, | ||
3 => unsafe { SoftwareInterrupt::<3>::steal().raise() }, | ||
other => { | ||
assert_eq!(other, THREAD_MODE_CONTEXT); | ||
// THREAD_MODE_CONTEXT id is reserved for thread mode executors | ||
thread::pend_thread_mode(context[1] as usize) | ||
} | ||
} | ||
} |
This file contains 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 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 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 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 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 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 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.