mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
start to flesh out API, allocate clean suspend page
This commit is contained in:
parent
07d6055b4e
commit
68ed591189
2 changed files with 24 additions and 4 deletions
|
|
@ -2,12 +2,23 @@ use utralib::generated::*;
|
||||||
|
|
||||||
pub(crate) const SERVER_NAME_SUSRES: &str = "_Suspend/resume manager_";
|
pub(crate) const SERVER_NAME_SUSRES: &str = "_Suspend/resume manager_";
|
||||||
|
|
||||||
/*
|
|
||||||
#[allow(dead_code)]
|
|
||||||
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||||
pub(crate) enum Opcode {
|
pub(crate) enum Opcode {
|
||||||
Placeholder,
|
/// requests a suspend
|
||||||
}*/
|
SuspendRequest,
|
||||||
|
|
||||||
|
/// register a subscriber to the suspend event
|
||||||
|
/// (if you don't register, you just get suspend without any warning!)
|
||||||
|
SuspendEventSubscribe,
|
||||||
|
|
||||||
|
/// indicate we're ready to suspend
|
||||||
|
SuspendReady,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
|
||||||
|
pub(crate) enum ExecGateOpcode {
|
||||||
|
SuspendNow,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub enum RegOrField {
|
pub enum RegOrField {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ mod implementation {
|
||||||
pub struct SusResHw {
|
pub struct SusResHw {
|
||||||
/// our CSR
|
/// our CSR
|
||||||
csr: utralib::CSR<u32>,
|
csr: utralib::CSR<u32>,
|
||||||
|
/// memory region for the "clean suspend" marker
|
||||||
|
marker: xous::MemoryRange,
|
||||||
/// backing store for the ticktimer value
|
/// backing store for the ticktimer value
|
||||||
time_backing: Option<[u32; 2]>,
|
time_backing: Option<[u32; 2]>,
|
||||||
}
|
}
|
||||||
|
|
@ -33,9 +35,16 @@ mod implementation {
|
||||||
)
|
)
|
||||||
.expect("couldn't map SusRes CSR range");
|
.expect("couldn't map SusRes CSR range");
|
||||||
|
|
||||||
|
let marker = xous::syscall::map_memory(
|
||||||
|
xous::MemoryAddress::new(0x40FFE000), // this is a special, hard-coded location
|
||||||
|
None,
|
||||||
|
4096,
|
||||||
|
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||||
|
).expect("couldn't map clean suspend page");
|
||||||
let mut sr = SusResHw {
|
let mut sr = SusResHw {
|
||||||
csr: CSR::new(csr.as_mut_ptr() as *mut u32),
|
csr: CSR::new(csr.as_mut_ptr() as *mut u32),
|
||||||
time_backing: None,
|
time_backing: None,
|
||||||
|
marker,
|
||||||
};
|
};
|
||||||
|
|
||||||
xous::claim_interrupt(
|
xous::claim_interrupt(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue