pub trait RawDapAccess {
// Required methods
fn raw_read_register(
&mut self,
port: PortType,
addr: u8,
) -> Result<u32, ArmError>;
fn raw_write_register(
&mut self,
port: PortType,
addr: u8,
value: u32,
) -> Result<(), ArmError>;
fn jtag_sequence(
&mut self,
cycles: u8,
tms: bool,
tdi: u64,
) -> Result<(), DebugProbeError>;
fn swj_sequence(
&mut self,
bit_len: u8,
bits: u64,
) -> Result<(), DebugProbeError>;
fn swj_pins(
&mut self,
pin_out: u32,
pin_select: u32,
pin_wait: u32,
) -> Result<u32, DebugProbeError>;
fn into_probe(self: Box<Self>) -> Box<dyn DebugProbe>;
fn core_status_notification(
&mut self,
state: CoreStatus,
) -> Result<(), DebugProbeError>;
// Provided methods
fn raw_read_block(
&mut self,
port: PortType,
addr: u8,
values: &mut [u32],
) -> Result<(), ArmError> { ... }
fn raw_write_block(
&mut self,
port: PortType,
addr: u8,
values: &[u32],
) -> Result<(), ArmError> { ... }
fn raw_flush(&mut self) -> Result<(), ArmError> { ... }
fn configure_jtag(
&mut self,
_skip_scan: bool,
) -> Result<(), DebugProbeError> { ... }
}
Expand description
Low-level DAP register access.
Operations on this trait closely match the transactions on the wire. Implementors only do basic error handling, such as retrying WAIT errors.
Almost everything is the responsibility of the caller. For example, the caller must handle bank switching and AP selection.
Required Methods§
Sourcefn 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>
Read a DAP register.
Only the lowest 4 bits of addr
are used. Bank switching is the caller’s responsibility.
Sourcefn 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>
Write a value to a DAP register.
Only the lowest 4 bits of addr
are used. Bank switching is the caller’s responsibility.
Sourcefn 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.
This can only be used for output, and should be used to generate the initial reset sequence, for example.
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.
This can only be used for output, and should be used to generate the initial reset sequence, for example.
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.
The bits have the following meaning:
Bit 0: SWCLK/TCK Bit 1: SWDIO/TMS Bit 2: TDI Bit 3: TDO Bit 5: nTRST Bit 7: nRESET
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 core_status_notification(
&mut self,
state: CoreStatus,
) -> Result<(), DebugProbeError>
fn core_status_notification( &mut self, state: CoreStatus, ) -> Result<(), DebugProbeError>
Inform the probe of the CoreStatus
of the chip attached to the probe.
Provided Methods§
Sourcefn 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.
If possible, this uses optimized read functions, otherwise it
falls back to the read_register
function.
Only the lowest 4 bits of addr
are used. Bank switching is the caller’s responsibility.
Sourcefn 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.
If possible, this uses optimized write functions, otherwise it
falls back to the write_register
function.
Only the lowest 4 bits of addr
are used. Bank switching is the caller’s responsibility.
Sourcefn raw_flush(&mut self) -> Result<(), ArmError>
fn raw_flush(&mut self) -> Result<(), ArmError>
Flush any outstanding writes.
By default, this does nothing – but in probes that implement write batching, this needs to flush any pending writes.
Sourcefn 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).