OpenOCD
jtag/core.c File Reference
Include dependency graph for jtag/core.c:

Go to the source code of this file.

Data Structures

struct  jtag_event_callback
 Contains a single callback along with a pointer that will be passed when an event occurs. More...
 

Macros

#define END_OF_CHAIN_FLAG   0xffffffff
 
#define EXTRACT_MFG(X)   (((X) & 0xffe) >> 1)
 
#define EXTRACT_PART(X)   (((X) & 0xffff000) >> 12)
 
#define EXTRACT_VER(X)   (((X) & 0xf0000000) >> 28)
 
#define JTAG_IRLEN_MAX   60
 
#define JTAG_MAX_AUTO_TAPS   20
 

Functions

int adapter_assert_reset (void)
 
int adapter_config_trace (bool enabled, enum tpiu_pin_protocol pin_protocol, uint32_t port_size, unsigned int *trace_freq, unsigned int traceclkin_freq, uint16_t *prescaler)
 
int adapter_deassert_reset (void)
 
int adapter_poll_trace (uint8_t *buf, size_t *size)
 
int adapter_resets (int trst, int srst)
 
static int adapter_system_reset (int req_srst)
 
int default_interface_jtag_execute_queue (void)
 Calls the interface callback to execute the queue. More...
 
bool is_jtag_poll_safe (void)
 Return true if it's safe for a background polling task to access the JTAG scan chain. More...
 
void jtag_add_clocks (unsigned int num_cycles)
 Function jtag_add_clocks first checks that the state in which the clocks are to be issued is stable, then queues up num_cycles clocks for transmission. More...
 
void jtag_add_dr_scan (struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, enum tap_state state)
 Generate a DR SCAN using the fields passed to the function. More...
 
void jtag_add_dr_scan_check (struct jtag_tap *active, int in_num_fields, struct scan_field *in_fields, enum tap_state state)
 A version of jtag_add_dr_scan() that uses the check_value/mask fields. More...
 
void jtag_add_ir_scan (struct jtag_tap *active, struct scan_field *in_fields, enum tap_state state)
 Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP. More...
 
void jtag_add_ir_scan_noverify (struct jtag_tap *active, const struct scan_field *in_fields, enum tap_state state)
 The same as jtag_add_ir_scan except no verification is performed out the output values. More...
 
static void jtag_add_ir_scan_noverify_callback (struct jtag_tap *active, int dummy, const struct scan_field *in_fields, enum tap_state state)
 
void jtag_add_pathmove (unsigned int num_states, const enum tap_state *path)
 Application code must assume that interfaces will implement transitions between states with different paths and path lengths through the state diagram. More...
 
void jtag_add_plain_dr_scan (int num_bits, const uint8_t *out_bits, uint8_t *in_bits, enum tap_state state)
 Scan out the bits in ir scan mode. More...
 
void jtag_add_plain_ir_scan (int num_bits, const uint8_t *out_bits, uint8_t *in_bits, enum tap_state state)
 Scan out the bits in ir scan mode. More...
 
void jtag_add_reset (int req_tlr_or_trst, int req_srst)
 A reset of the TAP state machine can be requested. More...
 
void jtag_add_runtest (unsigned int num_cycles, enum tap_state state)
 Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state, after which move to endstate (unless it is also TAP_IDLE). More...
 
static void jtag_add_scan_check (struct jtag_tap *active, void(*jtag_add_scan)(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, enum tap_state state), int in_num_fields, struct scan_field *in_fields, enum tap_state state)
 
void jtag_add_sleep (uint32_t us)
 
int jtag_add_statemove (enum tap_state goal_state)
 jtag_add_statemove() moves from the current state to goal_state. More...
 
void jtag_add_tlr (void)
 Run a TAP_RESET reset where the end state is TAP_RESET, regardless of the start state. More...
 
int jtag_add_tms_seq (unsigned int nbits, const uint8_t *seq, enum tap_state state)
 If supported by the underlying adapter, this clocks a raw bit sequence onto TMS for switching between JTAG and SWD modes. More...
 
struct jtag_tapjtag_all_taps (void)
 
int jtag_call_event_callbacks (enum jtag_event event)
 
static int jtag_check_value_inner (uint8_t *captured, uint8_t *in_check_value, uint8_t *in_check_mask, int num_bits)
 
void jtag_check_value_mask (struct scan_field *field, uint8_t *value, uint8_t *mask)
 Execute jtag queue and check value with an optional mask. More...
 
static int jtag_check_value_mask_callback (jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
 
static void jtag_checks (void)
 
static void jtag_constructor (void)
 
static int jtag_error_clear (void)
 Resets jtag_error to ERROR_OK, returning its previous value. More...
 
static int jtag_examine_chain (void)
 
static bool jtag_examine_chain_check (uint8_t *idcodes, unsigned int count)
 
static void jtag_examine_chain_display (enum log_levels level, const char *msg, const char *name, uint32_t idcode)
 
static bool jtag_examine_chain_end (uint8_t *idcodes, unsigned int count, unsigned int max)
 This helper checks that remaining bits in the examined chain data are all as expected, but a single JTAG device requires only 64 bits to be read back correctly. More...
 
static int jtag_examine_chain_execute (uint8_t *idcode_buffer, unsigned int num_idcode)
 
static bool jtag_examine_chain_match_tap (const struct jtag_tap *tap)
 
int jtag_execute_queue (void)
 For software FIFO implementations, the queued commands can be executed during this call or earlier. More...
 
void jtag_execute_queue_noclear (void)
 same as jtag_execute_queue() but does not clear the error flag More...
 
unsigned int jtag_get_flush_queue_count (void)
 
unsigned int jtag_get_nsrst_assert_width (void)
 
unsigned int jtag_get_nsrst_delay (void)
 
unsigned int jtag_get_ntrst_assert_width (void)
 
unsigned int jtag_get_ntrst_delay (void)
 
enum reset_types jtag_get_reset_config (void)
 
int jtag_get_srst (void)
 
int jtag_get_trst (void)
 
static bool jtag_idcode_is_final (uint32_t idcode)
 
int jtag_init (struct command_context *cmd_ctx)
 Initialize JTAG chain using only a RESET reset. More...
 
int jtag_init_inner (struct command_context *cmd_ctx)
 
int jtag_init_reset (struct command_context *cmd_ctx)
 reset, then initialize JTAG chain More...
 
bool jtag_poll_get_enabled (void)
 Return flag reporting whether JTAG polling is disallowed. More...
 
bool jtag_poll_mask (void)
 Mask (disable) polling and return the current mask status that should be feed to jtag_poll_unmask() to restore it. More...
 
void jtag_poll_set_enabled (bool value)
 Assign flag reporting whether JTAG polling is disallowed. More...
 
void jtag_poll_unmask (bool saved)
 Restore saved mask for polling. More...
 
int jtag_power_dropout (int *dropout)
 
static void jtag_prelude (enum tap_state state)
 
int jtag_register_event_callback (jtag_event_handler_t callback, void *priv)
 
static int jtag_reset_callback (enum jtag_event event, void *priv)
 
static int jtag_select (struct command_context *ctx)
 
void jtag_set_error (int error)
 Set the current JTAG core execution error, unless one was set by a previous call previously. More...
 
void jtag_set_flush_queue_sleep (int ms)
 Set ms to sleep after jtag_execute_queue() flushes queue. More...
 
void jtag_set_nsrst_assert_width (unsigned int delay)
 
void jtag_set_nsrst_delay (unsigned int delay)
 
void jtag_set_ntrst_assert_width (unsigned int delay)
 
void jtag_set_ntrst_delay (unsigned int delay)
 
void jtag_set_reset_config (enum reset_types type)
 
void jtag_set_verify (bool enable)
 Enable or disable data scan verification checking. More...
 
void jtag_set_verify_capture_ir (bool enable)
 Enable or disable verification of IR scan checking. More...
 
void jtag_sleep (uint32_t us)
 
int jtag_srst_asserted (int *srst_asserted)
 
static void jtag_tap_add (struct jtag_tap *t)
 Append a new TAP to the chain of all taps. More...
 
struct jtag_tapjtag_tap_by_position (unsigned int n)
 
struct jtag_tapjtag_tap_by_string (const char *s)
 
static unsigned int jtag_tap_count (void)
 
unsigned int jtag_tap_count_enabled (void)
 
void jtag_tap_free (struct jtag_tap *tap)
 
void jtag_tap_init (struct jtag_tap *tap)
 
const char * jtag_tap_name (const struct jtag_tap *tap)
 
struct jtag_tapjtag_tap_next_enabled (struct jtag_tap *p)
 
int jtag_unregister_event_callback (jtag_event_handler_t callback, void *priv)
 
static int jtag_validate_ircapture (void)
 
bool jtag_will_verify (void)
 
bool jtag_will_verify_capture_ir (void)
 
static void legacy_jtag_add_reset (int req_tlr_or_trst, int req_srst)
 
int swd_init_reset (struct command_context *cmd_ctx)
 
bool transport_is_jtag (void)
 Returns true if the current debug session is using JTAG as its transport. More...
 

Variables

static struct jtag_tap__jtag_all_taps
 List all TAPs that have been created. More...
 
struct adapter_driveradapter_driver
 
static unsigned int adapter_nsrst_assert_width
 
static unsigned int adapter_nsrst_delay
 
enum tap_state cmd_queue_cur_state = TAP_RESET
 The current TAP state of the pending JTAG command queue. More...
 
static int jtag_error = ERROR_OK
 The jtag_error variable is set when an error occurs while executing the queue. More...
 
static struct jtag_event_callbackjtag_event_callbacks
 
static const char * jtag_event_strings []
 
static unsigned int jtag_flush_queue_count
 The number of JTAG queue flushes (for profiling and debugging purposes). More...
 
static int jtag_flush_queue_sleep
 
static unsigned int jtag_ntrst_assert_width
 
static unsigned int jtag_ntrst_delay
 
static bool jtag_poll = true
 
static bool jtag_poll_en = true
 
static enum reset_types jtag_reset_config = RESET_NONE
 
static int jtag_srst = -1
 
static struct transport jtag_transport
 
static int jtag_trst = -1
 
static bool jtag_verify = true
 
static bool jtag_verify_capture_ir = true
 

Macro Definition Documentation

◆ END_OF_CHAIN_FLAG

#define END_OF_CHAIN_FLAG   0xffffffff

Definition at line 1092 of file jtag/core.c.

◆ EXTRACT_MFG

#define EXTRACT_MFG (   X)    (((X) & 0xffe) >> 1)

Definition at line 1085 of file jtag/core.c.

◆ EXTRACT_PART

#define EXTRACT_PART (   X)    (((X) & 0xffff000) >> 12)

Definition at line 1086 of file jtag/core.c.

◆ EXTRACT_VER

#define EXTRACT_VER (   X)    (((X) & 0xf0000000) >> 28)

Definition at line 1087 of file jtag/core.c.

◆ JTAG_IRLEN_MAX

#define JTAG_IRLEN_MAX   60

Definition at line 1095 of file jtag/core.c.

◆ JTAG_MAX_AUTO_TAPS

#define JTAG_MAX_AUTO_TAPS   20

Definition at line 1083 of file jtag/core.c.

Function Documentation

◆ adapter_assert_reset()

◆ adapter_config_trace()

int adapter_config_trace ( bool  enabled,
enum tpiu_pin_protocol  pin_protocol,
uint32_t  port_size,
unsigned int *  trace_freq,
unsigned int  traceclkin_freq,
uint16_t *  prescaler 
)

Definition at line 1929 of file jtag/core.c.

References adapter_driver::config_trace, ERROR_FAIL, ERROR_OK, and LOG_ERROR.

Referenced by arm_tpiu_swo_cleanup_all(), and COMMAND_HANDLER().

◆ adapter_deassert_reset()

◆ adapter_poll_trace()

int adapter_poll_trace ( uint8_t *  buf,
size_t *  size 
)

Definition at line 1944 of file jtag/core.c.

References ERROR_FAIL, adapter_driver::poll_trace, and size.

Referenced by arm_tpiu_swo_poll_trace().

◆ adapter_resets()

◆ adapter_system_reset()

◆ default_interface_jtag_execute_queue()

int default_interface_jtag_execute_queue ( void  )

◆ is_jtag_poll_safe()

bool is_jtag_poll_safe ( void  )

Return true if it's safe for a background polling task to access the JTAG scan chain.

Polling may be explicitly disallowed, and is also unsafe while nTRST is active or the JTAG clock is gated off.

Definition at line 148 of file jtag/core.c.

References jtag_poll, jtag_poll_en, jtag_reset_config, jtag_srst, jtag_trst, RESET_SRST_NO_GATING, and transport_is_jtag().

Referenced by handle_target().

◆ jtag_add_clocks()

void jtag_add_clocks ( unsigned int  num_cycles)

Function jtag_add_clocks first checks that the state in which the clocks are to be issued is stable, then queues up num_cycles clocks for transmission.

Definition at line 605 of file jtag/core.c.

References cmd_queue_cur_state, ERROR_JTAG_NOT_STABLE_STATE, interface_jtag_add_clocks(), jtag_checks(), jtag_set_error(), LOG_ERROR, tap_is_state_stable(), and tap_state_name().

Referenced by COMMAND_HANDLER(), mips32_pracc_fastdata_xfer(), mips32_pracc_queue_exec(), mips64_pracc_exec_read(), mips64_pracc_exec_write(), and mips64_pracc_fastdata_xfer().

◆ jtag_add_dr_scan()

void jtag_add_dr_scan ( struct jtag_tap tap,
int  num_fields,
const struct scan_field fields,
enum tap_state  endstate 
)

Generate a DR SCAN using the fields passed to the function.

For connected TAPs, the function checks in_fields and uses fields specified there. For bypassed TAPs, the function generates a dummy 1-bit field. The bypass status of TAPs is set by jtag_add_ir_scan().

Definition at line 457 of file jtag/core.c.

References interface_jtag_add_dr_scan(), jtag_prelude(), jtag_set_error(), state, and TAP_RESET.

Referenced by adbg_burst_command(), adbg_ctrl_read(), adbg_ctrl_write(), adbg_select_ctrl_reg(), adbg_select_module(), adbg_wb_burst_read(), adbg_wb_burst_write(), add_dbus_scan(), adi_jtag_dp_scan_cmd(), arc_jtag_enque_read_dr(), arc_jtag_enque_set_transaction(), arc_jtag_enque_write_dr(), arm11_add_dr_scan_vc(), arm11_run_instr_data_to_core_noack_inner(), arm720t_scan_cp15(), arm7tdmi_clock_data_in(), arm7tdmi_clock_data_in_endianness(), arm7tdmi_clock_out_inner(), arm7tdmi_examine_debug_reason(), arm920t_execute_cp15(), arm920t_read_cp15_physical(), arm920t_write_cp15_physical(), arm926ejs_cp15_read(), arm926ejs_cp15_write(), arm946e_read_cp15(), arm946e_write_cp15(), arm966e_read_cp15(), arm966e_write_cp15(), arm9tdmi_clock_data_in(), arm9tdmi_clock_data_in_endianness(), arm9tdmi_clock_out(), arm9tdmi_examine_debug_reason(), arm_jtag_scann_inner(), avr32_jtag_mwa_read_data(), avr32_jtag_mwa_set_address(), avr32_jtag_mwa_write_data(), avr32_jtag_nexus_read_data(), avr32_jtag_nexus_set_address(), avr32_jtag_nexus_write_data(), COMMAND_HANDLER(), dbus_scan(), dmi_scan(), drscan(), dtmcontrol_scan(), dtmcontrol_scan_via_bscan(), efinix_load(), embeddedice_handshake(), embeddedice_read_reg_w_check(), embeddedice_receive(), embeddedice_send(), embeddedice_write_reg_inner(), esirisc_jtag_recv(), esirisc_jtag_send(), etb_read_ram(), etb_read_reg_w_check(), etb_scann(), etb_write_reg(), etm_read_reg_w_check(), etm_write_reg(), feroceon_dummy_clock_out(), gatemate_load(), gowin_load_to_sram(), gowin_read_register(), idcode_scan(), intel_load(), ipdbg_jtag_transfer_bytes(), ipdbg_shift_data(), ipdbg_shift_empty_data(), ipdbg_shift_vir(), isc_data_read_out(), isc_program_register(), isc_read_register(), isc_set_register(), jtag_add_dr_scan_check(), jtagspi_cmd(), lakemont_reset_break(), lattice_certus_connect_spi_to_jtag(), lattice_certus_enable_programming(), lattice_certus_enable_transparent_mode(), lattice_certus_erase_device(), lattice_certus_program_config_map(), lattice_ecp2_3_erase_device(), lattice_ecp2_3_program_config_map(), lattice_ecp2_3_write_usercode(), lattice_ecp5_connect_spi_to_jtag(), lattice_ecp5_enable_sram_programming(), lattice_ecp5_erase_sram(), lattice_ecp5_init_address(), lattice_ecp5_program_config_map(), lattice_ecp5_write_usercode(), lattice_preload(), lattice_read_u32_register(), lattice_read_u64_register(), ls1_sap_memory_cmd(), ls1_sap_memory_read(), ls1_sap_memory_write(), ls1_sap_set_addr_high(), mips64_ejtag_fastdata_scan(), mips_ejtag_add_scan_96(), mips_ejtag_drscan_32_queued(), mips_ejtag_drscan_64(), mips_ejtag_drscan_8(), mips_ejtag_drscan_8_out(), mips_ejtag_fastdata_scan(), or1k_adv_jtag_jsp_xfer(), or1k_tap_vjtag_init(), riscv_add_bscan_tunneled_scan(), riscv_batch_run(), select_dmi_via_bscan(), str9xpec_blank_check(), str9xpec_erase_area(), str9xpec_isc_status(), str9xpec_lock_device(), str9xpec_read_config(), str9xpec_set_address(), str9xpec_write(), str9xpec_write_options(), virtex2_load(), virtex2_receive_32(), virtex2_send_32(), xcf_erase_check(), xscale_invalidate_ic_line(), xscale_load_ic(), xscale_read_dcsr(), xscale_read_tx(), xscale_send(), xscale_write_dcsr(), xscale_write_rx(), and xtensa_dm_add_dr_scan().

◆ jtag_add_dr_scan_check()

void jtag_add_dr_scan_check ( struct jtag_tap active,
int  in_num_fields,
struct scan_field in_fields,
enum tap_state  state 
)

A version of jtag_add_dr_scan() that uses the check_value/mask fields.

Definition at line 445 of file jtag/core.c.

References jtag_add_dr_scan(), jtag_add_scan_check(), jtag_verify, and state.

Referenced by embeddedice_read_reg_w_check(), etb_read_reg_w_check(), etm_read_reg_w_check(), and xscale_receive().

◆ jtag_add_ir_scan()

void jtag_add_ir_scan ( struct jtag_tap tap,
struct scan_field fields,
enum tap_state  endstate 
)

Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.

If the input field list contains an instruction value for a TAP then that is used otherwise the TAP is set to bypass.

TAPs for which no fields are passed are marked as bypassed for subsequent DR SCANs.

Definition at line 380 of file jtag/core.c.

References scan_field::check_mask, scan_field::check_value, jtag_tap::expected, jtag_tap::expected_mask, jtag_add_ir_scan_noverify(), jtag_add_ir_scan_noverify_callback(), jtag_add_scan_check(), jtag_verify, jtag_verify_capture_ir, state, and TAP_RESET.

Referenced by arc_jtag_enque_write_ir(), arm11_add_ir_scan_vc(), arm_jtag_set_instr_inner(), assert_reset(), avr32_jtag_set_instr(), COMMAND_HANDLER(), deassert_reset(), dtmcontrol_scan(), dtmcontrol_scan_via_bscan(), efinix_set_instr(), esirisc_jtag_set_instr(), etb_set_instr(), fpga_configure(), gatemate_set_instr(), gowin_set_instr(), halt(), idcode_scan(), intel_set_instr(), ipdbg_shift_instr(), irscan(), isc_data_read_out(), isc_enter(), isc_leave(), isc_program_register(), isc_read_register(), isc_set_register(), jtagspi_set_user_ir(), lakemont_reset_break(), lattice_set_instr(), ls1_sap_set_instr(), mips_ejtag_set_instr(), or1k_tap_vjtag_init(), or1k_tap_xilinx_bscan_init(), poll_target(), read_memory(), riscv011_resume(), riscv_add_bscan_tunneled_scan(), select_dmi(), select_dmi_via_bscan(), step(), str9xpec_set_instr(), virtex2_set_instr(), write_memory(), xcf_erase_check(), xscale_jtag_set_instr(), and xtensa_dm_add_set_ir().

◆ jtag_add_ir_scan_noverify()

void jtag_add_ir_scan_noverify ( struct jtag_tap active,
const struct scan_field in_fields,
enum tap_state  state 
)

The same as jtag_add_ir_scan except no verification is performed out the output values.

Definition at line 362 of file jtag/core.c.

References interface_jtag_add_ir_scan(), jtag_prelude(), jtag_set_error(), and state.

Referenced by arm_jtag_set_instr_inner(), jtag_add_ir_scan(), and jtag_add_ir_scan_noverify_callback().

◆ jtag_add_ir_scan_noverify_callback()

static void jtag_add_ir_scan_noverify_callback ( struct jtag_tap active,
int  dummy,
const struct scan_field in_fields,
enum tap_state  state 
)
static

Definition at line 371 of file jtag/core.c.

References jtag_add_ir_scan_noverify(), and state.

Referenced by jtag_add_ir_scan().

◆ jtag_add_pathmove()

void jtag_add_pathmove ( unsigned int  num_states,
const enum tap_state path 
)

Application code must assume that interfaces will implement transitions between states with different paths and path lengths through the state diagram.

The path will vary across interface and also across versions of the same interface over time. Even if the OpenOCD code is unchanged, the actual path taken may vary over time and versions of interface firmware or PCB revisions.

Use jtag_add_pathmove() when specific transition sequences are required.

Do not use jtag_add_pathmove() unless you need to, but do use it if you have to.

DANGER! If the target is dependent upon a particular sequence of transitions for things to work correctly(e.g. as a workaround for an errata that contradicts the JTAG standard), then pathmove must be used, even if some jtag interfaces happen to use the desired path. Worse, the jtag interface used for testing a particular implementation, could happen to use the "desired" path when transitioning to/from end state.

A list of unambiguous single clock state transitions, not all drivers can support this, but it is required for e.g. XScale and Xilinx support

Note! TAP_RESET must not be used in the path!

Note that the first on the list must be reachable via a single transition from the current state.

All drivers are required to implement jtag_add_pathmove(). However, if the pathmove sequence can not be precisely executed, an interface_jtag_add_pathmove() or jtag_execute_queue() must return an error. It is legal, but not recommended, that a driver returns an error in all cases for a pathmove if it can only implement a few transitions and therefore a partial implementation of pathmove would have little practical application.

If an error occurs, jtag_error will contain one of these error codes:

  • ERROR_JTAG_NOT_STABLE_STATE – The final state was not stable.
  • ERROR_JTAG_STATE_INVALID – The path passed through TAP_RESET.
  • ERROR_JTAG_TRANSITION_INVALID – The path includes invalid state transitions.

Definition at line 523 of file jtag/core.c.

References cmd_queue_cur_state, ERROR_JTAG_NOT_STABLE_STATE, ERROR_JTAG_STATE_INVALID, ERROR_JTAG_TRANSITION_INVALID, interface_jtag_add_pathmove(), jtag_checks(), jtag_set_error(), LOG_ERROR, tap_is_state_stable(), TAP_RESET, tap_state_name(), and tap_state_transition().

Referenced by arm11_add_dr_scan_vc(), arm11_add_ir_scan_vc(), arm11_run_instr_data_to_core_noack_inner(), COMMAND_HANDLER(), jtag_add_statemove(), reset_jtag(), svf_add_statemove(), xscale_read_tx(), and xscale_receive().

◆ jtag_add_plain_dr_scan()

void jtag_add_plain_dr_scan ( int  num_bits,
const uint8_t *  out_bits,
uint8_t *  in_bits,
enum tap_state  endstate 
)

Scan out the bits in ir scan mode.

If in_bits == NULL, discard incoming bits.

Definition at line 471 of file jtag/core.c.

References interface_jtag_add_plain_dr_scan(), jtag_prelude(), jtag_set_error(), state, and TAP_RESET.

Referenced by COMMAND_HANDLER(), dsp563xx_write_dr(), dsp5680xx_drscan(), jtag_examine_chain_execute(), and mcu_write_dr().

◆ jtag_add_plain_ir_scan()

void jtag_add_plain_ir_scan ( int  num_bits,
const uint8_t *  out_bits,
uint8_t *  in_bits,
enum tap_state  endstate 
)

Scan out the bits in ir scan mode.

If in_bits == NULL, discard incoming bits.

Definition at line 398 of file jtag/core.c.

References interface_jtag_add_plain_ir_scan(), jtag_prelude(), jtag_set_error(), state, and TAP_RESET.

Referenced by COMMAND_HANDLER(), dsp563xx_write_ir(), dsp5680xx_irscan(), esp32_queue_tdi_idle(), jtag_validate_ircapture(), and mcu_write_ir().

◆ jtag_add_reset()

void jtag_add_reset ( int  req_tlr_or_trst,
int  srst 
)

A reset of the TAP state machine can be requested.

Whether tms or trst reset is used depends on the capabilities of the target and jtag interface(reset_config command configures this).

srst can driver a reset of the TAP state machine and vice versa

Application code may need to examine value of jtag_reset_config to determine the proper codepath

DANGER! Even though srst drives trst, trst might not be connected to the interface, and it might actually be harmful to assert trst in this case.

This is why combinations such as "reset_config srst_only srst_pulls_trst" are supported.

only req_tlr_or_trst and srst can have a transition for a call as the effects of transitioning both at the "same time" are undefined, but when srst_pulls_trst or vice versa, then trst & srst must be asserted together.

Definition at line 771 of file jtag/core.c.

References adapter_nsrst_assert_width, adapter_nsrst_delay, ERROR_FAIL, ERROR_OK, jtag_add_sleep(), jtag_add_tlr(), jtag_call_event_callbacks(), jtag_execute_queue(), jtag_notify_event(), jtag_ntrst_assert_width, jtag_ntrst_delay, jtag_reset_config, jtag_set_error(), jtag_srst, jtag_trst, JTAG_TRST_ASSERTED, legacy_jtag_add_reset(), LOG_DEBUG, LOG_ERROR, adapter_driver::reset, RESET_HAS_SRST, RESET_HAS_TRST, RESET_SRST_PULLS_TRST, RESET_TRST_PULLS_SRST, TAP_RESET, and tap_set_state.

Referenced by adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), arc_assert_reset(), arc_deassert_reset(), arm11_assert_reset(), arm11_deassert_reset(), arm7_9_assert_reset(), arm7_9_deassert_reset(), COMMAND_HANDLER(), dsp563xx_assert_reset(), dsp563xx_deassert_reset(), dsp5680xx_f_lock(), dsp5680xx_f_unlock(), dsp5680xx_resume(), eonce_enter_debug_mode(), esirisc_assert_reset(), esirisc_deassert_reset(), jtag_init(), jtag_init_reset(), mips_m4k_assert_reset(), mips_m4k_deassert_reset(), mips_mips64_assert_reset(), mips_mips64_deassert_reset(), xscale_assert_reset(), and xscale_deassert_reset().

◆ jtag_add_runtest()

void jtag_add_runtest ( unsigned int  num_cycles,
enum tap_state  endstate 
)

Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state, after which move to endstate (unless it is also TAP_IDLE).

Parameters
num_cyclesNumber of cycles in TAP_IDLE state. This argument may be 0, in which case this routine will navigate to endstate via TAP_IDLE.
endstateThe final state.

Definition at line 598 of file jtag/core.c.

References interface_jtag_add_runtest(), jtag_prelude(), jtag_set_error(), and state.

Referenced by add_dbus_scan(), adi_jtag_dp_scan_cmd(), arm720t_scan_cp15(), arm7_9_assert_reset(), arm7_9_restart_core(), arm7tdmi_clock_data_in(), arm7tdmi_clock_data_in_endianness(), arm7tdmi_clock_out_inner(), arm9tdmi_clock_data_in(), arm9tdmi_clock_data_in_endianness(), arm9tdmi_clock_out(), COMMAND_HANDLER(), dbus_scan(), dmi_scan(), efinix_load(), gatemate_set_instr(), gowin_load_to_sram(), gowin_runtest_idle(), gowin_set_instr(), intel_load(), lattice_certus_disconnect_spi_from_jtag(), lattice_certus_enable_programming(), lattice_certus_enable_transparent_mode(), lattice_certus_erase_device(), lattice_certus_exit_programming_mode(), lattice_certus_init_address(), lattice_certus_refresh(), lattice_ecp2_3_erase_device(), lattice_ecp2_3_exit_programming_mode(), lattice_ecp2_3_program_config_map(), lattice_ecp2_3_write_usercode(), lattice_ecp2_load(), lattice_ecp3_load(), lattice_ecp5_disconnect_spi_from_jtag(), lattice_ecp5_enable_sram_programming(), lattice_ecp5_erase_sram(), lattice_ecp5_exit_programming_mode(), lattice_ecp5_init_address(), lattice_ecp5_program_config_map(), lattice_ecp5_refresh(), lattice_ecp5_write_usercode(), lattice_read_u32_register(), read_memory_bus_v1(), riscv_batch_run(), virtex2_load_cleanup(), virtex2_program(), xscale_deassert_reset(), and xscale_receive().

◆ jtag_add_scan_check()

static void jtag_add_scan_check ( struct jtag_tap active,
void(*)(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, enum tap_state state jtag_add_scan,
int  in_num_fields,
struct scan_field in_fields,
enum tap_state  state 
)
static

◆ jtag_add_sleep()

◆ jtag_add_statemove()

int jtag_add_statemove ( enum tap_state  goal_state)

jtag_add_statemove() moves from the current state to goal_state.

Parameters
goal_stateThe final TAP state.
Returns
ERROR_OK on success, or an error code on failure.

Moves from the current state to the goal state. Both states must be stable.

Definition at line 557 of file jtag/core.c.

References ARRAY_SIZE, bit(), cmd_queue_cur_state, ERROR_FAIL, ERROR_OK, jtag_add_pathmove(), jtag_add_tlr(), LOG_DEBUG, tap_get_tms_path(), tap_get_tms_path_len(), tap_is_state_stable(), TAP_RESET, tap_state_name(), and tap_state_transition().

Referenced by arm11_add_debug_scan_n(), COMMAND_HANDLER(), and reset_jtag().

◆ jtag_add_tlr()

◆ jtag_add_tms_seq()

int jtag_add_tms_seq ( unsigned int  nbits,
const uint8_t *  seq,
enum tap_state  state 
)

If supported by the underlying adapter, this clocks a raw bit sequence onto TMS for switching between JTAG and SWD modes.

DO NOT use this to bypass the integrity checks and logging provided by the jtag_add_pathmove() and jtag_add_statemove() calls.

Parameters
nbitsHow many bits to clock out.
seqThe bit sequence. The LSB is bit 0 of seq[0].
stateThe JTAG tap state to record on completion. Use TAP_INVALID to represent being in in SWD mode.
Todo:
Update naming conventions to stop assuming everything is JTAG.

Definition at line 508 of file jtag/core.c.

References cmd_queue_cur_state, DEBUG_CAP_TMS_SEQ, ERROR_JTAG_NOT_IMPLEMENTED, interface_add_tms_seq(), jtag_checks(), adapter_driver::jtag_ops, jtag_set_error(), state, and jtag_interface::supported.

Referenced by jtag_send_sequence().

◆ jtag_all_taps()

◆ jtag_call_event_callbacks()

◆ jtag_check_value_inner()

static int jtag_check_value_inner ( uint8_t *  captured,
uint8_t *  in_check_value,
uint8_t *  in_check_mask,
int  num_bits 
)
static

◆ jtag_check_value_mask()

void jtag_check_value_mask ( struct scan_field field,
uint8_t *  value,
uint8_t *  mask 
)

Execute jtag queue and check value with an optional mask.

Parameters
fieldPointer to scan field.
valuePointer to scan value.
maskPointer to scan mask; may be NULL.

returns Nothing, but calls jtag_set_error() on any error.

Definition at line 930 of file jtag/core.c.

References scan_field::in_value, jtag_check_value_inner(), jtag_execute_queue_noclear(), jtag_set_error(), mask, and scan_field::num_bits.

Referenced by COMMAND_HANDLER(), xscale_read_dcsr(), xscale_read_tx(), xscale_write_dcsr(), and xscale_write_rx().

◆ jtag_check_value_mask_callback()

static int jtag_check_value_mask_callback ( jtag_callback_data_t  data0,
jtag_callback_data_t  data1,
jtag_callback_data_t  data2,
jtag_callback_data_t  data3 
)
static

Definition at line 414 of file jtag/core.c.

References jtag_check_value_inner().

Referenced by jtag_add_scan_check().

◆ jtag_checks()

static void jtag_checks ( void  )
static

Definition at line 348 of file jtag/core.c.

References jtag_trst.

Referenced by jtag_add_clocks(), jtag_add_pathmove(), jtag_add_tms_seq(), and jtag_prelude().

◆ jtag_constructor()

static void jtag_constructor ( void  )
static

Definition at line 1831 of file jtag/core.c.

◆ jtag_error_clear()

static int jtag_error_clear ( void  )
static

Resets jtag_error to ERROR_OK, returning its previous value.

Returns
The previous value of jtag_error.

Definition at line 136 of file jtag/core.c.

References ERROR_OK, and jtag_error.

Referenced by jtag_execute_queue().

◆ jtag_examine_chain()

◆ jtag_examine_chain_check()

static bool jtag_examine_chain_check ( uint8_t *  idcodes,
unsigned int  count 
)
static

Definition at line 1114 of file jtag/core.c.

References count, and LOG_ERROR.

Referenced by jtag_examine_chain().

◆ jtag_examine_chain_display()

static void jtag_examine_chain_display ( enum log_levels  level,
const char *  msg,
const char *  name,
uint32_t  idcode 
)
static

◆ jtag_examine_chain_end()

static bool jtag_examine_chain_end ( uint8_t *  idcodes,
unsigned int  count,
unsigned int  max 
)
static

This helper checks that remaining bits in the examined chain data are all as expected, but a single JTAG device requires only 64 bits to be read back correctly.

This can help identify and diagnose problems with the JTAG chain earlier, gives more helpful/explicit error messages. Returns TRUE iff garbage was found.

Definition at line 1174 of file jtag/core.c.

References buf_get_u32(), count, jtag_idcode_is_final(), and LOG_WARNING.

Referenced by jtag_examine_chain().

◆ jtag_examine_chain_execute()

static int jtag_examine_chain_execute ( uint8_t *  idcode_buffer,
unsigned int  num_idcode 
)
static

◆ jtag_examine_chain_match_tap()

static bool jtag_examine_chain_match_tap ( const struct jtag_tap tap)
static

◆ jtag_execute_queue()

int jtag_execute_queue ( void  )

For software FIFO implementations, the queued commands can be executed during this call or earlier.

A sw queue might decide to push out some of the jtag_add_xxx() operations once the queue is "big enough".

This fn will return an error code if any of the prior jtag_add_xxx() calls caused a failure, e.g. check failure. Note that it does not matter if the operation was executed before jtag_execute_queue(), jtag_execute_queue() will still return an error code.

All jtag_add_xxx() calls that have in_handler != NULL will have been executed when this fn returns, but if what has been queued only clocks data out, without reading anything back, then JTAG could be running after jtag_execute_queue() returns. The API does not define a way to flush a hw FIFO that runs after jtag_execute_queue() returns.

jtag_add_xxx() commands can either be executed immediately or at some time between the jtag_add_xxx() fn call and jtag_execute_queue().

Definition at line 1050 of file jtag/core.c.

References jtag_error_clear(), and jtag_execute_queue_noclear().

Referenced by adapter_resets(), adbg_burst_command(), adbg_ctrl_read(), adbg_ctrl_write(), adbg_select_ctrl_reg(), adbg_select_module(), adbg_wb_burst_read(), adbg_wb_burst_write(), adi_jtag_dp_scan_cmd_sync(), adi_jtag_scan_inout_check_u32(), arc_jtag_read_memory(), arc_jtag_read_registers(), arc_jtag_startup(), arc_jtag_status(), arc_jtag_write_memory(), arc_jtag_write_registers(), arm11_add_debug_scan_n(), arm11_examine(), arm11_halt(), arm11_read_dscr(), arm11_resume(), arm11_run_instr_data_from_core(), arm11_run_instr_data_to_core_noack(), arm11_run_instr_data_to_core_noack_inner(), arm11_run_instr_no_data(), arm11_sc7_run(), arm11_step(), arm11_write_dscr(), arm720t_disable_mmu_caches(), arm720t_enable_mmu_caches(), arm720t_get_ttb(), arm720t_post_debug_entry(), arm720t_scan_cp15(), arm720t_soft_reset_halt(), arm7_9_clear_watchpoints(), arm7_9_debug_entry(), arm7_9_execute_sys_speed(), arm7_9_full_context(), arm7_9_handle_target_request(), arm7_9_poll(), arm7_9_read_core_reg(), arm7_9_read_memory(), arm7_9_restart_core(), arm7_9_set_breakpoint(), arm7_9_set_software_breakpoints(), arm7_9_set_watchpoint(), arm7_9_soft_reset_halt(), arm7_9_unset_breakpoint(), arm7_9_unset_watchpoint(), arm7_9_write_core_reg(), arm7_9_write_memory(), arm7tdmi_change_to_arm(), arm7tdmi_clock_data_in(), arm7tdmi_clock_data_in_endianness(), arm7tdmi_examine_debug_reason(), arm920t_disable_mmu_caches(), arm920t_enable_mmu_caches(), arm920t_execute_cp15(), arm920t_post_debug_entry(), arm920t_pre_restore_context(), arm920t_read_cp15_interpreted(), arm920t_read_cp15_physical(), arm920t_soft_reset_halt(), arm920t_write_cp15_interpreted(), arm926ejs_cp15_read(), arm926ejs_cp15_write(), arm926ejs_disable_mmu_caches(), arm926ejs_enable_mmu_caches(), arm926ejs_examine_debug_reason(), arm926ejs_post_debug_entry(), arm926ejs_soft_reset_halt(), arm946e_read_cp15(), arm946e_write_cp15(), arm966e_read_cp15(), arm9tdmi_change_to_arm(), arm9tdmi_clock_data_in(), arm9tdmi_clock_data_in_endianness(), arm9tdmi_clock_out(), arm9tdmi_examine_debug_reason(), avr32_jtag_mwa_read_data(), avr32_jtag_mwa_set_address(), avr32_jtag_mwa_write_data(), avr32_jtag_nexus_read_data(), avr32_jtag_nexus_set_address(), avr32_jtag_nexus_write_data(), avr32_jtag_set_instr(), COMMAND_HANDLER(), dbus_scan(), dmi_scan(), drscan(), dsp563xx_once_execute_dw_ir(), dsp563xx_once_execute_sw_ir(), dsp563xx_once_ir_exec(), dsp563xx_once_read_register(), dsp563xx_once_reg_read(), dsp563xx_once_reg_read_ex(), dsp563xx_once_reg_write(), dsp563xx_once_request_debug(), dsp563xx_once_target_status(), dsp563xx_read_memory_core(), dsp563xx_write_memory_core(), dsp5680xx_execute_queue(), dtmcontrol_scan(), dtmcontrol_scan_via_bscan(), efinix_load(), embeddedice_build_reg_cache(), embeddedice_handshake(), embeddedice_receive(), embeddedice_set_reg_w_exec(), embeddedice_setup(), esirisc_jtag_recv(), esirisc_jtag_send(), etb_get_reg(), etb_init(), etb_read_ram(), etb_read_trace(), etb_set_reg_w_exec(), etb_start_capture(), etm_get_reg(), etm_set_reg_w_exec(), etm_setup(), feroceon_change_to_arm(), feroceon_read_cp15(), fpga_configure(), gatemate_connect_spi_to_jtag(), gatemate_disconnect_spi_from_jtag(), gatemate_load(), gowin_disable_config(), gowin_enable_config(), gowin_erase_sram(), gowin_load_to_sram(), gowin_read_register(), gowin_reload(), gowin_runtest_idle(), idcode_scan(), intel_load(), ipdbg_jtag_transfer_bytes(), ipdbg_shift_data(), ipdbg_shift_empty_data(), ipdbg_shift_instr(), ipdbg_shift_vir(), irscan(), isc_data_read_out(), isc_enter(), isc_leave(), isc_program_register(), isc_read_register(), isc_set_register(), jtag_add_reset(), jtag_ap_q_abort(), jtag_examine_chain_execute(), jtag_init(), jtag_init_inner(), jtag_init_reset(), jtag_send_sequence(), jtag_validate_ircapture(), jtagdp_overrun_check(), jtagspi_cmd(), lakemont_reset_break(), lattice_certus_connect_spi_to_jtag(), lattice_certus_disconnect_spi_from_jtag(), lattice_certus_enable_programming(), lattice_certus_enable_transparent_mode(), lattice_certus_erase_device(), lattice_certus_exit_programming_mode(), lattice_certus_init_address(), lattice_certus_program_config_map(), lattice_certus_refresh(), lattice_ecp2_3_connect_spi_to_jtag(), lattice_ecp2_3_disconnect_spi_from_jtag(), lattice_ecp2_3_exit_programming_mode(), lattice_ecp2_3_program_config_map(), lattice_ecp2_3_refresh(), lattice_ecp2_3_write_usercode(), lattice_ecp5_connect_spi_to_jtag(), lattice_ecp5_disconnect_spi_from_jtag(), lattice_ecp5_enable_sram_programming(), lattice_ecp5_erase_sram(), lattice_ecp5_exit_programming_mode(), lattice_ecp5_init_address(), lattice_ecp5_program_config_map(), lattice_ecp5_refresh(), lattice_ecp5_write_usercode(), lattice_preload(), lattice_read_u32_register(), lattice_read_u64_register(), legacy_jtag_add_reset(), ls1_sap_read_memory(), mcu_execute_queue(), mips32_pracc_exec(), mips32_pracc_fastdata_xfer(), mips32_pracc_queue_exec(), mips64_pracc_exec_read(), mips64_pracc_exec_write(), mips64_pracc_fastdata_xfer(), mips_ejtag_drscan_32(), mips_ejtag_drscan_64(), mips_ejtag_drscan_8(), or1k_adv_jtag_jsp_xfer(), or1k_tap_vjtag_init(), or1k_tap_xilinx_bscan_init(), read_memory_bus_v1(), reset_jtag(), riscv_batch_run(), scans_execute(), str9xpec_blank_check(), str9xpec_erase_area(), str9xpec_isc_status(), str9xpec_lock_device(), str9xpec_read_config(), str9xpec_write(), str9xpec_write_options(), svf_execute_tap(), virtex2_load(), virtex2_load_cleanup(), virtex2_load_prepare(), virtex2_program(), virtex2_read_stat(), xcf_erase_check(), xscale_assert_reset(), xscale_deassert_reset(), xscale_load_ic(), xscale_read_dcsr(), xscale_read_tx(), xscale_receive(), xscale_send(), xscale_write_dcsr(), and xscale_write_rx().

◆ jtag_execute_queue_noclear()

void jtag_execute_queue_noclear ( void  )

◆ jtag_get_flush_queue_count()

unsigned int jtag_get_flush_queue_count ( void  )
Returns
the number of times the scan queue has been flushed

Definition at line 1045 of file jtag/core.c.

References jtag_flush_queue_count.

Referenced by COMMAND_HANDLER().

◆ jtag_get_nsrst_assert_width()

unsigned int jtag_get_nsrst_assert_width ( void  )

Definition at line 1786 of file jtag/core.c.

References adapter_nsrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_get_nsrst_delay()

unsigned int jtag_get_nsrst_delay ( void  )

Definition at line 1769 of file jtag/core.c.

References adapter_nsrst_delay.

Referenced by COMMAND_HANDLER().

◆ jtag_get_ntrst_assert_width()

unsigned int jtag_get_ntrst_assert_width ( void  )

Definition at line 1794 of file jtag/core.c.

References jtag_ntrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_get_ntrst_delay()

unsigned int jtag_get_ntrst_delay ( void  )

Definition at line 1777 of file jtag/core.c.

References jtag_ntrst_delay.

Referenced by COMMAND_HANDLER().

◆ jtag_get_reset_config()

◆ jtag_get_srst()

int jtag_get_srst ( void  )
Returns
The current state of SRST.

Definition at line 1760 of file jtag/core.c.

References jtag_srst.

Referenced by arc_halt(), avr32_ap7k_halt(), COMMAND_HANDLER(), mips_m4k_halt(), mips_mips64_halt(), and or1k_halt().

◆ jtag_get_trst()

int jtag_get_trst ( void  )
Returns
The current state of TRST.

Definition at line 1756 of file jtag/core.c.

References jtag_trst.

Referenced by COMMAND_HANDLER().

◆ jtag_idcode_is_final()

static bool jtag_idcode_is_final ( uint32_t  idcode)
static

Definition at line 1157 of file jtag/core.c.

References END_OF_CHAIN_FLAG.

Referenced by jtag_examine_chain(), and jtag_examine_chain_end().

◆ jtag_init()

int jtag_init ( struct command_context cmd_ctx)

Initialize JTAG chain using only a RESET reset.

If init fails, try reset + init.

Definition at line 1677 of file jtag/core.c.

References adapter_init(), ERROR_FAIL, ERROR_OK, command_context::interp, jtag_add_reset(), jtag_execute_queue(), jtag_reset_config, LOG_WARNING, RESET_CNCT_UNDER_SRST, and RESET_SRST_NO_GATING.

Referenced by COMMAND_HANDLER().

◆ jtag_init_inner()

◆ jtag_init_reset()

int jtag_init_reset ( struct command_context cmd_ctx)

◆ jtag_poll_get_enabled()

bool jtag_poll_get_enabled ( void  )

Return flag reporting whether JTAG polling is disallowed.

Definition at line 166 of file jtag/core.c.

References jtag_poll.

Referenced by COMMAND_HANDLER().

◆ jtag_poll_mask()

bool jtag_poll_mask ( void  )

Mask (disable) polling and return the current mask status that should be feed to jtag_poll_unmask() to restore it.

Multiple nested calls to jtag_poll_mask() are allowed, each balanced with its call to jtag_poll_unmask().

Definition at line 176 of file jtag/core.c.

References jtag_poll_en.

Referenced by COMMAND_HANDLER(), target_process_reset(), and target_resume().

◆ jtag_poll_set_enabled()

void jtag_poll_set_enabled ( bool  value)

Assign flag reporting whether JTAG polling is disallowed.

Definition at line 171 of file jtag/core.c.

References jtag_poll.

Referenced by COMMAND_HANDLER().

◆ jtag_poll_unmask()

void jtag_poll_unmask ( bool  saved)

Restore saved mask for polling.

Definition at line 183 of file jtag/core.c.

References jtag_poll_en.

Referenced by COMMAND_HANDLER(), target_process_reset(), and target_resume().

◆ jtag_power_dropout()

int jtag_power_dropout ( int *  dropout)

Definition at line 1723 of file jtag/core.c.

References ERROR_OK, is_adapter_initialized(), LOG_ERROR, and adapter_driver::power_dropout.

Referenced by sense_handler().

◆ jtag_prelude()

static void jtag_prelude ( enum tap_state  state)
static

◆ jtag_register_event_callback()

int jtag_register_event_callback ( jtag_event_handler_t  callback,
void *  priv 
)

◆ jtag_reset_callback()

static int jtag_reset_callback ( enum jtag_event  event,
void *  priv 
)
static

◆ jtag_select()

static int jtag_select ( struct command_context ctx)
static

◆ jtag_set_error()

void jtag_set_error ( int  error)

Set the current JTAG core execution error, unless one was set by a previous call previously.

Driver or application code must use jtag_error_clear to reset jtag_error once this routine has been called with a non-zero error code.

Definition at line 125 of file jtag/core.c.

References ERROR_OK, and jtag_error.

Referenced by arm11_in_handler_scan_n(), jtag_add_clocks(), jtag_add_dr_scan(), jtag_add_ir_scan_noverify(), jtag_add_pathmove(), jtag_add_plain_dr_scan(), jtag_add_plain_ir_scan(), jtag_add_reset(), jtag_add_runtest(), jtag_add_sleep(), jtag_add_tlr(), jtag_add_tms_seq(), jtag_check_value_mask(), jtag_execute_queue_noclear(), and legacy_jtag_add_reset().

◆ jtag_set_flush_queue_sleep()

void jtag_set_flush_queue_sleep ( int  ms)

Set ms to sleep after jtag_execute_queue() flushes queue.

Debug purposes.

Definition at line 120 of file jtag/core.c.

References jtag_flush_queue_sleep.

Referenced by COMMAND_HANDLER().

◆ jtag_set_nsrst_assert_width()

void jtag_set_nsrst_assert_width ( unsigned int  delay)

Definition at line 1782 of file jtag/core.c.

References adapter_nsrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_set_nsrst_delay()

void jtag_set_nsrst_delay ( unsigned int  delay)

Definition at line 1765 of file jtag/core.c.

References adapter_nsrst_delay.

Referenced by COMMAND_HANDLER().

◆ jtag_set_ntrst_assert_width()

void jtag_set_ntrst_assert_width ( unsigned int  delay)

Definition at line 1790 of file jtag/core.c.

References jtag_ntrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_set_ntrst_delay()

void jtag_set_ntrst_delay ( unsigned int  delay)

Definition at line 1773 of file jtag/core.c.

References jtag_ntrst_delay.

Referenced by COMMAND_HANDLER().

◆ jtag_set_reset_config()

void jtag_set_reset_config ( enum reset_types  type)

Definition at line 1751 of file jtag/core.c.

References jtag_reset_config, and type.

Referenced by COMMAND_HANDLER().

◆ jtag_set_verify()

void jtag_set_verify ( bool  enable)

Enable or disable data scan verification checking.

Definition at line 1703 of file jtag/core.c.

References jtag_verify.

Referenced by COMMAND_HANDLER().

◆ jtag_set_verify_capture_ir()

void jtag_set_verify_capture_ir ( bool  enable)

Enable or disable verification of IR scan checking.

Definition at line 1713 of file jtag/core.c.

References jtag_verify_capture_ir.

Referenced by COMMAND_HANDLER().

◆ jtag_sleep()

◆ jtag_srst_asserted()

int jtag_srst_asserted ( int *  srst_asserted)

Definition at line 1738 of file jtag/core.c.

Referenced by COMMAND_HANDLER(), and sense_handler().

◆ jtag_tap_add()

static void jtag_tap_add ( struct jtag_tap t)
static

Append a new TAP to the chain of all taps.

Definition at line 219 of file jtag/core.c.

References __jtag_all_taps, jtag_tap::abs_chain_position, and jtag_tap::next_tap.

Referenced by jtag_tap_init().

◆ jtag_tap_by_position()

struct jtag_tap* jtag_tap_by_position ( unsigned int  n)

◆ jtag_tap_by_string()

◆ jtag_tap_count()

static unsigned int jtag_tap_count ( void  )
static

Definition at line 195 of file jtag/core.c.

References jtag_all_taps(), and jtag_tap::next_tap.

Referenced by jtag_examine_chain().

◆ jtag_tap_count_enabled()

unsigned int jtag_tap_count_enabled ( void  )

Definition at line 206 of file jtag/core.c.

References jtag_tap::enabled, jtag_all_taps(), and jtag_tap::next_tap.

Referenced by interface_jtag_add_ir_scan(), and jtagspi_cmd().

◆ jtag_tap_free()

◆ jtag_tap_init()

◆ jtag_tap_name()

const char* jtag_tap_name ( const struct jtag_tap tap)

Definition at line 282 of file jtag/core.c.

References jtag_tap::dotted_name.

Referenced by dap_init_all(), and jtag_validate_ircapture().

◆ jtag_tap_next_enabled()

◆ jtag_unregister_event_callback()

int jtag_unregister_event_callback ( jtag_event_handler_t  callback,
void *  priv 
)

◆ jtag_validate_ircapture()

◆ jtag_will_verify()

bool jtag_will_verify ( void  )
Returns
True if data scan verification will be performed.

Definition at line 1708 of file jtag/core.c.

References jtag_verify.

Referenced by COMMAND_HANDLER().

◆ jtag_will_verify_capture_ir()

bool jtag_will_verify_capture_ir ( void  )
Returns
True if IR scan verification will be performed.

Definition at line 1718 of file jtag/core.c.

References jtag_verify_capture_ir.

Referenced by COMMAND_HANDLER().

◆ legacy_jtag_add_reset()

◆ swd_init_reset()

int swd_init_reset ( struct command_context cmd_ctx)

◆ transport_is_jtag()

Variable Documentation

◆ __jtag_all_taps

struct jtag_tap* __jtag_all_taps
static

List all TAPs that have been created.

Definition at line 87 of file jtag/core.c.

Referenced by jtag_all_taps(), and jtag_tap_add().

◆ adapter_driver

Definition at line 27 of file adapter.c.

◆ adapter_nsrst_assert_width

unsigned int adapter_nsrst_assert_width
static

◆ adapter_nsrst_delay

unsigned int adapter_nsrst_delay
static

◆ cmd_queue_cur_state

enum tap_state cmd_queue_cur_state = TAP_RESET

The current TAP state of the pending JTAG command queue.

Definition at line 87 of file jtag/core.c.

Referenced by arm11_add_dr_scan_vc(), arm11_add_ir_scan_vc(), COMMAND_HANDLER(), jtag_add_clocks(), jtag_add_pathmove(), jtag_add_statemove(), jtag_add_tms_seq(), jtag_prelude(), and svf_add_statemove().

◆ jtag_error

int jtag_error = ERROR_OK
static

The jtag_error variable is set when an error occurs while executing the queue.

Application code may set this using jtag_set_error(), when an error occurs during processing that should be reported during jtag_execute_queue().

The value is set and cleared, but never read by normal application code.

This value is returned (and cleared) by jtag_execute_queue().

Definition at line 66 of file jtag/core.c.

Referenced by jtag_error_clear(), and jtag_set_error().

◆ jtag_event_callbacks

struct jtag_event_callback* jtag_event_callbacks
static

◆ jtag_event_strings

const char* jtag_event_strings[]
static
Initial value:
= {
[JTAG_TRST_ASSERTED] = "TAP reset",
[JTAG_TAP_EVENT_SETUP] = "TAP setup",
[JTAG_TAP_EVENT_ENABLE] = "TAP enabled",
[JTAG_TAP_EVENT_DISABLE] = "TAP disabled",
}
@ JTAG_TAP_EVENT_ENABLE
Definition: jtag.h:182
@ JTAG_TAP_EVENT_SETUP
Definition: jtag.h:181
@ JTAG_TRST_ASSERTED
Definition: jtag.h:180
@ JTAG_TAP_EVENT_DISABLE
Definition: jtag.h:183

Definition at line 68 of file jtag/core.c.

Referenced by jtag_call_event_callbacks().

◆ jtag_flush_queue_count

unsigned int jtag_flush_queue_count
static

The number of JTAG queue flushes (for profiling and debugging purposes).

Definition at line 42 of file jtag/core.c.

Referenced by jtag_execute_queue_noclear(), and jtag_get_flush_queue_count().

◆ jtag_flush_queue_sleep

int jtag_flush_queue_sleep
static

Definition at line 45 of file jtag/core.c.

Referenced by jtag_execute_queue_noclear(), and jtag_set_flush_queue_sleep().

◆ jtag_ntrst_assert_width

unsigned int jtag_ntrst_assert_width
static

◆ jtag_ntrst_delay

unsigned int jtag_ntrst_delay
static

◆ jtag_poll

bool jtag_poll = true
static

Definition at line 145 of file jtag/core.c.

Referenced by is_jtag_poll_safe(), jtag_poll_get_enabled(), and jtag_poll_set_enabled().

◆ jtag_poll_en

bool jtag_poll_en = true
static

Definition at line 146 of file jtag/core.c.

Referenced by is_jtag_poll_safe(), jtag_poll_mask(), and jtag_poll_unmask().

◆ jtag_reset_config

◆ jtag_srst

int jtag_srst = -1
static

◆ jtag_transport

struct transport jtag_transport
static
Initial value:
= {
.select = jtag_select,
.init = jtag_init,
}
int jtag_init(struct command_context *cmd_ctx)
Initialize JTAG chain using only a RESET reset.
Definition: jtag/core.c:1677
static int jtag_select(struct command_context *ctx)
Definition: jtag/core.c:1799
#define TRANSPORT_JTAG
Definition: transport.h:19

Definition at line 1799 of file jtag/core.c.

Referenced by transport_is_jtag().

◆ jtag_trst

int jtag_trst = -1
static

◆ jtag_verify

bool jtag_verify = true
static

◆ jtag_verify_capture_ir

bool jtag_verify_capture_ir = true
static