pub struct FakeProbe { /* private fields */ }
Expand description
This is a mock probe which can be used for mocking things in tests or for dry runs.
Implementations
sourceimpl FakeProbe
impl FakeProbe
sourcepub fn set_dap_register_read_handler(
&mut self,
handler: Box<dyn Fn(PortType, u8) -> Result<u32, DebugProbeError> + Send>
)
pub fn set_dap_register_read_handler(
&mut self,
handler: Box<dyn Fn(PortType, u8) -> Result<u32, DebugProbeError> + Send>
)
This sets the read handler for DAP register reads. Can be used to hook into the read.
sourcepub fn set_dap_register_write_handler(
&mut self,
handler: Box<dyn Fn(PortType, u8, u32) -> Result<(), DebugProbeError> + Send>
)
pub fn set_dap_register_write_handler(
&mut self,
handler: Box<dyn Fn(PortType, u8, u32) -> Result<(), DebugProbeError> + Send>
)
This sets the write handler for DAP register writes. Can be used to hook into the write.
sourcepub fn into_probe(self) -> Probe
pub fn into_probe(self) -> Probe
Makes a generic probe out of the FakeProbe
Trait Implementations
sourceimpl DebugProbe for FakeProbe
impl DebugProbe for FakeProbe
sourcefn detach(&mut self) -> Result<(), DebugProbeError>
fn detach(&mut self) -> Result<(), DebugProbeError>
Leave debug mode
sourcefn target_reset(&mut self) -> Result<(), DebugProbeError>
fn target_reset(&mut self) -> Result<(), DebugProbeError>
Resets the target device.
sourcefn new_from_selector(
_selector: impl Into<DebugProbeSelector>
) -> Result<Box<Self>, DebugProbeError> where
Self: Sized,
fn new_from_selector(
_selector: impl Into<DebugProbeSelector>
) -> Result<Box<Self>, DebugProbeError> where
Self: Sized,
Creates a new boxed DebugProbe
from a given DebugProbeSelector
.
This will be called for all available debug drivers when discovering probes.
When opening, it will open the first probe which succeds during this call. Read more
sourcefn speed_khz(&self) -> u32
fn speed_khz(&self) -> u32
Get the currently used maximum speed for the debug protocol in kHz. Read more
sourcefn set_speed(&mut self, speed_khz: u32) -> Result<u32, DebugProbeError>
fn set_speed(&mut self, speed_khz: u32) -> Result<u32, DebugProbeError>
Set the speed in kHz used for communication with the target device. Read more
sourcefn select_protocol(
&mut self,
protocol: WireProtocol
) -> Result<(), DebugProbeError>
fn select_protocol(
&mut self,
protocol: WireProtocol
) -> Result<(), DebugProbeError>
Selects the transport protocol to be used by the debug probe.
sourcefn active_protocol(&self) -> Option<WireProtocol>
fn active_protocol(&self) -> Option<WireProtocol>
Get the transport protocol currently in active use by the debug probe.
sourcefn target_reset_assert(&mut self) -> Result<(), DebugProbeError>
fn target_reset_assert(&mut self) -> Result<(), DebugProbeError>
This should assert the reset pin of the target via debug probe.
sourcefn target_reset_deassert(&mut self) -> Result<(), DebugProbeError>
fn target_reset_deassert(&mut self) -> Result<(), DebugProbeError>
This should deassert the reset pin of the target via debug probe.
sourcefn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
Boxes itself.
sourcefn try_get_arm_interface<'probe>(
self: Box<Self>
) -> Result<Box<dyn UninitializedArmProbe + 'probe>, (Box<dyn DebugProbe>, DebugProbeError)>
fn try_get_arm_interface<'probe>(
self: Box<Self>
) -> Result<Box<dyn UninitializedArmProbe + 'probe>, (Box<dyn DebugProbe>, DebugProbeError)>
Get the dedicated interface to debug ARM chips. To check that the probe actually supports this, call DebugProbe::has_arm_interface first. Read more
sourcefn has_arm_interface(&self) -> bool
fn has_arm_interface(&self) -> bool
Check if the proble offers an interface to debug ARM chips.
sourcefn try_get_riscv_interface(
self: Box<Self>
) -> Result<RiscvCommunicationInterface, (Box<dyn DebugProbe>, DebugProbeError)>
fn try_get_riscv_interface(
self: Box<Self>
) -> Result<RiscvCommunicationInterface, (Box<dyn DebugProbe>, DebugProbeError)>
Get the dedicated interface to debug RISCV chips. Ensure that the probe actually supports this by calling DebugProbe::has_riscv_interface first. Read more
sourcefn has_riscv_interface(&self) -> bool
fn has_riscv_interface(&self) -> bool
Check if the probe offers an interface to debug RISCV chips.
sourcefn get_swo_interface(&self) -> Option<&dyn SwoAccess>
fn get_swo_interface(&self) -> Option<&dyn SwoAccess>
Get a SWO interface from the debug probe. Read more
sourcefn get_swo_interface_mut(&mut self) -> Option<&mut dyn SwoAccess>
fn get_swo_interface_mut(&mut self) -> Option<&mut dyn SwoAccess>
Get a mutable SWO interface from the debug probe. Read more
sourcefn try_as_dap_probe(&mut self) -> Option<&mut dyn DapProbe>
fn try_as_dap_probe(&mut self) -> Option<&mut dyn DapProbe>
Try creating a DAP interface for the given probe. Read more
sourcefn get_target_voltage(&mut self) -> Result<Option<f32>, DebugProbeError>
fn get_target_voltage(&mut self) -> Result<Option<f32>, DebugProbeError>
Reads the target voltage in Volts, if possible. Returns Ok(None)
if the probe doesn’t support reading the target voltage. Read more
sourceimpl RawDapAccess for FakeProbe
impl RawDapAccess for FakeProbe
sourcefn raw_read_register(
&mut self,
port: PortType,
addr: u8
) -> Result<u32, DebugProbeError>
fn raw_read_register(
&mut self,
port: PortType,
addr: u8
) -> Result<u32, DebugProbeError>
Reads the DAP register on the specified port and address
sourcefn raw_write_register(
&mut self,
port: PortType,
addr: u8,
value: u32
) -> Result<(), DebugProbeError>
fn raw_write_register(
&mut self,
port: PortType,
addr: u8,
value: u32
) -> Result<(), DebugProbeError>
Writes a value to the DAP register on the specified port and address
sourcefn select_dp(&mut self, _dp: DpAddress) -> Result<(), DebugProbeError>
fn select_dp(&mut self, _dp: DpAddress) -> Result<(), DebugProbeError>
Select the debug port to operate on.
sourcefn swj_sequence(
&mut self,
_bit_len: u8,
_bits: u64
) -> Result<(), DebugProbeError>
fn swj_sequence(
&mut self,
_bit_len: u8,
_bits: u64
) -> Result<(), DebugProbeError>
Send a specific output sequence over JTAG or SWD. Read more
sourcefn swj_pins(
&mut self,
_pin_out: u32,
_pin_select: u32,
_pin_wait: u32
) -> Result<u32, DebugProbeError>
fn swj_pins(
&mut self,
_pin_out: u32,
_pin_select: u32,
_pin_wait: u32
) -> Result<u32, DebugProbeError>
Set the state of debugger output pins directly. Read more
sourcefn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
Cast this interface into a generic DebugProbe
.
sourcefn raw_read_block(
&mut self,
port: PortType,
addr: u8,
values: &mut [u32]
) -> Result<(), DebugProbeError>
fn raw_read_block(
&mut self,
port: PortType,
addr: u8,
values: &mut [u32]
) -> Result<(), DebugProbeError>
Read multiple values from the same DAP register. Read more
sourcefn raw_write_block(
&mut self,
port: PortType,
addr: u8,
values: &[u32]
) -> Result<(), DebugProbeError>
fn raw_write_block(
&mut self,
port: PortType,
addr: u8,
values: &[u32]
) -> Result<(), DebugProbeError>
Write multiple values to the same DAP register. Read more
Auto Trait Implementations
impl !RefUnwindSafe for FakeProbe
impl Send for FakeProbe
impl !Sync for FakeProbe
impl Unpin for FakeProbe
impl !UnwindSafe for FakeProbe
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more