pub trait XvcServer {
type Err: Error;
// Required methods
fn set_tck(&self, period_ns: u32) -> Result<u32, Self::Err>;
fn shift(
&self,
num_bits: u32,
tms: &[u8],
tdi: &[u8],
tdo: &mut [u8],
) -> Result<(), Self::Err>;
}Expand description
Trait that backend drivers must implement to provide JTAG functionality.
This trait defines the interface between the XVC protocol server and the actual hardware debug bridge driver. Implementors are responsible for translating high-level JTAG operations into hardware-specific commands.
See the xvc-server-debugbridge crate for examples.
Required Associated Types§
Required Methods§
Sourcefn set_tck(&self, period_ns: u32) -> Result<u32, Self::Err>
fn set_tck(&self, period_ns: u32) -> Result<u32, Self::Err>
Set the TCK (Test Clock) period.
Configures the frequency of the JTAG Test Clock (TCK). The server attempts to set the requested period. If the hardware cannot achieve the exact period, it returns the closest achievable period.
§Arguments
period_ns- The desired TCK period in nanoseconds
§Returns
The actual TCK period set by the hardware (in nanoseconds). This may differ from the requested value if the hardware has limited frequency resolution.
§Errors
Returns Self::Err if the period cannot be configured. The XVC 1.0 protocol has
no error channel, so the server logs the error and echoes the requested period back
to the client to keep the reply framing intact.
Sourcefn shift(
&self,
num_bits: u32,
tms: &[u8],
tdi: &[u8],
tdo: &mut [u8],
) -> Result<(), Self::Err>
fn shift( &self, num_bits: u32, tms: &[u8], tdi: &[u8], tdo: &mut [u8], ) -> Result<(), Self::Err>
Shift JTAG TMS and TDI vectors into the device and capture TDO data.
Performs a JTAG shift operation by:
- Shifting
tmsandtdidata into the JTAG chain - Capturing and the corresponding TDO data to
tdo
The operation is atomic with respect to the JTAG state machine.
§Arguments
num_bits- Number of TCK cycles to performtms- Test Mode Select vector (⌈num_bits / 8⌉ bytes)tdi- Test Data In vector (⌈num_bits / 8⌉ bytes)tdo- Output buffer for the Test Data Out vector. The caller passes a buffer of ⌈num_bits / 8⌉ bytes; implementations must fill it completely with the captured TDO data.
§Errors
Returns Self::Err if the hardware shift fails. The XVC 1.0 protocol has no
error channel, so the server cannot report the failure to the client: it logs
the error and sends the current contents of tdo (zeroed by the caller) as the
TDO response. Implementations should leave tdo as-is on error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".