pub struct Request { /* private fields */ }Expand description
A run of sectors to read into memory.
Built with Request::new_raw, then refined with the with_* methods.
Implementations§
Source§impl Request
impl Request
Sourcepub const unsafe fn new_raw(
lba: u32,
sectors: u32,
destination: *mut u32,
) -> Self
pub const unsafe fn new_raw( lba: u32, sectors: u32, destination: *mut u32, ) -> Self
Read sectors sectors starting at lba (program-relative, shifted by
the loader’s disc base like every SDK disc read) into destination.
§Safety
destination must be word-aligned and valid for writes of
sectors * 2048 bytes, and nothing else may read or write that memory
from the moment the request is submitted until it has finished
(see Engine::state). The transport writes
from the interrupt handler, so the memory is not held by any borrow the
compiler can see. Memory that is only ever read through read_volatile
until the request finishes meets this.
Sourcepub const fn with_priority(self, priority: Priority) -> Self
pub const fn with_priority(self, priority: Priority) -> Self
Serve this request at priority.
Sourcepub const fn with_resumes(self, times: u8) -> Self
pub const fn with_resumes(self, times: u8) -> Self
Let the transport pick this request up again from where it stopped,
up to times times, when the drive reports an error mid-transfer.
Each resume costs the recovery pause and one seek. With 0 (the
default) an error ends the request as Outcome::Failed and the
caller decides.
Sourcepub const fn with_byte_len(self, bytes: u32) -> Self
pub const fn with_byte_len(self, bytes: u32) -> Self
Store only bytes bytes instead of sectors * 2048: the last sector
is popped whole but only its first words, rounded up to a word, are
written, so a transfer never writes past a chunk that does not end on
a sector boundary.
bytes must lie in (sectors - 1) * 2048 + 1 ..= sectors * 2048;
anything else is ignored (every sector stored whole). The destination
then only has to be valid for bytes rounded up to a word.
Sourcepub const fn end_lba(&self) -> u32
pub const fn end_lba(&self) -> u32
The sector after the last one, where a request that can chain onto this one starts.
Sourcepub unsafe fn remaining_after(&self, received: u32) -> Option<Request>
pub unsafe fn remaining_after(&self, received: u32) -> Option<Request>
The rest of this request after received sectors landed: the request
to submit to continue an aborted or failed transfer. None when
nothing is left.
The result is a request like any other. It starts with a fresh seek,
at lba + received, into the destination advanced by received
sectors, with the same priority and resume budget.
§Safety
received must be a count the transport reported for this request
(or lower): the memory the new request writes is the tail of this
request’s destination, and the safety contract of
new_raw applies to it again.
Trait Implementations§
impl Copy for Request
impl Eq for Request
impl StructuralPartialEq for Request
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl !Send for Request
impl !Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)