You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
5 years ago
|
// SPDX-License-Identifier: MIT
|
||
|
//
|
||
|
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
||
|
|
||
5 years ago
|
//! Board Support Package for the Raspberry Pi.
|
||
5 years ago
|
|
||
5 years ago
|
use crate::interface;
|
||
5 years ago
|
use core::fmt;
|
||
|
|
||
5 years ago
|
pub const BOOT_CORE_ID: u64 = 0;
|
||
|
pub const BOOT_CORE_STACK_START: u64 = 0x80_000;
|
||
5 years ago
|
|
||
|
/// A mystical, magical device for generating QEMU output out of the void.
|
||
|
struct QEMUOutput;
|
||
|
|
||
5 years ago
|
/// Implementing `console::Write` enables usage of the `format_args!` macros, which in turn are used
|
||
|
/// to implement the `kernel`'s `print!` and `println!` macros.
|
||
5 years ago
|
///
|
||
|
/// See [`src/print.rs`].
|
||
|
///
|
||
|
/// [`src/print.rs`]: ../../print/index.html
|
||
5 years ago
|
impl interface::console::Write for QEMUOutput {
|
||
5 years ago
|
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||
|
for c in s.chars() {
|
||
|
unsafe {
|
||
5 years ago
|
core::ptr::write_volatile(0x3F20_1000 as *mut u8, c as u8);
|
||
5 years ago
|
}
|
||
|
}
|
||
|
|
||
|
Ok(())
|
||
|
}
|
||
|
}
|
||
|
|
||
5 years ago
|
//--------------------------------------------------------------------------------------------------
|
||
5 years ago
|
// Implementation of the kernel's BSP calls
|
||
5 years ago
|
//--------------------------------------------------------------------------------------------------
|
||
5 years ago
|
|
||
|
/// Returns a ready-to-use `console::Write` implementation.
|
||
5 years ago
|
pub fn console() -> impl interface::console::Write {
|
||
5 years ago
|
QEMUOutput {}
|
||
|
}
|