mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add some trng tests to the console
This commit is contained in:
parent
79eab7da5e
commit
b557cd5ebc
2 changed files with 10 additions and 2 deletions
|
|
@ -70,6 +70,7 @@ modal-testing = ["ux-api", "modals/modal-testing"]
|
||||||
test-scrollbars = []
|
test-scrollbars = []
|
||||||
test-flash = []
|
test-flash = []
|
||||||
ctap-bringup = ["xous-usb-hid"]
|
ctap-bringup = ["xous-usb-hid"]
|
||||||
|
# this is mutually exclusive with the keystore, as keystore owns rram
|
||||||
rramtests = []
|
rramtests = []
|
||||||
|
|
||||||
# Activating this makes this crate *try* to grab the DUART. To improve its odds
|
# Activating this makes this crate *try* to grab the DUART. To improve its odds
|
||||||
|
|
@ -77,4 +78,4 @@ rramtests = []
|
||||||
# loaded and run.
|
# loaded and run.
|
||||||
duart-debug-hal = ["bao1x-hal/debug-print-duart"]
|
duart-debug-hal = ["bao1x-hal/debug-print-duart"]
|
||||||
|
|
||||||
default = ["rramtests"]
|
default = []
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,13 @@ impl<'a> ShellCmdApi<'a> for TrngCmd {
|
||||||
fn process(&mut self, args: String, env: &mut CommonEnv) -> Result<Option<String>, xous::Error> {
|
fn process(&mut self, args: String, env: &mut CommonEnv) -> Result<Option<String>, xous::Error> {
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
let helpstring = "trng [pump]";
|
let helpstring = "trng [pump] [u32] [u64]";
|
||||||
|
|
||||||
let mut tokens = args.split(' ');
|
let mut tokens = args.split(' ');
|
||||||
|
|
||||||
if let Some(sub_cmd) = tokens.next() {
|
if let Some(sub_cmd) = tokens.next() {
|
||||||
match sub_cmd {
|
match sub_cmd {
|
||||||
|
// used to test reseeding of the TRNG API
|
||||||
"pump" => {
|
"pump" => {
|
||||||
const ROUNDS: usize = 16;
|
const ROUNDS: usize = 16;
|
||||||
for i in 0..ROUNDS {
|
for i in 0..ROUNDS {
|
||||||
|
|
@ -30,6 +31,12 @@ impl<'a> ShellCmdApi<'a> for TrngCmd {
|
||||||
}
|
}
|
||||||
write!(ret, "Pumped {}x1k values out of the engine", ROUNDS).unwrap();
|
write!(ret, "Pumped {}x1k values out of the engine", ROUNDS).unwrap();
|
||||||
}
|
}
|
||||||
|
"u32" => {
|
||||||
|
log::info!("A u32 trng value: {:x}", env.trng.get_u32().unwrap());
|
||||||
|
}
|
||||||
|
"u64" => {
|
||||||
|
log::info!("A u64 trng value: {:x}", env.trng.get_u64().unwrap());
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
write!(ret, "{}", helpstring).unwrap();
|
write!(ret, "{}", helpstring).unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue