mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-25 17:33:28 +04:00
aarch64: add driver interfaces
This commit is contained in:
parent
81af2c82fd
commit
f76a604b78
@ -9,10 +9,16 @@ pub mod serial;
|
|||||||
pub const IO_REMAP_BASE: usize = bcm2837::IO_BASE;
|
pub const IO_REMAP_BASE: usize = bcm2837::IO_BASE;
|
||||||
pub const IO_REMAP_END: usize = 0x40001000;
|
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");
|
assert_has_not_been_called!("board::init must be called only once");
|
||||||
|
|
||||||
serial::SERIAL_PORT.lock().init();
|
serial::SERIAL_PORT.lock().init();
|
||||||
|
|
||||||
println!("Hello Raspberry Pi!");
|
println!("Hello Raspberry Pi!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Initialize raspi3 drivers
|
||||||
|
pub fn init_driver() {
|
||||||
|
timer::init();
|
||||||
|
}
|
||||||
|
12
kernel/src/arch/aarch64/driver/mod.rs
Normal file
12
kernel/src/arch/aarch64/driver/mod.rs
Normal 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();
|
||||||
|
}
|
@ -6,29 +6,25 @@ pub mod memory;
|
|||||||
pub mod interrupt;
|
pub mod interrupt;
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
pub mod cpu;
|
pub mod cpu;
|
||||||
|
pub mod driver;
|
||||||
|
|
||||||
#[cfg(feature = "board_raspi3")]
|
#[cfg(feature = "board_raspi3")]
|
||||||
#[path = "board/raspi3/mod.rs"]
|
#[path = "board/raspi3/mod.rs"]
|
||||||
pub mod board;
|
pub mod board;
|
||||||
|
|
||||||
pub use self::board::timer;
|
|
||||||
|
|
||||||
global_asm!(include_str!("boot/boot.S"));
|
global_asm!(include_str!("boot/boot.S"));
|
||||||
|
|
||||||
/// The entry point of kernel
|
/// The entry point of kernel
|
||||||
#[no_mangle] // don't mangle the name of this function
|
#[no_mangle] // don't mangle the name of this function
|
||||||
pub extern "C" fn rust_main() -> ! {
|
pub extern "C" fn rust_main() -> ! {
|
||||||
// Enable mmu and paging
|
memory::init_mmu_early(); // Enable mmu and paging
|
||||||
memory::init_mmu_early();
|
board::init_early();
|
||||||
|
|
||||||
// Init board to enable serial port.
|
|
||||||
board::init();
|
|
||||||
println!("{}", LOGO);
|
println!("{}", LOGO);
|
||||||
|
|
||||||
crate::logging::init();
|
crate::logging::init();
|
||||||
interrupt::init();
|
interrupt::init();
|
||||||
memory::init();
|
memory::init();
|
||||||
timer::init();
|
driver::init();
|
||||||
|
|
||||||
crate::process::init();
|
crate::process::init();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user