Skip to main content

InternalMemory

Struct InternalMemory 

Source
pub struct InternalMemory<T>(/* private fields */);
Available on crate feature 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>

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<T: Debug> Debug for InternalMemory<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for InternalMemory<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for InternalMemory<T>
where T: RefUnwindSafe,

§

impl<T> Send for InternalMemory<T>
where T: Send,

§

impl<T> Sync for InternalMemory<T>
where T: Sync,

§

impl<T> Unpin for InternalMemory<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for InternalMemory<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for InternalMemory<T>
where T: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.