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>
impl<M: AnyUFrameMeta + ?Sized + OwnerOf> DmaCoherent<M>
Sourcepub exec fn map(
segment: Segment<M>,
is_cache_coherent: bool,
) -> r : Result<Self, DmaError>
pub exec fn map( segment: Segment<M>, is_cache_coherent: bool, ) -> r : Result<Self, DmaError>
requires
segment.inv(),ensuresr 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>
impl<M: AnyUFrameMeta + ?Sized> DmaCoherent<M>
Sourcepub exec fn read_inner(
&self,
) -> r : RwLockReadGuard<'_, AtomicDataWithOwner<DmaCoherentInner<M>, DmaCoherentInnerOwner<M>>, PreemptDisabled>
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>
impl<M: AnyUFrameMeta + ?Sized + OwnerOf> DmaCoherent<M>
Sourcepub exec fn daddr(&self) -> r : Daddr
pub exec fn daddr(&self) -> r : Daddr
requires
self.inner.wf(),ensuresself.inner.wf(),Returns the starting device address.
Sourcepub exec fn paddr(&self) -> r : Paddr
pub exec fn paddr(&self) -> r : Paddr
requires
self.inner.wf(),ensuresself.inner.wf(),Returns the starting physical address.
Sourcepub exec fn nframes(&self) -> r : usize
pub exec fn nframes(&self) -> r : usize
requires
self.inner.wf(),ensuresself.inner.wf(),Returns the number of frames.
Sourcepub exec fn nbytes(&self) -> r : usize
pub exec fn nbytes(&self) -> r : usize
requires
self.inner.wf(),ensuresself.inner.wf(),Returns the number of bytes in the DMA mapping.
Sourcepub exec fn reader<'a>(&'a self) -> r : VmReader<'a, Infallible>
pub exec fn reader<'a>(&'a self) -> r : VmReader<'a, Infallible>
with
->
reader_perm: Tracked<VmIoOwner>,requiresself.inner.wf(),ensuresself.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.
Sourcepub exec fn writer<'a>(&'a self) -> r : VmWriter<'a, Infallible>
pub exec fn writer<'a>(&'a self) -> r : VmWriter<'a, Infallible>
with
->
writer_perm: Tracked<VmIoOwner>,requiresself.inner.wf(),ensuresself.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>
impl<M: AnyUFrameMeta + ?Sized> Clone for DmaCoherent<M>
Source§impl<M: AnyUFrameMeta + ?Sized + OwnerOf> HasDaddr for DmaCoherent<M>
impl<M: AnyUFrameMeta + ?Sized + OwnerOf> HasDaddr for DmaCoherent<M>
Source§impl<M: AnyUFrameMeta + ?Sized + OwnerOf> HasPaddr for DmaCoherent<M>
impl<M: AnyUFrameMeta + ?Sized + OwnerOf> HasPaddr for DmaCoherent<M>
Source§impl<M: AnyUFrameMeta + ?Sized> Inv for DmaCoherent<M>
impl<M: AnyUFrameMeta + ?Sized> Inv for DmaCoherent<M>
Source§impl<M: AnyUFrameMeta + ?Sized + Send + Sync + OwnerOf> VmIoOnce for DmaCoherent<M>
impl<M: AnyUFrameMeta + ?Sized + Send + Sync + OwnerOf> VmIoOnce for DmaCoherent<M>
Source§closed spec fn obeys_vmio_once_read_requires() -> bool
closed spec fn obeys_vmio_once_read_requires() -> bool
Source§closed spec fn obeys_vmio_once_write_requires() -> bool
closed spec fn obeys_vmio_once_write_requires() -> bool
Source§closed spec fn obeys_vmio_once_read_ensures() -> bool
closed spec fn obeys_vmio_once_read_ensures() -> bool
Source§closed spec fn obeys_vmio_once_write_ensures() -> bool
closed spec fn obeys_vmio_once_write_ensures() -> bool
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more