mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-24 10:26:25 +04:00
Add boards/ && cargo clippy&fmt
This commit is contained in:
parent
fff4669596
commit
f796209478
@ -9,6 +9,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
riscv = { git = "https://github.com/rcore-os/riscv", features = ["inline-asm"] }
|
||||
lazy_static = { version = "1.4.0", features = ["spin_no_std"] }
|
||||
cfg-if = { version = "1.0.0" }
|
||||
|
||||
[features]
|
||||
board_qemu = []
|
||||
|
1
os/src/boards/k210.rs
Normal file
1
os/src/boards/k210.rs
Normal file
@ -0,0 +1 @@
|
||||
pub const CLOCK_FREQ: usize = 403000000 / 62;
|
1
os/src/boards/qemu.rs
Normal file
1
os/src/boards/qemu.rs
Normal file
@ -0,0 +1 @@
|
||||
pub const CLOCK_FREQ: usize = 12500000;
|
@ -4,8 +4,11 @@ pub const MAX_APP_NUM: usize = 4;
|
||||
pub const APP_BASE_ADDRESS: usize = 0x80400000;
|
||||
pub const APP_SIZE_LIMIT: usize = 0x20000;
|
||||
|
||||
/*
|
||||
#[cfg(feature = "board_k210")]
|
||||
pub const CLOCK_FREQ: usize = 403000000 / 62;
|
||||
|
||||
#[cfg(feature = "board_qemu")]
|
||||
pub const CLOCK_FREQ: usize = 12500000;
|
||||
*/
|
||||
pub use crate::board::CLOCK_FREQ;
|
||||
|
@ -4,6 +4,12 @@
|
||||
|
||||
use core::arch::global_asm;
|
||||
|
||||
#[cfg(feature = "board_k210")]
|
||||
#[path = "boards/k210.rs"]
|
||||
mod board;
|
||||
#[cfg(not(any(feature = "board_k210")))]
|
||||
#[path = "boards/qemu.rs"]
|
||||
mod board;
|
||||
#[macro_use]
|
||||
mod console;
|
||||
mod config;
|
||||
|
@ -1,5 +1,6 @@
|
||||
mod context;
|
||||
mod switch;
|
||||
#[allow(clippy::module_inception)]
|
||||
mod task;
|
||||
|
||||
use crate::config::MAX_APP_NUM;
|
||||
@ -28,9 +29,9 @@ lazy_static! {
|
||||
task_cx: TaskContext::zero_init(),
|
||||
task_status: TaskStatus::UnInit,
|
||||
}; MAX_APP_NUM];
|
||||
for i in 0..num_app {
|
||||
tasks[i].task_cx = TaskContext::goto_restore(init_app_cx(i));
|
||||
tasks[i].task_status = TaskStatus::Ready;
|
||||
for (i, task) in tasks.iter_mut().enumerate() {
|
||||
task.task_cx = TaskContext::goto_restore(init_app_cx(i));
|
||||
task.task_status = TaskStatus::Ready;
|
||||
}
|
||||
TaskManager {
|
||||
num_app,
|
||||
|
Loading…
Reference in New Issue
Block a user