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

Hw

Trait Hw 

Source
pub trait Hw {
    // Required methods
    fn status(&mut self) -> u32;
    fn select(&mut self, port: Port, ack_irq: bool);
    fn deselect(&mut self);
    fn reset_uart(&mut self);
    fn drain_receive(&mut self);
    fn transmit(&mut self, byte: u8);
    fn receive(&mut self) -> u8;
    fn wait_ack_release(&mut self) -> bool;
    fn clear_ack_latch(&mut self, port: Option<Port>, ack_irq: bool);
    fn arm_deadline(&mut self, cycles: u32);
    fn cancel_deadline(&mut self);
    fn deadline_expired(&mut self) -> bool;
}
Expand description

What the engine needs from the console: the serial port, and one timer that raises an interrupt after a number of CPU cycles.

Required Methods§

Source

fn status(&mut self) -> u32

The status register.

Source

fn select(&mut self, port: Port, ack_irq: bool)

Configure 250 kHz 8N1, clear a stale latched IRQ, and assert /CS on port with the /ACK interrupt armed when ack_irq.

Source

fn deselect(&mut self)

Release /CS.

Source

fn reset_uart(&mut self)

Reset the UART, so a reply still in flight from an abandoned packet cannot be taken for the next one’s.

Source

fn drain_receive(&mut self)

Pop stale bytes from the receive FIFO.

Source

fn transmit(&mut self, byte: u8)

Start shifting one byte out.

Source

fn receive(&mut self) -> u8

Pop one received byte.

Source

fn wait_ack_release(&mut self) -> bool

Wait, a few microseconds at most, for a pulse of /ACK already seen to end. false when the line stays asserted.

Source

fn clear_ack_latch(&mut self, port: Option<Port>, ack_irq: bool)

Clear the latched /ACK IRQ so the next pulse raises IRQ7 again, leaving /CS asserted on port, or released when None.

Source

fn arm_deadline(&mut self, cycles: u32)

Raise the timer interrupt in cycles CPU cycles, once, replacing any deadline already armed.

Source

fn cancel_deadline(&mut self)

Disarm the deadline.

Source

fn deadline_expired(&mut self) -> bool

Whether the armed deadline has been reached. An interrupt left over from a deadline that was cancelled or replaced answers false.

Implementors§

Source§

impl Hw for Mmio