Skip to content

Commit

Permalink
[api] Re-export ArceOS modules in arceos_api, update app test
Browse files Browse the repository at this point in the history
  • Loading branch information
equation314 committed Jul 30, 2024
1 parent ee0d7a3 commit 1f97a03
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
env:
qemu-version: 8.2.0
rust-toolchain: nightly-2024-05-02
arceos-apps: b36b9d5
arceos-apps: c01cd92

jobs:
unit-test:
Expand Down
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions api/arceos_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ default = []

irq = ["axfeat/irq"]
alloc = ["dep:axalloc", "axfeat/alloc"]
multitask = ["axtask/multitask", "axfeat/multitask"]
fs = ["dep:axfs", "axfeat/fs"]
net = ["dep:axnet", "axfeat/net"]
display = ["dep:axdisplay", "axfeat/display"]
paging = ["dep:axmm", "axfeat/paging"]
multitask = ["axtask/multitask", "axsync/multitask", "axfeat/multitask"]
fs = ["dep:axfs", "dep:axdriver", "axfeat/fs"]
net = ["dep:axnet", "dep:axdriver", "axfeat/net"]
display = ["dep:axdisplay", "dep:axdriver", "axfeat/display"]

myfs = ["axfeat/myfs"]

Expand All @@ -32,8 +33,11 @@ axruntime = { workspace = true }
axconfig = { workspace = true }
axlog = { workspace = true }
axhal = { workspace = true }
axsync = { workspace = true }
axalloc = { workspace = true, optional = true }
axmm = { workspace = true, optional = true }
axtask = { workspace = true, optional = true }
axdriver = { workspace = true, optional = true }
axfs = { workspace = true, optional = true }
axnet = { workspace = true, optional = true }
axdisplay = { workspace = true, optional = true }
28 changes: 27 additions & 1 deletion api/arceos_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
feature = "dummy-if-not-enabled"
))]
extern crate alloc;
extern crate axruntime;

#[macro_use]
mod macros;
Expand Down Expand Up @@ -339,3 +338,30 @@ pub mod io {
pub type AxPollState;
}
}

/// Re-exports of ArceOS modules.
///
/// You should prefer to use other APIs rather than these modules. The modules
/// here should only be used if other APIs do not meet your requirements.
pub mod modules {
pub use axconfig;
pub use axhal;
pub use axlog;
pub use axruntime;
pub use axsync;

#[cfg(feature = "alloc")]
pub use axalloc;
#[cfg(feature = "display")]
pub use axdisplay;
#[cfg(any(feature = "fs", feature = "net", feature = "display"))]
pub use axdriver;
#[cfg(feature = "fs")]
pub use axfs;
#[cfg(feature = "paging")]
pub use axmm;
#[cfg(feature = "net")]
pub use axnet;
#[cfg(feature = "multitask")]
pub use axtask;
}
1 change: 0 additions & 1 deletion modules/axhal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ lazyinit = "0.2"
percpu = "0.1"
memory_addr = "0.2"
handler_table = "0.1"
crate_interface = "0.1"
page_table_entry = "0.3"
page_table_multiarch = { version = "0.3", optional = true }
axlog = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions modules/axhal/src/irq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use handler_table::HandlerTable;

use crate::platform::irq::{dispatch_irq, MAX_IRQ_COUNT};
use crate::trap::{reg_trap_handler, IRQ};
use crate::trap::{register_trap_handler, IRQ};

pub use crate::platform::irq::{register_handler, set_enable};

Expand Down Expand Up @@ -35,7 +35,7 @@ pub(crate) fn register_handler_common(irq_num: usize, handler: IrqHandler) -> bo
false
}

#[reg_trap_handler(IRQ)]
#[register_trap_handler(IRQ)]
fn handler_irq(irq_num: usize) -> bool {
let guard = kernel_guard::NoPreempt::new();
dispatch_irq(irq_num);
Expand Down
2 changes: 1 addition & 1 deletion modules/axhal/src/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use linkme::distributed_slice as def_trap_handler;
use memory_addr::VirtAddr;
use page_table_entry::MappingFlags;

pub use linkme::distributed_slice as reg_trap_handler;
pub use linkme::distributed_slice as register_trap_handler;

/// A slice of IRQ handler functions.
#[def_trap_handler]
Expand Down
2 changes: 2 additions & 0 deletions ulib/axstd/src/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/// ArceOS-specific definitions.
pub mod arceos {
pub use arceos_api as api;
#[doc(no_inline)]
pub use arceos_api::modules;
}

0 comments on commit 1f97a03

Please sign in to comment.