From: Zachary T Welch Date: Tue, 17 Nov 2009 21:07:36 +0000 (-0800) Subject: rename flash and nand command helpers X-Git-Tag: v0.4.0-rc1~491 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ff25e76bad7e57da4ebd363f1b35d4af04acaa67;p=openocd rename flash and nand command helpers After adding support for referencing banks by name, renames the COMMAND_HELPERs appropriately: flash_command_get_bank_by_num -> flash_command_get_bank nand_command_get_device_by_num -> flash_command_get_device --- diff --git a/src/flash/avrf.c b/src/flash/avrf.c index 20c619dc..356c4049 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -426,7 +426,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/flash.c b/src/flash/flash.c index 071503f1..b960c64e 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -216,7 +216,7 @@ struct flash_bank *get_flash_bank_by_num(int num) return p; } -COMMAND_HELPER(flash_command_get_bank_by_num, unsigned name_index, +COMMAND_HELPER(flash_command_get_bank, unsigned name_index, struct flash_bank **bank) { const char *name = CMD_ARGV[name_index]; @@ -425,7 +425,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command) } struct flash_bank *p; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); if (ERROR_OK != retval) return retval; @@ -513,7 +513,7 @@ COMMAND_HANDLER(handle_flash_protect_check_command) return ERROR_COMMAND_SYNTAX_ERROR; struct flash_bank *p; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); if (ERROR_OK != retval) return retval; @@ -837,7 +837,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command) duration_start(&bench); struct flash_bank *p; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p); if (ERROR_OK != retval) return retval; diff --git a/src/flash/flash.h b/src/flash/flash.h index fb88c353..1235a419 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -333,7 +333,7 @@ struct flash_bank *get_flash_bank_by_num(int num); * @param bank On output, contians a pointer to the bank or NULL. * @returns ERROR_OK on success, or an error indicating the problem. */ -COMMAND_HELPER(flash_command_get_bank_by_num, unsigned name_index, +COMMAND_HELPER(flash_command_get_bank, unsigned name_index, struct flash_bank **bank); /** * Returns the flash bank like get_flash_bank_by_num(), without probing. diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index 5442e712..b60c6cfd 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -749,7 +749,7 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 1d5abd9d..465d7768 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -544,7 +544,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -589,7 +589,7 @@ COMMAND_HANDLER(lpc2900_handle_read_custom_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -660,7 +660,7 @@ COMMAND_HANDLER(lpc2900_handle_password_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -695,7 +695,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -806,7 +806,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command) /* Get the bank descriptor */ struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -905,7 +905,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command) /* Get the bank descriptor */ struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/nand.c b/src/flash/nand.c index d812805a..35180567 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -322,7 +322,7 @@ struct nand_device *get_nand_device_by_num(int num) return NULL; } -COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index, +COMMAND_HELPER(nand_command_get_device, unsigned name_index, struct nand_device **nand) { const char *str = CMD_ARGV[name_index]; @@ -1100,7 +1100,7 @@ COMMAND_HANDLER(handle_nand_info_command) int last = -1; struct nand_device *p; - int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p); if (ERROR_OK != retval) return retval; @@ -1175,7 +1175,7 @@ COMMAND_HANDLER(handle_nand_probe_command) } struct nand_device *p; - int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p); if (ERROR_OK != retval) return retval; @@ -1204,7 +1204,7 @@ COMMAND_HANDLER(handle_nand_erase_command) } struct nand_device *p; - int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p); if (ERROR_OK != retval) return retval; @@ -1263,7 +1263,7 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command) } struct nand_device *p; - int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p); if (ERROR_OK != retval) return retval; @@ -1415,7 +1415,7 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state, return ERROR_COMMAND_SYNTAX_ERROR; struct nand_device *nand; - int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &nand); + int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &nand); if (ERROR_OK != retval) return retval; @@ -1674,7 +1674,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command) } struct nand_device *p; - int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p); + int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p); if (ERROR_OK != retval) return retval; diff --git a/src/flash/nand.h b/src/flash/nand.h index a1087715..d38ed67e 100644 --- a/src/flash/nand.h +++ b/src/flash/nand.h @@ -239,7 +239,7 @@ int nand_register_commands(struct command_context *cmd_ctx); int nand_init(struct command_context *cmd_ctx); /// helper for parsing a nand device command argument string -COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index, +COMMAND_HELPER(nand_command_get_device, unsigned name_index, struct nand_device **nand); diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index 4bfe91b8..fa5a4d67 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -684,7 +684,7 @@ COMMAND_HANDLER(pic32mx_handle_lock_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -730,7 +730,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -820,7 +820,7 @@ COMMAND_HANDLER(pic32mx_handle_chip_erase_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -858,7 +858,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command) COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 2, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 2, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index a18c99b3..32fa415e 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -1139,7 +1139,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index 4db338d5..c96b49d7 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -905,7 +905,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -951,7 +951,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -995,7 +995,7 @@ COMMAND_HANDLER(stm32x_handle_options_read_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -1051,7 +1051,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -1160,7 +1160,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/str7x.c b/src/flash/str7x.c index da1899d5..b79dd17f 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -618,7 +618,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 50cddaf2..3bb89705 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -642,7 +642,7 @@ COMMAND_HANDLER(str9x_handle_flash_config_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index de222fbf..f7c705e8 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -738,7 +738,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command) return ERROR_COMMAND_SYNTAX_ERROR; struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -789,7 +789,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -905,7 +905,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -928,7 +928,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -957,7 +957,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -986,7 +986,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -1015,7 +1015,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -1044,7 +1044,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -1067,7 +1067,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -1093,7 +1093,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval; @@ -1140,7 +1140,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command) } struct flash_bank *bank; - int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); if (ERROR_OK != retval) return retval;