From ed42ee0be71f26df32ab0f0e416b3e55a25d722f Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 6 Jun 2024 17:56:00 +0800 Subject: [PATCH] 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. --- svd2utra/src/generate.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/svd2utra/src/generate.rs b/svd2utra/src/generate.rs index ab3f5afd9..0c8d00437 100644 --- a/svd2utra/src/generate.rs +++ b/svd2utra/src/generate.rs @@ -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 { @@ -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()