#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct TimerPlan {
pub slice_ns: u64,
pub slice_cycles: u32,
pub timer_hz: u32,
}
#[cfg(all(feature = "std", target_os = "windows"))]
mod win32;
#[cfg(all(feature = "std", target_os = "windows"))]
pub use win32::*;
#[cfg(all(feature = "std", target_os = "linux"))]
mod posix;
#[cfg(all(feature = "std", target_os = "linux"))]
pub use posix::*;
#[cfg(all(feature = "std", unix, not(target_os = "linux")))]
compile_error!(
"rrkernel: the POSIX backend is currently implemented and verified for \
Linux/glibc only. `sigaction`, `sigset_t` and `sigevent` have different \
layouts on macOS/BSD, and guessing them would corrupt memory instead of \
failing loudly. See docs/PORTING.md (about 30 lines to adapt)."
);
#[cfg(all(feature = "std", not(any(target_os = "windows", unix))))]
compile_error!(
"rrkernel: no `std` backend for this operating system. Implement the port \
described in docs/PORTING.md and add it to src/arch/mod.rs."
);
#[cfg(all(not(feature = "std"), target_arch = "arm", target_feature = "mclass"))]
mod cortex_m;
#[cfg(all(not(feature = "std"), target_arch = "arm", target_feature = "mclass"))]
pub use cortex_m::*;
#[cfg(all(
not(feature = "std"),
target_arch = "arm",
not(target_feature = "mclass")
))]
mod arm_ar;
#[cfg(all(
not(feature = "std"),
target_arch = "arm",
not(target_feature = "mclass")
))]
pub use arm_ar::*;
#[cfg(all(not(feature = "std"), target_arch = "riscv32"))]
mod riscv;
#[cfg(all(not(feature = "std"), target_arch = "riscv32"))]
pub use riscv::*;
#[cfg(all(
not(feature = "std"),
not(any(
target_arch = "arm",
target_arch = "riscv32",
target_arch = "avr",
target_arch = "xtensa"
))
))]
compile_error!(
"rrkernel: this bare-metal architecture has no port yet. Verified ports: ARM \
Cortex-M (thumbv6m/v7m/v8m.main) and ARM A/R profile (armv7a/armv7r, QEMU- \
tested) and RISC-V 32 (riscv32imac, QEMU-tested). See docs/PORTING.md for the \
port surface: it is 14 functions, most of them one line."
);
#[cfg(all(not(feature = "std"), target_arch = "avr"))]
compile_error!(
"rrkernel: the AVR port is not implemented yet. What it needs, concretely: \
(1) `rustup component add rust-src`, then build with \
`RUSTFLAGS=\"-C target-cpu=atmega328p\" cargo build -Z build-std=core \
--target avr-none`; (2) `avr-gcc` (binutils-avr) installed for linking, \
because `lld` cannot link AVR (QEMU can then run the image with \
`qemu-system-avr -M arduino-uno`); (3) a port in the shape documented in \
docs/PORTING.md: a 35-byte frame (r0-r31 + SREG + the 2-byte return address, \
low byte first), Timer1 in CTC mode with OCR1A, `cli`/`sei` with SREG.I as \
the critical-section token, and an ISR that swaps SPL/SPH and `reti`s into \
the next task."
);
#[cfg(all(not(feature = "std"), target_arch = "xtensa"))]
mod xtensa;
#[cfg(all(not(feature = "std"), target_arch = "xtensa"))]
pub use xtensa::*;
#[cfg(all(feature = "std", not(any(target_os = "windows", unix))))]
compile_error!(
"rrkernel: no `std` backend for this operating system. Implement the port \
described in docs/PORTING.md (14 functions) and add it to src/arch/mod.rs."
);