From da623ccd017a338d2279d06f1ae85c111121319d Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 5 Aug 2025 23:00:09 +0800 Subject: [PATCH] harmonize cache_flush in hal and also add rram module --- libs/cramium-hal/src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/cramium-hal/src/lib.rs b/libs/cramium-hal/src/lib.rs index 04f142641..02b1af8f6 100644 --- a/libs/cramium-hal/src/lib.rs +++ b/libs/cramium-hal/src/lib.rs @@ -30,3 +30,21 @@ pub mod usb; pub use shared_csr::*; #[cfg(not(feature = "hosted-baosec"))] pub mod mbox; +#[cfg(not(feature = "hosted-baosec"))] +pub mod rram; + +#[inline(always)] +pub fn cache_flush() { + unsafe { + // cache flush + #[rustfmt::skip] + core::arch::asm!( + "fence.i", + ".word 0x500F", + "nop", + "nop", + "nop", + "nop", + ); + } +}