Skip to main content
← PSoXide SDK guides and examples · SDK 80d1c329e977 · All Cargo features enabled; check feature gates before use.

Block

Trait Block 

Source
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§

Source

fn read_frame(&mut self, frame: u16, out: &mut [u8; 128]) -> Result<()>

Read frame frame (0..FRAME_COUNT) into out.

Source

fn write_frame(&mut self, frame: u16, data: &[u8; 128]) -> Result<()>

Write data to frame frame (0..FRAME_COUNT).

Provided Methods§

Source

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.

Implementors§

Source§

impl Block for RamCard

Source§

impl<P: BorrowMut<ControllerPort>> Block for HardwareCard<P>

Source§

impl<const N: usize> Block for Staged<'_, N>