2025-10-05 09:01:28 +00:00
|
|
|
mod cmds;
|
|
|
|
|
#[cfg(feature = "ctap-bringup")]
|
|
|
|
|
mod ctap;
|
|
|
|
|
mod repl;
|
|
|
|
|
mod shell;
|
|
|
|
|
use cmds::*;
|
2025-10-25 13:33:09 +00:00
|
|
|
use usb_bao1x::UsbHid;
|
2025-10-05 09:01:28 +00:00
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
log_server::init_wait().unwrap();
|
|
|
|
|
log::set_max_level(log::LevelFilter::Info);
|
|
|
|
|
log::info!("my PID is {}", xous::process::id());
|
|
|
|
|
let tt = ticktimer::Ticktimer::new().unwrap();
|
|
|
|
|
|
2025-10-26 11:27:54 +00:00
|
|
|
let hal = bao1x_hal_service::Hal::new();
|
|
|
|
|
// allow preemption in the dabao console environment
|
|
|
|
|
hal.set_preemption(true);
|
|
|
|
|
|
2025-11-02 02:36:24 +00:00
|
|
|
// spawn the shell thread
|
|
|
|
|
shell::start_shell();
|
|
|
|
|
|
2026-06-09 09:52:20 +00:00
|
|
|
tt.sleep_ms(500).ok(); // pause for the system to startup
|
|
|
|
|
let usb = UsbHid::new();
|
|
|
|
|
usb.serial_console_input_injection();
|
2025-10-25 13:33:09 +00:00
|
|
|
|
2025-10-05 09:01:28 +00:00
|
|
|
#[cfg(feature = "ctap-bringup")]
|
|
|
|
|
{
|
|
|
|
|
tt.sleep_ms(4000).ok();
|
|
|
|
|
crate::ctap::ctap_test();
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-09 09:52:20 +00:00
|
|
|
// This idiom creates a dummy server that blocks. This effectively parks the parent
|
|
|
|
|
// process, allowing its child threads to run without taking any CPU resources.
|
|
|
|
|
let dummy_sid = xous::create_server().unwrap();
|
2025-10-05 09:01:28 +00:00
|
|
|
loop {
|
2026-06-09 09:52:20 +00:00
|
|
|
// This call blocks forever since nobody has `dummy_sid` and thus it will never
|
|
|
|
|
// receive a message.
|
|
|
|
|
let _ = xous::receive_message(dummy_sid);
|
2025-10-05 09:01:28 +00:00
|
|
|
}
|
|
|
|
|
}
|