-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
107 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub fn construct_rng(_peripherals: &mut crate::OptionalPeripherals) { | ||
riot_rs_random::construct_rng(embassy_rp::clocks::RoscRng); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use embassy_stm32::rng::Rng; | ||
use embassy_stm32::{bind_interrupts, peripherals, rng}; | ||
|
||
#[cfg(not(any(feature = "stm32-hash-rng", feature = "stm32-rng")))] | ||
compile_error!("no stm32 rng feature enabled"); | ||
|
||
#[cfg(feature = "stm32-hash-rng")] | ||
bind_interrupts!(struct Irqs { | ||
HASH_RNG => rng::InterruptHandler<peripherals::RNG>; | ||
}); | ||
|
||
#[cfg(feature = "stm32-rng")] | ||
bind_interrupts!(struct Irqs { | ||
RNG => rng::InterruptHandler<peripherals::RNG>; | ||
}); | ||
|
||
pub fn construct_rng(peripherals: &mut crate::OptionalPeripherals) { | ||
cfg_if::cfg_if! { | ||
// The union of all contexts that wind up in a construct_rng should be synchronized | ||
// with laze-project.yml's hwrng module. | ||
if #[cfg(any(context = "stm32"))] { | ||
let rng = Rng::new( | ||
peripherals | ||
.RNG | ||
// We don't even have to take it out, just use it to seed the RNG | ||
.as_mut() | ||
.expect("RNG has not been previously used"), | ||
Irqs, | ||
); | ||
|
||
riot_rs_random::construct_rng(rng); | ||
} else if #[cfg(context = "riot-rs")] { | ||
compile_error!("hardware RNG is not supported on this architecture"); | ||
} | ||
} | ||
} |
Oops, something went wrong.