diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-15 04:57:12 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-17 11:38:06 -0800 |
commit | 7bf1a86e473a12882bf6f71cb4d0d416394b69d4 (patch) | |
tree | 2c9c1d2138df704ac551cdafe105dbb68b8f23b8 /src/jtag | |
parent | 5b9899d6ea1e0cf763465c64c700f20eddd893f9 (diff) | |
download | riscv-openocd-7bf1a86e473a12882bf6f71cb4d0d416394b69d4.zip riscv-openocd-7bf1a86e473a12882bf6f71cb4d0d416394b69d4.tar.gz riscv-openocd-7bf1a86e473a12882bf6f71cb4d0d416394b69d4.tar.bz2 |
command_handler: change to 'argc' to CMD_ARGC
This patch converts all instances of 'argc' in COMMAND_HANDLER routines
to use CMD_ARGC.
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/amt_jtagaccel.c | 4 | ||||
-rw-r--r-- | src/jtag/at91rm9200.c | 2 | ||||
-rw-r--r-- | src/jtag/ft2232.c | 20 | ||||
-rw-r--r-- | src/jtag/gw16012.c | 2 | ||||
-rw-r--r-- | src/jtag/jlink.c | 2 | ||||
-rw-r--r-- | src/jtag/parport.c | 8 | ||||
-rw-r--r-- | src/jtag/presto.c | 2 | ||||
-rw-r--r-- | src/jtag/tcl.c | 60 | ||||
-rw-r--r-- | src/jtag/vsllink.c | 12 |
9 files changed, 56 insertions, 56 deletions
diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c index 3fb77f8..949acec 100644 --- a/src/jtag/amt_jtagaccel.c +++ b/src/jtag/amt_jtagaccel.c @@ -497,7 +497,7 @@ static int amt_jtagaccel_quit(void) COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command) { - if (argc == 1) + if (CMD_ARGC == 1) { /* only if the port wasn't overwritten by cmdline */ if (amt_jtagaccel_port == 0) @@ -520,7 +520,7 @@ COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command) COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command) { - if (argc == 0) + if (CMD_ARGC == 0) { command_print(cmd_ctx, "amt_jtagaccel RTCK feature %s", (rtck_enabled) ? "enabled" : "disabled"); return ERROR_OK; diff --git a/src/jtag/at91rm9200.c b/src/jtag/at91rm9200.c index dc9797e..90d94c9 100644 --- a/src/jtag/at91rm9200.c +++ b/src/jtag/at91rm9200.c @@ -187,7 +187,7 @@ static int at91rm9200_speed(int speed) static int at91rm9200_handle_device_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc) { - if (argc == 0) + if (CMD_ARGC == 0) return ERROR_OK; /* only if the device name wasn't overwritten by cmdline */ diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 7acdf1a..c1b3f10 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -2801,7 +2801,7 @@ COMMAND_HANDLER(ft2232_handle_device_desc_command) { char *cp; char buf[200]; - if (argc == 1) + if (CMD_ARGC == 1) { ft2232_device_desc = strdup(args[0]); cp = strchr(ft2232_device_desc, 0); @@ -2833,7 +2833,7 @@ COMMAND_HANDLER(ft2232_handle_device_desc_command) COMMAND_HANDLER(ft2232_handle_serial_command) { - if (argc == 1) + if (CMD_ARGC == 1) { ft2232_serial = strdup(args[0]); } @@ -2847,7 +2847,7 @@ COMMAND_HANDLER(ft2232_handle_serial_command) COMMAND_HANDLER(ft2232_handle_layout_command) { - if (argc == 0) + if (CMD_ARGC == 0) return ERROR_OK; ft2232_layout = malloc(strlen(args[0]) + 1); @@ -2858,23 +2858,23 @@ COMMAND_HANDLER(ft2232_handle_layout_command) COMMAND_HANDLER(ft2232_handle_vid_pid_command) { - if (argc > MAX_USB_IDS * 2) + if (CMD_ARGC > MAX_USB_IDS * 2) { LOG_WARNING("ignoring extra IDs in ft2232_vid_pid " "(maximum is %d pairs)", MAX_USB_IDS); - argc = MAX_USB_IDS * 2; + CMD_ARGC = MAX_USB_IDS * 2; } - if (argc < 2 || (argc & 1)) + if (CMD_ARGC < 2 || (CMD_ARGC & 1)) { LOG_WARNING("incomplete ft2232_vid_pid configuration directive"); - if (argc < 2) + if (CMD_ARGC < 2) return ERROR_COMMAND_SYNTAX_ERROR; /* remove the incomplete trailing id */ - argc -= 1; + CMD_ARGC -= 1; } unsigned i; - for (i = 0; i < argc; i += 2) + for (i = 0; i < CMD_ARGC; i += 2) { COMMAND_PARSE_NUMBER(u16, args[i], ft2232_vid[i >> 1]); COMMAND_PARSE_NUMBER(u16, args[i + 1], ft2232_pid[i >> 1]); @@ -2891,7 +2891,7 @@ COMMAND_HANDLER(ft2232_handle_vid_pid_command) COMMAND_HANDLER(ft2232_handle_latency_command) { - if (argc == 1) + if (CMD_ARGC == 1) { ft2232_latency = atoi(args[0]); } diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index e24c23a..d1da2a1 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -543,7 +543,7 @@ static int gw16012_quit(void) COMMAND_HANDLER(gw16012_handle_parport_port_command) { - if (argc == 1) + if (CMD_ARGC == 1) { /* only if the port wasn't overwritten by cmdline */ if (gw16012_port == 0) diff --git a/src/jtag/jlink.c b/src/jtag/jlink.c index 23ebc62..41b99a1 100644 --- a/src/jtag/jlink.c +++ b/src/jtag/jlink.c @@ -627,7 +627,7 @@ COMMAND_HANDLER(jlink_handle_jlink_info_command) COMMAND_HANDLER(jlink_handle_jlink_hw_jtag_command) { - switch (argc) { + switch (CMD_ARGC) { case 0: command_print(cmd_ctx, "jlink hw jtag %i", jlink_hw_jtag_version); break; diff --git a/src/jtag/parport.c b/src/jtag/parport.c index 399c00a..52289c5 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -411,7 +411,7 @@ static int parport_quit(void) COMMAND_HANDLER(parport_handle_parport_port_command) { - if (argc == 1) + if (CMD_ARGC == 1) { /* only if the port wasn't overwritten by cmdline */ if (parport_port == 0) @@ -432,7 +432,7 @@ COMMAND_HANDLER(parport_handle_parport_port_command) COMMAND_HANDLER(parport_handle_parport_cable_command) { - if (argc == 0) + if (CMD_ARGC == 0) return ERROR_OK; /* only if the cable name wasn't overwritten by cmdline */ @@ -447,7 +447,7 @@ COMMAND_HANDLER(parport_handle_parport_cable_command) COMMAND_HANDLER(parport_handle_write_on_exit_command) { - if (argc != 1) + if (CMD_ARGC != 1) { command_print(cmd_ctx, "usage: parport_write_on_exit <on | off>"); return ERROR_OK; @@ -463,7 +463,7 @@ COMMAND_HANDLER(parport_handle_write_on_exit_command) COMMAND_HANDLER(parport_handle_parport_toggling_time_command) { - if (argc == 1) { + if (CMD_ARGC == 1) { uint32_t ns; int retval = parse_u32(args[0], &ns); diff --git a/src/jtag/presto.c b/src/jtag/presto.c index b4ba3f4..45d99ff 100644 --- a/src/jtag/presto.c +++ b/src/jtag/presto.c @@ -752,7 +752,7 @@ static char *presto_serial; COMMAND_HANDLER(presto_handle_serial_command) { - if (argc == 1) + if (CMD_ARGC == 1) { if (presto_serial) free(presto_serial); diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 71e7bd5..bd3f704 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -605,7 +605,7 @@ static int default_srst_asserted(int *srst_asserted) COMMAND_HANDLER(handle_interface_list_command) { - if (strcmp(CMD_NAME, "interface_list") == 0 && argc > 0) + if (strcmp(CMD_NAME, "interface_list") == 0 && CMD_ARGC > 0) return ERROR_COMMAND_SYNTAX_ERROR; command_print(cmd_ctx, "The following JTAG interfaces are available:"); @@ -628,7 +628,7 @@ COMMAND_HANDLER(handle_interface_command) } /* interface name is a mandatory argument */ - if (argc != 1 || args[0][0] == '\0') + if (CMD_ARGC != 1 || args[0][0] == '\0') return ERROR_COMMAND_SYNTAX_ERROR; for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) @@ -711,7 +711,7 @@ COMMAND_HANDLER(handle_reset_config_command) * Here we don't care about the order, and only change values * which have been explicitly specified. */ - for (; argc; argc--, args++) { + for (; CMD_ARGC; CMD_ARGC--, args++) { int tmp = 0; int m; @@ -897,9 +897,9 @@ next: COMMAND_HANDLER(handle_jtag_nsrst_delay_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) + if (CMD_ARGC == 1) { unsigned delay; COMMAND_PARSE_NUMBER(uint, args[0], delay); @@ -912,9 +912,9 @@ COMMAND_HANDLER(handle_jtag_nsrst_delay_command) COMMAND_HANDLER(handle_jtag_ntrst_delay_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) + if (CMD_ARGC == 1) { unsigned delay; COMMAND_PARSE_NUMBER(uint, args[0], delay); @@ -927,9 +927,9 @@ COMMAND_HANDLER(handle_jtag_ntrst_delay_command) COMMAND_HANDLER(handle_jtag_nsrst_assert_width_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) + if (CMD_ARGC == 1) { unsigned delay; COMMAND_PARSE_NUMBER(uint, args[0], delay); @@ -942,9 +942,9 @@ COMMAND_HANDLER(handle_jtag_nsrst_assert_width_command) COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) + if (CMD_ARGC == 1) { unsigned delay; COMMAND_PARSE_NUMBER(uint, args[0], delay); @@ -957,11 +957,11 @@ COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command) COMMAND_HANDLER(handle_jtag_khz_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; int retval = ERROR_OK; - if (argc == 1) + if (CMD_ARGC == 1) { unsigned khz = 0; COMMAND_PARSE_NUMBER(uint, args[0], khz); @@ -986,11 +986,11 @@ COMMAND_HANDLER(handle_jtag_khz_command) COMMAND_HANDLER(handle_jtag_rclk_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; int retval = ERROR_OK; - if (argc == 1) + if (CMD_ARGC == 1) { unsigned khz = 0; COMMAND_PARSE_NUMBER(uint, args[0], khz); @@ -1015,7 +1015,7 @@ COMMAND_HANDLER(handle_jtag_rclk_command) COMMAND_HANDLER(handle_jtag_reset_command) { - if (argc != 2) + if (CMD_ARGC != 2) return ERROR_COMMAND_SYNTAX_ERROR; int trst = -1; @@ -1043,7 +1043,7 @@ COMMAND_HANDLER(handle_jtag_reset_command) COMMAND_HANDLER(handle_runtest_command) { - if (argc != 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; unsigned num_clocks; @@ -1082,7 +1082,7 @@ COMMAND_HANDLER(handle_irscan_command) struct jtag_tap *tap; tap_state_t endstate; - if ((argc < 2) || (argc % 2)) + if ((CMD_ARGC < 2) || (CMD_ARGC % 2)) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -1093,21 +1093,21 @@ COMMAND_HANDLER(handle_irscan_command) */ endstate = TAP_IDLE; - if (argc >= 4) { + if (CMD_ARGC >= 4) { /* have at least one pair of numbers. */ /* is last pair the magic text? */ - if (strcmp("-endstate", args[argc - 2]) == 0) { - endstate = tap_state_by_name(args[argc - 1]); + if (strcmp("-endstate", args[CMD_ARGC - 2]) == 0) { + endstate = tap_state_by_name(args[CMD_ARGC - 1]); if (endstate == TAP_INVALID) return ERROR_COMMAND_SYNTAX_ERROR; if (!scan_is_safe(endstate)) LOG_WARNING("unstable irscan endstate \"%s\"", - args[argc - 1]); - argc -= 2; + args[CMD_ARGC - 1]); + CMD_ARGC -= 2; } } - int num_fields = argc / 2; + int num_fields = CMD_ARGC / 2; size_t fields_len = sizeof(struct scan_field) * num_fields; fields = malloc(fields_len); memset(fields, 0, fields_len); @@ -1352,10 +1352,10 @@ static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const COMMAND_HANDLER(handle_verify_ircapture_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) + if (CMD_ARGC == 1) { if (strcmp(args[0], "enable") == 0) jtag_set_verify_capture_ir(true); @@ -1373,10 +1373,10 @@ COMMAND_HANDLER(handle_verify_ircapture_command) COMMAND_HANDLER(handle_verify_jtag_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) + if (CMD_ARGC == 1) { if (strcmp(args[0], "enable") == 0) jtag_set_verify(true); @@ -1394,10 +1394,10 @@ COMMAND_HANDLER(handle_verify_jtag_command) COMMAND_HANDLER(handle_tms_sequence_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) + if (CMD_ARGC == 1) { bool use_new_table; if (strcmp(args[0], "short") == 0) diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c index 0684dd3..cbea995 100644 --- a/src/jtag/vsllink.c +++ b/src/jtag/vsllink.c @@ -1324,7 +1324,7 @@ static void vsllink_simple_command(uint8_t command) COMMAND_HANDLER(vsllink_handle_mode_command) { - if (argc != 1) { + if (CMD_ARGC != 1) { LOG_ERROR("parameter error, should be one parameter for VID"); return ERROR_FAIL; } @@ -1348,7 +1348,7 @@ COMMAND_HANDLER(vsllink_handle_mode_command) COMMAND_HANDLER(vsllink_handle_usb_vid_command) { - if (argc != 1) + if (CMD_ARGC != 1) { LOG_ERROR("parameter error, should be one parameter for VID"); return ERROR_OK; @@ -1360,7 +1360,7 @@ COMMAND_HANDLER(vsllink_handle_usb_vid_command) COMMAND_HANDLER(vsllink_handle_usb_pid_command) { - if (argc != 1) + if (CMD_ARGC != 1) { LOG_ERROR("parameter error, should be one parameter for PID"); return ERROR_OK; @@ -1371,7 +1371,7 @@ COMMAND_HANDLER(vsllink_handle_usb_pid_command) COMMAND_HANDLER(vsllink_handle_usb_bulkin_command) { - if (argc != 1) + if (CMD_ARGC != 1) { LOG_ERROR("parameter error, should be one parameter for BULKIN endpoint"); return ERROR_OK; @@ -1386,7 +1386,7 @@ COMMAND_HANDLER(vsllink_handle_usb_bulkin_command) COMMAND_HANDLER(vsllink_handle_usb_bulkout_command) { - if (argc != 1) + if (CMD_ARGC != 1) { LOG_ERROR("parameter error, should be one parameter for BULKOUT endpoint"); return ERROR_OK; @@ -1401,7 +1401,7 @@ COMMAND_HANDLER(vsllink_handle_usb_bulkout_command) COMMAND_HANDLER(vsllink_handle_usb_interface_command) { - if (argc != 1) + if (CMD_ARGC != 1) { LOG_ERROR("parameter error, should be one parameter for interface number"); return ERROR_OK; |