pub enum Message<B = Box<[u8]>> {
GetInfo,
SetTck {
period_ns: u32,
},
Shift {
num_bits: u32,
tms: B,
tdi: B,
},
}Expand description
A Message is transferred from the client to the server. For each message, the client is expected to send the message and wait for a response from the server. The server needs to process each message in the order received and promptly provide a response. For the XVC 1.0 protocol, only one connection is assumed.
Variants§
GetInfo
Requests info from the server. This is used to determine protocol capabilities of the server.
SetTck
Configures the TCK period. When sending JTAG vectors the TCK rate may need to be varied to accommodate cable and board signal integrity conditions. This command is used by clients to adjust the TCK rate in order to slow down or speed up the shifting of JTAG vectors.
Shift
Used to shift JTAG vectors in-and out of a device.
Implementations§
Source§impl Message<Box<[u8]>>
impl Message<Box<[u8]>>
Sourcepub fn from_reader(
reader: &mut impl Read,
max_shift_bytes: usize,
) -> Result<OwnedMessage, ReadError>
pub fn from_reader( reader: &mut impl Read, max_shift_bytes: usize, ) -> Result<OwnedMessage, ReadError>
Read a Message from reader using an internal Decoder.
This is a convenience wrapper that constructs a Decoder configured
with max_shift_bytes and delegates to its read_message method.
Example:
use std::io::Cursor;
let mut c = Cursor::new(b"getinfo:");
let msg = xvc_protocol::OwnedMessage::from_reader(&mut c, 1024).unwrap();
assert!(matches!(msg, xvc_protocol::Message::GetInfo));Sourcepub fn borrow<'a>(&'a self) -> BorrowedMessage<'a>
pub fn borrow<'a>(&'a self) -> BorrowedMessage<'a>
Borrows this message into a BorrowedMessage
Source§impl<B: AsRef<[u8]>> Message<B>
impl<B: AsRef<[u8]>> Message<B>
Sourcepub fn write_to(&self, writer: &mut impl Write) -> Result<()>
pub fn write_to(&self, writer: &mut impl Write) -> Result<()>
Serialize this Message to writer in the protocol command format.
GetInfois written asgetinfo:SetTckis written assettck:followed by a 4-byte little-endian periodShiftis written asshift:followed by a 4-byte little-endiannum_bits, then thetmsandtdipayload bytes
The function writes raw bytes and returns any I/O error encountered.