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/target | |
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/target')
-rw-r--r-- | src/target/arm11.c | 6 | ||||
-rw-r--r-- | src/target/arm720t.c | 6 | ||||
-rw-r--r-- | src/target/arm7_9_common.c | 12 | ||||
-rw-r--r-- | src/target/arm920t.c | 18 | ||||
-rw-r--r-- | src/target/arm926ejs.c | 4 | ||||
-rw-r--r-- | src/target/arm966e.c | 6 | ||||
-rw-r--r-- | src/target/arm9tdmi.c | 4 | ||||
-rw-r--r-- | src/target/arm_adi_v5.c | 8 | ||||
-rw-r--r-- | src/target/armv4_5.c | 4 | ||||
-rw-r--r-- | src/target/armv7a.c | 2 | ||||
-rw-r--r-- | src/target/armv7m.c | 4 | ||||
-rw-r--r-- | src/target/cortex_m3.c | 14 | ||||
-rw-r--r-- | src/target/etb.c | 2 | ||||
-rw-r--r-- | src/target/etm.c | 16 | ||||
-rw-r--r-- | src/target/oocd_trace.c | 2 | ||||
-rw-r--r-- | src/target/target.c | 88 | ||||
-rw-r--r-- | src/target/target_request.c | 2 | ||||
-rw-r--r-- | src/target/trace.c | 4 | ||||
-rw-r--r-- | src/target/xscale.c | 38 |
19 files changed, 120 insertions, 120 deletions
diff --git a/src/target/arm11.c b/src/target/arm11.c index 936edd8..4236ac8 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2005,13 +2005,13 @@ static int arm11_build_reg_cache(struct target *target) static COMMAND_HELPER(arm11_handle_bool, bool *var, char *name) { - if (argc == 0) + if (CMD_ARGC == 0) { LOG_INFO("%s is %s.", name, *var ? "enabled" : "disabled"); return ERROR_OK; } - if (argc != 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; switch (args[0][0]) @@ -2052,7 +2052,7 @@ BOOL_WRAPPER(hardware_step, "hardware single step") COMMAND_HANDLER(arm11_handle_vcr) { - switch (argc) { + switch (CMD_ARGC) { case 0: break; case 1: diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 3bac0be..53d2224 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -429,12 +429,12 @@ COMMAND_HANDLER(arm720t_handle_cp15_command) } /* one or more argument, access a single register (write if second argument is given */ - if (argc >= 1) + if (CMD_ARGC >= 1) { uint32_t opcode; COMMAND_PARSE_NUMBER(u32, args[0], opcode); - if (argc == 1) + if (CMD_ARGC == 1) { uint32_t value; if ((retval = arm720t_read_cp15(target, opcode, &value)) != ERROR_OK) @@ -450,7 +450,7 @@ COMMAND_HANDLER(arm720t_handle_cp15_command) command_print(cmd_ctx, "0x%8.8" PRIx32 ": 0x%8.8" PRIx32 "", opcode, value); } - else if (argc == 2) + else if (CMD_ARGC == 2) { uint32_t value; COMMAND_PARSE_NUMBER(u32, args[1], value); diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 923c8cd..19c9791 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -2765,7 +2765,7 @@ COMMAND_HANDLER(handle_arm7_9_write_xpsr_command) return ERROR_FAIL; } - if (argc < 2) + if (CMD_ARGC < 2) { command_print(cmd_ctx, "usage: write_xpsr <value> <not cpsr | spsr>"); return ERROR_FAIL; @@ -2809,7 +2809,7 @@ COMMAND_HANDLER(handle_arm7_9_write_xpsr_im8_command) return ERROR_FAIL; } - if (argc < 3) + if (CMD_ARGC < 3) { command_print(cmd_ctx, "usage: write_xpsr_im8 <im8> <rotate> <not cpsr | spsr>"); return ERROR_FAIL; @@ -2849,7 +2849,7 @@ COMMAND_HANDLER(handle_arm7_9_write_core_reg_command) return ERROR_FAIL; } - if (argc < 3) + if (CMD_ARGC < 3) { command_print(cmd_ctx, "usage: write_core_reg <num> <mode> <value>"); return ERROR_FAIL; @@ -2873,7 +2873,7 @@ COMMAND_HANDLER(handle_arm7_9_dbgrq_command) return ERROR_TARGET_INVALID; } - if (argc > 0) + if (CMD_ARGC > 0) { if (strcmp("enable", args[0]) == 0) { @@ -2905,7 +2905,7 @@ COMMAND_HANDLER(handle_arm7_9_fast_memory_access_command) return ERROR_TARGET_INVALID; } - if (argc > 0) + if (CMD_ARGC > 0) { if (strcmp("enable", args[0]) == 0) { @@ -2937,7 +2937,7 @@ COMMAND_HANDLER(handle_arm7_9_dcc_downloads_command) return ERROR_TARGET_INVALID; } - if (argc > 0) + if (CMD_ARGC > 0) { if (strcmp("enable", args[0]) == 0) { diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 62dd3a1..58e92c3 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -682,7 +682,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command) if (retval != ERROR_OK) return retval; - if (argc != 1) + if (CMD_ARGC != 1) { command_print(cmd_ctx, "usage: arm920t read_cache <filename>"); return ERROR_OK; @@ -928,7 +928,7 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command) if (retval != ERROR_OK) return retval; - if (argc != 1) + if (CMD_ARGC != 1) { command_print(cmd_ctx, "usage: arm920t read_mmu <filename>"); return ERROR_OK; @@ -1207,12 +1207,12 @@ COMMAND_HANDLER(arm920t_handle_cp15_command) } /* one or more argument, access a single register (write if second argument is given */ - if (argc >= 1) + if (CMD_ARGC >= 1) { int address; COMMAND_PARSE_NUMBER(int, args[0], address); - if (argc == 1) + if (CMD_ARGC == 1) { uint32_t value; if ((retval = arm920t_read_cp15_physical(target, address, &value)) != ERROR_OK) @@ -1227,7 +1227,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command) command_print(cmd_ctx, "%i: %8.8" PRIx32 "", address, value); } - else if (argc == 2) + else if (CMD_ARGC == 2) { uint32_t value; COMMAND_PARSE_NUMBER(u32, args[1], value); @@ -1261,12 +1261,12 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command) } /* one or more argument, access a single register (write if second argument is given */ - if (argc >= 1) + if (CMD_ARGC >= 1) { uint32_t opcode; COMMAND_PARSE_NUMBER(u32, args[0], opcode); - if (argc == 1) + if (CMD_ARGC == 1) { uint32_t value; if ((retval = arm920t_read_cp15_interpreted(target, opcode, 0x0, &value)) != ERROR_OK) @@ -1277,7 +1277,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command) command_print(cmd_ctx, "%8.8" PRIx32 ": %8.8" PRIx32 "", opcode, value); } - else if (argc == 2) + else if (CMD_ARGC == 2) { uint32_t value; COMMAND_PARSE_NUMBER(u32, args[1], value); @@ -1288,7 +1288,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command) } command_print(cmd_ctx, "%8.8" PRIx32 ": %8.8" PRIx32 "", opcode, value); } - else if (argc == 3) + else if (CMD_ARGC == 3) { uint32_t value; COMMAND_PARSE_NUMBER(u32, args[1], value); diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index e38e7df..4e20664 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -722,7 +722,7 @@ COMMAND_HANDLER(arm926ejs_handle_cp15_command) int CRn; int CRm; - if ((argc < 4) || (argc > 5)) + if ((CMD_ARGC < 4) || (CMD_ARGC > 5)) { command_print(cmd_ctx, "usage: arm926ejs cp15 <opcode_1> <opcode_2> <CRn> <CRm> [value]"); return ERROR_OK; @@ -743,7 +743,7 @@ COMMAND_HANDLER(arm926ejs_handle_cp15_command) return ERROR_OK; } - if (argc == 4) + if (CMD_ARGC == 4) { uint32_t value; if ((retval = arm926ejs->read_cp15(target, opcode_1, opcode_2, CRn, CRm, &value)) != ERROR_OK) diff --git a/src/target/arm966e.c b/src/target/arm966e.c index fc50acb..0c08a60 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -179,12 +179,12 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) } /* one or more argument, access a single register (write if second argument is given */ - if (argc >= 1) + if (CMD_ARGC >= 1) { uint32_t address; COMMAND_PARSE_NUMBER(u32, args[0], address); - if (argc == 1) + if (CMD_ARGC == 1) { uint32_t value; if ((retval = arm966e_read_cp15(target, address, &value)) != ERROR_OK) @@ -202,7 +202,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command) command_print(cmd_ctx, "%" PRIi32 ": %8.8" PRIx32, address, value); } - else if (argc == 2) + else if (CMD_ARGC == 2) { uint32_t value; COMMAND_PARSE_NUMBER(u32, args[1], value); diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 3492c2a..b582eae 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -853,7 +853,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) /* get the current setting */ vector_catch_value = buf_get_u32(vector_catch->value, 0, 8); - if (argc > 0) + if (CMD_ARGC > 0) { vector_catch_value = 0x0; if (strcmp(args[0], "all") == 0) @@ -866,7 +866,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) } else { - for (unsigned i = 0; i < argc; i++) + for (unsigned i = 0; i < CMD_ARGC; i++) { /* go through list of vectors */ unsigned j; diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 958844b..dcae818 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1370,7 +1370,7 @@ DAP_COMMAND_HANDLER(dap_baseaddr_command) int retval; apselsave = swjdp->apsel; - switch (argc) { + switch (CMD_ARGC) { case 0: apsel = swjdp->apsel; break; @@ -1398,7 +1398,7 @@ DAP_COMMAND_HANDLER(dap_memaccess_command) { uint32_t memaccess_tck; - switch (argc) { + switch (CMD_ARGC) { case 0: memaccess_tck = swjdp->memaccess_tck; break; @@ -1421,7 +1421,7 @@ DAP_COMMAND_HANDLER(dap_apsel_command) uint32_t apsel, apid; int retval; - switch (argc) { + switch (CMD_ARGC) { case 0: apsel = 0; break; @@ -1447,7 +1447,7 @@ DAP_COMMAND_HANDLER(dap_apid_command) int retval; apselsave = swjdp->apsel; - switch (argc) { + switch (CMD_ARGC) { case 0: apsel = swjdp->apsel; break; diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 413061f..4c2a6e5 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -422,7 +422,7 @@ COMMAND_HANDLER(handle_armv4_5_core_state_command) return ERROR_FAIL; } - if (argc > 0) + if (CMD_ARGC > 0) { if (strcmp(args[0], "arm") == 0) { @@ -453,7 +453,7 @@ COMMAND_HANDLER(handle_armv4_5_disassemble_command) return ERROR_FAIL; } - switch (argc) { + switch (CMD_ARGC) { case 3: if (strcmp(args[2], "thumb") != 0) goto usage; diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 5193b2a..31ab4b4 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -259,7 +259,7 @@ COMMAND_HANDLER(handle_dap_info_command) struct swjdp_common *swjdp = &armv7a->swjdp_info; uint32_t apsel; - switch (argc) { + switch (CMD_ARGC) { case 0: apsel = swjdp->apsel; break; diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 8c1de32..e9d46df 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -766,7 +766,7 @@ COMMAND_HANDLER(handle_dap_baseaddr_command) int retval; apselsave = swjdp->apsel; - switch (argc) { + switch (CMD_ARGC) { case 0: apsel = swjdp->apsel; break; @@ -829,7 +829,7 @@ COMMAND_HANDLER(handle_dap_info_command) struct swjdp_common *swjdp = &armv7m->swjdp_info; uint32_t apsel; - switch (argc) { + switch (CMD_ARGC) { case 0: apsel = swjdp->apsel; break; diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index c7b978b..0584434 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1780,7 +1780,7 @@ COMMAND_HANDLER(handle_cortex_m3_disassemble_command) return retval; errno = 0; - switch (argc) { + switch (CMD_ARGC) { case 2: COMMAND_PARSE_NUMBER(ulong, args[1], count); /* FALL THROUGH */ @@ -1832,10 +1832,10 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command) mem_ap_read_atomic_u32(swjdp, DCB_DEMCR, &demcr); - if (argc > 0) { + if (CMD_ARGC > 0) { unsigned catch = 0; - if (argc == 1) { + if (CMD_ARGC == 1) { if (strcmp(args[0], "all") == 0) { catch = VC_HARDERR | VC_INTERR | VC_BUSERR | VC_STATERR | VC_CHKERR | VC_NOCPERR @@ -1845,16 +1845,16 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command) goto write; } } - while (argc-- > 0) { + while (CMD_ARGC-- > 0) { unsigned i; for (i = 0; i < ARRAY_SIZE(vec_ids); i++) { - if (strcmp(args[argc], vec_ids[i].name) != 0) + if (strcmp(args[CMD_ARGC], vec_ids[i].name) != 0) continue; catch |= vec_ids[i].mask; break; } if (i == ARRAY_SIZE(vec_ids)) { - LOG_ERROR("No CM3 vector '%s'", args[argc]); + LOG_ERROR("No CM3 vector '%s'", args[CMD_ARGC]); return ERROR_INVALID_ARGUMENTS; } } @@ -1890,7 +1890,7 @@ COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) return ERROR_OK; } - if (argc > 0) + if (CMD_ARGC > 0) { if (!strcmp(args[0], "on")) { diff --git a/src/target/etb.c b/src/target/etb.c index 859ebaf..2ad5156 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -354,7 +354,7 @@ COMMAND_HANDLER(handle_etb_config_command) struct jtag_tap *tap; struct arm *arm; - if (argc != 2) + if (CMD_ARGC != 2) { return ERROR_COMMAND_SYNTAX_ERROR; } diff --git a/src/target/etm.c b/src/target/etm.c index 31b8bb2..044ccb0 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1263,7 +1263,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command) etmv1_tracemode_t tracemode = etm->tracemode; - switch (argc) + switch (CMD_ARGC) { case 0: break; @@ -1374,7 +1374,7 @@ COMMAND_HANDLER(handle_etm_config_command) struct etm_context *etm_ctx; int i; - if (argc != 5) + if (CMD_ARGC != 5) return ERROR_COMMAND_SYNTAX_ERROR; target = get_target(args[0]); @@ -1730,7 +1730,7 @@ COMMAND_HANDLER(handle_etm_image_command) struct arm *arm; struct etm_context *etm_ctx; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "usage: etm image <file> [base address] [type]"); return ERROR_FAIL; @@ -1763,7 +1763,7 @@ COMMAND_HANDLER(handle_etm_image_command) etm_ctx->image->start_address_set = 0; /* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */ - if (argc >= 2) + if (CMD_ARGC >= 2) { etm_ctx->image->base_address_set = 1; COMMAND_PARSE_NUMBER(int, args[1], etm_ctx->image->base_address); @@ -1773,7 +1773,7 @@ COMMAND_HANDLER(handle_etm_image_command) etm_ctx->image->base_address_set = 0; } - if (image_open(etm_ctx->image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(etm_ctx->image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) { free(etm_ctx->image); etm_ctx->image = NULL; @@ -1791,7 +1791,7 @@ COMMAND_HANDLER(handle_etm_dump_command) struct etm_context *etm_ctx; uint32_t i; - if (argc != 1) + if (CMD_ARGC != 1) { command_print(cmd_ctx, "usage: etm dump <file>"); return ERROR_FAIL; @@ -1859,7 +1859,7 @@ COMMAND_HANDLER(handle_etm_load_command) struct etm_context *etm_ctx; uint32_t i; - if (argc != 1) + if (CMD_ARGC != 1) { command_print(cmd_ctx, "usage: etm load <file>"); return ERROR_FAIL; @@ -1956,7 +1956,7 @@ COMMAND_HANDLER(handle_etm_trigger_percent_command) return ERROR_FAIL; } - if (argc > 0) + if (CMD_ARGC > 0) { uint32_t new_value; COMMAND_PARSE_NUMBER(u32, args[0], new_value); diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index cad4977..47c2bb4 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -294,7 +294,7 @@ COMMAND_HANDLER(handle_oocd_trace_config_command) struct target *target; struct arm *arm; - if (argc != 2) + if (CMD_ARGC != 2) { LOG_ERROR("incomplete 'oocd_trace config <target> <tty>' command"); return ERROR_FAIL; diff --git a/src/target/target.c b/src/target/target.c index 0b2438c..88fea17 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1648,7 +1648,7 @@ COMMAND_HANDLER(handle_targets_command) { struct target *target = all_targets; - if (argc == 1) + if (CMD_ARGC == 1) { target = get_target(args[0]); if (target == NULL) { @@ -1868,7 +1868,7 @@ COMMAND_HANDLER(handle_reg_command) target = get_current_target(cmd_ctx); /* list all available registers for the current target */ - if (argc == 0) + if (CMD_ARGC == 0) { struct reg_cache *cache = target->reg_cache; @@ -1948,9 +1948,9 @@ COMMAND_HANDLER(handle_reg_command) } /* display a register */ - if ((argc == 1) || ((argc == 2) && !((args[1][0] >= '0') && (args[1][0] <= '9')))) + if ((CMD_ARGC == 1) || ((CMD_ARGC == 2) && !((args[1][0] >= '0') && (args[1][0] <= '9')))) { - if ((argc == 2) && (strcmp(args[1], "force") == 0)) + if ((CMD_ARGC == 2) && (strcmp(args[1], "force") == 0)) reg->valid = 0; if (reg->valid == 0) @@ -1964,7 +1964,7 @@ COMMAND_HANDLER(handle_reg_command) } /* set register value */ - if (argc == 2) + if (CMD_ARGC == 2) { uint8_t *buf = malloc(DIV_ROUND_UP(reg->size, 8)); str_to_buf(args[1], strlen(args[1]), buf, reg->size, 0); @@ -1990,7 +1990,7 @@ COMMAND_HANDLER(handle_poll_command) int retval = ERROR_OK; struct target *target = get_current_target(cmd_ctx); - if (argc == 0) + if (CMD_ARGC == 0) { command_print(cmd_ctx, "background polling: %s", jtag_poll_get_enabled() ? "on" : "off"); @@ -2005,7 +2005,7 @@ COMMAND_HANDLER(handle_poll_command) return retval; } - else if (argc == 1) + else if (CMD_ARGC == 1) { if (strcmp(args[0], "on") == 0) { @@ -2029,11 +2029,11 @@ COMMAND_HANDLER(handle_poll_command) COMMAND_HANDLER(handle_wait_halt_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; unsigned ms = 5000; - if (1 == argc) + if (1 == CMD_ARGC) { int retval = parse_uint(args[0], &ms); if (ERROR_OK != retval) @@ -2103,7 +2103,7 @@ COMMAND_HANDLER(handle_halt_command) if (ERROR_OK != retval) return retval; - if (argc == 1) + if (CMD_ARGC == 1) { unsigned wait; retval = parse_uint(args[0], &wait); @@ -2129,11 +2129,11 @@ COMMAND_HANDLER(handle_soft_reset_halt_command) COMMAND_HANDLER(handle_reset_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; enum target_reset_mode reset_mode = RESET_RUN; - if (argc == 1) + if (CMD_ARGC == 1) { const Jim_Nvp *n; n = Jim_Nvp_name2value_simple(nvp_reset_modes, args[0]); @@ -2151,7 +2151,7 @@ COMMAND_HANDLER(handle_reset_command) COMMAND_HANDLER(handle_resume_command) { int current = 1; - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; struct target *target = get_current_target(cmd_ctx); @@ -2161,7 +2161,7 @@ COMMAND_HANDLER(handle_resume_command) * with one arguments, addr = args[0], * handle breakpoints, not debugging */ uint32_t addr = 0; - if (argc == 1) + if (CMD_ARGC == 1) { COMMAND_PARSE_NUMBER(u32, args[0], addr); current = 0; @@ -2172,7 +2172,7 @@ COMMAND_HANDLER(handle_resume_command) COMMAND_HANDLER(handle_step_command) { - if (argc > 1) + if (CMD_ARGC > 1) return ERROR_COMMAND_SYNTAX_ERROR; LOG_DEBUG("-"); @@ -2182,7 +2182,7 @@ COMMAND_HANDLER(handle_step_command) * handle breakpoints, debugging */ uint32_t addr = 0; int current_pc = 1; - if (argc == 1) + if (CMD_ARGC == 1) { COMMAND_PARSE_NUMBER(u32, args[0], addr); current_pc = 0; @@ -2244,7 +2244,7 @@ static void handle_md_output(struct command_context *cmd_ctx, COMMAND_HANDLER(handle_md_command) { - if (argc < 1) + if (CMD_ARGC < 1) return ERROR_COMMAND_SYNTAX_ERROR; unsigned size = 0; @@ -2261,14 +2261,14 @@ COMMAND_HANDLER(handle_md_command) uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); if (physical) { - argc--; + CMD_ARGC--; args++; fn=target_read_phys_memory; } else { fn=target_read_memory; } - if ((argc < 1) || (argc > 2)) + if ((CMD_ARGC < 1) || (CMD_ARGC > 2)) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -2277,7 +2277,7 @@ COMMAND_HANDLER(handle_md_command) COMMAND_PARSE_NUMBER(u32, args[0], address); unsigned count = 1; - if (argc == 2) + if (CMD_ARGC == 2) COMMAND_PARSE_NUMBER(uint, args[1], count); uint8_t *buffer = calloc(count, size); @@ -2294,7 +2294,7 @@ COMMAND_HANDLER(handle_md_command) COMMAND_HANDLER(handle_mw_command) { - if (argc < 2) + if (CMD_ARGC < 2) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -2304,14 +2304,14 @@ COMMAND_HANDLER(handle_mw_command) const char *cmd_name = CMD_NAME; if (physical) { - argc--; + CMD_ARGC--; args++; fn=target_write_phys_memory; } else { fn=target_write_memory; } - if ((argc < 2) || (argc > 3)) + if ((CMD_ARGC < 2) || (CMD_ARGC > 3)) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t address; @@ -2321,7 +2321,7 @@ COMMAND_HANDLER(handle_mw_command) COMMAND_PARSE_NUMBER(u32, args[1], value); unsigned count = 1; - if (argc == 3) + if (CMD_ARGC == 3) COMMAND_PARSE_NUMBER(uint, args[2], count); struct target *target = get_current_target(cmd_ctx); @@ -2360,12 +2360,12 @@ COMMAND_HANDLER(handle_mw_command) static COMMAND_HELPER(parse_load_image_command_args, struct image *image, uint32_t *min_address, uint32_t *max_address) { - if (argc < 1 || argc > 5) + if (CMD_ARGC < 1 || CMD_ARGC > 5) return ERROR_COMMAND_SYNTAX_ERROR; /* a base address isn't always necessary, * default to 0x0 (i.e. don't relocate) */ - if (argc >= 2) + if (CMD_ARGC >= 2) { uint32_t addr; COMMAND_PARSE_NUMBER(u32, args[1], addr); @@ -2377,11 +2377,11 @@ static COMMAND_HELPER(parse_load_image_command_args, struct image *image, image->start_address_set = 0; - if (argc >= 4) + if (CMD_ARGC >= 4) { COMMAND_PARSE_NUMBER(u32, args[3], *min_address); } - if (argc == 5) + if (CMD_ARGC == 5) { COMMAND_PARSE_NUMBER(u32, args[4], *max_address); // use size (given) to find max (required) @@ -2414,7 +2414,7 @@ COMMAND_HANDLER(handle_load_image_command) struct duration bench; duration_start(&bench); - if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(&image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) { return ERROR_OK; } @@ -2495,7 +2495,7 @@ COMMAND_HANDLER(handle_dump_image_command) struct target *target = get_current_target(cmd_ctx); - if (argc != 3) + if (CMD_ARGC != 3) { command_print(cmd_ctx, "usage: dump_image <filename> <address> <size>"); return ERROR_OK; @@ -2562,7 +2562,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify) struct target *target = get_current_target(cmd_ctx); - if (argc < 1) + if (CMD_ARGC < 1) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -2576,7 +2576,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify) struct duration bench; duration_start(&bench); - if (argc >= 2) + if (CMD_ARGC >= 2) { uint32_t addr; COMMAND_PARSE_NUMBER(u32, args[1], addr); @@ -2591,7 +2591,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, int verify) image.start_address_set = 0; - if ((retval = image_open(&image, args[0], (argc == 3) ? args[2] : NULL)) != ERROR_OK) + if ((retval = image_open(&image, args[0], (CMD_ARGC == 3) ? args[2] : NULL)) != ERROR_OK) { return retval; } @@ -2745,10 +2745,10 @@ static int handle_bp_command_set(struct command_context *cmd_ctx, COMMAND_HANDLER(handle_bp_command) { - if (argc == 0) + if (CMD_ARGC == 0) return handle_bp_command_list(cmd_ctx); - if (argc < 2 || argc > 3) + if (CMD_ARGC < 2 || CMD_ARGC > 3) { command_print(cmd_ctx, "usage: bp <address> <length> ['hw']"); return ERROR_COMMAND_SYNTAX_ERROR; @@ -2760,7 +2760,7 @@ COMMAND_HANDLER(handle_bp_command) COMMAND_PARSE_NUMBER(u32, args[1], length); int hw = BKPT_SOFT; - if (argc == 3) + if (CMD_ARGC == 3) { if (strcmp(args[2], "hw") == 0) hw = BKPT_HARD; @@ -2773,7 +2773,7 @@ COMMAND_HANDLER(handle_bp_command) COMMAND_HANDLER(handle_rbp_command) { - if (argc != 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t addr; @@ -2789,7 +2789,7 @@ COMMAND_HANDLER(handle_wp_command) { struct target *target = get_current_target(cmd_ctx); - if (argc == 0) + if (CMD_ARGC == 0) { struct watchpoint *watchpoint = target->watchpoints; @@ -2815,7 +2815,7 @@ COMMAND_HANDLER(handle_wp_command) uint32_t data_value = 0x0; uint32_t data_mask = 0xffffffff; - switch (argc) + switch (CMD_ARGC) { case 5: COMMAND_PARSE_NUMBER(u32, args[4], data_mask); @@ -2861,7 +2861,7 @@ COMMAND_HANDLER(handle_wp_command) COMMAND_HANDLER(handle_rwp_command) { - if (argc != 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t addr; @@ -2882,7 +2882,7 @@ COMMAND_HANDLER(handle_rwp_command) */ COMMAND_HANDLER(handle_virt2phys_command) { - if (argc != 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t va; @@ -3020,7 +3020,7 @@ COMMAND_HANDLER(handle_profile_command) struct timeval timeout, now; gettimeofday(&timeout, NULL); - if (argc != 2) + if (CMD_ARGC != 2) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -4551,7 +4551,7 @@ COMMAND_HANDLER(handle_fast_load_image_command) struct duration bench; duration_start(&bench); - if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(&image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) { return ERROR_OK; } @@ -4645,7 +4645,7 @@ COMMAND_HANDLER(handle_fast_load_image_command) COMMAND_HANDLER(handle_fast_load_command) { - if (argc > 0) + if (CMD_ARGC > 0) return ERROR_COMMAND_SYNTAX_ERROR; if (fastload == NULL) { diff --git a/src/target/target_request.c b/src/target/target_request.c index be176ca..c5de691 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -268,7 +268,7 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command) if (find_debug_msg_receiver(cmd_ctx, target) != NULL) receiving = 1; - if (argc > 0) + if (CMD_ARGC > 0) { if (!strcmp(args[0], "enable") || !strcmp(args[0], "charmsg")) { diff --git a/src/target/trace.c b/src/target/trace.c index 6ec08d6..88f4ed3 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -52,7 +52,7 @@ COMMAND_HANDLER(handle_trace_point_command) struct target *target = get_current_target(cmd_ctx); struct trace *trace = target->trace_info; - if (argc == 0) + if (CMD_ARGC == 0) { uint32_t i; @@ -100,7 +100,7 @@ COMMAND_HANDLER(handle_trace_history_command) struct target *target = get_current_target(cmd_ctx); struct trace *trace = target->trace_info; - if (argc > 0) + if (CMD_ARGC > 0) { trace->trace_history_pos = 0; trace->trace_history_overflowed = 0; diff --git a/src/target/xscale.c b/src/target/xscale.c index 4c3945c..3af28d0 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2995,7 +2995,7 @@ COMMAND_HANDLER(xscale_handle_debug_handler_command) int retval; uint32_t handler_address; - if (argc < 2) + if (CMD_ARGC < 2) { LOG_ERROR("'xscale debug_handler <target#> <address>' command takes two required operands"); return ERROR_OK; @@ -3035,7 +3035,7 @@ COMMAND_HANDLER(xscale_handle_cache_clean_address_command) int retval; uint32_t cache_clean_address; - if (argc < 2) + if (CMD_ARGC < 2) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -3130,7 +3130,7 @@ COMMAND_HANDLER(xscale_handle_mmu_command) return ERROR_OK; } - if (argc >= 1) + if (CMD_ARGC >= 1) { if (strcmp("enable", args[0]) == 0) { @@ -3171,7 +3171,7 @@ COMMAND_HANDLER(xscale_handle_idcache_command) else if (strcmp(CMD_NAME, "dcache") == 0) dcache = 1; - if (argc >= 1) + if (CMD_ARGC >= 1) { if (strcmp("enable", args[0]) == 0) { @@ -3212,7 +3212,7 @@ COMMAND_HANDLER(xscale_handle_vector_catch_command) if (retval != ERROR_OK) return retval; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "usage: xscale vector_catch [mask]"); } @@ -3240,7 +3240,7 @@ COMMAND_HANDLER(xscale_handle_vector_table_command) if (retval != ERROR_OK) return retval; - if (argc == 0) /* print current settings */ + if (CMD_ARGC == 0) /* print current settings */ { int idx; @@ -3254,7 +3254,7 @@ COMMAND_HANDLER(xscale_handle_vector_table_command) return ERROR_OK; } - if (argc != 3) + if (CMD_ARGC != 3) err = 1; else { @@ -3305,7 +3305,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) return ERROR_OK; } - if ((argc >= 1) && (strcmp("enable", args[0]) == 0)) + if ((CMD_ARGC >= 1) && (strcmp("enable", args[0]) == 0)) { struct xscale_trace_data *td, *next_td; xscale->trace.buffer_enabled = 1; @@ -3323,19 +3323,19 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) } xscale->trace.data = NULL; } - else if ((argc >= 1) && (strcmp("disable", args[0]) == 0)) + else if ((CMD_ARGC >= 1) && (strcmp("disable", args[0]) == 0)) { xscale->trace.buffer_enabled = 0; } - if ((argc >= 2) && (strcmp("fill", args[1]) == 0)) + if ((CMD_ARGC >= 2) && (strcmp("fill", args[1]) == 0)) { uint32_t fill = 1; - if (argc >= 3) + if (CMD_ARGC >= 3) COMMAND_PARSE_NUMBER(u32, args[2], fill); xscale->trace.buffer_fill = fill; } - else if ((argc >= 2) && (strcmp("wrap", args[1]) == 0)) + else if ((CMD_ARGC >= 2) && (strcmp("wrap", args[1]) == 0)) { xscale->trace.buffer_fill = -1; } @@ -3372,7 +3372,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command) struct xscale_common *xscale = target_to_xscale(target); int retval; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "usage: xscale trace_image <file> [base address] [type]"); return ERROR_OK; @@ -3394,7 +3394,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command) xscale->trace.image->start_address_set = 0; /* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */ - if (argc >= 2) + if (CMD_ARGC >= 2) { xscale->trace.image->base_address_set = 1; COMMAND_PARSE_NUMBER(int, args[1], xscale->trace.image->base_address); @@ -3404,7 +3404,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command) xscale->trace.image->base_address_set = 0; } - if (image_open(xscale->trace.image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) + if (image_open(xscale->trace.image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK) { free(xscale->trace.image); xscale->trace.image = NULL; @@ -3432,7 +3432,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command) return ERROR_OK; } - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "usage: xscale dump_trace <file>"); return ERROR_OK; @@ -3503,7 +3503,7 @@ COMMAND_HANDLER(xscale_handle_cp15) } uint32_t reg_no = 0; struct reg *reg = NULL; - if (argc > 0) + if (CMD_ARGC > 0) { COMMAND_PARSE_NUMBER(u32, args[0], reg_no); /*translate from xscale cp15 register no to openocd register*/ @@ -3540,7 +3540,7 @@ COMMAND_HANDLER(xscale_handle_cp15) reg = &xscale->reg_cache->reg_list[reg_no]; } - if (argc == 1) + if (CMD_ARGC == 1) { uint32_t value; @@ -3549,7 +3549,7 @@ COMMAND_HANDLER(xscale_handle_cp15) value = buf_get_u32(reg->value, 0, 32); command_print(cmd_ctx, "%s (/%i): 0x%" PRIx32 "", reg->name, (int)(reg->size), value); } - else if (argc == 2) + else if (CMD_ARGC == 2) { uint32_t value; COMMAND_PARSE_NUMBER(u32, args[1], value); |