From 7bf1a86e473a12882bf6f71cb4d0d416394b69d4 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Sun, 15 Nov 2009 04:57:12 -0800 Subject: command_handler: change to 'argc' to CMD_ARGC This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC. --- src/flash/at91sam3.c | 4 ++-- src/flash/at91sam7.c | 6 +++--- src/flash/avrf.c | 4 ++-- src/flash/cfi.c | 4 ++-- src/flash/davinci_nand.c | 2 +- src/flash/ecos.c | 2 +- src/flash/faux.c | 2 +- src/flash/flash.c | 32 ++++++++++++++++---------------- src/flash/flash.h | 2 +- src/flash/lpc2000.c | 6 +++--- src/flash/lpc288x.c | 2 +- src/flash/lpc2900.c | 16 ++++++++-------- src/flash/lpc3180_nand_controller.c | 6 +++--- src/flash/mflash.c | 8 ++++---- src/flash/mx3_nand.c | 2 +- src/flash/nand.c | 24 ++++++++++++------------ src/flash/ocl.c | 2 +- src/flash/orion_nand.c | 2 +- src/flash/pic32mx.c | 10 +++++----- src/flash/stellaris.c | 4 ++-- src/flash/stm32x.c | 12 ++++++------ src/flash/str7x.c | 4 ++-- src/flash/str9x.c | 4 ++-- src/flash/str9xpec.c | 24 ++++++++++++------------ src/flash/tms470.c | 14 +++++++------- 25 files changed, 99 insertions(+), 99 deletions(-) (limited to 'src/flash') diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index 4507888f..54e60bff 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -2365,7 +2365,7 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command) } - switch (argc) { + switch (CMD_ARGC) { default: command_print(cmd_ctx,"Too many parameters\n"); return ERROR_COMMAND_SYNTAX_ERROR; @@ -2438,7 +2438,7 @@ COMMAND_HANDLER(sam3_handle_slowclk_command) } - switch (argc) { + switch (CMD_ARGC) { case 0: // show break; diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 9d05d7b5..193bfd35 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -743,7 +743,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) at91sam7_info->ext_freq = 0; at91sam7_info->flash_autodetection = 0; - if (argc < 13) + if (CMD_ARGC < 13) { at91sam7_info->flash_autodetection = 1; return ERROR_OK; @@ -760,7 +760,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command) COMMAND_PARSE_NUMBER(u16, args[11], page_size); COMMAND_PARSE_NUMBER(u16, args[12], num_nvmbits); - if (argc == 14) { + if (CMD_ARGC == 14) { unsigned long freq; COMMAND_PARSE_NUMBER(ulong, args[13], freq); ext_freq = freq * 1000; @@ -1107,7 +1107,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command) struct at91sam7_flash_bank *at91sam7_info; int retval; - if (argc != 2) + if (CMD_ARGC != 2) { command_print(cmd_ctx, "at91sam7 gpnvm "); return ERROR_OK; diff --git a/src/flash/avrf.c b/src/flash/avrf.c index 5d3c033d..f1db3c41 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -184,7 +184,7 @@ FLASH_BANK_COMMAND_HANDLER(avrf_flash_bank_command) { struct avrf_flash_bank *avrf_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank avr configuration"); return ERROR_FLASH_BANK_INVALID; @@ -419,7 +419,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command) { int i; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "avr mass_erase "); return ERROR_OK; diff --git a/src/flash/cfi.c b/src/flash/cfi.c index c0ad50dd..c68fb738 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -606,7 +606,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) { struct cfi_flash_bank *cfi_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank cfi configuration"); return ERROR_FLASH_BANK_INVALID; @@ -633,7 +633,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) cfi_info->jedec_probe = 0; cfi_info->not_cfi = 0; - for (unsigned i = 6; i < argc; i++) + for (unsigned i = 6; i < CMD_ARGC; i++) { if (strcmp(args[i], "x16_as_x8") == 0) { diff --git a/src/flash/davinci_nand.c b/src/flash/davinci_nand.c index 413bcda4..7c68be70 100644 --- a/src/flash/davinci_nand.c +++ b/src/flash/davinci_nand.c @@ -645,7 +645,7 @@ NAND_DEVICE_COMMAND_HANDLER(davinci_nand_device_command) * - aemif address * Plus someday, optionally, ALE and CLE masks. */ - if (argc < 5) { + if (CMD_ARGC < 5) { LOG_ERROR("parameters: %s target " "chip_addr hwecc_mode aemif_addr", args[0]); diff --git a/src/flash/ecos.c b/src/flash/ecos.c index b2ffadff..8d2d3eec 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -109,7 +109,7 @@ FLASH_BANK_COMMAND_HANDLER(ecosflash_flash_bank_command) { struct ecosflash_flash_bank *info; - if (argc < 7) + if (CMD_ARGC < 7) { LOG_WARNING("incomplete flash_bank ecosflash configuration"); return ERROR_FLASH_BANK_INVALID; diff --git a/src/flash/faux.c b/src/flash/faux.c index b048fcb0..54acf754 100644 --- a/src/flash/faux.c +++ b/src/flash/faux.c @@ -41,7 +41,7 @@ FLASH_BANK_COMMAND_HANDLER(faux_flash_bank_command) { struct faux_flash_bank *info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank faux configuration"); return ERROR_FLASH_BANK_INVALID; diff --git a/src/flash/flash.c b/src/flash/flash.c index adc14119..7402772c 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -222,7 +222,7 @@ COMMAND_HANDLER(handle_flash_bank_command) int found = 0; struct target *target; - if (argc < 6) + if (CMD_ARGC < 6) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -303,7 +303,7 @@ COMMAND_HANDLER(handle_flash_info_command) int j = 0; int retval; - if (argc != 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; unsigned bank_nr; @@ -362,7 +362,7 @@ COMMAND_HANDLER(handle_flash_probe_command) { int retval; - if (argc != 1) + if (CMD_ARGC != 1) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -397,7 +397,7 @@ COMMAND_HANDLER(handle_flash_probe_command) COMMAND_HANDLER(handle_flash_erase_check_command) { - if (argc != 1) + if (CMD_ARGC != 1) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -450,7 +450,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command) struct target *target = get_current_target(cmd_ctx); - if (argc != 2) + if (CMD_ARGC != 2) return ERROR_COMMAND_SYNTAX_ERROR; COMMAND_PARSE_NUMBER(int, args[0], address); @@ -487,7 +487,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command) COMMAND_HANDLER(handle_flash_protect_check_command) { - if (argc != 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; struct flash_bank *p; @@ -531,7 +531,7 @@ static int flash_check_sector_parameters(struct command_context *cmd_ctx, COMMAND_HANDLER(handle_flash_erase_command) { - if (argc != 2) + if (CMD_ARGC != 2) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t bank_nr; @@ -571,7 +571,7 @@ COMMAND_HANDLER(handle_flash_erase_command) COMMAND_HANDLER(handle_flash_protect_command) { - if (argc != 3) + if (CMD_ARGC != 3) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t bank_nr; @@ -622,7 +622,7 @@ COMMAND_HANDLER(handle_flash_write_image_command) int retval; - if (argc < 1) + if (CMD_ARGC < 1) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -637,13 +637,13 @@ COMMAND_HANDLER(handle_flash_write_image_command) { auto_erase = 1; args++; - argc--; + CMD_ARGC--; command_print(cmd_ctx, "auto erase enabled"); } else if (strcmp(args[0], "unlock") == 0) { auto_unlock = true; args++; - argc--; + CMD_ARGC--; command_print(cmd_ctx, "auto unlock enabled"); } else { @@ -651,7 +651,7 @@ COMMAND_HANDLER(handle_flash_write_image_command) } } - if (argc < 1) + if (CMD_ARGC < 1) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -665,7 +665,7 @@ COMMAND_HANDLER(handle_flash_write_image_command) struct duration bench; duration_start(&bench); - if (argc >= 2) + if (CMD_ARGC >= 2) { image.base_address_set = 1; COMMAND_PARSE_NUMBER(int, args[1], image.base_address); @@ -678,7 +678,7 @@ COMMAND_HANDLER(handle_flash_write_image_command) image.start_address_set = 0; - retval = image_open(&image, args[0], (argc == 3) ? args[2] : NULL); + retval = image_open(&image, args[0], (CMD_ARGC == 3) ? args[2] : NULL); if (retval != ERROR_OK) { return retval; @@ -718,7 +718,7 @@ COMMAND_HANDLER(handle_flash_fill_command) uint32_t i; uint32_t wordsize; - if (argc != 3) + if (CMD_ARGC != 3) return ERROR_COMMAND_SYNTAX_ERROR; COMMAND_PARSE_NUMBER(u32, args[0], address); @@ -813,7 +813,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command) uint8_t *buffer; struct fileio fileio; - if (argc != 3) + if (CMD_ARGC != 3) return ERROR_COMMAND_SYNTAX_ERROR; struct duration bench; diff --git a/src/flash/flash.h b/src/flash/flash.h index 96a41207..df5b0c9b 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -118,7 +118,7 @@ struct flash_driver * * For example, args[4] = 16 bit flash, args[5] = 32bit bus. * - * If extra arguments are provided (@a argc > 6), they will + * If extra arguments are provided (@a CMD_ARGC > 6), they will * start in @a args[6]. These can be used to implement * driver-specific extensions. * diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index a3f97180..60d909f1 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -424,7 +424,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command) { struct lpc2000_flash_bank *lpc2000_info; - if (argc < 8) + if (CMD_ARGC < 8) { LOG_WARNING("incomplete flash_bank lpc2000 configuration"); return ERROR_FLASH_BANK_INVALID; @@ -469,7 +469,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command) lpc2000_info->calc_checksum = 0; lpc2000_build_sector_list(bank); - if (argc >= 9) + if (CMD_ARGC >= 9) { if (strcmp(args[8], "calc_checksum") == 0) lpc2000_info->calc_checksum = 1; @@ -744,7 +744,7 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command) uint32_t result_table[4]; int status_code; - if (argc < 1) + if (CMD_ARGC < 1) { return ERROR_COMMAND_SYNTAX_ERROR; } diff --git a/src/flash/lpc288x.c b/src/flash/lpc288x.c index eb95b660..2ad50146 100644 --- a/src/flash/lpc288x.c +++ b/src/flash/lpc288x.c @@ -169,7 +169,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command) { struct lpc288x_flash_bank *lpc288x_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank LPC288x configuration"); return ERROR_FLASH_BANK_INVALID; diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index dc916689..67a510e0 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -537,7 +537,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command) uint32_t signature[4]; - if( argc < 1 ) + if( CMD_ARGC < 1 ) { LOG_WARNING( "Too few arguments. Call: lpc2900 signature " ); return ERROR_FLASH_BANK_INVALID; @@ -583,7 +583,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command) */ COMMAND_HANDLER(lpc2900_handle_read_custom_command) { - if( argc < 2 ) + if( CMD_ARGC < 2 ) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -654,7 +654,7 @@ COMMAND_HANDLER(lpc2900_handle_read_custom_command) */ COMMAND_HANDLER(lpc2900_handle_password_command) { - if (argc < 2) + if (CMD_ARGC < 2) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -689,7 +689,7 @@ COMMAND_HANDLER(lpc2900_handle_password_command) */ COMMAND_HANDLER(lpc2900_handle_write_custom_command) { - if (argc < 2) + if (CMD_ARGC < 2) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -724,7 +724,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command) image.start_address_set = 0; const char *filename = args[1]; - const char *type = (argc >= 3) ? args[2] : NULL; + const char *type = (CMD_ARGC >= 3) ? args[2] : NULL; retval = image_open(&image, filename, type); if (retval != ERROR_OK) { @@ -799,7 +799,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command) */ COMMAND_HANDLER(lpc2900_handle_secure_sector_command) { - if (argc < 3) + if (CMD_ARGC < 3) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -898,7 +898,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command) */ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command) { - if (argc < 1) + if (CMD_ARGC < 1) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -1020,7 +1020,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command) { struct lpc2900_flash_bank *lpc2900_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank LPC2900 configuration"); return ERROR_FLASH_BANK_INVALID; diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index 3589e8be..d7cbe388 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -31,7 +31,7 @@ static int lpc3180_controller_ready(struct nand_device *nand, int timeout); */ NAND_DEVICE_COMMAND_HANDLER(lpc3180_nand_device_command) { - if (argc < 3) + if (CMD_ARGC < 3) { LOG_WARNING("incomplete 'lpc3180' nand flash configuration"); return ERROR_FLASH_BANK_INVALID; @@ -836,7 +836,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command) "no", "mlc", "slc" }; - if ((argc < 1) || (argc > 2)) + if ((CMD_ARGC < 1) || (CMD_ARGC > 2)) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -852,7 +852,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command) lpc3180_info = nand->controller_priv; - if (argc == 2) + if (CMD_ARGC == 2) { if (strcmp(args[1], "mlc") == 0) { diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 06206427..6aeeabc6 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -710,7 +710,7 @@ COMMAND_HANDLER(mg_write_cmd) struct fileio fileio; int ret; - if (argc != 3) { + if (CMD_ARGC != 3) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -775,7 +775,7 @@ COMMAND_HANDLER(mg_dump_cmd) struct fileio fileio; int ret; - if (argc != 4) { + if (CMD_ARGC != 4) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -1223,7 +1223,7 @@ COMMAND_HANDLER(mg_config_cmd) if ((ret = mg_mflash_rst()) != ERROR_OK) return ret; - switch (argc) { + switch (CMD_ARGC) { case 2: if (!strcmp(args[1], "boot")) return mg_boot_config(); @@ -1288,7 +1288,7 @@ COMMAND_HANDLER(mg_bank_cmd) struct target *target; int i; - if (argc < 4) + if (CMD_ARGC < 4) { return ERROR_COMMAND_SYNTAX_ERROR; } diff --git a/src/flash/mx3_nand.c b/src/flash/mx3_nand.c index 45d2a323..49e1758b 100644 --- a/src/flash/mx3_nand.c +++ b/src/flash/mx3_nand.c @@ -79,7 +79,7 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command) LOG_ERROR ("target '%s' not defined", args[1]); return ERROR_FAIL; } - if (argc < 3) + if (CMD_ARGC < 3) { LOG_ERROR ("use \"nand device imx31 target noecc|hwecc\""); return ERROR_FAIL; diff --git a/src/flash/nand.c b/src/flash/nand.c index 71a67c45..9231b9ad 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -210,7 +210,7 @@ COMMAND_HANDLER(handle_nand_device_command) int i; int retval; - if (argc < 1) + if (CMD_ARGC < 1) { LOG_WARNING("incomplete flash device nand configuration"); return ERROR_FLASH_BANK_INVALID; @@ -1082,7 +1082,7 @@ COMMAND_HANDLER(handle_nand_info_command) if (ERROR_OK != retval) return retval; - switch (argc) { + switch (CMD_ARGC) { default: return ERROR_COMMAND_SYNTAX_ERROR; case 1: @@ -1147,7 +1147,7 @@ COMMAND_HANDLER(handle_nand_info_command) COMMAND_HANDLER(handle_nand_probe_command) { - if (argc != 1) + if (CMD_ARGC != 1) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -1175,7 +1175,7 @@ COMMAND_HANDLER(handle_nand_probe_command) COMMAND_HANDLER(handle_nand_erase_command) { - if (argc != 1 && argc != 3) + if (CMD_ARGC != 1 && CMD_ARGC != 3) { return ERROR_COMMAND_SYNTAX_ERROR; @@ -1190,7 +1190,7 @@ COMMAND_HANDLER(handle_nand_erase_command) unsigned long length; /* erase specified part of the chip; or else everything */ - if (argc == 3) { + if (CMD_ARGC == 3) { unsigned long size = p->erase_size * p->num_blocks; COMMAND_PARSE_NUMBER(ulong, args[1], offset); @@ -1234,7 +1234,7 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command) int first = -1; int last = -1; - if ((argc < 1) || (argc > 3) || (argc == 2)) + if ((CMD_ARGC < 1) || (CMD_ARGC > 3) || (CMD_ARGC == 2)) { return ERROR_COMMAND_SYNTAX_ERROR; @@ -1245,7 +1245,7 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command) if (ERROR_OK != retval) return retval; - if (argc == 3) + if (CMD_ARGC == 3) { unsigned long offset; unsigned long length; @@ -1389,7 +1389,7 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state, nand_fileio_init(state); unsigned minargs = need_size ? 4 : 3; - if (argc < minargs) + if (CMD_ARGC < minargs) return ERROR_COMMAND_SYNTAX_ERROR; struct nand_device *nand; @@ -1414,9 +1414,9 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state, } } - if (argc > minargs) + if (CMD_ARGC > minargs) { - for (unsigned i = minargs; i < argc; i++) + for (unsigned i = minargs; i < CMD_ARGC; i++) { if (!strcmp(args[i], "oob_raw")) state->oob_format |= NAND_OOB_RAW; @@ -1646,7 +1646,7 @@ COMMAND_HANDLER(handle_nand_dump_command) COMMAND_HANDLER(handle_nand_raw_access_command) { - if ((argc < 1) || (argc > 2)) + if ((CMD_ARGC < 1) || (CMD_ARGC > 2)) { return ERROR_COMMAND_SYNTAX_ERROR; } @@ -1662,7 +1662,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command) return ERROR_OK; } - if (argc == 2) + if (CMD_ARGC == 2) { if (strcmp("enable", args[1]) == 0) p->use_raw = 1; diff --git a/src/flash/ocl.c b/src/flash/ocl.c index 0b492c64..388395f0 100644 --- a/src/flash/ocl.c +++ b/src/flash/ocl.c @@ -49,7 +49,7 @@ FLASH_BANK_COMMAND_HANDLER(ocl_flash_bank_command) struct arm7_9_common *arm7_9; struct ocl_priv *ocl; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank ocl configuration"); return ERROR_FLASH_BANK_INVALID; diff --git a/src/flash/orion_nand.c b/src/flash/orion_nand.c index 4235b085..69d6d966 100644 --- a/src/flash/orion_nand.c +++ b/src/flash/orion_nand.c @@ -131,7 +131,7 @@ NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command) uint32_t base; uint8_t ale, cle; - if (argc != 3) { + if (CMD_ARGC != 3) { LOG_ERROR("arguments must be: \n"); return ERROR_NAND_DEVICE_INVALID; } diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index 51c42b59..95e2c637 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -66,7 +66,7 @@ FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command) { struct pic32mx_flash_bank *pic32mx_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank pic32mx configuration"); return ERROR_FLASH_BANK_INVALID; @@ -677,7 +677,7 @@ COMMAND_HANDLER(pic32mx_handle_lock_command) struct target *target = NULL; struct pic32mx_flash_bank *pic32mx_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "pic32mx lock "); return ERROR_OK; @@ -723,7 +723,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command) struct target *target = NULL; struct pic32mx_flash_bank *pic32mx_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "pic32mx unlock "); return ERROR_OK; @@ -813,7 +813,7 @@ COMMAND_HANDLER(pic32mx_handle_chip_erase_command) #if 0 int i; - if (argc != 0) + if (CMD_ARGC != 0) { command_print(cmd_ctx, "pic32mx chip_erase"); return ERROR_OK; @@ -848,7 +848,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command) uint32_t address, value; int status, res; - if (argc != 3) + if (CMD_ARGC != 3) { command_print(cmd_ctx, "pic32mx pgm_word "); return ERROR_OK; diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index bbe4aef9..4f28c099 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -218,7 +218,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command) { struct stellaris_flash_bank *stellaris_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank stellaris configuration"); return ERROR_FLASH_BANK_INVALID; @@ -1132,7 +1132,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command) { int i; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "stellaris mass_erase "); return ERROR_OK; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index ab9831b9..d32e9ea4 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -38,7 +38,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command) { struct stm32x_flash_bank *stm32x_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank stm32x configuration"); return ERROR_FLASH_BANK_INVALID; @@ -898,7 +898,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command) struct target *target = NULL; struct stm32x_flash_bank *stm32x_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "stm32x lock "); return ERROR_OK; @@ -944,7 +944,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command) struct target *target = NULL; struct stm32x_flash_bank *stm32x_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "stm32x unlock "); return ERROR_OK; @@ -988,7 +988,7 @@ COMMAND_HANDLER(stm32x_handle_options_read_command) struct target *target = NULL; struct stm32x_flash_bank *stm32x_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "stm32x options_read "); return ERROR_OK; @@ -1044,7 +1044,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command) struct stm32x_flash_bank *stm32x_info = NULL; uint16_t optionbyte = 0xF8; - if (argc < 4) + if (CMD_ARGC < 4) { command_print(cmd_ctx, "stm32x options_write "); return ERROR_OK; @@ -1153,7 +1153,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command) { int i; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "stm32x mass_erase "); return ERROR_OK; diff --git a/src/flash/str7x.c b/src/flash/str7x.c index d8510511..134780b1 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -114,7 +114,7 @@ FLASH_BANK_COMMAND_HANDLER(str7x_flash_bank_command) { struct str7x_flash_bank *str7x_info; - if (argc < 7) + if (CMD_ARGC < 7) { LOG_WARNING("incomplete flash_bank str7x configuration"); return ERROR_FLASH_BANK_INVALID; @@ -611,7 +611,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command) uint16_t ProtectionLevel = 0; uint16_t ProtectionRegs; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "str7x disable_jtag "); return ERROR_OK; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 4c4d8ae7..c103e572 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -121,7 +121,7 @@ FLASH_BANK_COMMAND_HANDLER(str9x_flash_bank_command) { struct str9x_flash_bank *str9x_info; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank str9x configuration"); return ERROR_FLASH_BANK_INVALID; @@ -636,7 +636,7 @@ COMMAND_HANDLER(str9x_handle_flash_config_command) struct str9x_flash_bank *str9x_info; struct target *target = NULL; - if (argc < 5) + if (CMD_ARGC < 5) { return ERROR_COMMAND_SYNTAX_ERROR; } diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 7f6d8bed..73027e45 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -242,7 +242,7 @@ FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command) struct arm7_9_common *arm7_9 = NULL; struct arm_jtag *jtag_info = NULL; - if (argc < 6) + if (CMD_ARGC < 6) { LOG_WARNING("incomplete flash_bank str9x configuration"); return ERROR_FLASH_BANK_INVALID; @@ -734,7 +734,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command) uint32_t idcode; struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) return ERROR_COMMAND_SYNTAX_ERROR; struct flash_bank *bank; @@ -782,7 +782,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command) uint8_t status; struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "str9xpec options_read "); return ERROR_OK; @@ -898,7 +898,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command) { uint8_t status; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "str9xpec options_write "); return ERROR_OK; @@ -921,7 +921,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command) { struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 2) + if (CMD_ARGC < 2) { command_print(cmd_ctx, "str9xpec options_cmap "); return ERROR_OK; @@ -950,7 +950,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command) { struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 2) + if (CMD_ARGC < 2) { command_print(cmd_ctx, "str9xpec options_lvdthd <2.4v | 2.7v>"); return ERROR_OK; @@ -979,7 +979,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command) { struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 2) + if (CMD_ARGC < 2) { command_print(cmd_ctx, "str9xpec options_lvdsel "); return ERROR_OK; @@ -1008,7 +1008,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command) { struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 2) + if (CMD_ARGC < 2) { command_print(cmd_ctx, "str9xpec options_lvdwarn "); return ERROR_OK; @@ -1037,7 +1037,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command) { uint8_t status; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "str9xpec lock "); return ERROR_OK; @@ -1060,7 +1060,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command) { uint8_t status; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "str9xpec unlock "); return ERROR_OK; @@ -1086,7 +1086,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command) struct jtag_tap *tap2; struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "str9xpec enable_turbo "); return ERROR_OK; @@ -1133,7 +1133,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command) struct jtag_tap *tap; struct str9xpec_flash_controller *str9xpec_info = NULL; - if (argc < 1) + if (CMD_ARGC < 1) { command_print(cmd_ctx, "str9xpec disable_turbo "); return ERROR_OK; diff --git a/src/flash/tms470.c b/src/flash/tms470.c index b71e9ed6..d52dcc13 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -291,12 +291,12 @@ static uint32_t flashKeys[4]; COMMAND_HANDLER(tms470_handle_flash_keyset_command) { - if (argc > 4) + if (CMD_ARGC > 4) { command_print(cmd_ctx, "tms470 flash_keyset "); return ERROR_INVALID_ARGUMENTS; } - else if (argc == 4) + else if (CMD_ARGC == 4) { int i; @@ -314,7 +314,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command) keysSet = 1; } - else if (argc != 0) + else if (CMD_ARGC != 0) { command_print(cmd_ctx, "tms470 flash_keyset "); return ERROR_INVALID_ARGUMENTS; @@ -355,12 +355,12 @@ static int oscMHz = 12; COMMAND_HANDLER(tms470_handle_osc_megahertz_command) { - if (argc > 1) + if (CMD_ARGC > 1) { command_print(cmd_ctx, "tms470 osc_megahertz "); return ERROR_INVALID_ARGUMENTS; } - else if (argc == 1) + else if (CMD_ARGC == 1) { sscanf(args[0], "%d", &oscMHz); } @@ -384,12 +384,12 @@ static int plldis = 0; COMMAND_HANDLER(tms470_handle_plldis_command) { - if (argc > 1) + if (CMD_ARGC > 1) { command_print(cmd_ctx, "tms470 plldis <0 | 1>"); return ERROR_INVALID_ARGUMENTS; } - else if (argc == 1) + else if (CMD_ARGC == 1) { sscanf(args[0], "%d", &plldis); plldis = plldis ? 1 : 0; -- cgit v1.2.3