parent
1ba6c3f4d7
commit
593544a6ec
|
@ -7,7 +7,7 @@ pub mod traps;
|
||||||
pub use self::memory::{PhysicalAddress, VirtualAddress};
|
pub use self::memory::{PhysicalAddress, VirtualAddress};
|
||||||
pub use mmu::*;
|
pub use mmu::*;
|
||||||
|
|
||||||
use cortex_a::{asm, barrier, regs::*};
|
use cortex_a::{asm, regs::*};
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
static mut WAIT_FLAG: bool = true;
|
static mut WAIT_FLAG: bool = true;
|
||||||
|
@ -25,14 +25,6 @@ pub fn jtag_dbg_wait() {
|
||||||
unsafe { write_volatile(&mut WAIT_FLAG, true) }
|
unsafe { write_volatile(&mut WAIT_FLAG, true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data memory barrier
|
|
||||||
#[inline]
|
|
||||||
pub fn dmb() {
|
|
||||||
unsafe {
|
|
||||||
barrier::dmb(barrier::SY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn flushcache(address: usize) {
|
pub fn flushcache(address: usize) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
arch::*,
|
|
||||||
platform::{display::Size2d, rpi3::BcmHost},
|
platform::{display::Size2d, rpi3::BcmHost},
|
||||||
println,
|
println,
|
||||||
};
|
};
|
||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
use core::sync::atomic::{compiler_fence, Ordering};
|
use core::sync::atomic::{compiler_fence, Ordering};
|
||||||
|
use cortex_a::barrier;
|
||||||
use register::mmio::*;
|
use register::mmio::*;
|
||||||
|
|
||||||
// Public interface to the mailbox.
|
// Public interface to the mailbox.
|
||||||
|
@ -207,7 +207,9 @@ fn write(regs: &RegisterBlock, buf_ptr: u32, channel: u32) -> Result<()> {
|
||||||
return Err(MboxError::Timeout);
|
return Err(MboxError::Timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dmb();
|
unsafe {
|
||||||
|
barrier::dmb(barrier::SY);
|
||||||
|
}
|
||||||
regs.WRITE
|
regs.WRITE
|
||||||
.set((buf_ptr & !CHANNEL_MASK) | (channel & CHANNEL_MASK));
|
.set((buf_ptr & !CHANNEL_MASK) | (channel & CHANNEL_MASK));
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -227,9 +229,13 @@ fn read(regs: &RegisterBlock, expected: u32, channel: u32) -> Result<()> {
|
||||||
/* Read the data
|
/* Read the data
|
||||||
* Data memory barriers as we've switched peripheral
|
* Data memory barriers as we've switched peripheral
|
||||||
*/
|
*/
|
||||||
dmb();
|
unsafe {
|
||||||
|
barrier::dmb(barrier::SY);
|
||||||
|
}
|
||||||
let data: u32 = regs.READ.get();
|
let data: u32 = regs.READ.get();
|
||||||
dmb();
|
unsafe {
|
||||||
|
barrier::dmb(barrier::SY);
|
||||||
|
}
|
||||||
|
|
||||||
// is it a response to our message?
|
// is it a response to our message?
|
||||||
if ((data & CHANNEL_MASK) == channel) && ((data & !CHANNEL_MASK) == expected) {
|
if ((data & CHANNEL_MASK) == channel) && ((data & !CHANNEL_MASK) == expected) {
|
||||||
|
|
Loading…
Reference in New Issue