#![no_std]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(dead_code)] #![allow(static_mut_refs)]
#[cfg(not(any(
feature = "port-cortex-m0",
feature = "port-cortex-m3",
feature = "port-cortex-m4f",
feature = "port-cortex-m7",
feature = "port-riscv32",
feature = "port-cortex-a9",
feature = "port-cortex-a53",
feature = "port-test",
feature = "port-dummy"
)))]
compile_error!("select exactly one FreeRTOS-in-Rust port feature");
#[cfg(any(
all(
feature = "port-cortex-m0",
any(
feature = "port-cortex-m3",
feature = "port-cortex-m4f",
feature = "port-cortex-m7",
feature = "port-riscv32",
feature = "port-cortex-a9",
feature = "port-cortex-a53",
feature = "port-test",
feature = "port-dummy"
)
),
all(
feature = "port-cortex-m3",
any(
feature = "port-cortex-m4f",
feature = "port-cortex-m7",
feature = "port-riscv32",
feature = "port-cortex-a9",
feature = "port-cortex-a53",
feature = "port-test",
feature = "port-dummy"
)
),
all(
feature = "port-cortex-m4f",
any(
feature = "port-cortex-m7",
feature = "port-riscv32",
feature = "port-cortex-a9",
feature = "port-cortex-a53",
feature = "port-test",
feature = "port-dummy"
)
),
all(
feature = "port-cortex-m7",
any(
feature = "port-riscv32",
feature = "port-cortex-a9",
feature = "port-cortex-a53",
feature = "port-test",
feature = "port-dummy"
)
),
all(
feature = "port-riscv32",
any(
feature = "port-cortex-a9",
feature = "port-cortex-a53",
feature = "port-test",
feature = "port-dummy"
)
),
all(
feature = "port-cortex-a9",
any(
feature = "port-cortex-a53",
feature = "port-test",
feature = "port-dummy"
)
),
all(
feature = "port-cortex-a53",
any(feature = "port-test", feature = "port-dummy")
),
all(feature = "port-test", feature = "port-dummy")
))]
compile_error!("FreeRTOS-in-Rust port features are mutually exclusive");
#[cfg(any(
all(feature = "heap-4", feature = "heap-5"),
all(feature = "heap-4", feature = "alloc"),
all(feature = "heap-5", feature = "alloc")
))]
compile_error!("allocator features are mutually exclusive");
#[cfg(feature = "std")]
extern crate std;
#[cfg(any(feature = "alloc", feature = "heap-4", feature = "heap-5"))]
extern crate alloc;
pub mod config;
pub mod trace;
pub mod types;
pub mod port;
pub mod memory;
pub mod kernel;
pub mod sync;
pub use config::*;
pub use types::*;
#[inline]
pub fn delay(context: &sync::TaskContext, ticks: TickType_t) {
assert!(context.current().is_some(), "delay requires a running task");
sync::assert_can_block("delay", ticks);
unsafe { kernel::tasks::vTaskDelay(ticks) };
}
#[inline]
pub fn delay_ms(context: &sync::TaskContext, ms: u32) {
let ticks = milliseconds_to_ticks_checked(u64::from(ms))
.expect("millisecond delay does not fit in TickType_t");
delay(context, ticks);
}
#[inline]
pub fn start_scheduler(_context: sync::TaskContext) -> ! {
sync::assert_task_context("start_scheduler");
assert_eq!(
kernel::tasks::xTaskGetSchedulerState(),
kernel::tasks::taskSCHEDULER_NOT_STARTED,
"start_scheduler requires exclusive pre-scheduler initialization context"
);
unsafe { kernel::tasks::vTaskStartScheduler() };
panic!("FreeRTOS scheduler failed to start")
}