28 Jim_SetResultFormatted(goi->
interp,
"option: %s bad parameter",
34 uint32_t *new_expected_ids = malloc(expected_len +
sizeof(uint32_t));
35 if (!new_expected_ids) {
36 Jim_SetResultFormatted(goi->
interp,
"no memory");
41 memcpy(new_expected_ids, tap->
expected_ids, expected_len);
52 #define NTAP_OPT_EXPECTED_ID 0
64 {.name =
NULL, .value = -1},
67 tap = calloc(1,
sizeof(
struct jtag_tap));
69 Jim_SetResultFormatted(goi->
interp,
"no memory");
77 Jim_SetResultFormatted(goi->
interp,
78 "Missing CHIP TAP OPTIONS ....");
85 tap->
chip = strdup(tmp);
91 x = strlen(tap->
chip) + 1 + strlen(tap->
tapname) + 1;
96 LOG_DEBUG(
"Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
141 static bool jtag_initialized;
142 if (jtag_initialized) {
143 LOG_INFO(
"'jtag init' has already been called");
146 jtag_initialized =
true;
148 LOG_DEBUG(
"Initializing jtag devices...");
155 char expected_id[12];
160 " TapName Enabled IdCode Expected IrLen IrCap IrMask");
162 "-- ------------------- -------- ---------- ---------- ----- ----- ------");
167 snprintf(expected_id,
sizeof(expected_id),
"0x%08x",
172 expected_id[2] =
'*';
178 "%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
182 (
unsigned int)(tap->
idcode),
189 snprintf(expected_id,
sizeof(expected_id),
"0x%08x",
192 expected_id[2] =
'*';
207 LOG_DEBUG(
"No implement: jim_aice_arp_init");
215 LOG_DEBUG(
"Initializing with hard TRST+SRST reset");
241 Jim_WrongNumArgs(goi.
interp, 1, goi.
argv - 1,
"(no params)");
248 Jim_Obj *obj = Jim_NewIntObj(goi.
interp, e);
249 Jim_SetResultFormatted(goi.
interp,
"error: %#s", obj);
260 Jim_WrongNumArgs(goi.
interp, 1, goi.
argv,
"Too many parameters");
267 Jim_ListAppendElement(goi.
interp,
268 Jim_GetResult(goi.
interp),
269 Jim_NewStringObj(goi.
interp,
280 .handler = handle_aice_init_command,
281 .help =
"initialize jtag scan chain",
288 .help =
"Validates JTAG scan chain against the list of "
292 .name =
"arp_init-reset",
295 .help =
"Uses TRST and SRST to try resetting everything on "
296 "the JTAG scan chain, then performs 'jtag arp_init'."
302 .help =
"Create a new TAP instance named basename.tap_type, "
303 "and appends it to the scan chain.",
304 .usage =
"basename tap_type ['-expected_id' number]"
307 .name =
"tapisenabled",
310 .help =
"Returns a Tcl boolean (0/1) indicating whether "
311 "the TAP is enabled (1) or not (0).",
318 .help =
"Try to enable the specified TAP using the "
319 "'tap-enable' TAP event.",
323 .name =
"tapdisable",
326 .help =
"Try to disable the specified TAP using the "
327 "'tap-disable' TAP event.",
334 .help =
"Provide a Tcl handler for the specified "
336 .usage =
"tap_name '-event' event_name handler",
342 .help =
"Return any Tcl handler for the specified "
344 .usage =
"tap_name '-event' event_name",
350 .help =
"Returns list of all JTAG tap names.",
353 .name =
"scan_chain",
354 .handler = handle_scan_chain_command,
356 .help =
"print current scan chain configuration",
int aice_init_targets(void)
int aice_scan_jtag_chain(void)
static int aice_transport_select(struct command_context *ctx)
static int jim_aice_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int aice_transport_init(struct command_context *cmd_ctx)
static int aice_init_reset(struct command_context *cmd_ctx)
static int jim_aice_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static const struct command_registration aice_transport_command_handlers[]
static int aice_transport_register_commands(struct command_context *cmd_ctx)
static const struct command_registration aice_transport_jtag_subcommand_handlers[]
static int jim_aice_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
#define NTAP_OPT_EXPECTED_ID
static int jim_aice_newtap_cmd(struct jim_getopt_info *goi)
static int jim_aice_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi, struct jtag_tap *tap)
const char * aice_transports[]
static struct transport aice_jtag_transport
COMMAND_HANDLER(handle_aice_init_command)
static void aice_constructor(void)
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned first, unsigned num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
struct command_context * current_command_context(Jim_Interp *interp)
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
static int register_commands(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds)
Register one or more commands in the specified context, as children of parent (or top-level commends,...
struct esp_usb_jtag __attribute__
int jim_getopt_wide(struct jim_getopt_info *goi, jim_wide *puthere)
Remove argv[0] as wide.
int jim_getopt_setup(struct jim_getopt_info *p, Jim_Interp *interp, int argc, Jim_Obj *const *argv)
GetOpt - how to.
int jim_getopt_string(struct jim_getopt_info *goi, const char **puthere, int *len)
Remove argv[0] as string.
int jim_getopt_nvp(struct jim_getopt_info *goi, const struct jim_nvp *nvp, struct jim_nvp **puthere)
Remove argv[0] as NVP.
void jim_getopt_nvp_unknown(struct jim_getopt_info *goi, const struct jim_nvp *nvptable, int hadprefix)
Create an appropriate error message for an NVP.
void jtag_add_reset(int req_tlr_or_trst, int req_srst)
A reset of the TAP state machine can be requested.
int jtag_init(struct command_context *cmd_ctx)
Initialize JTAG chain using only a RESET reset.
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
struct jtag_tap * jtag_all_taps(void)
static enum reset_types jtag_reset_config
void jtag_tap_init(struct jtag_tap *tap)
enum reset_types jtag_get_reset_config(void)
int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
A TCL -ish GetOpt like code.
Name Value Pairs, aka: NVP.
uint8_t * expected_mask
Capture-IR expected mask.
bool ignore_version
Flag saying whether to ignore version field in expected_ids[].
bool disabled_after_reset
Is this TAP disabled after JTAG reset?
int ir_length
size of instruction register
uint8_t * expected
Capture-IR expected value.
uint8_t expected_ids_cnt
Number of expected identification codes.
bool enabled
Is this TAP currently enabled?
uint32_t * expected_ids
Array of expected identification codes.
struct jtag_tap * next_tap
uint32_t idcode
device identification code
Wrapper for transport lifecycle operations.
const char * name
Each transport has a unique name, used to select it from among the alternatives.
struct target * get_current_target(struct command_context *cmd_ctx)
struct transport * get_current_transport(void)
Returns the transport currently being used by this debug or programming session.
int transport_register(struct transport *new_transport)
Registers a transport.