cleanup bitrot

This commit is contained in:
bunnie 2025-10-06 01:34:13 +08:00
parent 3a18782524
commit 8fcca4f873
5 changed files with 11 additions and 9 deletions

View file

@ -1,6 +1,9 @@
use String;
use bao1x_api::I2cApi;
use bao1x_api::I2cResult;
#[cfg(feature = "hosted-baosec")]
use bao1x_emu::i2c::I2c;
#[cfg(not(feature = "hosted-baosec"))]
use bao1x_hal_service::I2c;
use crate::{CommonEnv, ShellCmdApi};

View file

@ -57,6 +57,7 @@ impl<'a> ShellCmdApi<'a> for Test {
}
}
}
#[cfg(not(feature = "hosted-baosec"))]
"shutdown" => {
use bao1x_api::*;
use bao1x_hal_service::I2c;

View file

@ -8,7 +8,7 @@ fn main() {
log::info!("my PID is {}", xous::process::id());
let xns = xous_names::XousNames::new().unwrap();
let sid = xns.register_name(bao1x_api::SERVER_NAME_bao1x_HAL, None).expect("can't register server");
let sid = xns.register_name(bao1x_api::SERVER_NAME_BAO1X_HAL, None).expect("can't register server");
// start keyboard emulator service
keyboard::start_keyboard_service();
@ -123,6 +123,7 @@ fn main() {
HalOpcode::InvalidCall => {
log::error!("Invalid opcode received: {:?}", msg);
}
bao1x_api::HalOpcode::ConfigureBio => todo!(),
HalOpcode::Quit => {
log::info!("Received quit opcode, exiting.");
break;

View file

@ -18,20 +18,19 @@ impl Trng {
/// This is copied out of the 0.5 API for rand_core
pub fn fill_bytes_via_next(&mut self, dest: &mut [u8]) {
use core::mem::transmute;
let mut left = dest;
while left.len() >= 8 {
let (l, r) = { left }.split_at_mut(8);
left = r;
let chunk: [u8; 8] = unsafe { transmute(rand::thread_rng().next_u64().to_le()) };
let chunk: [u8; 8] = u64::to_ne_bytes(rand::thread_rng().next_u64().to_le());
l.copy_from_slice(&chunk);
}
let n = left.len();
if n > 4 {
let chunk: [u8; 8] = unsafe { transmute(rand::thread_rng().next_u64().to_le()) };
let chunk: [u8; 8] = u64::to_ne_bytes(rand::thread_rng().next_u64().to_le());
left.copy_from_slice(&chunk[..n]);
} else if n > 0 {
let chunk: [u8; 4] = unsafe { transmute(rand::thread_rng().next_u32().to_le()) };
let chunk: [u8; 4] = u32::to_ne_bytes(rand::thread_rng().next_u32().to_le());
left.copy_from_slice(&chunk[..n]);
}
}

View file

@ -87,6 +87,7 @@ test-baosec = ["ux-api/loader-baosec"]
hosted-baosec = [
"keystore-api/gen2",
"modals/no-gam",
"aes",
] # emulated hardware on x86 platform
board-baosor = [
"utralib/bao1x",
@ -94,10 +95,7 @@ board-baosor = [
"modals/bao1x",
] # Precursor form factor
loader-baosor = []
board-dabao = [
"utralib/bao1x",
"keystore-api/gen2",
] # Dev board form factor
board-dabao = ["utralib/bao1x", "keystore-api/gen2"] # Dev board form factor
loader-dabao = []
policy-menu = [