Add power management watchdog,

rework interrupts
This commit is contained in:
2025-12-26 13:48:22 +01:00
parent 36bc1f3315
commit 384c548557
10 changed files with 361 additions and 110 deletions

View File

@@ -1,12 +1,15 @@
#![no_std]
#![allow(clippy::missing_safety_doc)]
use core::{
arch::asm,
panic::PanicInfo,
ptr::{read_volatile, write_volatile},
};
use heap::Heap;
pub static PERIPHERAL_BASE: u32 = 0x3F00_0000;
unsafe extern "C" {
unsafe static mut __heap_start: u8;
unsafe static mut __heap_end: u8;
@@ -53,6 +56,7 @@ pub mod configuration;
pub mod framebuffer;
pub mod irq_interrupt;
pub mod mailbox;
pub mod power_management;
pub mod timer;
pub fn mmio_read(address: u32) -> u32 {
@@ -62,3 +66,15 @@ pub fn mmio_read(address: u32) -> u32 {
pub fn mmio_write(address: u32, data: u32) {
unsafe { write_volatile(address as *mut u32, data) }
}
pub fn get_current_el() -> u64 {
let el: u64;
unsafe {
asm!(
"mrs {el}, CurrentEL",
el = out(reg) el,
options(nomem, nostack, preserves_flags)
);
}
el >> 2
}