pub trait XvcServer {
// Required methods
fn set_tck(&self, period_ns: u32) -> u32;
fn shift(&self, num_bits: u32, tms: Box<[u8]>, tdi: Box<[u8]>) -> Box<[u8]>;
}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 Methods§
Sourcefn set_tck(&self, period_ns: u32) -> u32
fn set_tck(&self, period_ns: u32) -> u32
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.
Sourcefn shift(&self, num_bits: u32, tms: Box<[u8]>, tdi: Box<[u8]>) -> Box<[u8]>
fn shift(&self, num_bits: u32, tms: Box<[u8]>, tdi: Box<[u8]>) -> Box<[u8]>
Shift JTAG TMS and TDI vectors into the device and return TDO data.
Performs a JTAG shift operation by:
- Shifting
tmsandtdidata into the JTAG chain - Capturing the corresponding
tdo(Test Data Out) data - Returning the captured
tdodata
The operation is atomic with respect to the JTAG state machine.
§Arguments
num_bits- Number of TCK cycles to performtms- Test Mode Select vector (must be ⌈num_bits / 8⌉ bytes)tdi- Test Data In vector (must be ⌈num_bits / 8⌉ bytes)
§Returns
Test Data Out vector of the same size as tms and tdi. On error,
an empty vector should be returned.
§Error Handling
The XVC 1.0 protocol does not support error reporting for shift operations. Implementations should return an empty box on error rather than propagating errors.