Skip to main content

DmaCoherent

Struct DmaCoherent 

Source
pub struct DmaCoherent<M: AnyUFrameMeta + ?Sized> {
    pub inner: RwArc<AtomicDataWithOwner<DmaCoherentInner<M>, DmaCoherentInnerOwner<M>>>,
}
Expand description

A coherent (or consistent) DMA mapping, which guarantees that the device and the CPU can access the data in parallel.

The mapping will be destroyed automatically when the object is dropped.

Fields§

§inner: RwArc<AtomicDataWithOwner<DmaCoherentInner<M>, DmaCoherentInnerOwner<M>>>

Implementations§

Source§

impl<M: AnyUFrameMeta + ?Sized + OwnerOf> DmaCoherent<M>

Source

pub exec fn map( segment: Segment<M>, is_cache_coherent: bool, ) -> r : Result<Self, DmaError>

requires
segment.inv(),
ensures
r matches Ok(r) ==> r.inner.wf(),

Creates a coherent DMA mapping backed by segment.

The is_cache_coherent argument specifies whether the target device can access main memory in a CPU-cache-coherent way.

Source§

impl<M: AnyUFrameMeta + ?Sized> DmaCoherent<M>

Source

pub exec fn read_inner( &self, ) -> r : RwLockReadGuard<'_, AtomicDataWithOwner<DmaCoherentInner<M>, DmaCoherentInnerOwner<M>>, PreemptDisabled>

ensures
self.inner.wf(),
r@.inv(),

Acquires a read guard for the inner DMA-coherent state.

Source§

impl<M: AnyUFrameMeta + ?Sized + OwnerOf> DmaCoherent<M>

Source

pub exec fn daddr(&self) -> r : Daddr

requires
self.inner.wf(),
ensures
self.inner.wf(),

Returns the starting device address.

Source

pub exec fn paddr(&self) -> r : Paddr

requires
self.inner.wf(),
ensures
self.inner.wf(),

Returns the starting physical address.

Source

pub exec fn nframes(&self) -> r : usize

requires
self.inner.wf(),
ensures
self.inner.wf(),

Returns the number of frames.

Source

pub exec fn nbytes(&self) -> r : usize

requires
self.inner.wf(),
ensures
self.inner.wf(),

Returns the number of bytes in the DMA mapping.

Source

pub exec fn reader<'a>(&'a self) -> r : VmReader<'a, Infallible>

with
->
reader_perm: Tracked<VmIoOwner>,
requires
self.inner.wf(),
ensures
self.inner.wf(),
r.inv(),
reader_perm@.inv(),
reader_perm@.is_kernel,
reader_perm@.has_read_view(),
r.wf(reader_perm@),
KERNEL_BASE_VADDR <= r.cursor.range@.start,
r.cursor.range@.end <= KERNEL_END_VADDR,

Returns a reader to read data from it.

Source

pub exec fn writer<'a>(&'a self) -> r : VmWriter<'a, Infallible>

with
->
writer_perm: Tracked<VmIoOwner>,
requires
self.inner.wf(),
ensures
self.inner.wf(),
r.inv(),
writer_perm@.inv(),
writer_perm@.is_kernel,
writer_perm@.has_write_view(),
r.wf(writer_perm@),

Returns a writer to write data into it.

Trait Implementations§

Source§

impl<M: AnyUFrameMeta + ?Sized> Clone for DmaCoherent<M>

Source§

exec fn clone(&self) -> r : Self

ensures
r == self,
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<M: AnyUFrameMeta + ?Sized + OwnerOf> HasDaddr for DmaCoherent<M>

Source§

exec fn daddr(&self) -> Daddr

Source§

impl<M: AnyUFrameMeta + ?Sized + OwnerOf> HasPaddr for DmaCoherent<M>

Source§

exec fn paddr(&self) -> Paddr

Source§

impl<M: AnyUFrameMeta + ?Sized> Inv for DmaCoherent<M>

Source§

open spec fn inv(self) -> bool

{ true }
Source§

impl<M: AnyUFrameMeta + ?Sized + Send + Sync + OwnerOf> VmIoOnce for DmaCoherent<M>

Source§

closed spec fn obeys_vmio_once_read_requires() -> bool

Source§

closed spec fn obeys_vmio_once_write_requires() -> bool

Source§

closed spec fn obeys_vmio_once_read_ensures() -> bool

Source§

closed spec fn obeys_vmio_once_write_ensures() -> bool

Source§

exec fn read_once<T: PodOnce>(&self, offset: usize) -> Result<T, Error>

Source§

exec fn write_once<T: PodOnce>( &self, offset: usize, new_val: &T, ) -> Result<(), Error>

Auto Trait Implementations§

§

impl<M> Freeze for DmaCoherent<M>

§

impl<M> !RefUnwindSafe for DmaCoherent<M>

§

impl<M> Send for DmaCoherent<M>

§

impl<M> Sync for DmaCoherent<M>

§

impl<M> Unpin for DmaCoherent<M>

§

impl<M> UnsafeUnpin for DmaCoherent<M>

§

impl<M> !UnwindSafe for DmaCoherent<M>

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.

§

impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: From<T>,

§

fn obeys_from_spec() -> bool

§

fn from_spec(v: T) -> VERUS_SPEC__A

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.

§

impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: Into<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> T

§

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

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> U

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryFrom<T>,

§

fn obeys_try_from_spec() -> bool

§

fn try_from_spec( v: T, ) -> Result<VERUS_SPEC__A, <VERUS_SPEC__A as TryFrom<T>>::Error>

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.
§

impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryInto<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<T, <VERUS_SPEC__A as TryInto<T>>::Error>

§

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

§

fn obeys_try_into_spec() -> bool

§

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

§

impl<A> SpecEq<&A> for A
where A: ?Sized,

§

impl<A> SpecEq<&mut A> for A
where A: ?Sized,

§

impl<A> SpecEq<A> for A
where A: ?Sized,

§

impl<A> SpecEq<Ghost<A>> for A

§

impl<A> SpecEq<Tracked<A>> for A