jtag_scanner/lib.rs
1//! JTAG boundary scanning module.
2//!
3//! **WARNING**: This tool may damage your hardware in `EXTEST` mode, especially when the target
4//! is not a development board: to reduce the risk, do not enable the output of any pin with
5//! unknown functionality for a long time (the duration should be as short as possible).
6//!
7//! ## Usage
8//!
9//! ### Building the `PinScanner`
10//! - Check for [compatible debug adapters](jtag_taps::cable), connect the adapter to the target,
11//! connect the adapter to the PC and power on the target;
12//! - With the `backend-jtag-taps` feature of `jtag-scanner` enabled, construct and configure a
13//! [Cable](jtag_taps::cable::Cable) instance;
14//! - Create a [`PinScannerBuilder`] with the `Cable` instance, and (optionally) check the result of
15//! [get_id_codes](PinScannerBuilder::get_id_codes) to make sure the TAP chain is working;
16//! - With the builder, call [scan_tap_info](PinScannerBuilder::scan_tap_info) with a directory path
17//! for scanning BSDL files, then call [build](PinScannerBuilder::build) to build the [`PinScanner`].
18//!
19//! ### Using the `PinScanner`
20//! - Enumerate in [tap_infos](PinScanner::tap_infos) to get the index of the TAP that you want to control.
21//! - Get [`PinId`] values via [get_pin_id](PinScanner::get_pin_id), providing the port name as the argument;
22//! or iterate through [pin_ids_for_tap](PinScanner::pin_ids_for_tap).
23//! - Set the TAP to `SAMPLE` or `EXTEST` mode by [set_tap_state](PinScanner::set_tap_state).
24//! - Call [get_pin_state](PinScanner::get_pin_state) or [set_pin_state](PinScanner::set_pin_state), and then
25//! [update](PinScanner::update) or [write_update](PinScanner::write_update).
26//! - Check [`PinScanner::batch`] if higher transmission efficiency is required.
27//!
28//! ### Creating bitbang IO interface adapters
29//! Some adapters (e.g. I2C, NOR and NAND flash) may be added in the future. These adapters should
30//! depend on [`PinGroup`] instead of using [`PinScanner`] directly; they are all under `protocols`
31//! feature gate.
32
33#![deny(unsafe_code)]
34
35mod builder;
36mod error;
37mod group;
38mod jtag;
39mod scanner;
40mod types;
41
42pub use {builder::*, error::*, group::*, jtag::Backend, scanner::*, types::*};
43
44#[cfg(feature = "protocol")]
45pub mod protocols;