diff --git a/src/main.rs b/src/main.rs index ee57d7a..bc2954c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unused_must_use)] +#![allow(unused_imports)] //any(target_arch = "aarch64", target_arch = "x86_64") #[cfg(not(target_arch = "aarch64"))] @@ -82,13 +83,11 @@ fn kmain() -> ! { // Err(_) => endless_sleep(), // } - // jtag_dbg_wait(); CONSOLE.lock(|c| { c.replace_with(Output::new().into()); }); - let mut out = Output::new(); - writeln!(out, "JLink RTT is working!"); // @todo RttConsole + jtag_dbg_wait(); println!("\n[0] UART is live!"); diff --git a/src/platform/mailbox.rs b/src/platform/mailbox.rs index 9c1fdd6..6a8c63f 100644 --- a/src/platform/mailbox.rs +++ b/src/platform/mailbox.rs @@ -194,6 +194,8 @@ pub mod alpha_mode { fn write(regs: &RegisterBlock, buf_ptr: u32, channel: u32) -> Result<()> { let mut count: u32 = 0; + let buf_ptr = BcmHost::phys2bus(buf_ptr); + println!("Mailbox::write {:x}/{:x}", buf_ptr, channel); // Insert a compiler fence that ensures that all stores to the @@ -221,6 +223,7 @@ fn read(regs: &RegisterBlock, expected: u32, channel: u32) -> Result<()> { while regs.STATUS.is_set(STATUS::EMPTY) { count += 1; if count > (1 << 25) { + println!("Timed out waiting for mbox response"); return Err(MboxError::Timeout); } } @@ -236,6 +239,11 @@ fn read(regs: &RegisterBlock, expected: u32, channel: u32) -> Result<()> { barrier::dmb(barrier::SY); } + println!( + "Received mbox response {:#08x}, expecting {:#08x}", + data, expected + ); + // is it a response to our message? if ((data & CHANNEL_MASK) == channel) && ((data & !CHANNEL_MASK) == expected) { // is it a valid successful response? @@ -298,7 +306,11 @@ impl Mailbox { } pub fn read(&self, channel: u32) -> Result<()> { - read(self, self.buffer.as_ptr() as u32, channel)?; + read( + self, + BcmHost::phys2bus(self.buffer.as_ptr() as u32), + channel, + )?; match self.buffer[1] { response::SUCCESS => {