mirror of
https://github.com/iceHtwoO/novaOS.git
synced 2026-04-17 04:32:27 +00:00
Add power management watchdog,
rework interrupts
This commit is contained in:
16
src/lib.rs
16
src/lib.rs
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user