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

ControllerPort

Struct ControllerPort 

Source
pub struct ControllerPort { /* private fields */ }
Expand description

The token a HardwareCard drives the port through. The controller and memory-card port.

Implementations§

Source§

impl ControllerPort

Source

pub const unsafe fn steal() -> ControllerPort

Make a token without going through psx_rt::Peripherals::take().

§Safety

The caller must not use this token while another one of the same type is in use: two owners of one device each assume they are the only driver programming it.

Trait Implementations§

Source§

impl Debug for ControllerPort

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Transport for ControllerPort

Source§

fn status(&mut self) -> u32

Read the status register.
Source§

fn receive(&mut self) -> u8

Pop one received byte.
Source§

fn transmit(&mut self, byte: u8)

Start shifting one byte out.
Source§

fn set_mode(&mut self, value: u16)

Write the mode register.
Source§

fn set_baud(&mut self, value: u16)

Write the baud-rate reload.
Source§

fn set_control(&mut self, value: u16)

Write the control register.
Source§

fn select(&mut self, port: Port)

Configure the port for 250 kHz, 8N1 and assert /CS on port. Read more
Source§

fn select_with(&mut self, port: Port, arm_ack_irq: bool)

select with the /ACK interrupt armed when arm_ack_irq is set, so STAT latches each pulse. Only a diagnostic pacing wants that.
Source§

fn deselect(&mut self)

Release /CS, which resets the attached device’s state machine.
Source§

fn reset(&mut self)

Reset the port’s UART. A deselect alone need not cancel a late reply still in the shifter, so a failed transaction ends with this.
Source§

fn drain_receive(&mut self)

Pop up to a few stale bytes so the next reply lines up with the first byte of the transaction. Bounded, so a stuck “RX not empty” flag cannot spin forever.
Source§

fn delay(&mut self, spins: u32)

Burn time with spins status reads, which the compiler cannot remove.
Source§

fn wait_status_set(&mut self, mask: u32, spins: u32) -> bool

Spin until any bit of mask is set in the status register, at most spins reads after the first. false on timeout.
Source§

fn wait_status_clear(&mut self, mask: u32, spins: u32) -> bool

Spin until every bit of mask is clear in the status register, at most spins reads after the first. false on timeout.
Source§

fn begin(&mut self, port: Port, timing: Timing) -> bool

Start a transaction: select port, wait out the setup time, drop stale bytes, and wait for an /ACK left asserted by an aborted transaction to release, so it is not counted as the first byte’s. Read more
Source§

fn finish(&mut self, succeeded: bool)

End a transaction: release /CS, and after a failed one reset the UART as well. The next select restores mode and baud.
Source§

fn exchange( &mut self, byte: u8, is_last: bool, timing: Timing, ) -> Result<u8, ExchangeError>

Clock one byte and wait for the device’s /ACK. Read more

Auto Trait Implementations§

§

impl Freeze for ControllerPort

§

impl RefUnwindSafe for ControllerPort

§

impl Send for ControllerPort

§

impl Sync for ControllerPort

§

impl Unpin for ControllerPort

§

impl UnsafeUnpin for ControllerPort

§

impl UnwindSafe for ControllerPort

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.