Trait opentitanlib::io::emu::Emulator
source · pub trait Emulator {
// Required methods
fn get_state(&self) -> Result<EmuState>;
fn start(
&self,
factory_reset: bool,
args: &HashMap<String, EmuValue>
) -> Result<()>;
fn stop(&self) -> Result<()>;
}
Expand description
A trait which represents a Emulator
instance
Required Methods§
sourcefn get_state(&self) -> Result<EmuState>
fn get_state(&self) -> Result<EmuState>
Simple function with return EmuState
representing current state of Emulator instance.
sourcefn start(
&self,
factory_reset: bool,
args: &HashMap<String, EmuValue>
) -> Result<()>
fn start( &self, factory_reset: bool, args: &HashMap<String, EmuValue> ) -> Result<()>
Start Emulator with provided arguments.
Parameter factory_reset
is a flag that describe if internal state
and “resources” should be set to its “initial state” before applying
the changes from the parameter args
.
If factory_reset
is set to true - all internal state and “resources”
will be set to its “initial state”. The “initial state” for most devices
means that the content is set to zero.
If factory_reset
is set to false - all internal state will be preserved
form last run.
Parameter args
describe set of named flags, value and resources passed
to Emulator in order to update the content of its internal state.
In the context of the function below, “resources” denote files
representing the state of devices, for example: EEPROM, FUSES, FLASH, SRAM…
(most often binary files). Resources files sent via parameter args
cannot be modified by the Emulator directly, the Emulator backend should have
copy-on-write implementations to enable resource modification during DUT Emulation.
It should be noted that the method of resources interpretation
and their format depends on the backend implementing the Emulator trait.
More detail about supported args
value and its content can be found
in the documentation of individual backend.