jtag_taps/
lib.rs

1//! This crate allows for interacting with a JTAG test chain at a variety of levels
2//! of abstraction.  At the lowest level, you can directly interact with a JTAG
3//! cable, such as those based on the "jtagkey" design.  Other FT2232-based cables
4//! could easily be added, as well as direct GPIO control.  The Cable trait allows
5//! for changing modes and shifting bits in and out of the JTAG chain.
6//! 
7//! The next higher level of abstraction is the JtagSM, which keeps track of the
8//! mode of the TAPs.  You tell it which mode you want (e.g., Reset or Idle) and it
9//! gets there with the fewest number of mode changes.  You can also read and write
10//! the instruction and data registers.  read_write and write_reg take care of
11//! getting to ShiftDR or ShiftIR mode as appropriate.
12//! 
13//! If there are multiple TAPs in the JTAG chain, you probably want to use the
14//! methods associated with the Taps struct.  You tell Taps how much TAPs exist and
15//! what the IR length is for each one.  You can then read and write the
16//! instruction and data registers for that one TAP, and it will take care of
17//! putting other TAPs in BYPASS and shifting data in and out as appropriate.  Taps
18//! also has some support for automatically detecting the IR lengths and ID codes
19//! of the TAPs.
20//! 
21//! # Example
22//! ```
23//! use jtag_taps::cable::jtagkey::JtagKey;
24//! use jtag_taps::statemachine::JtagSM;
25//! use jtag_taps::taps::Taps;
26//! let cable = JtagKey::new("Dual RS232-HS A", 1 << 20);
27//! let jtag = JtagSM::new(Box::new(cable));
28//! let mut taps = Taps::new(jtag);
29//! taps.detect();
30//! 
31//! let ir = vec![235, 0];
32//! taps.select_tap(0, &ir);
33//! let buf = vec![
34//!     0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
35//! ];
36//! taps.write_dr(&buf, 8);
37//! ```
38
39pub mod cable;
40pub mod statemachine;
41pub mod taps;