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§
Source§impl FakeProbe
impl FakeProbe
Sourcepub fn with_mocked_core() -> Self
pub fn with_mocked_core() -> Self
Fake probe with a mocked core
Sourcepub fn set_dap_register_read_handler(
&mut self,
handler: Box<dyn Fn(PortType, u8) -> Result<u32, ArmError> + Send>,
)
pub fn set_dap_register_read_handler( &mut self, handler: Box<dyn Fn(PortType, u8) -> Result<u32, ArmError> + 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<(), ArmError> + Send>,
)
pub fn set_dap_register_write_handler( &mut self, handler: Box<dyn Fn(PortType, u8, u32) -> Result<(), ArmError> + 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
pub fn expect_operation(&self, operation: Operation)
Trait Implementations§
Source§impl DebugProbe for FakeProbe
impl DebugProbe for FakeProbe
Source§fn target_reset(&mut self) -> Result<(), DebugProbeError>
fn target_reset(&mut self) -> Result<(), DebugProbeError>
Resets the target device.
Source§fn speed_khz(&self) -> u32
fn speed_khz(&self) -> u32
Get the currently used maximum speed for the debug protocol in kHz. Read more
Source§fn set_scan_chain(
&mut self,
scan_chain: Vec<ScanChainElement>,
) -> Result<(), DebugProbeError>
fn set_scan_chain( &mut self, scan_chain: Vec<ScanChainElement>, ) -> Result<(), DebugProbeError>
Set the JTAG scan chain information for the target under debug. Read more
Source§fn scan_chain(&self) -> Result<&[ScanChainElement], DebugProbeError>
fn scan_chain(&self) -> Result<&[ScanChainElement], DebugProbeError>
Returns the JTAG scan chain
Source§fn 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
Source§fn 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.
Source§fn active_protocol(&self) -> Option<WireProtocol>
fn active_protocol(&self) -> Option<WireProtocol>
Get the transport protocol currently in active use by the debug probe.
Source§fn 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.
Source§fn 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.
Source§fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
Boxes itself.
Source§fn 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.
Source§fn has_arm_interface(&self) -> bool
fn has_arm_interface(&self) -> bool
Check if the probe offers an interface to debug ARM chips.
Source§fn select_jtag_tap(&mut self, index: usize) -> Result<(), DebugProbeError>
fn select_jtag_tap(&mut self, index: usize) -> Result<(), DebugProbeError>
Selects the JTAG TAP to be used for communication.
Source§fn try_get_riscv_interface_builder<'probe>(
&'probe mut self,
) -> Result<Box<dyn RiscvInterfaceBuilder<'probe> + 'probe>, DebugProbeError>
fn try_get_riscv_interface_builder<'probe>( &'probe mut self, ) -> Result<Box<dyn RiscvInterfaceBuilder<'probe> + 'probe>, DebugProbeError>
Try to get a
RiscvInterfaceBuilder
object, which can be used to set up a communication
interface with chips using the RISC-V architecture. Read moreSource§fn has_riscv_interface(&self) -> bool
fn has_riscv_interface(&self) -> bool
Check if the probe offers an interface to debug RISC-V chips.
Source§fn try_get_xtensa_interface<'probe>(
&'probe mut self,
_state: &'probe mut XtensaDebugInterfaceState,
) -> Result<XtensaCommunicationInterface<'probe>, DebugProbeError>
fn try_get_xtensa_interface<'probe>( &'probe mut self, _state: &'probe mut XtensaDebugInterfaceState, ) -> Result<XtensaCommunicationInterface<'probe>, DebugProbeError>
Get the dedicated interface to debug Xtensa chips. Ensure that the
probe actually supports this by calling DebugProbe::has_xtensa_interface first.
Source§fn has_xtensa_interface(&self) -> bool
fn has_xtensa_interface(&self) -> bool
Check if the probe offers an interface to debug Xtensa chips.
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn 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.Source§fn try_into_jlink(&mut self) -> Result<&mut JLink, DebugProbeError>
fn try_into_jlink(&mut self) -> Result<&mut JLink, DebugProbeError>
Try to get a J-Link interface from the debug probe.
Source§impl RawDapAccess for FakeProbe
impl RawDapAccess for FakeProbe
Source§fn raw_read_register(
&mut self,
port: PortType,
addr: u8,
) -> Result<u32, ArmError>
fn raw_read_register( &mut self, port: PortType, addr: u8, ) -> Result<u32, ArmError>
Reads the DAP register on the specified port and address
Source§fn raw_write_register(
&mut self,
port: PortType,
addr: u8,
value: u32,
) -> Result<(), ArmError>
fn raw_write_register( &mut self, port: PortType, addr: u8, value: u32, ) -> Result<(), ArmError>
Writes a value to the DAP register on the specified port and address
Source§fn jtag_sequence(
&mut self,
_cycles: u8,
_tms: bool,
_tdi: u64,
) -> Result<(), DebugProbeError>
fn jtag_sequence( &mut self, _cycles: u8, _tms: bool, _tdi: u64, ) -> Result<(), DebugProbeError>
Send a specific output sequence over JTAG. Read more
Source§fn 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
Source§fn 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
Source§fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
Cast this interface into a generic
DebugProbe
.Source§fn core_status_notification(
&mut self,
_: CoreStatus,
) -> Result<(), DebugProbeError>
fn core_status_notification( &mut self, _: CoreStatus, ) -> Result<(), DebugProbeError>
Inform the probe of the
CoreStatus
of the chip attached to the probe.Source§fn raw_read_block(
&mut self,
port: PortType,
addr: u8,
values: &mut [u32],
) -> Result<(), ArmError>
fn raw_read_block( &mut self, port: PortType, addr: u8, values: &mut [u32], ) -> Result<(), ArmError>
Read multiple values from the same DAP register. Read more
Source§fn raw_write_block(
&mut self,
port: PortType,
addr: u8,
values: &[u32],
) -> Result<(), ArmError>
fn raw_write_block( &mut self, port: PortType, addr: u8, values: &[u32], ) -> Result<(), ArmError>
Write multiple values to the same DAP register. Read more
Source§fn configure_jtag(&mut self, _skip_scan: bool) -> Result<(), DebugProbeError>
fn configure_jtag(&mut self, _skip_scan: bool) -> Result<(), DebugProbeError>
Configures the probe for JTAG use (specifying IR lengths of each DAP).
Auto Trait Implementations§
impl !Freeze for FakeProbe
impl !RefUnwindSafe for FakeProbe
impl Send for FakeProbe
impl !Sync for FakeProbe
impl Unpin for FakeProbe
impl !UnwindSafe for FakeProbe
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.