Function opentitanlib::test_utils::lc_transition::trigger_lc_transition
source · pub fn trigger_lc_transition(
transport: &TransportWrapper,
jtag: Box<dyn Jtag + '_>,
target_lc_state: DifLcCtrlState,
token: Option<[u32; 4]>,
use_external_clk: bool,
reset_delay: Duration,
reset_tap_straps: Option<JtagTap>
) -> Result<()>
Expand description
Perform a lifecycle transition through the JTAG interface to the LC CTRL.
Requires the jtag
to be already connected to the LC TAP.
The device will be reset into the new lifecycle state.
The jtag
will be disconnected before resetting the device.
Optionally, the function will setup JTAG straps to the requested interface.
Examples
let init: InitializedTest;
let transport = init.init_target().unwrap();
// Set TAP strapping to the LC controller.
let tap_lc_strapping = transport.pin_strapping("PINMUX_TAP_LC").unwrap();
tap_lc_strapping.apply().expect("failed to apply strapping");
// Reset into the new strapping.
transport.reset_target(init.bootstrap.options.reset_delay, true).unwrap();
// Connect to the LC controller TAP.
let mut jtag = transport
.jtag(jtag_opts)
.unwrap()
.connect(JtagTap::LcTap)
.expect("failed to connect to LC TAP");
let test_exit_token = DifLcCtrlToken::from([0xff; 16]);
lc_transition::trigger_lc_transition(
&transport,
jtag,
DifLcCtrlState::Prod,
Some(test_exit_token.into_register_values()),
true,
init.bootstrap.options.reset_delay,
Some(JtagTap::LcTap),
).expect("failed to trigger transition to prod");
jtag = transport
.jtag(jtag_opts)
.unwrap()
.connect(JtagTap::LcTap)
.expect("failed to reconnect to LC TAP");
assert_eq!(
jtag.read_lc_ctrl_reg(&LcCtrlReg::LCState).unwrap(),
DifLcCtrlState::Prod.redundant_encoding(),
);