mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
Merge branch 'main' of github.com:betrusted-io/xous-core into keystore-dabao
This commit is contained in:
commit
2f0895b46c
4 changed files with 27 additions and 3 deletions
|
|
@ -273,6 +273,10 @@ pub unsafe extern "C" fn rust_entry() -> ! {
|
|||
}
|
||||
}
|
||||
|
||||
boot(&iox, oled, se0_port, se0_pin)
|
||||
}
|
||||
|
||||
pub fn boot(iox: &Iox, mut oled: Option<Oled128x128>, se0_port: bao1x_api::IoxPort, se0_pin: u8) -> ! {
|
||||
if let Some(ref mut sh1107) = oled {
|
||||
marquee(sh1107, "Booting...");
|
||||
}
|
||||
|
|
@ -280,6 +284,7 @@ pub unsafe extern "C" fn rust_entry() -> ! {
|
|||
// stop the USB subsystem so it can be re-init'd by the next stage.
|
||||
// without this, USB init will hang later on.
|
||||
glue::shutdown();
|
||||
iox.set_gpio_dir(se0_port, se0_pin, bao1x_api::IoxDir::Output);
|
||||
iox.set_gpio_pin(se0_port, se0_pin, bao1x_api::IoxValue::Low); // put the USB port into SE0, so we re-enumerate with the OS stack
|
||||
|
||||
// check that all pages in the SPI memory page cache have been written out
|
||||
|
|
|
|||
|
|
@ -106,7 +106,25 @@ impl Repl {
|
|||
rcurst.wo(utra::sysctrl::SFR_RCURST0, 0x55AA);
|
||||
}
|
||||
"boot" => {
|
||||
crate::secboot::try_boot(true);
|
||||
use bao1x_hal::iox::Iox;
|
||||
let one_way = OneWayCounter::new();
|
||||
let iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
|
||||
let (port, pin) = match one_way.get_decoded::<bao1x_api::BoardTypeCoding>() {
|
||||
// the default map is baosec in boot1
|
||||
Ok(bao1x_api::BoardTypeCoding::Baosec) => bao1x_hal::board::setup_usb_pins(&iox),
|
||||
// otherwise assume dabao mapping
|
||||
_ => crate::setup_dabao_se0_pin(&iox),
|
||||
};
|
||||
|
||||
// assert SE0 pin here. We add a delay even though crate:boot() calls this, because
|
||||
// a button press initiated SE0 includes a certain minimum "low"; a direct serial command
|
||||
// does not.
|
||||
iox.set_gpio_pin(port, pin, IoxValue::Low);
|
||||
crate::platform::delay(20); // minimum is 2.5ms
|
||||
|
||||
// note: the SE0 pin is now asserted & configured as an output as it goes to the next stage
|
||||
// it us up to the next USB stack to de-assert this.
|
||||
crate::boot(&iox, None, port, pin);
|
||||
}
|
||||
"uf2" => {
|
||||
use base64::{Engine as _, engine::general_purpose};
|
||||
|
|
|
|||
|
|
@ -54,4 +54,4 @@ pub const GUARD_MEMORY_BYTES: usize = 8 * crate::PAGE_SIZE; // 1 extra page for
|
|||
pub const SWAPPER_PID: u8 = 2;
|
||||
|
||||
#[cfg(feature = "bao1x")]
|
||||
pub const SYSTEM_CLOCK_FREQUENCY: u32 = 800_000_000;
|
||||
pub const SYSTEM_CLOCK_FREQUENCY: u32 = bao1x_hal::board::DEFAULT_FCLK_FREQUENCY / 2;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ pub fn delay(quantum: usize) {
|
|||
use utralib::{CSR, utra};
|
||||
// abuse the d11ctime timer to create some time-out like thing
|
||||
let mut d11c = CSR::new(utra::d11ctime::HW_D11CTIME_BASE as *mut u32);
|
||||
d11c.wfo(utra::d11ctime::CONTROL_COUNT, 333_333); // 1.0ms per interval
|
||||
// 1.0ms per interval
|
||||
d11c.wfo(utra::d11ctime::CONTROL_COUNT, crate::SYSTEM_CLOCK_FREQUENCY / 1000);
|
||||
let mut polarity = d11c.rf(utra::d11ctime::HEARTBEAT_BEAT);
|
||||
for _ in 0..quantum {
|
||||
while polarity == d11c.rf(utra::d11ctime::HEARTBEAT_BEAT) {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue