Trait probe_rs::DebugProbe
source · [−]pub trait DebugProbe: Send + Debug {
Show 20 methods
fn new_from_selector(
selector: impl Into<DebugProbeSelector>
) -> Result<Box<Self>, DebugProbeError>
where
Self: Sized;
fn get_name(&self) -> &str;
fn speed_khz(&self) -> u32;
fn set_speed(&mut self, speed_khz: u32) -> Result<u32, DebugProbeError>;
fn attach(&mut self) -> Result<(), DebugProbeError>;
fn detach(&mut self) -> Result<(), DebugProbeError>;
fn target_reset(&mut self) -> Result<(), DebugProbeError>;
fn target_reset_assert(&mut self) -> Result<(), DebugProbeError>;
fn target_reset_deassert(&mut self) -> Result<(), DebugProbeError>;
fn select_protocol(
&mut self,
protocol: WireProtocol
) -> Result<(), DebugProbeError>;
fn active_protocol(&self) -> Option<WireProtocol>;
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>;
fn has_arm_interface(&self) -> bool { ... }
fn try_get_arm_interface<'probe>(
self: Box<Self>
) -> Result<Box<dyn UninitializedArmProbe + 'probe>, (Box<dyn DebugProbe>, DebugProbeError)> { ... }
fn try_get_riscv_interface(
self: Box<Self>
) -> Result<RiscvCommunicationInterface, (Box<dyn DebugProbe>, DebugProbeError)> { ... }
fn has_riscv_interface(&self) -> bool { ... }
fn get_swo_interface(&self) -> Option<&dyn SwoAccess> { ... }
fn get_swo_interface_mut(&mut self) -> Option<&mut dyn SwoAccess> { ... }
fn try_as_dap_probe(&mut self) -> Option<&mut dyn DapProbe> { ... }
fn get_target_voltage(&mut self) -> Result<Option<f32>, DebugProbeError> { ... }
}
Expand description
An abstraction over general debug probe functionality.
This trait has to be implemented by ever debug probe driver.
Required Methods
fn 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.
Get the currently used maximum speed for the debug protocol in kHz.
Not all probes report which speed is used, meaning this value is not always the actual speed used. However, the speed should not be any higher than this value.
Set the speed in kHz used for communication with the target device.
The desired speed might not be supported by the probe. If the desired speed is not directly supported, a lower speed will be selected if possible.
If possible, the actual speed used is returned by the function. Some probes cannot report this, so the value may be inaccurate.
If the requested speed is not supported,
DebugProbeError::UnsupportedSpeed
will be returned.
fn attach(&mut self) -> Result<(), DebugProbeError>
fn attach(&mut self) -> Result<(), DebugProbeError>
Attach to the chip.
This should run all the necessary protocol init routines.
fn detach(&mut self) -> Result<(), DebugProbeError>
fn detach(&mut self) -> Result<(), DebugProbeError>
Detach from the chip.
This should run all the necessary protocol deinit routines.
fn target_reset(&mut self) -> Result<(), DebugProbeError>
fn target_reset(&mut self) -> Result<(), DebugProbeError>
This should hard reset the target device.
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.
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.
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.
fn active_protocol(&self) -> Option<WireProtocol>
fn active_protocol(&self) -> Option<WireProtocol>
Get the transport protocol currently in active use by the debug probe.
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>
Boxes itself.
Provided Methods
fn has_arm_interface(&self) -> bool
fn has_arm_interface(&self) -> bool
Check if the proble offers an interface to debug ARM chips.
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.
fn 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.
fn has_riscv_interface(&self) -> bool
fn has_riscv_interface(&self) -> bool
Check if the probe offers an interface to debug RISCV chips.
fn get_swo_interface(&self) -> Option<&dyn SwoAccess>
fn get_swo_interface(&self) -> Option<&dyn SwoAccess>
Get a SWO interface from the debug probe.
This is not available on all debug probes.
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.
This is not available on all debug probes.
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.
This is not available on all probes.
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.