mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add code to dump the TRNG output via the DUART
gotta move on to other things, can't fully debug the USB serial thing now. :-/
This commit is contained in:
parent
28ab6ae311
commit
d40e92b52d
2 changed files with 19 additions and 0 deletions
|
|
@ -96,5 +96,6 @@ spi-alt-channel = []
|
|||
irq-test = []
|
||||
usb-test = []
|
||||
trng-test = []
|
||||
dump-trng = []
|
||||
resume = [] # suspend/resume pathway code
|
||||
default = ["board-bringup", "usb-test", "trng-test"]
|
||||
|
|
|
|||
|
|
@ -289,6 +289,24 @@ impl SwapHal {
|
|||
let mut trng = sce::trng::Trng::new(utralib::generated::HW_TRNG_BASE as usize);
|
||||
trng.setup_raw_generation(32);
|
||||
|
||||
#[cfg(feature="dump-trng")]
|
||||
{
|
||||
let duart = utralib::generated::utra::duart::HW_DUART_BASE as *mut u32;
|
||||
loop {
|
||||
let d = trng.get_raw();
|
||||
for b in d.to_le_bytes() {
|
||||
unsafe {
|
||||
while duart.add(utralib::generated::utra::duart::SFR_SR.offset()).read_volatile() != 0
|
||||
{
|
||||
}
|
||||
duart
|
||||
.add(utralib::generated::utra::duart::SFR_TXD.offset())
|
||||
.write_volatile(b as char as u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The first seed is always 0.
|
||||
let mut seed = [0u8; 32];
|
||||
// println!("seed: {:x?}", seed); // used to eyeball that things are working correctly
|
||||
|
|
|
|||
Loading…
Reference in a new issue