ScsiBus

Struct ScsiBus 

Source
pub struct ScsiBus {
Show 27 fields pub disc: Option<Rc<Disc>>, pub cdda: CddaPlayer, pub switches: ScsiSwitches, pub now: i64, pub log: Vec<(i64, String)>, pub record_log: bool, pub irq_changes: Vec<(u8, bool)>, pub bsy: bool, pub sel: bool, pub cd: bool, pub io: bool, pub msg: bool, pub req: bool, pub ack: bool, pub atn: bool, pub rst: bool, pub phase: Phase, pub data_port: u8, pub read_port: u8, pub message_done: bool, pub sector: i64, pub sectors_left: i64, pub last_lba: i64, pub cmd: Vec<u8>, pub out: VecDeque<u8>, pub sense_key: u8, pub sense_asc: u8, /* private fields */
}
Expand description

Signals, phase, timers and the command set. irq_changes collects (mask, level) when the REQ-held-in-a-phase conditions change (mask 0x40 data in, 0x20 status/message).

Fields§

§disc: Option<Rc<Disc>>§cdda: CddaPlayer§switches: ScsiSwitches§now: i64§log: Vec<(i64, String)>

(mclk, text) of commands, for the tests and runs

§record_log: bool§irq_changes: Vec<(u8, bool)>§bsy: bool§sel: bool§cd: bool§io: bool§msg: bool§req: bool§ack: bool§atn: bool§rst: bool§phase: Phase§data_port: u8

what the CPU wrote

§read_port: u8

what the drive presents

§message_done: bool§sector: i64

next LBA to deliver

§sectors_left: i64§last_lba: i64

where the head is (for seek times)

§cmd: Vec<u8>§out: VecDeque<u8>§sense_key: u8§sense_asc: u8

Implementations§

Source§

impl ScsiBus

Source

pub fn new(disc: Option<Rc<Disc>>, cdda: CddaPlayer) -> ScsiBus

Source

pub fn reset(&mut self)

Source

pub fn status_bits(&self) -> u8

$1800 read: I/O D3, C/D D4, MSG D5, REQ D6, BSY D7 [emu: all].

Source

pub fn current_lba(&self) -> i64

Source

pub fn next_event(&self) -> Option<i64>

Source

pub fn run_to(&mut self, mclk: i64)

Fire every timer due at or before mclk, in time order.

Source

pub fn status_message(&mut self, status: u8, message: u8, length: usize)

Enter the status phase with status; length message bytes follow.

Source

pub fn good_status(&mut self)

Source

pub fn select(&mut self)

A write to $1800: SEL pulses. From any phase but data in this starts a command.

Source

pub fn write_data(&mut self, value: u8)

Source

pub fn read_data(&self) -> u8

Source

pub fn set_ack(&mut self, level: bool)

Source

pub fn pulse_ack(&mut self)

A $1808 data read: ACK for a moment, so the next byte is presented without the CPU’s own handshake [emu: Mesen2; the pulse width is its measurement].

Source

pub fn set_reset(&mut self, level: bool)

$1804 bit 1: the SCSI RST line.

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for ScsiBus

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ScsiBus

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for ScsiBus

§

impl !RefUnwindSafe for ScsiBus

§

impl !Send for ScsiBus

§

impl !Sync for ScsiBus

§

impl Unpin for ScsiBus

§

impl !UnwindSafe for ScsiBus

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,