pub struct DmaSubSlice<'a, T: ImmutableFromIntoBytes> { /* private fields */ }Expand description
An immutable buffer that can be safely used for read-only DMA operations,
created from a SubSlice describing an active range in a larger buffer.
Creating a DmaSubSlice over a SubSlice ensures that all prior Rust
writes to the active region of this slice are observable by any DMA
operations initiated through an MMIO write operation, where that MMIO write
is performed after constructing the DmaSubSlice.
For this guarantee to hold, the DmaSubSlice struct must exist for the
duration of the entire DMA operation, until the Rust program has observed
that the operation is complete (such as by reading a status bit in memory or
an MMIO register).
DmaSubSlice wraps an immutable, shared Rust slice reference. As such,
its contents must not be modified by the DMA operation. For a DMA operation
that may write to the supplied buffer, use DmaSubSliceMut instead.
Implementations§
Source§impl<'a, T: ImmutableFromIntoBytes> DmaSubSlice<'a, T>
impl<'a, T: ImmutableFromIntoBytes> DmaSubSlice<'a, T>
Sourcepub fn new(
sub_slice: SubSlice<'_, T>,
fence: impl DmaFence,
) -> DmaSubSlice<'_, T>
pub fn new( sub_slice: SubSlice<'_, T>, fence: impl DmaFence, ) -> DmaSubSlice<'_, T>
Create a DmaSubSlice from a shared, immutable Rust slice.
This function uses the supplied fence object to ensure that all prior
writes to slice are exposed to any DMA operations initiated by an MMIO
read or write operation after this function returns, and which finish
before the resulting DmaSubSlice is dropped.
Sourcepub fn as_ptr(&self) -> *const T
pub fn as_ptr(&self) -> *const T
Returns the pointer to the first element of the currently accessible
portion of the wrapped SubSlice.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the currently accessible range of the wrapped
SubSlice.
Sourcepub fn as_sub_slice(&self) -> SubSlice<'a, T>
pub fn as_sub_slice(&self) -> SubSlice<'a, T>
Retrieve the wrapped SubSlice.