OpenOCD
jtag.h File Reference

The JTAG interface can be implemented with a software or hardware fifo. More...

Include dependency graph for jtag.h:

Go to the source code of this file.

Data Structures

struct  jtag_tap
 
struct  jtag_tap_event_action
 
struct  scan_field
 This structure defines a single scan field in the scan. More...
 

Macros

#define DEBUG_JTAG_IOZ   64
 
#define ERROR_JTAG_DEVICE_ERROR   (-107)
 
#define ERROR_JTAG_INIT_FAILED   (-100)
 
#define ERROR_JTAG_INIT_SOFT_FAIL   (-110)
 
#define ERROR_JTAG_INVALID_INTERFACE   (-101)
 
#define ERROR_JTAG_NOT_IMPLEMENTED   (-102)
 
#define ERROR_JTAG_NOT_STABLE_STATE   (-105)
 
#define ERROR_JTAG_QUEUE_FAILED   (-104)
 
#define ERROR_JTAG_STATE_INVALID   (-108)
 
#define ERROR_JTAG_TRANSITION_INVALID   (-109)
 
#define ERROR_JTAG_TRST_ASSERTED   (-103)
 
#define SRST_ASSERT   1
 
#define SRST_DEASSERT   0
 Defines arguments for reset functions. More...
 
#define TRST_ASSERT   1
 
#define TRST_DEASSERT   0
 

Typedefs

typedef void(* jtag_callback1_t) (jtag_callback_data_t data0)
 Defines a simple JTAG callback that can allow conversions on data scanned in from an interface. More...
 
typedef intptr_t jtag_callback_data_t
 Defines the type of data passed to the jtag_callback_t interface. More...
 
typedef int(* jtag_callback_t) (jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
 Defines the interface of the JTAG callback mechanism. More...
 
typedef int(* jtag_event_handler_t) (enum jtag_event event, void *priv)
 Defines the function signature required for JTAG event callback functions, which are added with jtag_register_event_callback() and removed jtag_unregister_event_callback(). More...
 
typedef enum tap_state tap_state_t
 Defines JTAG Test Access Port states. More...
 

Enumerations

enum  jtag_event { JTAG_TRST_ASSERTED , JTAG_TAP_EVENT_SETUP , JTAG_TAP_EVENT_ENABLE , JTAG_TAP_EVENT_DISABLE }
 
enum  reset_types {
  RESET_NONE = 0x0 , RESET_HAS_TRST = 0x1 , RESET_HAS_SRST = 0x2 , RESET_TRST_AND_SRST = 0x3 ,
  RESET_SRST_PULLS_TRST = 0x4 , RESET_TRST_PULLS_SRST = 0x8 , RESET_TRST_OPEN_DRAIN = 0x10 , RESET_SRST_PUSH_PULL = 0x20 ,
  RESET_SRST_NO_GATING = 0x40 , RESET_CNCT_UNDER_SRST = 0x80
}
 
enum  tap_state {
  TAP_INVALID = -1 , TAP_DREXIT2 = 0x0 , TAP_DREXIT1 = 0x1 , TAP_DRSHIFT = 0x2 ,
  TAP_DRPAUSE = 0x3 , TAP_IRSELECT = 0x4 , TAP_DRUPDATE = 0x5 , TAP_DRCAPTURE = 0x6 ,
  TAP_DRSELECT = 0x7 , TAP_IREXIT2 = 0x8 , TAP_IREXIT1 = 0x9 , TAP_IRSHIFT = 0xa ,
  TAP_IRPAUSE = 0xb , TAP_IDLE = 0xc , TAP_IRUPDATE = 0xd , TAP_IRCAPTURE = 0xe ,
  TAP_RESET = 0x0f
}
 Defines JTAG Test Access Port states. More...
 

Functions

 __COMMAND_HANDLER (handle_jtag_newtap)
 
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_callback (jtag_callback1_t f, jtag_callback_data_t data0)
 A simpler version of jtag_add_callback4(). More...
 
void jtag_add_clocks (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 *tap, int num_fields, const struct scan_field *fields, tap_state_t endstate)
 Generate a DR SCAN using the fields passed to the function. More...
 
void jtag_add_dr_scan_check (struct jtag_tap *tap, int num_fields, struct scan_field *fields, tap_state_t endstate)
 A version of jtag_add_dr_scan() that uses the check_value/mask fields. More...
 
void jtag_add_ir_scan (struct jtag_tap *tap, struct scan_field *fields, tap_state_t endstate)
 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 *tap, const struct scan_field *fields, tap_state_t state)
 The same as jtag_add_ir_scan except no verification is performed out the output values. More...
 
void jtag_add_pathmove (int num_states, const tap_state_t *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, tap_state_t endstate)
 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, tap_state_t endstate)
 Scan out the bits in ir scan mode. More...
 
void jtag_add_reset (int req_tlr_or_trst, int srst)
 A reset of the TAP state machine can be requested. More...
 
void jtag_add_runtest (int num_cycles, tap_state_t 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). More...
 
void jtag_add_sleep (uint32_t us)
 
int jtag_add_statemove (tap_state_t 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 nbits, const uint8_t *seq, enum tap_state t)
 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)
 
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...
 
int jtag_error_clear (void)
 Resets jtag_error to ERROR_OK, returning its previous value. More...
 
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...
 
int jtag_get_flush_queue_count (void)
 
unsigned jtag_get_nsrst_assert_width (void)
 
unsigned jtag_get_nsrst_delay (void)
 
unsigned jtag_get_ntrst_assert_width (void)
 
unsigned jtag_get_ntrst_delay (void)
 
enum reset_types jtag_get_reset_config (void)
 
int jtag_get_srst (void)
 
int jtag_get_trst (void)
 
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...
 
void jtag_notify_event (enum jtag_event)
 Report Tcl event to all TAPs. 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)
 
int jtag_register_commands (struct command_context *cmd_ctx)
 
int jtag_register_event_callback (jtag_event_handler_t f, void *x)
 
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 delay)
 
void jtag_set_nsrst_delay (unsigned delay)
 
void jtag_set_ntrst_assert_width (unsigned delay)
 
void jtag_set_ntrst_delay (unsigned 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)
 
struct jtag_tapjtag_tap_by_jim_obj (Jim_Interp *interp, Jim_Obj *obj)
 
struct jtag_tapjtag_tap_by_position (unsigned abs_position)
 
struct jtag_tapjtag_tap_by_string (const char *dotted_name)
 
unsigned jtag_tap_count (void)
 
unsigned 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 f, void *x)
 
bool jtag_will_verify (void)
 
bool jtag_will_verify_capture_ir (void)
 
tap_state_t tap_state_by_name (const char *name)
 Provides user-friendly name lookup of TAP states. More...
 
const char * tap_state_name (tap_state_t state)
 Function tap_state_name Returns a string suitable for display representing the JTAG tap_state. More...
 

Variables

tap_state_t cmd_queue_cur_state
 The current TAP state of the pending JTAG command queue. More...
 

Detailed Description

The JTAG interface can be implemented with a software or hardware fifo.

TAP_DRSHIFT and TAP_IRSHIFT are illegal end states; however, TAP_DRSHIFT/IRSHIFT can be emulated as end states, by using longer scans.

Code that is relatively insensitive to the path taken through state machine (as long as it is JTAG compliant) can use endstate for jtag_add_xxx_scan(). Otherwise, the pause state must be specified as end state and a subsequent jtag_add_pathmove() must be issued.

Definition in file jtag.h.

Macro Definition Documentation

◆ DEBUG_JTAG_IOZ

#define DEBUG_JTAG_IOZ   64

Definition at line 20 of file jtag.h.

◆ ERROR_JTAG_DEVICE_ERROR

#define ERROR_JTAG_DEVICE_ERROR   (-107)

Definition at line 559 of file jtag.h.

◆ ERROR_JTAG_INIT_FAILED

#define ERROR_JTAG_INIT_FAILED   (-100)

Definition at line 553 of file jtag.h.

◆ ERROR_JTAG_INIT_SOFT_FAIL

#define ERROR_JTAG_INIT_SOFT_FAIL   (-110)

Definition at line 562 of file jtag.h.

◆ ERROR_JTAG_INVALID_INTERFACE

#define ERROR_JTAG_INVALID_INTERFACE   (-101)

Definition at line 554 of file jtag.h.

◆ ERROR_JTAG_NOT_IMPLEMENTED

#define ERROR_JTAG_NOT_IMPLEMENTED   (-102)

Definition at line 555 of file jtag.h.

◆ ERROR_JTAG_NOT_STABLE_STATE

#define ERROR_JTAG_NOT_STABLE_STATE   (-105)

Definition at line 558 of file jtag.h.

◆ ERROR_JTAG_QUEUE_FAILED

#define ERROR_JTAG_QUEUE_FAILED   (-104)

Definition at line 557 of file jtag.h.

◆ ERROR_JTAG_STATE_INVALID

#define ERROR_JTAG_STATE_INVALID   (-108)

Definition at line 560 of file jtag.h.

◆ ERROR_JTAG_TRANSITION_INVALID

#define ERROR_JTAG_TRANSITION_INVALID   (-109)

Definition at line 561 of file jtag.h.

◆ ERROR_JTAG_TRST_ASSERTED

#define ERROR_JTAG_TRST_ASSERTED   (-103)

Definition at line 556 of file jtag.h.

◆ SRST_ASSERT

#define SRST_ASSERT   1

Definition at line 63 of file jtag.h.

◆ SRST_DEASSERT

#define SRST_DEASSERT   0

Defines arguments for reset functions.

Definition at line 62 of file jtag.h.

◆ TRST_ASSERT

#define TRST_ASSERT   1

Definition at line 65 of file jtag.h.

◆ TRST_DEASSERT

#define TRST_DEASSERT   0

Definition at line 64 of file jtag.h.

Typedef Documentation

◆ jtag_callback1_t

typedef void(* jtag_callback1_t) (jtag_callback_data_t data0)

Defines a simple JTAG callback that can allow conversions on data scanned in from an interface.

This callback should only be used for conversion that cannot fail. For conversion types or checks that can fail, use the more complete variant: jtag_callback_t.

Definition at line 347 of file jtag.h.

◆ jtag_callback_data_t

typedef intptr_t jtag_callback_data_t

Defines the type of data passed to the jtag_callback_t interface.

The underlying type must allow storing an int or pointer type.

Definition at line 337 of file jtag.h.

◆ jtag_callback_t

typedef int(* jtag_callback_t) (jtag_callback_data_t data0, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)

Defines the interface of the JTAG callback mechanism.

Such callbacks can be executed once the queue has been flushed.

The JTAG queue can be executed synchronously or asynchronously. Typically for USB, the queue is executed asynchronously. For low-latency interfaces, the queue may be executed synchronously.

The callback mechanism is very general and does not make many assumptions about what the callback does or what its arguments are. These callbacks are typically executed after the entire JTAG queue has been executed for e.g. USB interfaces, and they are guaranteed to be invoked in the order that they were queued.

If the execution of the queue fails before the callbacks, then – depending on driver implementation – the callbacks may or may not be invoked.

Todo:
Make that behavior consistent.
Parameters
data0Typically used to point to the data to operate on. Frequently this will be the data clocked in during a shift operation.
data1An integer big enough to use as an int or a pointer.
data2An integer big enough to use as an int or a pointer.
data3An integer big enough to use as an int or a pointer.
Returns
an error code

Definition at line 380 of file jtag.h.

◆ jtag_event_handler_t

typedef int(* jtag_event_handler_t) (enum jtag_event event, void *priv)

Defines the function signature required for JTAG event callback functions, which are added with jtag_register_event_callback() and removed jtag_unregister_event_callback().

Parameters
eventThe event to handle.
privA pointer to data that was passed to jtag_register_event_callback().
Returns
Must return ERROR_OK on success, or an error code on failure.
Todo:
Change to return void or define a use for its return code.

Definition at line 209 of file jtag.h.

◆ tap_state_t

typedef enum tap_state tap_state_t

Defines JTAG Test Access Port states.

These definitions were gleaned from the ARM7TDMI-S Technical Reference Manual and validated against several other ARM core technical manuals.

FIXME some interfaces require specific numbers be used, as they are handed-off directly to their hardware implementations. Fix those drivers to map as appropriate ... then pick some sane set of numbers here (where 0/uninitialized == INVALID).

Enumeration Type Documentation

◆ jtag_event

enum jtag_event
Enumerator
JTAG_TRST_ASSERTED 
JTAG_TAP_EVENT_SETUP 
JTAG_TAP_EVENT_ENABLE 
JTAG_TAP_EVENT_DISABLE 

Definition at line 180 of file jtag.h.

◆ reset_types

Enumerator
RESET_NONE 
RESET_HAS_TRST 
RESET_HAS_SRST 
RESET_TRST_AND_SRST 
RESET_SRST_PULLS_TRST 
RESET_TRST_PULLS_SRST 
RESET_TRST_OPEN_DRAIN 
RESET_SRST_PUSH_PULL 
RESET_SRST_NO_GATING 
RESET_CNCT_UNDER_SRST 

Definition at line 216 of file jtag.h.

◆ tap_state

enum tap_state

Defines JTAG Test Access Port states.

These definitions were gleaned from the ARM7TDMI-S Technical Reference Manual and validated against several other ARM core technical manuals.

FIXME some interfaces require specific numbers be used, as they are handed-off directly to their hardware implementations. Fix those drivers to map as appropriate ... then pick some sane set of numbers here (where 0/uninitialized == INVALID).

Enumerator
TAP_INVALID 
TAP_DREXIT2 
TAP_DREXIT1 
TAP_DRSHIFT 
TAP_DRPAUSE 
TAP_IRSELECT 
TAP_DRUPDATE 
TAP_DRCAPTURE 
TAP_DRSELECT 
TAP_IREXIT2 
TAP_IREXIT1 
TAP_IRSHIFT 
TAP_IRPAUSE 
TAP_IDLE 
TAP_IRUPDATE 
TAP_IRCAPTURE 
TAP_RESET 

Definition at line 37 of file jtag.h.

Function Documentation

◆ __COMMAND_HANDLER()

__COMMAND_HANDLER ( handle_jtag_newtap  )

◆ 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 142 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_callback()

◆ jtag_add_clocks()

void jtag_add_clocks ( 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 599 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,
tap_state_t  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 451 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 tap,
int  num_fields,
struct scan_field fields,
tap_state_t  endstate 
)

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

Definition at line 439 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,
tap_state_t  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 374 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 tap,
const struct scan_field fields,
tap_state_t  state 
)

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

Definition at line 356 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_pathmove()

void jtag_add_pathmove ( int  num_states,
const tap_state_t 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 517 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,
tap_state_t  endstate 
)

Scan out the bits in ir scan mode.

If in_bits == NULL, discard incoming bits.

Definition at line 465 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,
tap_state_t  endstate 
)

Scan out the bits in ir scan mode.

If in_bits == NULL, discard incoming bits.

Definition at line 392 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 758 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 ( int  num_cycles,
tap_state_t  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 592 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_sleep()

◆ jtag_add_statemove()

int jtag_add_statemove ( tap_state_t  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 551 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  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 502 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_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 917 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_error_clear()

int jtag_error_clear ( void  )

Resets jtag_error to ERROR_OK, returning its previous value.

Returns
The previous value of jtag_error.

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

References ERROR_OK, and jtag_error.

Referenced by jtag_execute_queue().

◆ 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 1037 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(), 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(), etb_status(), 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()

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

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

References jtag_flush_queue_count.

Referenced by COMMAND_HANDLER().

◆ jtag_get_nsrst_assert_width()

unsigned jtag_get_nsrst_assert_width ( void  )

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

References adapter_nsrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_get_nsrst_delay()

unsigned jtag_get_nsrst_delay ( void  )

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

References adapter_nsrst_delay.

Referenced by COMMAND_HANDLER().

◆ jtag_get_ntrst_assert_width()

unsigned jtag_get_ntrst_assert_width ( void  )

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

References jtag_ntrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_get_ntrst_delay()

unsigned jtag_get_ntrst_delay ( void  )

Definition at line 1764 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 1747 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 1743 of file jtag/core.c.

References jtag_trst.

Referenced by COMMAND_HANDLER().

◆ 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 1664 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_notify_event()

void jtag_notify_event ( enum  jtag_event)

Report Tcl event to all TAPs.

Definition at line 779 of file jtag/tcl.c.

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

Referenced by jtag_add_reset(), jtag_add_tlr(), jtag_init_inner(), and legacy_jtag_add_reset().

◆ jtag_poll_get_enabled()

bool jtag_poll_get_enabled ( void  )

Return flag reporting whether JTAG polling is disallowed.

Definition at line 160 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 170 of file jtag/core.c.

References jtag_poll_en.

Referenced by COMMAND_HANDLER(), jim_capture(), 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 165 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 177 of file jtag/core.c.

References jtag_poll_en.

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

◆ jtag_power_dropout()

int jtag_power_dropout ( int *  dropout)

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

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

Referenced by sense_handler().

◆ jtag_register_commands()

int jtag_register_commands ( struct command_context cmd_ctx)

Definition at line 1208 of file jtag/tcl.c.

References jtag_command_handlers, NULL, and register_commands().

Referenced by jtag_select().

◆ jtag_register_event_callback()

int jtag_register_event_callback ( jtag_event_handler_t  f,
void *  x 
)

◆ 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 123 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 118 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  delay)

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

References adapter_nsrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_set_nsrst_delay()

void jtag_set_nsrst_delay ( unsigned  delay)

Definition at line 1752 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  delay)

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

References jtag_ntrst_assert_width.

Referenced by COMMAND_HANDLER().

◆ jtag_set_ntrst_delay()

void jtag_set_ntrst_delay ( unsigned  delay)

Definition at line 1760 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 1738 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 1690 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 1700 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 1725 of file jtag/core.c.

Referenced by COMMAND_HANDLER(), and sense_handler().

◆ jtag_tap_by_jim_obj()

struct jtag_tap* jtag_tap_by_jim_obj ( Jim_Interp *  interp,
Jim_Obj *  obj 
)

Definition at line 53 of file jtag/tcl.c.

References jtag_tap_by_string(), and NULL.

Referenced by __COMMAND_HANDLER(), dap_configure(), and target_configure().

◆ jtag_tap_by_position()

struct jtag_tap* jtag_tap_by_position ( unsigned  abs_position)

◆ jtag_tap_by_string()

◆ jtag_tap_count()

unsigned jtag_tap_count ( void  )

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

References jtag_all_taps(), and jtag_tap::next_tap.

Referenced by jtag_examine_chain().

◆ jtag_tap_count_enabled()

unsigned jtag_tap_count_enabled ( void  )

Definition at line 200 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 276 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()

◆ jtag_will_verify()

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

Definition at line 1695 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 1705 of file jtag/core.c.

References jtag_verify_capture_ir.

Referenced by COMMAND_HANDLER().

◆ tap_state_by_name()

tap_state_t tap_state_by_name ( const char *  name)

Provides user-friendly name lookup of TAP states.

Definition at line 355 of file interface.c.

References ARRAY_SIZE, name, TAP_INVALID, and tap_name_mapping.

Referenced by COMMAND_HANDLER(), and reset_jtag().

◆ tap_state_name()

Variable Documentation

◆ cmd_queue_cur_state

tap_state_t cmd_queue_cur_state
extern

The current TAP state of the pending JTAG command queue.

Definition at line 88 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().