OpenOCD
jtag/tcl.c File Reference

Holds support for accessing JTAG-specific mechanisms from TCl scripts. More...

Include dependency graph for jtag/tcl.c:

Go to the source code of this file.

Macros

#define NTAP_OPT_BYPASS   7
 
#define NTAP_OPT_DISABLED   4
 
#define NTAP_OPT_ENABLED   3
 
#define NTAP_OPT_EXPECTED_ID   5
 
#define NTAP_OPT_IRCAPTURE   2
 
#define NTAP_OPT_IRLEN   0
 
#define NTAP_OPT_IRMASK   1
 
#define NTAP_OPT_VERSION   6
 

Enumerations

enum  jtag_tap_cfg_param { JCFG_EVENT , JCFG_IDCODE }
 

Functions

 COMMAND_HANDLER (handle_irscan_command)
 
 COMMAND_HANDLER (handle_jtag_flush_queue_sleep)
 
 COMMAND_HANDLER (handle_jtag_init_command)
 
 COMMAND_HANDLER (handle_jtag_ntrst_assert_width_command)
 
 COMMAND_HANDLER (handle_jtag_ntrst_delay_command)
 
 COMMAND_HANDLER (handle_jtag_rclk_command)
 
 COMMAND_HANDLER (handle_runtest_command)
 
 COMMAND_HANDLER (handle_scan_chain_command)
 
 COMMAND_HANDLER (handle_tms_sequence_command)
 
 COMMAND_HANDLER (handle_verify_ircapture_command)
 
 COMMAND_HANDLER (handle_verify_jtag_command)
 
 COMMAND_HANDLER (handle_wait_srst_deassert)
 
static int is_bad_irval (int ir_length, jim_wide w)
 
static int jim_command_drscan (Jim_Interp *interp, int argc, Jim_Obj *const *args)
 
static int jim_command_flush_count (Jim_Interp *interp, int argc, Jim_Obj *const *args)
 
static int jim_command_pathmove (Jim_Interp *interp, int argc, Jim_Obj *const *args)
 
static int jim_jtag_arp_init (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_jtag_arp_init_reset (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
int jim_jtag_configure (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_jtag_names (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
int jim_jtag_newtap (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
int jim_jtag_tap_enabler (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_newtap_cmd (struct jim_getopt_info *goi)
 
static int jim_newtap_expected_id (struct jim_nvp *n, struct jim_getopt_info *goi, struct jtag_tap *tap)
 
static int jim_newtap_ir_param (struct jim_nvp *n, struct jim_getopt_info *goi, struct jtag_tap *tap)
 
void jtag_notify_event (enum jtag_event event)
 Report Tcl event to all TAPs. More...
 
int jtag_register_commands (struct command_context *cmd_ctx)
 
struct jtag_tapjtag_tap_by_jim_obj (Jim_Interp *interp, Jim_Obj *o)
 
static int jtag_tap_configure_cmd (struct jim_getopt_info *goi, struct jtag_tap *tap)
 
static int jtag_tap_configure_event (struct jim_getopt_info *goi, struct jtag_tap *tap)
 
static bool jtag_tap_disable (struct jtag_tap *t)
 
static bool jtag_tap_enable (struct jtag_tap *t)
 
static void jtag_tap_handle_event (struct jtag_tap *tap, enum jtag_event e)
 
static bool scan_is_safe (tap_state_t state)
 

Variables

static const struct command_registration jtag_command_handlers []
 
static const struct command_registration jtag_command_handlers_to_move []
 
static const struct command_registration jtag_subcommand_handlers []
 
static struct jim_nvp nvp_config_opts []
 
static const struct jim_nvp nvp_jtag_tap_event []
 

Detailed Description

Holds support for accessing JTAG-specific mechanisms from TCl scripts.

Definition in file jtag/tcl.c.

Macro Definition Documentation

◆ NTAP_OPT_BYPASS

#define NTAP_OPT_BYPASS   7

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

◆ NTAP_OPT_DISABLED

#define NTAP_OPT_DISABLED   4

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

◆ NTAP_OPT_ENABLED

#define NTAP_OPT_ENABLED   3

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

◆ NTAP_OPT_EXPECTED_ID

#define NTAP_OPT_EXPECTED_ID   5

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

◆ NTAP_OPT_IRCAPTURE

#define NTAP_OPT_IRCAPTURE   2

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

◆ NTAP_OPT_IRLEN

#define NTAP_OPT_IRLEN   0

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

◆ NTAP_OPT_IRMASK

#define NTAP_OPT_IRMASK   1

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

◆ NTAP_OPT_VERSION

#define NTAP_OPT_VERSION   6

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

Enumeration Type Documentation

◆ jtag_tap_cfg_param

Enumerator
JCFG_EVENT 
JCFG_IDCODE 

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

Function Documentation

◆ COMMAND_HANDLER() [1/12]

◆ COMMAND_HANDLER() [2/12]

COMMAND_HANDLER ( handle_jtag_flush_queue_sleep  )

◆ COMMAND_HANDLER() [3/12]

COMMAND_HANDLER ( handle_jtag_init_command  )

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

References CMD_ARGC, CMD_CTX, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, jtag_init(), LOG_DEBUG, and LOG_INFO.

◆ COMMAND_HANDLER() [4/12]

COMMAND_HANDLER ( handle_jtag_ntrst_assert_width_command  )

◆ COMMAND_HANDLER() [5/12]

COMMAND_HANDLER ( handle_jtag_ntrst_delay_command  )

◆ COMMAND_HANDLER() [6/12]

◆ COMMAND_HANDLER() [7/12]

COMMAND_HANDLER ( handle_runtest_command  )

◆ COMMAND_HANDLER() [8/12]

◆ COMMAND_HANDLER() [9/12]

COMMAND_HANDLER ( handle_tms_sequence_command  )

◆ COMMAND_HANDLER() [10/12]

COMMAND_HANDLER ( handle_verify_ircapture_command  )

◆ COMMAND_HANDLER() [11/12]

COMMAND_HANDLER ( handle_verify_jtag_command  )

◆ COMMAND_HANDLER() [12/12]

COMMAND_HANDLER ( handle_wait_srst_deassert  )

◆ is_bad_irval()

static int is_bad_irval ( int  ir_length,
jim_wide  w 
)
static

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

Referenced by jim_newtap_ir_param().

◆ jim_command_drscan()

static int jim_command_drscan ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  args 
)
static

◆ jim_command_flush_count()

static int jim_command_flush_count ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  args 
)
static

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

References jtag_get_flush_queue_count().

◆ jim_command_pathmove()

static int jim_command_pathmove ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  args 
)
static

◆ jim_jtag_arp_init()

static int jim_jtag_arp_init ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_jtag_arp_init_reset()

static int jim_jtag_arp_init_reset ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_jtag_configure()

int jim_jtag_configure ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)

◆ jim_jtag_names()

static int jim_jtag_names ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_jtag_newtap()

int jim_jtag_newtap ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)

◆ jim_jtag_tap_enabler()

int jim_jtag_tap_enabler ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)

◆ jim_newtap_cmd()

◆ jim_newtap_expected_id()

static int jim_newtap_expected_id ( struct jim_nvp n,
struct jim_getopt_info goi,
struct jtag_tap tap 
)
static

◆ jim_newtap_ir_param()

◆ jtag_notify_event()

void jtag_notify_event ( enum jtag_event  event)

Report Tcl event to all TAPs.

Definition at line 940 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_register_commands()

int jtag_register_commands ( struct command_context cmd_ctx)

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

References jtag_command_handlers, NULL, and register_commands().

Referenced by jtag_select().

◆ jtag_tap_by_jim_obj()

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

◆ jtag_tap_configure_cmd()

◆ jtag_tap_configure_event()

◆ jtag_tap_disable()

static bool jtag_tap_disable ( struct jtag_tap t)
static

◆ jtag_tap_enable()

static bool jtag_tap_enable ( struct jtag_tap t)
static

◆ jtag_tap_handle_event()

◆ scan_is_safe()

static bool scan_is_safe ( tap_state_t  state)
static

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

References state, TAP_DRPAUSE, TAP_IDLE, TAP_IRPAUSE, and TAP_RESET.

Referenced by COMMAND_HANDLER(), and jim_command_drscan().

Variable Documentation

◆ jtag_command_handlers

const struct command_registration jtag_command_handlers[]
static

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

Referenced by jtag_register_commands().

◆ jtag_command_handlers_to_move

const struct command_registration jtag_command_handlers_to_move[]
static
Initial value:
= {
{
.name = "drscan",
.mode = COMMAND_EXEC,
.jim_handler = jim_command_drscan,
.help = "Execute Data Register (DR) scan for one TAP. "
"Other TAPs must be in BYPASS mode.",
.usage = "tap_name [num_bits value]* ['-endstate' state_name]",
},
{
.name = "flush_count",
.mode = COMMAND_EXEC,
.jim_handler = jim_command_flush_count,
.help = "Returns the number of times the JTAG queue "
"has been flushed.",
},
{
.name = "pathmove",
.mode = COMMAND_EXEC,
.jim_handler = jim_command_pathmove,
.usage = "start_state state1 [state2 [state3 ...]]",
.help = "Move JTAG state machine from current state "
"(start_state) to state1, then state2, state3, etc.",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_EXEC
Definition: command.h:40
static int jim_command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args)
Definition: jtag/tcl.c:253
static int jim_command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *args)
Definition: jtag/tcl.c:216
static int jim_command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args)
Definition: jtag/tcl.c:75

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

◆ jtag_subcommand_handlers

const struct command_registration jtag_subcommand_handlers[]
static

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

◆ nvp_config_opts

struct jim_nvp nvp_config_opts[]
static
Initial value:
= {
{ .name = "-event", .value = JCFG_EVENT },
{ .name = "-idcode", .value = JCFG_IDCODE },
{ .name = NULL, .value = -1 }
}
@ JCFG_IDCODE
Definition: jtag/tcl.c:300
@ JCFG_EVENT
Definition: jtag/tcl.c:299
#define NULL
Definition: usb.h:16

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

Referenced by jtag_tap_configure_cmd().

◆ nvp_jtag_tap_event

const struct jim_nvp nvp_jtag_tap_event[]
static
Initial value:
= {
{ .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
{ .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
{ .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
{ .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
{ .name = NULL, .value = -1 }
}
@ JTAG_TAP_EVENT_ENABLE
Definition: jtag.h:179
@ JTAG_TAP_EVENT_SETUP
Definition: jtag.h:178
@ JTAG_TRST_ASSERTED
Definition: jtag.h:177
@ JTAG_TAP_EVENT_DISABLE
Definition: jtag.h:180

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

Referenced by jtag_tap_configure_event(), and jtag_tap_handle_event().