mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-24 03:10:28 +02:00
WFI
This commit is contained in:
parent
f6daca3dde
commit
cddf766491
@ -553,3 +553,11 @@ pub fn irq_enable() {
|
||||
asm!("msr DAIFClr, #0xf", options(nomem, nostack));
|
||||
}
|
||||
}
|
||||
|
||||
/// Waits for an interrupt.
|
||||
pub fn wfi() {
|
||||
// Safe because this doesn't access memory in any way.
|
||||
unsafe {
|
||||
asm!("wfi", options(nomem, nostack));
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ mod pl011;
|
||||
// ANCHOR_END: top
|
||||
mod pl031;
|
||||
|
||||
use crate::gicv3::{irq_enable, GicV3, Trigger, SPI_START};
|
||||
use crate::gicv3::{irq_enable, wfi, GicV3, Trigger, SPI_START};
|
||||
use crate::pl031::Rtc;
|
||||
use chrono::{TimeZone, Utc};
|
||||
use core::hint::spin_loop;
|
||||
@ -113,7 +113,7 @@ extern "C" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {
|
||||
rtc.interrupt_pending()
|
||||
);
|
||||
while !rtc.interrupt_pending() {
|
||||
spin_loop();
|
||||
wfi();
|
||||
}
|
||||
trace!(
|
||||
"matched={}, interrupt_pending={}",
|
||||
|
Loading…
x
Reference in New Issue
Block a user