summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-15 06:48:20 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-16 08:44:38 -0800
commite84849f5ed7416c758914bea88a31827259c4f5b (patch)
tree09aa41817c6425c3722e37a7edbe3b5696e204e7 /src
parentd7a0dfa4dc28c60c3137b9f9acf3fcc046730f0f (diff)
downloadopenocd+libswd-e84849f5ed7416c758914bea88a31827259c4f5b.tar.gz
openocd+libswd-e84849f5ed7416c758914bea88a31827259c4f5b.tar.bz2
openocd+libswd-e84849f5ed7416c758914bea88a31827259c4f5b.tar.xz
openocd+libswd-e84849f5ed7416c758914bea88a31827259c4f5b.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/flash/avrf.c2
-rw-r--r--src/flash/flash.c12
-rw-r--r--src/flash/flash.h8
-rw-r--r--src/flash/lpc2000.c2
-rw-r--r--src/flash/lpc2900.c12
-rw-r--r--src/flash/pic32mx.c8
-rw-r--r--src/flash/stellaris.c2
-rw-r--r--src/flash/stm32x.c10
-rw-r--r--src/flash/str7x.c2
-rw-r--r--src/flash/str9x.c2
-rw-r--r--src/flash/str9xpec.c22
11 files changed, 41 insertions, 41 deletions
diff --git a/src/flash/avrf.c b/src/flash/avrf.c
index e41093de..5d3c033d 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 20efa502..bdee53b6 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 4651fc36..96a41207 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 09bb13f2..79f58045 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 35f15070..b80079df 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 b6c4c440..51c42b59 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 7b946754..bbe4aef9 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 70727158..ab9831b9 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 19ee160e..d8510511 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 870871cc..4c4d8ae7 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 d1b02c5e..4bf5bcae 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;