Add Board Support for RPi3
This commit is contained in:
parent
c823b42447
commit
88b0af44cb
|
@ -29,6 +29,7 @@ extern crate rlibc; // To enable linking memory intrinsics.
|
|||
pub mod arch;
|
||||
pub use arch::*;
|
||||
mod macros;
|
||||
mod platform;
|
||||
#[cfg(feature = "qemu")]
|
||||
mod qemu;
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Board Support Packages
|
||||
|
||||
This directory contains support for specific Boards like RaspberryPi3 etc.
|
|
@ -0,0 +1,5 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: BlueOak-1.0.0
|
||||
* Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
*/
|
||||
pub mod rpi3;
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: BlueOak-1.0.0
|
||||
* Copyright (c) Berkus Decker <berkus+vesper@metta.systems>
|
||||
*/
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
/// See BCM2835-ARM-Peripherals.pdf
|
||||
/// See https://www.raspberrypi.org/forums/viewtopic.php?t=186090 for more details.
|
||||
|
||||
pub struct BcmHost;
|
||||
|
||||
impl BcmHost {
|
||||
/// This returns the ARM-side physical address where peripherals are mapped.
|
||||
///
|
||||
/// As per https://www.raspberrypi.org/documentation/hardware/raspberrypi/peripheral_addresses.md
|
||||
/// BCM SOC could address only 1Gb of memory, so 0x4000_0000 is the high watermark.
|
||||
pub const fn get_peripheral_address() -> usize {
|
||||
0x3f00_0000
|
||||
}
|
||||
|
||||
/// This returns the size of the peripherals' space.
|
||||
pub const fn get_peripheral_size() -> usize {
|
||||
0x0100_0000
|
||||
}
|
||||
|
||||
/// This returns the bus address of the SDRAM.
|
||||
pub const fn get_sdram_address() -> usize {
|
||||
0xc000_0000 // uncached
|
||||
}
|
||||
|
||||
/// As per https://www.raspberrypi.org/forums/viewtopic.php?p=1170522#p1170522
|
||||
///
|
||||
pub fn bus2phys(bus: usize) -> usize {
|
||||
bus & !0xc000_0000
|
||||
}
|
||||
|
||||
pub fn phys2bus(phys: usize) -> usize {
|
||||
phys | 0xc000_0000
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue