1#![cfg_attr(not(test), no_std)]
2#![cfg_attr(docsrs, feature(doc_auto_cfg))]
3#![doc = include_str!("../README.md")]
4
5#[macro_use]
6extern crate axplat_macros;
7
8pub mod console;
9pub mod init;
10#[cfg(feature = "irq")]
11pub mod irq;
12pub mod mem;
13pub mod power;
14pub mod time;
15
16pub use axplat_macros::main;
17pub use crate_interface::impl_interface as impl_plat_interface;
18
19#[cfg(feature = "smp")]
20pub use axplat_macros::secondary_main;
21
22#[doc(hidden)]
23pub mod __priv {
24 pub use const_str::equal as const_str_eq;
25 pub use crate_interface::{call_interface, def_interface};
26}
27
28#[macro_export]
47macro_rules! assert_str_eq {
48 ($expect:expr, $actual:expr, $mes:literal) => {
49 const _: () = assert!($crate::__priv::const_str_eq!($expect, $actual), $mes);
50 };
51 ($expect:expr, $actual:expr $(,)?) => {
52 const _: () = assert!(
53 $crate::__priv::const_str_eq!($expect, $actual),
54 "assertion failed: expected != actual.",
55 );
56 };
57}
58
59pub fn call_main(cpu_id: usize, arg: usize) -> ! {
63 unsafe { __axplat_main(cpu_id, arg) }
64}
65
66#[cfg(feature = "smp")]
70pub fn call_secondary_main(cpu_id: usize) -> ! {
71 unsafe { __axplat_secondary_main(cpu_id) }
72}
73
74unsafe extern "Rust" {
75 fn __axplat_main(cpu_id: usize, arg: usize) -> !;
76 fn __axplat_secondary_main(cpu_id: usize) -> !;
77}