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§
Sourcefn select(&mut self, port: Port, ack_irq: bool)
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.
Sourcefn reset_uart(&mut self)
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.
Sourcefn drain_receive(&mut self)
fn drain_receive(&mut self)
Pop stale bytes from the receive FIFO.
Sourcefn wait_ack_release(&mut self) -> bool
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.
Sourcefn clear_ack_latch(&mut self, port: Option<Port>, ack_irq: bool)
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.
Sourcefn arm_deadline(&mut self, cycles: u32)
fn arm_deadline(&mut self, cycles: u32)
Raise the timer interrupt in cycles CPU cycles, once, replacing any
deadline already armed.
Sourcefn cancel_deadline(&mut self)
fn cancel_deadline(&mut self)
Disarm the deadline.
Sourcefn deadline_expired(&mut self) -> bool
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.