mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-14 08:03:34 +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-flash = []
|
||||
ctap-bringup = ["xous-usb-hid"]
|
||||
# this is mutually exclusive with the keystore, as keystore owns rram
|
||||
rramtests = []
|
||||
|
||||
# Activating this makes this crate *try* to grab the DUART. To improve its odds
|
||||
|
|
@ -77,4 +78,4 @@ rramtests = []
|
|||
# loaded and run.
|
||||
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> {
|
||||
use core::fmt::Write;
|
||||
let mut ret = String::new();
|
||||
let helpstring = "trng [pump]";
|
||||
let helpstring = "trng [pump] [u32] [u64]";
|
||||
|
||||
let mut tokens = args.split(' ');
|
||||
|
||||
if let Some(sub_cmd) = tokens.next() {
|
||||
match sub_cmd {
|
||||
// used to test reseeding of the TRNG API
|
||||
"pump" => {
|
||||
const ROUNDS: usize = 16;
|
||||
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();
|
||||
}
|
||||
"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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue