#![cfg_attr(any(not(test), target_os = "none"), no_std)]
#![cfg_attr(all(test, target_os = "none"), no_main)]
#![cfg_attr(all(test, target_os = "none"), feature(custom_test_frameworks))]
#![cfg_attr(doc, feature(doc_cfg))]
#![cfg_attr(
all(test, target_os = "none"),
test_runner(crate::bare_metal_test_runner)
)]
#[cfg(all(feature = "host-test", not(target_os = "none")))]
extern crate std;
pub mod sync;
#[cfg(all(test, target_os = "none"))]
fn bare_metal_test_runner(_tests: &[&dyn Fn()]) {}
#[cfg(all(test, target_os = "none"))]
#[unsafe(no_mangle)]
extern "C" fn _start() -> ! {
loop {
core::hint::spin_loop();
}
}
#[cfg(all(test, target_os = "none"))]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo<'_>) -> ! {
loop {
core::hint::spin_loop();
}
}
#[cfg(feature = "multitask")]
mod build_info {
include!(concat!(env!("OUT_DIR"), "/build_info.rs"));
}
cfg_if::cfg_if! {
if #[cfg(feature = "multitask")] {
#[macro_use]
extern crate log;
extern crate alloc;
#[macro_use]
mod run_queue;
mod interrupt;
mod task;
mod api;
#[doc(hidden)]
pub mod runtime_preempt;
#[cfg(feature = "lockdep")]
mod lockdep;
#[cfg(feature = "tracepoint-hooks")]
mod sched_tracepoint;
#[cfg(feature = "irq")]
mod irq_notify;
mod wait_queue;
#[cfg(feature = "irq")]
mod timers;
#[cfg(feature = "multitask")]
pub mod future;
#[cfg_attr(doc, doc(cfg(feature = "multitask")))]
pub use self::api::*;
#[cfg(feature = "irq")]
pub use self::irq_notify::IrqNotify;
pub use self::api::{sleep, sleep_until, yield_now};
#[cfg(feature = "tracepoint-hooks")]
pub use self::sched_tracepoint::SchedTracepoint;
#[cfg(all(feature = "smp", feature = "ipi"))]
pub use self::run_queue::handle_ipi_reschedule;
} else {
mod api_s;
pub use self::api_s::{sleep, sleep_until, yield_now};
}
}
#[cfg(all(axtest, feature = "multitask"))]
#[doc(hidden)]
pub mod axtest_support {
#[cfg(feature = "axtest")]
pub fn atomic_context_and_stack_configuration_hold() -> bool {
super::api::axtask_api_atomic_context_structs_hold_for_test()
}
#[cfg(feature = "preempt")]
pub fn request_current_preemption() {
super::api::request_current_preemption_for_test();
}
pub fn record_initial_scheduler_frame_consumed() {
super::api::record_initial_scheduler_frame_consumed_for_test();
}
pub fn initial_scheduler_frame_consumed() -> bool {
super::api::initial_scheduler_frame_consumed_for_test()
}
}