OpenOCD
|
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 (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, tap_state_t 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, tap_state_t 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, tap_state_t 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, tap_state_t 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, tap_state_t state) |
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 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, tap_state_t 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 (int num_cycles, tap_state_t 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, tap_state_t state), int in_num_fields, struct scan_field *in_fields, tap_state_t state) |
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 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_tap * | jtag_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) |
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 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 count, unsigned 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 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... | |
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) |
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 (tap_state_t 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 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) |
static void | jtag_tap_add (struct jtag_tap *t) |
Append a new TAP to the chain of all taps. More... | |
struct jtag_tap * | jtag_tap_by_position (unsigned n) |
struct jtag_tap * | jtag_tap_by_string (const char *s) |
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_tap * | jtag_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_driver * | adapter_driver |
static int | adapter_nsrst_assert_width |
static int | adapter_nsrst_delay |
tap_state_t | 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_callback * | jtag_event_callbacks |
static const char * | jtag_event_strings [] |
static int | jtag_flush_queue_count |
The number of JTAG queue flushes (for profiling and debugging purposes). More... | |
static int | jtag_flush_queue_sleep |
static int | jtag_ntrst_assert_width |
static 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 int | jtag_verify = 1 |
static bool | jtag_verify_capture_ir = true |
#define END_OF_CHAIN_FLAG 0xffffffff |
Definition at line 1079 of file jtag/core.c.
#define EXTRACT_MFG | ( | X | ) | (((X) & 0xffe) >> 1) |
Definition at line 1072 of file jtag/core.c.
#define EXTRACT_PART | ( | X | ) | (((X) & 0xffff000) >> 12) |
Definition at line 1073 of file jtag/core.c.
#define EXTRACT_VER | ( | X | ) | (((X) & 0xf0000000) >> 28) |
Definition at line 1074 of file jtag/core.c.
#define JTAG_IRLEN_MAX 60 |
Definition at line 1082 of file jtag/core.c.
#define JTAG_MAX_AUTO_TAPS 20 |
Definition at line 1070 of file jtag/core.c.
int adapter_assert_reset | ( | void | ) |
Definition at line 1880 of file jtag/core.c.
References adapter_system_reset(), ERROR_FAIL, ERROR_OK, get_current_transport(), jtag_add_reset(), jtag_reset_config, LOG_ERROR, name, RESET_SRST_PULLS_TRST, transport_is_dapdirect_jtag(), transport_is_dapdirect_swd(), transport_is_hla(), transport_is_jtag(), transport_is_swd(), and transport_is_swim().
Referenced by aarch64_assert_reset(), COMMAND_HANDLER(), cortex_a_assert_reset(), cortex_m_assert_reset(), dapdirect_init(), hl_assert_reset(), hl_interface_init_reset(), stlink_dap_op_connect(), stm8_reset_assert(), and swd_connect().
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 1917 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 jim_arm_tpiu_swo_enable().
int adapter_deassert_reset | ( | void | ) |
Definition at line 1900 of file jtag/core.c.
References adapter_system_reset(), ERROR_FAIL, ERROR_OK, get_current_transport(), jtag_add_reset(), LOG_ERROR, name, transport_is_dapdirect_jtag(), transport_is_dapdirect_swd(), transport_is_hla(), transport_is_jtag(), transport_is_swd(), and transport_is_swim().
Referenced by aarch64_deassert_reset(), COMMAND_HANDLER(), cortex_a_deassert_reset(), cortex_m_deassert_reset(), dapdirect_init(), hl_deassert_reset(), hl_interface_init_reset(), and stm8_reset_deassert().
int adapter_poll_trace | ( | uint8_t * | buf, |
size_t * | size | ||
) |
Definition at line 1932 of file jtag/core.c.
References ERROR_FAIL, adapter_driver::poll_trace, and size.
Referenced by arm_tpiu_swo_poll_trace().
int adapter_resets | ( | int | trst, |
int | srst | ||
) |
Definition at line 1833 of file jtag/core.c.
References adapter_system_reset(), ERROR_FAIL, ERROR_OK, get_current_transport(), jtag_add_reset(), jtag_execute_queue(), jtag_reset_config, LOG_ERROR, name, RESET_HAS_SRST, SRST_ASSERT, SRST_DEASSERT, transport_is_dapdirect_jtag(), transport_is_dapdirect_swd(), transport_is_hla(), transport_is_jtag(), transport_is_swd(), transport_is_swim(), TRST_ASSERT, and TRST_DEASSERT.
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 614 of file jtag/core.c.
References adapter_nsrst_assert_width, adapter_nsrst_delay, ERROR_FAIL, ERROR_OK, jtag_reset_config, jtag_sleep(), jtag_srst, LOG_DEBUG, LOG_ERROR, adapter_driver::reset, and RESET_HAS_SRST.
Referenced by adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), and swd_init_reset().
int default_interface_jtag_execute_queue | ( | void | ) |
Calls the interface callback to execute the queue.
This routine is used by the JTAG driver layer and should not be called directly.
Definition at line 932 of file jtag/core.c.
References buf_to_hex_str(), cmd, debug_level, ERROR_FAIL, ERROR_OK, jtag_interface::execute_queue, scan_field::in_value, is_adapter_initialized(), jtag_command_queue, adapter_driver::jtag_ops, JTAG_PATHMOVE, JTAG_RESET, JTAG_RUNTEST, JTAG_SCAN, JTAG_SLEEP, JTAG_STABLECLOCKS, JTAG_TLR_RESET, JTAG_TMS, LOG_DEBUG_IO, LOG_ERROR, LOG_LVL_DEBUG_IO, scan_field::num_bits, scan_field::out_value, tap_state_name(), and transport_is_jtag().
Referenced by interface_jtag_execute_queue().
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().
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().
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(), 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(), idcode_scan(), ipdbg_shift_data(), ipdbg_shift_vir(), isc_data_read_out(), isc_program_register(), isc_read_register(), isc_set_register(), jim_command_drscan(), jtag_add_dr_scan_check(), jtagspi_cmd(), lakemont_reset_break(), 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().
void jtag_add_dr_scan_check | ( | struct jtag_tap * | active, |
int | in_num_fields, | ||
struct scan_field * | in_fields, | ||
tap_state_t | state | ||
) |
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().
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(), esirisc_jtag_set_instr(), etb_set_instr(), fpga_configure(), halt(), idcode_scan(), ipdbg_shift_instr(), irscan(), isc_data_read_out(), isc_enter(), isc_leave(), isc_program_register(), isc_read_register(), isc_set_register(), jtagspi_set_ir(), lakemont_reset_break(), 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().
void jtag_add_ir_scan_noverify | ( | struct jtag_tap * | active, |
const struct scan_field * | in_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().
|
static |
Definition at line 365 of file jtag/core.c.
References jtag_add_ir_scan_noverify(), and state.
Referenced by jtag_add_ir_scan().
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:
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(), jim_command_pathmove(), jtag_add_statemove(), reset_jtag(), svf_add_statemove(), xscale_read_tx(), and xscale_receive().
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().
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().
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(), aice_init_reset(), 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().
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).
num_cycles | Number of cycles in TAP_IDLE state. This argument may be 0, in which case this routine will navigate to endstate via TAP_IDLE. |
endstate | The 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(), read_memory_bus_v1(), riscv_batch_run(), virtex2_load(), xscale_deassert_reset(), and xscale_receive().
|
static |
Definition at line 419 of file jtag/core.c.
References jtag_add_callback4(), jtag_check_value_mask_callback(), and state.
Referenced by jtag_add_dr_scan_check(), and jtag_add_ir_scan().
void jtag_add_sleep | ( | uint32_t | us | ) |
Definition at line 870 of file jtag/core.c.
References interface_jtag_add_sleep(), jtag_set_error(), and keep_alive().
Referenced by arc_assert_reset(), arm7_9_assert_reset(), COMMAND_HANDLER(), dsp563xx_assert_reset(), dsp5680xx_f_lock(), dsp5680xx_f_unlock(), dsp5680xx_resume(), eonce_enter_debug_mode(), jtag_add_reset(), legacy_jtag_add_reset(), mips_ejtag_exit_debug(), mips_m4k_assert_reset(), mips_mips64_assert_reset(), read_hw_reg(), str9xpec_blank_check(), str9xpec_erase_area(), str9xpec_isc_disable(), str9xpec_write(), str9xpec_write_options(), submit_pir(), virtex2_load(), xscale_assert_reset(), and xscale_deassert_reset().
int jtag_add_statemove | ( | tap_state_t | goal_state | ) |
jtag_add_statemove() moves from the current state to goal_state.
goal_state | The final TAP state. |
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(), jim_command_pathmove(), and reset_jtag().
void jtag_add_tlr | ( | void | ) |
Run a TAP_RESET reset where the end state is TAP_RESET, regardless of the start state.
Definition at line 478 of file jtag/core.c.
References interface_jtag_add_tlr(), jtag_call_event_callbacks(), jtag_notify_event(), jtag_prelude(), jtag_set_error(), JTAG_TRST_ASSERTED, and TAP_RESET.
Referenced by arm11_deassert_reset(), COMMAND_HANDLER(), jtag_add_reset(), jtag_add_statemove(), jtag_examine_chain_execute(), jtag_init_inner(), jtag_validate_ircapture(), legacy_jtag_add_reset(), or1k_tap_vjtag_init(), or1k_tap_xilinx_bscan_init(), svf_add_statemove(), virtex2_load(), and virtex2_read_stat().
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.
nbits | How many bits to clock out. |
seq | The bit sequence. The LSB is bit 0 of seq[0]. |
state | The JTAG tap state to record on completion. Use TAP_INVALID to represent being in in SWD mode. |
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().
struct jtag_tap* jtag_all_taps | ( | void | ) |
Definition at line 184 of file jtag/core.c.
References __jtag_all_taps.
Referenced by adapter_quit(), COMMAND_HANDLER(), jim_jtag_names(), jtag_notify_event(), jtag_tap_by_position(), jtag_tap_by_string(), jtag_tap_count(), jtag_tap_count_enabled(), and jtag_tap_next_enabled().
int jtag_call_event_callbacks | ( | enum jtag_event | event | ) |
Definition at line 324 of file jtag/core.c.
References jtag_event_callback::callback, ERROR_OK, jtag_event_callbacks, jtag_event_strings, LOG_DEBUG, and jtag_event_callback::next.
Referenced by jtag_add_reset(), jtag_add_tlr(), jtag_tap_disable(), jtag_tap_enable(), and legacy_jtag_add_reset().
|
static |
Definition at line 877 of file jtag/core.c.
References bits, buf_cmp(), buf_cmp_mask(), buf_to_hex_str(), DEBUG_JTAG_IOZ, ERROR_JTAG_QUEUE_FAILED, ERROR_OK, and LOG_WARNING.
Referenced by jtag_check_value_mask(), and jtag_check_value_mask_callback().
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.
field | Pointer to scan field. |
value | Pointer to scan value. |
mask | Pointer 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().
|
static |
Definition at line 408 of file jtag/core.c.
References jtag_check_value_inner().
Referenced by jtag_add_scan_check().
|
static |
Definition at line 342 of file jtag/core.c.
References jtag_trst.
Referenced by jtag_add_clocks(), jtag_add_pathmove(), jtag_add_tms_seq(), and jtag_prelude().
|
static |
Definition at line 1819 of file jtag/core.c.
int jtag_error_clear | ( | void | ) |
Resets jtag_error to ERROR_OK, returning its previous value.
jtag_error
. Definition at line 130 of file jtag/core.c.
References ERROR_OK, and jtag_error.
Referenced by jtag_execute_queue().
|
static |
Definition at line 1215 of file jtag/core.c.
References alloc_printf(), buf_get_u32(), jtag_tap::chip, jtag_tap::dotted_name, jtag_tap::enabled, ERROR_FAIL, ERROR_JTAG_INIT_FAILED, ERROR_JTAG_INIT_SOFT_FAIL, ERROR_OK, jtag_tap::hasidcode, jtag_tap::idcode, jtag_tap::ignore_bypass, jtag_tap::ir_capture_mask, jtag_tap::ir_capture_value, jtag_tap::ir_length, jtag_examine_chain_check(), jtag_examine_chain_display(), jtag_examine_chain_end(), jtag_examine_chain_execute(), jtag_examine_chain_match_tap(), jtag_idcode_is_final(), JTAG_MAX_AUTO_TAPS, jtag_tap_count(), jtag_tap_init(), jtag_tap_next_enabled(), LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_LVL_INFO, NULL, and jtag_tap::tapname.
Referenced by jtag_init_inner().
|
static |
Definition at line 1101 of file jtag/core.c.
References count, and LOG_ERROR.
Referenced by jtag_examine_chain().
|
static |
Definition at line 1130 of file jtag/core.c.
References EXTRACT_MFG, EXTRACT_PART, EXTRACT_VER, jep106_manufacturer(), log_printf_lf(), and name.
Referenced by jtag_examine_chain(), and jtag_examine_chain_match_tap().
|
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 1161 of file jtag/core.c.
References buf_get_u32(), count, jtag_idcode_is_final(), and LOG_WARNING.
Referenced by jtag_examine_chain().
|
static |
Definition at line 1084 of file jtag/core.c.
References buf_set_u32(), END_OF_CHAIN_FLAG, scan_field::in_value, jtag_add_plain_dr_scan(), jtag_add_tlr(), jtag_execute_queue(), scan_field::num_bits, scan_field::out_value, and TAP_DRPAUSE.
Referenced by jtag_examine_chain().
|
static |
Definition at line 1177 of file jtag/core.c.
References jtag_tap::dotted_name, jtag_tap::expected_ids, jtag_tap::expected_ids_cnt, jtag_tap::hasidcode, jtag_tap::idcode, jtag_tap::ignore_version, jtag_examine_chain_display(), LOG_LVL_ERROR, LOG_LVL_WARNING, and mask.
Referenced by jtag_examine_chain().
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(), aice_init_reset(), 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(), 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(), idcode_scan(), ipdbg_shift_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(), jim_command_drscan(), jim_command_pathmove(), 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(), 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_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().
void jtag_execute_queue_noclear | ( | void | ) |
same as jtag_execute_queue() but does not clear the error flag
Definition at line 1018 of file jtag/core.c.
References interface_jtag_execute_queue(), jtag_flush_queue_count, jtag_flush_queue_sleep, and jtag_set_error().
Referenced by arm11_add_debug_scan_n(), jtag_check_value_mask(), and jtag_execute_queue().
int jtag_get_flush_queue_count | ( | void | ) |
Definition at line 1032 of file jtag/core.c.
References jtag_flush_queue_count.
Referenced by jim_command_flush_count().
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().
unsigned jtag_get_nsrst_delay | ( | void | ) |
Definition at line 1756 of file jtag/core.c.
References adapter_nsrst_delay.
Referenced by COMMAND_HANDLER().
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().
unsigned jtag_get_ntrst_delay | ( | void | ) |
Definition at line 1764 of file jtag/core.c.
References jtag_ntrst_delay.
Referenced by COMMAND_HANDLER().
enum reset_types jtag_get_reset_config | ( | void | ) |
Definition at line 1725 of file jtag/core.c.
References ERROR_OK, adapter_driver::srst_asserted, and srst_asserted.
Referenced by aarch64_assert_reset(), aice_init_reset(), amt_jtagaccel_init(), arc_assert_reset(), arc_halt(), arm11_assert_reset(), arm7_9_assert_reset(), arm7_9_deassert_reset(), avr32_ap7k_halt(), bitq_execute_queue(), cmsis_dap_init(), COMMAND_HANDLER(), cortex_a_assert_reset(), cortex_m_assert_reset(), cortex_m_deassert_reset(), cortex_m_halt(), dapdirect_init(), dsp563xx_assert_reset(), dummy_reset(), esirisc_assert_reset(), esirisc_deassert_reset(), ftdi_reset(), hl_assert_reset(), hl_deassert_reset(), hl_interface_open(), mips_m4k_assert_reset(), mips_m4k_halt(), mips_mips64_assert_reset(), mips_mips64_halt(), or1k_halt(), rlink_execute_queue(), stlink_dap_init(), stlink_dap_op_connect(), stm8_examine(), stm8_reset_assert(), stm8_reset_deassert(), swd_connect(), and sync_adapter_reset_with_gpios().
int jtag_get_srst | ( | void | ) |
Definition at line 1747 of file jtag/core.c.
References jtag_srst.
Referenced by arc_halt(), avr32_ap7k_halt(), COMMAND_HANDLER(), cortex_m_halt(), mips_m4k_halt(), mips_mips64_halt(), and or1k_halt().
int jtag_get_trst | ( | void | ) |
Definition at line 1743 of file jtag/core.c.
References jtag_trst.
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 1144 of file jtag/core.c.
References END_OF_CHAIN_FLAG.
Referenced by jtag_examine_chain(), and jtag_examine_chain_end().
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().
int jtag_init_inner | ( | struct command_context * | cmd_ctx | ) |
Definition at line 1503 of file jtag/core.c.
References ERROR_OK, jtag_add_tlr(), jtag_examine_chain(), jtag_execute_queue(), jtag_notify_event(), JTAG_TAP_EVENT_SETUP, jtag_tap_next_enabled(), jtag_validate_ircapture(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, and NULL.
Referenced by jim_jtag_arp_init(), and jtag_init_reset().
int jtag_init_reset | ( | struct command_context * | cmd_ctx | ) |
reset, then initialize JTAG chain
Definition at line 1600 of file jtag/core.c.
References adapter_init(), ERROR_OK, jtag_add_reset(), jtag_execute_queue(), jtag_init_inner(), jtag_reset_config, LOG_DEBUG, LOG_WARNING, RESET_CNCT_UNDER_SRST, RESET_HAS_SRST, RESET_SRST_NO_GATING, and RESET_SRST_PULLS_TRST.
Referenced by jim_jtag_arp_init_reset().
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().
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(), psoc4_write(), target_process_reset(), and target_resume().
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().
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(), psoc4_write(), target_process_reset(), and target_resume().
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().
|
static |
Definition at line 347 of file jtag/core.c.
References cmd_queue_cur_state, jtag_checks(), state, and TAP_INVALID.
Referenced by jtag_add_dr_scan(), jtag_add_ir_scan_noverify(), jtag_add_plain_dr_scan(), jtag_add_plain_ir_scan(), jtag_add_runtest(), and jtag_add_tlr().
int jtag_register_event_callback | ( | jtag_event_handler_t | callback, |
void * | priv | ||
) |
Definition at line 282 of file jtag/core.c.
References jtag_event_callback::callback, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, jtag_event_callbacks, NULL, and priv.
Referenced by arm_jtag_setup_connection(), jtag_tap_init(), and target_examine().
|
static |
Definition at line 1043 of file jtag/core.c.
References buf_set_ones(), jtag_tap::bypass, jtag_tap::cur_instr, jtag_tap::disabled_after_reset, jtag_tap::enabled, ERROR_OK, jtag_tap::ir_length, JTAG_TRST_ASSERTED, and priv.
Referenced by jtag_tap_free(), and jtag_tap_init().
|
static |
Definition at line 1787 of file jtag/core.c.
References ERROR_OK, ipdbg_register_commands(), jtag_register_commands(), svf_register_commands(), and xsvf_register_commands().
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().
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().
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().
void jtag_set_nsrst_delay | ( | unsigned | delay | ) |
Definition at line 1752 of file jtag/core.c.
References adapter_nsrst_delay.
Referenced by COMMAND_HANDLER().
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().
void jtag_set_ntrst_delay | ( | unsigned | delay | ) |
Definition at line 1760 of file jtag/core.c.
References jtag_ntrst_delay.
Referenced by COMMAND_HANDLER().
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().
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().
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().
void jtag_sleep | ( | uint32_t | us | ) |
Definition at line 1062 of file jtag/core.c.
References alive_sleep().
Referenced by adapter_system_reset(), amt_jtagaccel_execute_queue(), armjtagew_execute_queue(), bitbang_execute_queue(), buspirate_execute_queue(), cmsis_dap_execute_sleep(), cortex_m_assert_reset(), esp_usb_jtag_sleep(), ftdi_execute_sleep(), gw16012_execute_queue(), jlink_execute_sleep(), jlink_init(), jtag_dpi_execute_queue(), jtag_vpi_execute_queue(), kitprog_generic_acquire(), kitprog_get_status(), opendous_execute_queue(), openjtag_execute_sleep(), osbdm_execute_command(), presto_bitq_sleep(), rlink_execute_queue(), setup_sysfs_gpio(), ublast_usleep(), usbprog_execute_queue(), vsllink_execute_queue(), and xds110_execute_sleep().
int jtag_srst_asserted | ( | int * | srst_asserted | ) |
Definition at line 1725 of file jtag/core.c.
Referenced by COMMAND_HANDLER(), and sense_handler().
|
static |
Append a new TAP to the chain of all taps.
Definition at line 213 of file jtag/core.c.
References __jtag_all_taps, jtag_tap::abs_chain_position, and jtag_tap::next_tap.
Referenced by jtag_tap_init().
struct jtag_tap* jtag_tap_by_position | ( | unsigned | n | ) |
Definition at line 227 of file jtag/core.c.
References jtag_all_taps(), and jtag_tap::next_tap.
Referenced by FLASH_BANK_COMMAND_HANDLER(), jtag_tap_by_string(), and lakemont_reset_break().
struct jtag_tap* jtag_tap_by_string | ( | const char * | s | ) |
Definition at line 237 of file jtag/core.c.
References jtag_tap::dotted_name, ERROR_OK, jtag_all_taps(), jtag_tap_by_position(), LOG_WARNING, jtag_tap::next_tap, and NULL.
Referenced by COMMAND_HANDLER(), dsp5680xx_f_lock(), dsp5680xx_f_unlock(), dsp5680xx_irscan(), eonce_enter_debug_mode(), jtag_tap_by_jim_obj(), PLD_DEVICE_COMMAND_HANDLER(), and switch_tap().
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().
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().
void jtag_tap_free | ( | struct jtag_tap * | tap | ) |
Definition at line 1481 of file jtag/core.c.
References jtag_tap_event_action::body, jtag_tap::chip, jtag_tap::cur_instr, jtag_tap::dotted_name, jtag_tap::event_action, jtag_tap::expected, jtag_tap::expected_ids, jtag_tap::expected_mask, jtag_tap_event_action::interp, jtag_reset_callback(), jtag_unregister_event_callback(), jtag_tap_event_action::next, and jtag_tap::tapname.
Referenced by adapter_quit(), and jim_newtap_cmd().
void jtag_tap_init | ( | struct jtag_tap * | tap | ) |
Definition at line 1446 of file jtag/core.c.
References jtag_tap::abs_chain_position, buf_set_ones(), buf_set_u32(), jtag_tap::bypass, jtag_tap::cur_instr, DIV_ROUND_UP, jtag_tap::dotted_name, jtag_tap::expected, jtag_tap::expected_mask, jtag_tap::ir_capture_mask, jtag_tap::ir_capture_value, jtag_tap::ir_length, JTAG_IRLEN_MAX, jtag_register_event_callback(), jtag_reset_callback(), jtag_tap_add(), and LOG_DEBUG.
Referenced by COMMAND_HANDLER(), jim_aice_newtap_cmd(), jim_hl_newtap_cmd(), jim_newtap_cmd(), and jtag_examine_chain().
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().
Definition at line 265 of file jtag/core.c.
References jtag_tap::enabled, jtag_all_taps(), jtag_tap::next_tap, and NULL.
Referenced by esirisc_jtag_get_padding(), interface_jtag_add_dr_scan(), interface_jtag_add_ir_scan(), jtag_examine_chain(), jtag_init_inner(), and jtag_validate_ircapture().
int jtag_unregister_event_callback | ( | jtag_event_handler_t | callback, |
void * | priv | ||
) |
Definition at line 303 of file jtag/core.c.
References jtag_event_callback::callback, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, jtag_event_callbacks, jtag_event_callback::next, and priv.
Referenced by arm_jtag_close_connection(), jtag_enable_callback(), jtag_tap_free(), and target_destroy().
|
static |
Definition at line 1331 of file jtag/core.c.
References buf_get_u64(), buf_set_ones(), buf_to_hex_str(), jtag_tap::chip, DIV_ROUND_UP, jtag_tap::dotted_name, ERROR_FAIL, ERROR_JTAG_INIT_FAILED, ERROR_OK, jtag_tap::idcode, scan_field::in_value, jtag_tap::ir_capture_mask, jtag_tap::ir_capture_value, jtag_tap::ir_length, jtag_add_plain_ir_scan(), jtag_add_tlr(), jtag_execute_queue(), JTAG_IRLEN_MAX, jtag_tap_name(), jtag_tap_next_enabled(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, NULL, scan_field::num_bits, scan_field::out_value, TAP_IDLE, and jtag_tap::tapname.
Referenced by jtag_init_inner().
bool jtag_will_verify | ( | void | ) |
Definition at line 1695 of file jtag/core.c.
References jtag_verify.
Referenced by COMMAND_HANDLER().
bool jtag_will_verify_capture_ir | ( | void | ) |
Definition at line 1705 of file jtag/core.c.
References jtag_verify_capture_ir.
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 649 of file jtag/core.c.
References adapter_nsrst_assert_width, adapter_nsrst_delay, ERROR_FAIL, ERROR_OK, interface_jtag_add_reset(), 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, LOG_DEBUG, LOG_ERROR, RESET_HAS_SRST, RESET_HAS_TRST, RESET_SRST_PULLS_TRST, RESET_TRST_PULLS_SRST, TAP_RESET, and tap_set_state.
Referenced by jtag_add_reset().
int swd_init_reset | ( | struct command_context * | cmd_ctx | ) |
Definition at line 1583 of file jtag/core.c.
References adapter_init(), adapter_system_reset(), ERROR_OK, jtag_reset_config, LOG_DEBUG, and RESET_HAS_SRST.
Referenced by jim_jtag_arp_init_reset().
bool transport_is_jtag | ( | void | ) |
Returns true if the current debug session is using JTAG as its transport.
Definition at line 1828 of file jtag/core.c.
References get_current_transport(), and jtag_transport.
Referenced by adapter_assert_reset(), adapter_deassert_reset(), adapter_resets(), am335xgpio_init(), bcm2835gpio_init(), bcm2835gpio_quit(), cleanup_all_fds(), COMMAND_HANDLER(), cortex_a_assert_reset(), dap_check_config(), default_interface_jtag_execute_queue(), imx_gpio_init(), imx_gpio_quit(), is_jtag_poll_safe(), jim_jtag_arp_init_reset(), jim_newtap_cmd(), jtag_queue_command(), linuxgpiod_init(), sysfsgpio_init(), vdebug_init(), and vdebug_reset().
|
static |
List all TAPs that have been created.
Definition at line 85 of file jtag/core.c.
Referenced by jtag_all_taps(), and jtag_tap_add().
|
extern |
|
static |
Definition at line 97 of file jtag/core.c.
Referenced by adapter_system_reset(), jtag_add_reset(), jtag_get_nsrst_assert_width(), jtag_set_nsrst_assert_width(), and legacy_jtag_add_reset().
|
static |
Definition at line 95 of file jtag/core.c.
Referenced by adapter_system_reset(), jtag_add_reset(), jtag_get_nsrst_delay(), jtag_set_nsrst_delay(), and legacy_jtag_add_reset().
tap_state_t cmd_queue_cur_state = TAP_RESET |
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().
|
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 64 of file jtag/core.c.
Referenced by jtag_error_clear(), and jtag_set_error().
|
static |
Definition at line 114 of file jtag/core.c.
Referenced by jtag_call_event_callbacks(), jtag_register_event_callback(), and jtag_unregister_event_callback().
|
static |
Definition at line 66 of file jtag/core.c.
Referenced by jtag_call_event_callbacks().
|
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().
|
static |
Definition at line 45 of file jtag/core.c.
Referenced by jtag_execute_queue_noclear(), and jtag_set_flush_queue_sleep().
|
static |
Definition at line 98 of file jtag/core.c.
Referenced by jtag_add_reset(), jtag_get_ntrst_assert_width(), jtag_set_ntrst_assert_width(), and legacy_jtag_add_reset().
|
static |
Definition at line 96 of file jtag/core.c.
Referenced by jtag_add_reset(), jtag_get_ntrst_delay(), jtag_set_ntrst_delay(), and legacy_jtag_add_reset().
|
static |
Definition at line 139 of file jtag/core.c.
Referenced by is_jtag_poll_safe(), jtag_poll_get_enabled(), and jtag_poll_set_enabled().
|
static |
Definition at line 140 of file jtag/core.c.
Referenced by is_jtag_poll_safe(), jtag_poll_mask(), and jtag_poll_unmask().
|
static |
Definition at line 85 of file jtag/core.c.
Referenced by adapter_assert_reset(), adapter_resets(), adapter_system_reset(), aice_init_reset(), amt_jtagaccel_init(), arc_assert_reset(), arm7_9_assert_reset(), arm7_9_deassert_reset(), cmsis_dap_init(), COMMAND_HANDLER(), cortex_m_assert_reset(), cortex_m_deassert_reset(), dapdirect_init(), dsp563xx_assert_reset(), hl_assert_reset(), hl_deassert_reset(), hl_interface_open(), is_jtag_poll_safe(), jtag_add_reset(), jtag_init(), jtag_init_reset(), jtag_set_reset_config(), legacy_jtag_add_reset(), mips_m4k_assert_reset(), mips_mips64_assert_reset(), stlink_dap_init(), stlink_dap_op_connect(), stm8_examine(), stm8_reset_assert(), stm8_reset_deassert(), swd_connect(), and swd_init_reset().
|
static |
Definition at line 80 of file jtag/core.c.
Referenced by adapter_system_reset(), is_jtag_poll_safe(), jtag_add_reset(), jtag_get_srst(), and legacy_jtag_add_reset().
|
static |
Definition at line 1787 of file jtag/core.c.
Referenced by transport_is_jtag().
|
static |
Definition at line 79 of file jtag/core.c.
Referenced by is_jtag_poll_safe(), jtag_add_reset(), jtag_checks(), jtag_get_trst(), and legacy_jtag_add_reset().
|
static |
Definition at line 91 of file jtag/core.c.
Referenced by jtag_add_dr_scan_check(), jtag_add_ir_scan(), jtag_set_verify(), and jtag_will_verify().
|
static |
Definition at line 90 of file jtag/core.c.
Referenced by jtag_add_ir_scan(), jtag_set_verify_capture_ir(), and jtag_will_verify_capture_ir().