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_IRBYPASS   8
 
#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_jtag_configure)
 
 __COMMAND_HANDLER (handle_jtag_newtap)
 
 __COMMAND_HANDLER (handle_jtag_tap_enabler)
 
 COMMAND_HANDLER (handle_irscan_command)
 
 COMMAND_HANDLER (handle_jtag_arp_init)
 
 COMMAND_HANDLER (handle_jtag_arp_init_reset)
 
 COMMAND_HANDLER (handle_jtag_command_drscan)
 
 COMMAND_HANDLER (handle_jtag_command_pathmove)
 
 COMMAND_HANDLER (handle_jtag_flush_count)
 
 COMMAND_HANDLER (handle_jtag_flush_queue_sleep)
 
 COMMAND_HANDLER (handle_jtag_init_command)
 
 COMMAND_HANDLER (handle_jtag_names)
 
 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 COMMAND_HELPER (handle_jtag_command_drscan_fields, struct scan_field *fields)
 
static COMMAND_HELPER (handle_jtag_newtap_args, 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 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 int jtag_tap_set_event (struct command_context *cmd_ctx, struct jtag_tap *tap, const struct nvp *event, Jim_Obj *body)
 
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 nvp jtag_newtap_opts []
 
static const struct command_registration jtag_subcommand_handlers []
 
static struct nvp nvp_config_opts []
 
static const struct 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 372 of file jtag/tcl.c.

◆ NTAP_OPT_DISABLED

#define NTAP_OPT_DISABLED   4

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

◆ NTAP_OPT_ENABLED

#define NTAP_OPT_ENABLED   3

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

◆ NTAP_OPT_EXPECTED_ID

#define NTAP_OPT_EXPECTED_ID   5

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

◆ NTAP_OPT_IRBYPASS

#define NTAP_OPT_IRBYPASS   8

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

◆ NTAP_OPT_IRCAPTURE

#define NTAP_OPT_IRCAPTURE   2

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

◆ NTAP_OPT_IRLEN

#define NTAP_OPT_IRLEN   0

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

◆ NTAP_OPT_IRMASK

#define NTAP_OPT_IRMASK   1

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

◆ NTAP_OPT_VERSION

#define NTAP_OPT_VERSION   6

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

Enumeration Type Documentation

◆ jtag_tap_cfg_param

Enumerator
JCFG_EVENT 
JCFG_IDCODE 

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

Function Documentation

◆ __COMMAND_HANDLER() [1/3]

◆ __COMMAND_HANDLER() [2/3]

__COMMAND_HANDLER ( handle_jtag_newtap  )

◆ __COMMAND_HANDLER() [3/3]

◆ COMMAND_HANDLER() [1/18]

◆ COMMAND_HANDLER() [2/18]

COMMAND_HANDLER ( handle_jtag_arp_init  )

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

References CMD_ARGC, CMD_CTX, ERROR_COMMAND_SYNTAX_ERROR, and jtag_init_inner().

◆ COMMAND_HANDLER() [3/18]

COMMAND_HANDLER ( handle_jtag_arp_init_reset  )

◆ COMMAND_HANDLER() [4/18]

◆ COMMAND_HANDLER() [5/18]

◆ COMMAND_HANDLER() [6/18]

COMMAND_HANDLER ( handle_jtag_flush_count  )

◆ COMMAND_HANDLER() [7/18]

COMMAND_HANDLER ( handle_jtag_flush_queue_sleep  )

◆ COMMAND_HANDLER() [8/18]

COMMAND_HANDLER ( handle_jtag_init_command  )

Definition at line 673 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() [9/18]

COMMAND_HANDLER ( handle_jtag_names  )

◆ COMMAND_HANDLER() [10/18]

COMMAND_HANDLER ( handle_jtag_ntrst_assert_width_command  )

◆ COMMAND_HANDLER() [11/18]

COMMAND_HANDLER ( handle_jtag_ntrst_delay_command  )

◆ COMMAND_HANDLER() [12/18]

◆ COMMAND_HANDLER() [13/18]

COMMAND_HANDLER ( handle_runtest_command  )

◆ COMMAND_HANDLER() [14/18]

◆ COMMAND_HANDLER() [15/18]

COMMAND_HANDLER ( handle_tms_sequence_command  )

◆ COMMAND_HANDLER() [16/18]

COMMAND_HANDLER ( handle_verify_ircapture_command  )

◆ COMMAND_HANDLER() [17/18]

COMMAND_HANDLER ( handle_verify_jtag_command  )

◆ COMMAND_HANDLER() [18/18]

COMMAND_HANDLER ( handle_wait_srst_deassert  )

◆ COMMAND_HELPER() [1/2]

static COMMAND_HELPER ( handle_jtag_command_drscan_fields  ,
struct scan_field fields 
)
static

◆ COMMAND_HELPER() [2/2]

◆ jtag_notify_event()

void jtag_notify_event ( enum jtag_event  event)

Report Tcl event to all TAPs.

Definition at line 783 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 1209 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 
)

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_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()

◆ jtag_tap_set_event()

static int jtag_tap_set_event ( struct command_context cmd_ctx,
struct jtag_tap tap,
const struct nvp event,
Jim_Obj *  body 
)
static

◆ scan_is_safe()

static bool scan_is_safe ( tap_state_t  state)
static

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

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

Referenced by COMMAND_HANDLER().

Variable Documentation

◆ jtag_command_handlers

const struct command_registration jtag_command_handlers[]
static

Definition at line 1069 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,
.handler = handle_jtag_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,
.handler = handle_jtag_flush_count,
.help = "Returns the number of times the JTAG queue "
"has been flushed.",
.usage = "",
},
{
.name = "pathmove",
.mode = COMMAND_EXEC,
.handler = handle_jtag_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:253
@ COMMAND_EXEC
Definition: command.h:40

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

◆ jtag_newtap_opts

const struct nvp jtag_newtap_opts[]
static
Initial value:
= {
{ .name = "-irlen", .value = NTAP_OPT_IRLEN },
{ .name = "-irmask", .value = NTAP_OPT_IRMASK },
{ .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
{ .name = "-enable", .value = NTAP_OPT_ENABLED },
{ .name = "-disable", .value = NTAP_OPT_DISABLED },
{ .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
{ .name = "-ignore-version", .value = NTAP_OPT_VERSION },
{ .name = "-ignore-bypass", .value = NTAP_OPT_BYPASS },
{ .name = "-ir-bypass", .value = NTAP_OPT_IRBYPASS },
{ .name = NULL, .value = -1 },
}
#define NTAP_OPT_IRMASK
Definition: jtag/tcl.c:366
#define NTAP_OPT_DISABLED
Definition: jtag/tcl.c:369
#define NTAP_OPT_IRLEN
Definition: jtag/tcl.c:365
#define NTAP_OPT_BYPASS
Definition: jtag/tcl.c:372
#define NTAP_OPT_ENABLED
Definition: jtag/tcl.c:368
#define NTAP_OPT_EXPECTED_ID
Definition: jtag/tcl.c:370
#define NTAP_OPT_IRCAPTURE
Definition: jtag/tcl.c:367
#define NTAP_OPT_IRBYPASS
Definition: jtag/tcl.c:373
#define NTAP_OPT_VERSION
Definition: jtag/tcl.c:371
#define NULL
Definition: usb.h:16

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

Referenced by COMMAND_HELPER().

◆ jtag_subcommand_handlers

const struct command_registration jtag_subcommand_handlers[]
static

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

◆ nvp_config_opts

struct 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:262
@ JCFG_EVENT
Definition: jtag/tcl.c:261

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

Referenced by __COMMAND_HANDLER().

◆ nvp_jtag_tap_event

const struct 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:183
@ JTAG_TAP_EVENT_SETUP
Definition: jtag.h:182
@ JTAG_TRST_ASSERTED
Definition: jtag.h:181
@ JTAG_TAP_EVENT_DISABLE
Definition: jtag.h:184

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

Referenced by __COMMAND_HANDLER(), and jtag_tap_handle_event().