Skip to main content

RiscvCoherentDmaFence

Struct RiscvCoherentDmaFence 

pub struct RiscvCoherentDmaFence { /* private fields */ }
Expand description

An implementation of [DmaFence] for RISC-V systems with cache-coherent DMA memory accesses.

The provided release and acquire methods use opaque assembly blocks and RISC-V FENCE instructions to make prior writes to DMA buffers visible to DMA devices, and DMA writes visible to prior memory reads, respectively.

These primitives are sufficient to implement the release / acquire semantics of [DmaFence] for cache-coherent platforms where all memory writes written back are immediately visible to DMA devices, and all DMA writes are immediately visible to CPU fetches.

For platforms where explicit cache-flush instructions are required, this implementation alone is insufficient and must be extended with the necessary platform-specific instructions.

Implementations§

§

impl RiscvCoherentDmaFence

pub unsafe fn new() -> RiscvCoherentDmaFence

Construct a new RiscvCoherentDmaFence.

Refer to the type-level documentation and the documentation of the DmaFence trait and its implementation for RiscvCoherentDmaFence for more details.

§Safety

This RiscvCoherentDmaFence implementation is insufficient for platforms with non-coherent DMA, where explicit cache-flush instructions are required. By using unsafe, callers of this function promise that the resulting instance is not used for non-coherent DMA mappings.

Trait Implementations§

§

impl Clone for RiscvCoherentDmaFence

§

fn clone(&self) -> RiscvCoherentDmaFence

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for RiscvCoherentDmaFence

§

impl Debug for RiscvCoherentDmaFence

§

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

Formats the value using the given formatter. Read more
§

impl DmaFence for RiscvCoherentDmaFence

Available on non-riscv_bare_metal only.
§

fn release<T>(self, _slice_ptr: *mut [T])

Expose prior writes to in-memory buffers to subsequent DMA operations. Read more
§

fn acquire<T>(self, _slice_ptr: *mut [T])

Expose prior writes by DMA peripherals to subsequent memory reads. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.