add functions necessary to create a compatibility shim

We don't have Arc in machine mode (no-std), but we want to be
able to run our USB driver in machine mode for fast debugging
of certain problems.

Add some thunks that allow us to do some slightly unholy things
which facilitate such debug access.
This commit is contained in:
bunnie 2024-06-06 17:56:00 +08:00
parent 519ae31485
commit ed42ee0be7

View file

@ -619,6 +619,7 @@ impl Field {
}
pub const fn offset(&self) -> usize { self.offset }
pub const fn mask(&self) -> usize { self.mask }
pub const fn register(&self) -> Register { self.register }
}
#[derive(Debug, Copy, Clone)]
pub struct CSR<T> {
@ -733,6 +734,9 @@ where
base: Arc::new(AtomicPtr::new(base))
}
}
pub unsafe fn base(&self) -> *mut T {
self.base.load(core::sync::atomic::Ordering::SeqCst) as *mut T
}
pub fn clone(&self) -> Self {
AtomicCsr {
base: self.base.clone()