pub struct DriverChain<M, const R: usize> { /* private fields */ }Expand description
A chain a driver owns: the regions the device reads, then the regions it
writes, one descriptor each, at most R in all.
The value is a description. It owns no memory and holds no descriptor
until DriverRing::publish gives it some; the bytes it names are the
driver’s, in memory M reaches by the same device addresses the device
will be given. Nothing is copied into a queue: a region may be a buffer
that already holds a payload.
Implementations§
Source§impl<M, const R: usize> DriverChain<M, R>
impl<M, const R: usize> DriverChain<M, R>
Sourcepub fn new(
memory: M,
readable: &[Region],
writable: &[Region],
) -> Result<Self, ChainShapeError>
pub fn new( memory: M, readable: &[Region], writable: &[Region], ) -> Result<Self, ChainShapeError>
A chain of readable regions followed by writable ones.
The shape is held to the protocol’s own rule here
(validate_chain_layout), so a DriverChain that exists is one a
conforming device accepts.
Sourcepub const fn descriptors(&self) -> u16
pub const fn descriptors(&self) -> u16
Descriptors the chain takes: one a region.
Trait Implementations§
Source§impl<M: SharedMemory + Debug, const R: usize> DriverChainBuffer for DriverChain<M, R>
impl<M: SharedMemory + Debug, const R: usize> DriverChainBuffer for DriverChain<M, R>
Source§type Error = MemoryFault
type Error = MemoryFault
Concrete transport byte-access failure.
Source§fn device_readable_len(&self) -> u64
fn device_readable_len(&self) -> u64
Total bytes readable by the device.
Source§fn device_writable_len(&self) -> u64
fn device_writable_len(&self) -> u64
Total bytes writable by the device.
Source§fn write_device_readable(
&mut self,
offset: u64,
source: &[u8],
) -> Result<(), MemoryFault>
fn write_device_readable( &mut self, offset: u64, source: &[u8], ) -> Result<(), MemoryFault>
Write an exact logical range into the device-readable side.
Source§fn read_device_writable(
&self,
offset: u64,
target: &mut [u8],
) -> Result<(), MemoryFault>
fn read_device_writable( &self, offset: u64, target: &mut [u8], ) -> Result<(), MemoryFault>
Read an exact logical range from the device-writable side after completion.
Auto Trait Implementations§
impl<M, const R: usize> Freeze for DriverChain<M, R>where
M: Freeze,
impl<M, const R: usize> RefUnwindSafe for DriverChain<M, R>where
M: RefUnwindSafe,
impl<M, const R: usize> Send for DriverChain<M, R>where
M: Send,
impl<M, const R: usize> Sync for DriverChain<M, R>where
M: Sync,
impl<M, const R: usize> Unpin for DriverChain<M, R>where
M: Unpin,
impl<M, const R: usize> UnsafeUnpin for DriverChain<M, R>where
M: UnsafeUnpin,
impl<M, const R: usize> UnwindSafe for DriverChain<M, R>where
M: UnwindSafe,
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