pub trait Block {
// Required methods
fn read_frame(&mut self, frame: u16, out: &mut [u8; 128]) -> Result<()>;
fn write_frame(&mut self, frame: u16, data: &[u8; 128]) -> Result<()>;
// Provided method
fn write_frame_unsettled(
&mut self,
frame: u16,
data: &[u8; 128],
) -> Result<()> { ... }
}Expand description
A card as a flat array of FRAME_COUNT 128-byte frames.
This is the seam between the hardware and the filesystem: implement it once
per backing (real card, RAM image, a file on a host) and the whole Card
filesystem works unchanged.
Required Methods§
Sourcefn read_frame(&mut self, frame: u16, out: &mut [u8; 128]) -> Result<()>
fn read_frame(&mut self, frame: u16, out: &mut [u8; 128]) -> Result<()>
Read frame frame (0..FRAME_COUNT) into out.
Sourcefn write_frame(&mut self, frame: u16, data: &[u8; 128]) -> Result<()>
fn write_frame(&mut self, frame: u16, data: &[u8; 128]) -> Result<()>
Write data to frame frame (0..FRAME_COUNT).
Provided Methods§
Sourcefn write_frame_unsettled(&mut self, frame: u16, data: &[u8; 128]) -> Result<()>
fn write_frame_unsettled(&mut self, frame: u16, data: &[u8; 128]) -> Result<()>
write_frame without waiting out the card’s
commit time afterwards.
A physical card needs time to commit a frame to flash after the
transfer, and no other transaction may reach it until that has passed.
write_frame spins that time away inside the call; this variant returns
as soon as the transfer ends, and the caller owes the card
SETTLE_VBLANKS before the next read or write. CardJob is that
caller, spreading the wait over frames. A device with no commit time
(the default) simply writes.