Skip to main content

ax_task/
api_s.rs

1//! Task APIs for single-task configuration.
2
3/// For single-task situation, we just relax the CPU and wait for incoming
4/// interrupts.
5pub fn yield_now() {
6    if cfg!(feature = "irq") {
7        ax_hal::asm::wait_for_irqs();
8    } else {
9        core::hint::spin_loop();
10    }
11}
12
13/// For single-task situation, we just busy wait for the given duration.
14pub fn sleep(dur: core::time::Duration) {
15    ax_hal::time::busy_wait(dur);
16}
17
18/// For single-task situation, we just busy wait until reaching the given
19/// deadline.
20pub fn sleep_until(deadline: ax_hal::time::TimeValue) {
21    ax_hal::time::busy_wait_until(deadline);
22}