1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 16:16:16 +04:00

aarch64: add driver interfaces

This commit is contained in:
equation314 2018-12-13 18:42:42 +08:00
parent 81af2c82fd
commit f76a604b78
3 changed files with 23 additions and 9 deletions

View File

@ -9,10 +9,16 @@ pub mod serial;
pub const IO_REMAP_BASE: usize = bcm2837::IO_BASE;
pub const IO_REMAP_END: usize = 0x40001000;
pub fn init() {
/// Some initializations must be done before other initializations.
pub fn init_early() {
assert_has_not_been_called!("board::init must be called only once");
serial::SERIAL_PORT.lock().init();
println!("Hello Raspberry Pi!");
}
/// Initialize raspi3 drivers
pub fn init_driver() {
timer::init();
}

View File

@ -0,0 +1,12 @@
/// ARM64 drivers
use once::*;
use super::board;
/// Initialize ARM64 common drivers
pub fn init() {
assert_has_not_been_called!();
board::init_driver();
}

View File

@ -6,29 +6,25 @@ pub mod memory;
pub mod interrupt;
pub mod consts;
pub mod cpu;
pub mod driver;
#[cfg(feature = "board_raspi3")]
#[path = "board/raspi3/mod.rs"]
pub mod board;
pub use self::board::timer;
global_asm!(include_str!("boot/boot.S"));
/// The entry point of kernel
#[no_mangle] // don't mangle the name of this function
pub extern "C" fn rust_main() -> ! {
// Enable mmu and paging
memory::init_mmu_early();
// Init board to enable serial port.
board::init();
memory::init_mmu_early(); // Enable mmu and paging
board::init_early();
println!("{}", LOGO);
crate::logging::init();
interrupt::init();
memory::init();
timer::init();
driver::init();
crate::process::init();