diff --git a/embassy-nrf/src/util.rs b/embassy-nrf/src/util.rs index 76162b701..b24bc452f 100644 --- a/embassy-nrf/src/util.rs +++ b/embassy-nrf/src/util.rs @@ -4,18 +4,18 @@ const SRAM_LOWER: usize = 0x2000_0000; const SRAM_UPPER: usize = 0x3000_0000; // TODO: replace transmutes with core::ptr::metadata once it's stable - -pub(crate) fn slice_ptr_parts(slice: *const [T]) -> (usize, usize) { +pub(crate) fn slice_ptr_parts(slice: *const [T]) -> (*const T, usize) { unsafe { mem::transmute(slice) } } -pub(crate) fn slice_ptr_parts_mut(slice: *mut [T]) -> (usize, usize) { +pub(crate) fn slice_ptr_parts_mut(slice: *mut [T]) -> (*mut T, usize) { unsafe { mem::transmute(slice) } } /// Does this slice reside entirely within RAM? pub(crate) fn slice_in_ram(slice: *const [T]) -> bool { let (ptr, len) = slice_ptr_parts(slice); + let ptr = ptr as usize; ptr >= SRAM_LOWER && (ptr + len * core::mem::size_of::()) < SRAM_UPPER }