pub struct InternalMemory<T>(/* private fields */);unstable only.Expand description
DMA appropriate wrapper type for internal memory values.
The value wrapped in this type is guaranteed to be safely useable as a DMA buffer or descriptor array, meaning DMA or cache management operations will not corrupt surrounding data.
DmaAlignedMut is a reference type that carries this guarantee.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Implementations§
Source§impl<T> InternalMemory<T>
impl<T> InternalMemory<T>
Sourcepub const fn new(init: T) -> Self
pub const fn new(init: T) -> Self
Creates a new value aligned for DMA operations in internal memory.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub const fn as_ptr(&self) -> *const T
pub const fn as_ptr(&self) -> *const T
Returns a const pointer to the wrapped value.
The returned pointer is aligned appropriately for DMA and points at the same address that the DMA engine will access.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn get_mut(&mut self) -> DmaAlignedMut<'_, T>
pub fn get_mut(&mut self) -> DmaAlignedMut<'_, T>
Returns a DmaAlignedMut to the underlying value.
§Panics
Panics if the value is not located at a valid internal RAM address.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn get_ref(&self) -> DmaAlignedRef<'_, T>
pub fn get_ref(&self) -> DmaAlignedRef<'_, T>
Returns a DmaAlignedRef to the underlying value.
The reference can be used to read the value and to invalidate its cache lines, but not to mutate or write it back. This allows polling DMA-written state (e.g. a descriptor ownership bit) through a shared borrow.
§Panics
Panics if the value is not located at a valid internal RAM address.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.