pub struct DmaSlice<'a, T: ImmutableFromIntoBytes> { /* private fields */ }Expand description
An immutable buffer that can be safely used for read-only DMA operations.
The buffer can be a slice of any type which implements
ImmutableFromIntoBytes,
such as u8 or u32.
DmaSlice wraps an immutable slice. As such, its contents MUST NOT be
modified by the DMA operation. For a DMA operation that may write to the
supplied buffer, use DmaSliceMut instead.
§Use with DMA
Creating a DmaSlice over an immutable Rust slice ensures that all prior
Rust writes to this slice are observable by any DMA operations initiated
through an MMIO write operation, where that MMIO write is performed after
constructing the DmaSlice.
For this guarantee to hold, the DmaSlice instance 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).
This struct uses a DmaFence implementation to ensure that all prior
writes to slice are exposed to any DMA operations initiated by an MMIO
read or write operation issued after this function returns, and which finish
before the resulting DmaSlice is dropped.