From e84849f5ed7416c758914bea88a31827259c4f5b Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Sun, 15 Nov 2009 06:48:20 -0800 Subject: flash_command_get_bank_by_num: make COMMAND_HELPER Use COMMAND_HELPER macro to declare flash_command_get_bank_by_num. This is required for COMMAND_PARSE_NUMBER macro. --- src/flash/avrf.c | 2 +- src/flash/flash.c | 12 ++++++------ src/flash/flash.h | 8 ++++---- src/flash/lpc2000.c | 2 +- src/flash/lpc2900.c | 12 ++++++------ src/flash/pic32mx.c | 8 ++++---- src/flash/stellaris.c | 2 +- src/flash/stm32x.c | 10 +++++----- src/flash/str7x.c | 2 +- src/flash/str9x.c | 2 +- src/flash/str9xpec.c | 22 +++++++++++----------- 11 files changed, 41 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/flash/avrf.c b/src/flash/avrf.c index e41093d..5d3c033 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/flash.c b/src/flash/flash.c index 20efa50..bdee53b 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -198,11 +198,11 @@ struct flash_bank *get_flash_bank_by_num(int num) return p; } -int flash_command_get_bank_by_num( - struct command_context *cmd_ctx, const char *str, struct flash_bank **bank) +COMMAND_HELPER(flash_command_get_bank_by_num, + unsigned name_index, struct flash_bank **bank) { unsigned bank_num; - COMMAND_PARSE_NUMBER(uint, str, bank_num); + COMMAND_PARSE_NUMBER(uint, args[name_index], bank_num); *bank = get_flash_bank_by_num(bank_num); if (!*bank) @@ -403,7 +403,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command) } struct flash_bank *p; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p); if (ERROR_OK != retval) return retval; @@ -491,7 +491,7 @@ COMMAND_HANDLER(handle_flash_protect_check_command) return ERROR_COMMAND_SYNTAX_ERROR; struct flash_bank *p; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p); if (ERROR_OK != retval) return retval; @@ -821,7 +821,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command) duration_start(&bench); struct flash_bank *p; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p); if (ERROR_OK != retval) return retval; diff --git a/src/flash/flash.h b/src/flash/flash.h index 4651fc3..96a4120 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -318,13 +318,13 @@ struct flash_bank *get_flash_bank_by_num(int num); /** * Retreives @a bank from a command argument, reporting errors parsing * the bank identifier or retreiving the specified bank. - * @param cmd_ctx The command context for reporting errors. - * @param str The string containing the bank identifier. + * @param name_index The index to the string in args containing the + * bank identifier. * @param bank On output, contians a pointer to the bank or NULL. * @returns ERROR_OK on success, or an error indicating the problem. */ -int flash_command_get_bank_by_num(struct command_context *cmd_ctx, - const char *str, struct flash_bank **bank); +COMMAND_HELPER(flash_command_get_bank_by_num, unsigned name_index, + struct flash_bank **bank); /** * Returns the flash bank like get_flash_bank_by_num(), without probing. * @param num The flash bank number. diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index 09bb13f..79f5804 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -750,7 +750,7 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command) } struct flash_bank *bank; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 35f1507..b80079d 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; @@ -660,7 +660,7 @@ COMMAND_HANDLER(lpc2900_handle_password_command) } struct flash_bank *bank; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index b6c4c44..51c42b5 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; @@ -730,7 +730,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command) } struct flash_bank *bank; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; @@ -858,7 +858,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command) COMMAND_PARSE_NUMBER(u32, args[1], value); struct flash_bank *bank; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[2], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 2, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index 7b94675..bbe4aef 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index 7072715..ab9831b 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; @@ -951,7 +951,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command) } struct flash_bank *bank; - int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/str7x.c b/src/flash/str7x.c index 19ee160..d851051 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 870871c..4c4d8ae 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index d1b02c5..4bf5bca 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 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 = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank); if (ERROR_OK != retval) return retval; -- cgit v1.1