pub struct HardwareCard<P = ControllerPort> { /* private fields */ }Expand description
A physical memory card reached over SIO0.
P is how the card holds the port: the ControllerPort token (the
default) or a &mut ControllerPort borrowed from the program for the
length of the card’s use. While a card holds the port, a pad poll cannot
borrow it:
ⓘ
use psx_mc::{HardwareCard, Slot};
use psx_io::periph::ControllerPort;
// SAFETY: the doctest never touches the port; it only has to compile.
let mut port = unsafe { ControllerPort::steal() };
let mut card = HardwareCard::on_port(&mut port, Slot::One);
let other_driver = &mut port; // the card still holds the borrow
let _ = card.last_trace();
let _ = other_driver;Implementations§
Source§impl<P: BorrowMut<ControllerPort>> HardwareCard<P>
impl<P: BorrowMut<ControllerPort>> HardwareCard<P>
Sourcepub fn on_port(port: P, slot: Slot) -> Self
pub fn on_port(port: P, slot: Slot) -> Self
A card on slot, reached through port (the token, or a borrow of
it), with the memory card’s default Timing.
Sourcepub fn on_port_with_timing(port: P, slot: Slot, timing: Timing) -> Self
pub fn on_port_with_timing(port: P, slot: Slot, timing: Timing) -> Self
Sourcepub fn release(self) -> P
pub fn release(self) -> P
Give the port back: the token when the card owned it, the borrow otherwise.
Sourcepub fn last_trace(&self) -> TransportTrace
pub fn last_trace(&self) -> TransportTrace
Diagnostic evidence from the most recent frame read or write.
Sourcepub fn controller_port(&mut self) -> &mut ControllerPort
pub fn controller_port(&mut self) -> &mut ControllerPort
The port, between transactions, for another driver that shares it (a pad poll). Every frame read or write finishes inside its own call, so the card is never mid-transaction when this is reachable.