1#![cfg_attr(any(not(test), target_os = "none"), no_std)]
15#![cfg_attr(all(test, target_os = "none"), no_main)]
16#![cfg_attr(all(test, target_os = "none"), feature(custom_test_frameworks))]
17#![cfg_attr(doc, feature(doc_cfg))]
18#![cfg_attr(
19 all(test, target_os = "none"),
20 test_runner(crate::bare_metal_test_runner)
21)]
22
23pub use ax_kspin as spin;
24
25#[cfg(all(test, target_os = "none"))]
26fn bare_metal_test_runner(_tests: &[&dyn Fn()]) {}
27
28#[cfg(all(test, target_os = "none"))]
29#[unsafe(no_mangle)]
30extern "C" fn _start() -> ! {
31 loop {
32 core::hint::spin_loop();
33 }
34}
35
36#[cfg(all(test, target_os = "none"))]
37#[panic_handler]
38fn panic(_info: &core::panic::PanicInfo<'_>) -> ! {
39 loop {
40 core::hint::spin_loop();
41 }
42}
43
44#[cfg(feature = "multitask")]
45mod mutex;
46
47#[cfg(not(feature = "multitask"))]
48#[cfg_attr(doc, doc(cfg(not(feature = "multitask"))))]
49pub use ax_kspin::{SpinNoIrq as Mutex, SpinNoIrqGuard as MutexGuard};
50
51#[cfg(feature = "multitask")]
52#[cfg_attr(doc, doc(cfg(feature = "multitask")))]
53pub use self::mutex::{Mutex, MutexGuard, RawMutex};