diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-09 23:56:52 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-13 10:51:45 -0800 |
commit | cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e (patch) | |
tree | f129c414d90f81a2caf6054ab7bbcd1306ac1f26 /src | |
parent | ddb6138ed428f666064d26bb08036de3afe44bc8 (diff) | |
download | openocd+libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.tar.gz openocd+libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.tar.bz2 openocd+libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.tar.xz openocd+libswd-cfc4d5c6b7b6f8f82dc5bbf3ee661c179814666e.zip |
use COMMAND_HANDLER macro to define all commands
Diffstat (limited to 'src')
55 files changed, 224 insertions, 327 deletions
diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index 714e8b8b..804a35b4 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -2266,8 +2266,7 @@ sam3_write(struct flash_bank_s *bank, return r; } -static int -sam3_handle_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(sam3_handle_info_command) { struct sam3_chip *pChip; void *vp; @@ -2343,8 +2342,7 @@ sam3_handle_info_command(struct command_context_s *cmd_ctx, char *cmd, char **ar return ERROR_OK; } -static int -sam3_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(sam3_handle_gpnvm_command) { unsigned x,v; int r,who; @@ -2437,8 +2435,7 @@ sam3_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **a return r; } -static int -sam3_handle_slowclk_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(sam3_handle_slowclk_command) { struct sam3_chip *pChip; diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 134c9e56..4cd27056 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -1098,7 +1098,7 @@ static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size) * The maximum number of write/erase cycles for Non volatile Memory bits is 100. this includes * Lock Bits (LOCKx), General Purpose NVM bits (GPNVMx) and the Security Bit. */ -static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(at91sam7_handle_gpnvm_command) { flash_bank_t *bank; int bit; diff --git a/src/flash/avrf.c b/src/flash/avrf.c index b0459093..6badb2d1 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -415,7 +415,7 @@ static int avrf_mass_erase(struct flash_bank_s *bank) return ERROR_OK; } -static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(avrf_handle_mass_erase_command) { int i; diff --git a/src/flash/flash.c b/src/flash/flash.c index 1a04e123..d3889b9b 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -215,7 +215,7 @@ int flash_command_get_bank_by_num( } -static int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_bank_command) { int retval; int i; @@ -295,7 +295,7 @@ static int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -static int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_info_command) { flash_bank_t *p; uint32_t i = 0; @@ -357,7 +357,7 @@ static int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -static int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_probe_command) { int retval; @@ -394,7 +394,7 @@ static int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } -static int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_erase_check_command) { if (argc != 1) { @@ -440,7 +440,7 @@ static int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, c return ERROR_OK; } -static int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_erase_address_command) { flash_bank_t *p; int retval; @@ -484,7 +484,7 @@ static int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, return retval; } -static int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_protect_check_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -528,8 +528,7 @@ static int flash_check_sector_parameters(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_flash_erase_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_erase_command) { if (argc != 2) return ERROR_COMMAND_SYNTAX_ERROR; @@ -569,8 +568,7 @@ static int handle_flash_erase_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_flash_protect_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_protect_command) { if (argc != 3) return ERROR_COMMAND_SYNTAX_ERROR; @@ -614,7 +612,7 @@ static int handle_flash_protect_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_write_image_command) { target_t *target = get_current_target(cmd_ctx); @@ -704,7 +702,7 @@ static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, c return retval; } -static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_fill_command) { int err = ERROR_OK; uint32_t address; @@ -808,7 +806,7 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -static int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_flash_write_bank_command) { uint32_t offset; uint8_t *buffer; diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index e71629e5..4d4d9a2a 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -737,7 +737,7 @@ static int lpc2000_info(struct flash_bank_s *bank, char *buf, int buf_size) return ERROR_OK; } -static int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(lpc2000_handle_part_id_command) { uint32_t param_table[5]; uint32_t result_table[4]; diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 379b4e87..945fc9a2 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -531,8 +531,7 @@ static uint32_t lpc2900_calc_tr( uint32_t clock, uint32_t time ) * Uses the Built-In-Self-Test (BIST) to generate a 128-bit hash value * of the flash content. */ -static int lpc2900_handle_signature_command( struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc ) +COMMAND_HANDLER(lpc2900_handle_signature_command) { uint32_t status; uint32_t signature[4]; @@ -582,8 +581,7 @@ static int lpc2900_handle_signature_command( struct command_context_s *cmd_ctx, * Read customer info from index sector, and store that block of data into * a disk file. The format is binary. */ -static int lpc2900_handle_read_custom_command( struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc ) +COMMAND_HANDLER(lpc2900_handle_read_custom_command) { if( argc < 2 ) { @@ -654,8 +652,7 @@ static int lpc2900_handle_read_custom_command( struct command_context_s *cmd_ctx /** * Enter password to enable potentially dangerous options. */ -static int lpc2900_handle_password_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(lpc2900_handle_password_command) { if (argc < 2) { @@ -690,8 +687,7 @@ static int lpc2900_handle_password_command(struct command_context_s *cmd_ctx, /** * Write customer info from file to the index sector. */ -static int lpc2900_handle_write_custom_command( struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc ) +COMMAND_HANDLER(lpc2900_handle_write_custom_command) { if (argc < 2) { @@ -801,8 +797,7 @@ static int lpc2900_handle_write_custom_command( struct command_context_s *cmd_ct /** * Activate 'sector security' for a range of sectors. */ -static int lpc2900_handle_secure_sector_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(lpc2900_handle_secure_sector_command) { if (argc < 3) { @@ -901,8 +896,7 @@ static int lpc2900_handle_secure_sector_command(struct command_context_s *cmd_ct /** * Activate JTAG protection. */ -static int lpc2900_handle_secure_jtag_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(lpc2900_handle_secure_jtag_command) { if (argc < 1) { diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index f02c8807..4b120779 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -828,7 +828,7 @@ static int lpc3180_nand_ready(struct nand_device_s *nand, int timeout) return 0; } -static int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_lpc3180_select_command) { lpc3180_nand_controller_t *lpc3180_info = NULL; char *selected[] = diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 5a392a4d..5a9b7c35 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -408,7 +408,7 @@ static int mg_mflash_probe(void) return mg_dsk_drv_info(); } -static int mg_probe_cmd(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(mg_probe_cmd) { int ret; @@ -702,7 +702,7 @@ static int mg_mflash_write(uint32_t addr, uint8_t *buff, uint32_t len) return ret; } -static int mg_write_cmd(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(mg_write_cmd) { uint32_t address, buf_cnt, cnt, res, i; uint8_t *buffer; @@ -766,7 +766,7 @@ mg_write_cmd_err: return ret; } -static int mg_dump_cmd(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(mg_dump_cmd) { uint32_t address, size_written, size, cnt, res, i; uint8_t *buffer; @@ -1208,8 +1208,7 @@ static int mg_erase_nand(void) return ret; } -int mg_config_cmd(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc) +COMMAND_HANDLER(mg_config_cmd) { double fin, fout; mg_pll_t pll; @@ -1281,7 +1280,7 @@ int mflash_init_drivers(struct command_context_s *cmd_ctx) return ERROR_OK; } -static int mg_bank_cmd(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(mg_bank_cmd) { target_t *target; int i; diff --git a/src/flash/nand.c b/src/flash/nand.c index 4d32d25d..181700d0 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -205,7 +205,7 @@ static nand_ecclayout_t nand_oob_64 = { /* nand device <nand_controller> [controller options] */ -static int handle_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_device_command) { int i; int retval; @@ -1041,7 +1041,7 @@ int nand_write_page_raw(struct nand_device_s *nand, uint32_t page, uint8_t *data return ERROR_OK; } -int handle_nand_list_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_list_command) { nand_device_t *p; int i; @@ -1068,7 +1068,7 @@ int handle_nand_list_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -static int handle_nand_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_info_command) { int i = 0; int j = 0; @@ -1143,7 +1143,7 @@ static int handle_nand_info_command(struct command_context_s *cmd_ctx, char *cmd return ERROR_OK; } -static int handle_nand_probe_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_probe_command) { if (argc != 1) { @@ -1171,7 +1171,7 @@ static int handle_nand_probe_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -static int handle_nand_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_erase_command) { if (argc != 1 && argc != 3) { @@ -1227,7 +1227,7 @@ static int handle_nand_erase_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -int handle_nand_check_bad_blocks_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_check_bad_blocks_command) { int first = -1; int last = -1; @@ -1284,7 +1284,7 @@ int handle_nand_check_bad_blocks_command(struct command_context_s *cmd_ctx, char return ERROR_OK; } -static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_write_command) { uint32_t offset; uint32_t binary_size; @@ -1451,7 +1451,7 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -static int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_dump_command) { if (argc < 4) { @@ -1569,7 +1569,7 @@ static int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd return ERROR_OK; } -static int handle_nand_raw_access_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_nand_raw_access_command) { if ((argc < 1) || (argc > 2)) { diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index 78ed1854..aa34aeae 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -631,7 +631,7 @@ static int pic32mx_auto_probe(struct flash_bank_s *bank) } #if 0 -static int pic32mx_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(pic32mx_handle_part_id_command) { return ERROR_OK; } @@ -672,7 +672,7 @@ static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size) } #if 0 -int pic32mx_handle_lock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(pic32mx_handle_lock_command) { target_t *target = NULL; pic32mx_flash_bank_t *pic32mx_info = NULL; @@ -718,7 +718,7 @@ int pic32mx_handle_lock_command(struct command_context_s *cmd_ctx, char *cmd, ch return ERROR_OK; } -int pic32mx_handle_unlock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(pic32mx_handle_unlock_command) { target_t *target = NULL; pic32mx_flash_bank_t *pic32mx_info = NULL; @@ -808,7 +808,7 @@ static int pic32mx_chip_erase(struct flash_bank_s *bank) } #endif -static int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(pic32mx_handle_chip_erase_command) { #if 0 int i; @@ -843,7 +843,7 @@ static int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(pic32mx_handle_pgm_word_command) { uint32_t address, value; int status, res; diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index bd561a61..22d5bc46 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -1127,7 +1127,7 @@ static int stellaris_mass_erase(struct flash_bank_s *bank) return ERROR_OK; } -static int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(stellaris_handle_mass_erase_command) { int i; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index 2ca5fa94..95d15a95 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -780,7 +780,7 @@ static int stm32x_auto_probe(struct flash_bank_s *bank) } #if 0 -static int stm32x_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(stm32x_handle_part_id_command) { return ERROR_OK; } @@ -892,7 +892,7 @@ static int stm32x_info(struct flash_bank_s *bank, char *buf, int buf_size) return ERROR_OK; } -static int stm32x_handle_lock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(stm32x_handle_lock_command) { target_t *target = NULL; stm32x_flash_bank_t *stm32x_info = NULL; @@ -938,7 +938,7 @@ static int stm32x_handle_lock_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } -static int stm32x_handle_unlock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(stm32x_handle_unlock_command) { target_t *target = NULL; stm32x_flash_bank_t *stm32x_info = NULL; @@ -981,7 +981,7 @@ static int stm32x_handle_unlock_command(struct command_context_s *cmd_ctx, char return ERROR_OK; } -static int stm32x_handle_options_read_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(stm32x_handle_options_read_command) { uint32_t optionbyte; target_t *target = NULL; @@ -1037,7 +1037,7 @@ static int stm32x_handle_options_read_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int stm32x_handle_options_write_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(stm32x_handle_options_write_command) { target_t *target = NULL; stm32x_flash_bank_t *stm32x_info = NULL; @@ -1148,7 +1148,7 @@ static int stm32x_mass_erase(struct flash_bank_s *bank) return ERROR_OK; } -static int stm32x_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(stm32x_handle_mass_erase_command) { int i; diff --git a/src/flash/str7x.c b/src/flash/str7x.c index ed107f31..028eab63 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -589,7 +589,7 @@ static int str7x_probe(struct flash_bank_s *bank) } #if 0 -static int str7x_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str7x_handle_part_id_command) { return ERROR_OK; } @@ -601,7 +601,7 @@ static int str7x_info(struct flash_bank_s *bank, char *buf, int buf_size) return ERROR_OK; } -static int str7x_handle_disable_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str7x_handle_disable_jtag_command) { target_t *target = NULL; str7x_flash_bank_t *str7x_info = NULL; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 893baf53..665c1607 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -619,8 +619,7 @@ static int str9x_probe(struct flash_bank_s *bank) } #if 0 -static int str9x_handle_part_id_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(str9x_handle_part_id_command) { return ERROR_OK; } @@ -632,8 +631,7 @@ static int str9x_info(struct flash_bank_s *bank, char *buf, int buf_size) return ERROR_OK; } -static int str9x_handle_flash_config_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(str9x_handle_flash_config_command) { str9x_flash_bank_t *str9x_info; target_t *target = NULL; diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 73b9a1d4..3a35ee17 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -726,7 +726,7 @@ static int str9xpec_probe(struct flash_bank_s *bank) return ERROR_OK; } -static int str9xpec_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_part_id_command) { scan_field_t field; uint8_t *buffer = NULL; @@ -777,7 +777,7 @@ static int str9xpec_info(struct flash_bank_s *bank, char *buf, int buf_size) return ERROR_OK; } -static int str9xpec_handle_flash_options_read_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_options_read_command) { uint8_t status; str9xpec_flash_controller_t *str9xpec_info = NULL; @@ -894,7 +894,7 @@ static int str9xpec_write_options(struct flash_bank_s *bank) return status; } -static int str9xpec_handle_flash_options_write_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_options_write_command) { uint8_t status; @@ -917,7 +917,7 @@ static int str9xpec_handle_flash_options_write_command(struct command_context_s return ERROR_OK; } -static int str9xpec_handle_flash_options_cmap_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command) { str9xpec_flash_controller_t *str9xpec_info = NULL; @@ -946,7 +946,7 @@ static int str9xpec_handle_flash_options_cmap_command(struct command_context_s * return ERROR_OK; } -static int str9xpec_handle_flash_options_lvdthd_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command) { str9xpec_flash_controller_t *str9xpec_info = NULL; @@ -975,7 +975,7 @@ static int str9xpec_handle_flash_options_lvdthd_command(struct command_context_s return ERROR_OK; } -int str9xpec_handle_flash_options_lvdsel_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command) { str9xpec_flash_controller_t *str9xpec_info = NULL; @@ -1004,7 +1004,7 @@ int str9xpec_handle_flash_options_lvdsel_command(struct command_context_s *cmd_c return ERROR_OK; } -static int str9xpec_handle_flash_options_lvdwarn_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command) { str9xpec_flash_controller_t *str9xpec_info = NULL; @@ -1033,7 +1033,7 @@ static int str9xpec_handle_flash_options_lvdwarn_command(struct command_context_ return ERROR_OK; } -static int str9xpec_handle_flash_lock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_lock_command) { uint8_t status; @@ -1056,7 +1056,7 @@ static int str9xpec_handle_flash_lock_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int str9xpec_handle_flash_unlock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_unlock_command) { uint8_t status; @@ -1079,7 +1079,7 @@ static int str9xpec_handle_flash_unlock_command(struct command_context_s *cmd_ct return ERROR_OK; } -static int str9xpec_handle_flash_enable_turbo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command) { jtag_tap_t *tap0; jtag_tap_t *tap1; @@ -1128,7 +1128,7 @@ static int str9xpec_handle_flash_enable_turbo_command(struct command_context_s * return ERROR_OK; } -static int str9xpec_handle_flash_disable_turbo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command) { jtag_tap_t *tap; str9xpec_flash_controller_t *str9xpec_info = NULL; diff --git a/src/flash/tms470.c b/src/flash/tms470.c index 1348697a..53043cd5 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -289,7 +289,7 @@ static int tms470_read_part_info(struct flash_bank_s *bank) static uint32_t keysSet = 0; static uint32_t flashKeys[4]; -static int tms470_handle_flash_keyset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(tms470_handle_flash_keyset_command) { if (argc > 4) { @@ -353,7 +353,7 @@ static const uint32_t FLASH_KEYS_MIX2[] = { 0x0000ffff, 0x0000ffff, static int oscMHz = 12; -static int tms470_handle_osc_megahertz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(tms470_handle_osc_megahertz_command) { if (argc > 1) { @@ -382,7 +382,7 @@ static int tms470_handle_osc_megahertz_command(struct command_context_s *cmd_ctx static int plldis = 0; -static int tms470_handle_plldis_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(tms470_handle_plldis_command) { if (argc > 1) { diff --git a/src/helper/command.c b/src/helper/command.c index e467be0b..4ce50855 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -716,8 +716,7 @@ static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv) /* sleep command sleeps for <n> miliseconds * this is useful in target startup scripts */ -static int handle_sleep_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_sleep_command) { bool busy = false; if (argc == 2) @@ -750,7 +749,7 @@ static int handle_sleep_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_fast_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_fast_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index b3171bc0..1423462c 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -57,8 +57,7 @@ #endif -int handle_rm_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc) +COMMAND_HANDLER(handle_rm_command) { if (argc != 1) { @@ -134,10 +133,7 @@ int loadFile(const char *fileName, void **data, size_t *len) return ERROR_OK; } - - -int handle_cat_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc) +COMMAND_HANDLER(handle_cat_command) { if (argc != 1) { @@ -162,8 +158,8 @@ int handle_cat_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_OK; } -int handle_trunc_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc) + +COMMAND_HANDLER(handle_trunc_command) { if (argc != 1) { @@ -179,8 +175,7 @@ int handle_trunc_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_OK; } - -int handle_meminfo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_meminfo_command) { static int prev = 0; struct mallinfo info; @@ -205,8 +200,7 @@ int handle_meminfo_command(struct command_context_s *cmd_ctx, char *cmd, char ** } -int handle_append_command(struct command_context_s *cmd_ctx, char *cmd, - char **args, int argc) +COMMAND_HANDLER(handle_append_command) { if (argc < 1) { @@ -245,7 +239,7 @@ int handle_append_command(struct command_context_s *cmd_ctx, char *cmd, -int handle_cp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_cp_command) { if (argc != 2) { diff --git a/src/helper/log.c b/src/helper/log.c index a8b519af..ccc0c01b 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -274,7 +274,7 @@ void log_printf_lf(enum log_levels level, const char *file, int line, const char * 2: + INFORMATIONAL MSGS * 3: + DEBUG MSGS */ -int handle_debug_level_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_debug_level_command) { if (argc == 1) { @@ -302,7 +302,7 @@ int handle_debug_level_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } -int handle_log_output_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_log_output_command) { if (argc == 1) { diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c index abfaadc9..a34387f8 100644 --- a/src/jtag/amt_jtagaccel.c +++ b/src/jtag/amt_jtagaccel.c @@ -495,8 +495,7 @@ static int amt_jtagaccel_quit(void) return ERROR_OK; } -static int amt_jtagaccel_handle_parport_port_command( - struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command) { if (argc == 1) { @@ -519,7 +518,7 @@ static int amt_jtagaccel_handle_parport_port_command( return ERROR_OK; } -static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command) { if (argc == 0) { diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 243479db..6d233569 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -2798,7 +2798,7 @@ static int ft2232_quit(void) return ERROR_OK; } -static int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc) +COMMAND_HANDLER(ft2232_handle_device_desc_command) { char *cp; char buf[200]; @@ -2832,7 +2832,7 @@ static int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, return ERROR_OK; } -static int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc) +COMMAND_HANDLER(ft2232_handle_serial_command) { if (argc == 1) { @@ -2846,7 +2846,7 @@ static int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* return ERROR_OK; } -static int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc) +COMMAND_HANDLER(ft2232_handle_layout_command) { if (argc == 0) return ERROR_OK; @@ -2857,7 +2857,7 @@ static int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* return ERROR_OK; } -static int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc) +COMMAND_HANDLER(ft2232_handle_vid_pid_command) { if (argc > MAX_USB_IDS * 2) { @@ -2891,7 +2891,7 @@ static int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char return retval; } -static int ft2232_handle_latency_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc) +COMMAND_HANDLER(ft2232_handle_latency_command) { if (argc == 1) { diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index 35473ab8..07188f4e 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -541,7 +541,7 @@ static int gw16012_quit(void) return ERROR_OK; } -static int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(gw16012_handle_parport_port_command) { if (argc == 1) { diff --git a/src/jtag/parport.c b/src/jtag/parport.c index 9b202902..cee7a169 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -410,7 +410,7 @@ static int parport_quit(void) return ERROR_OK; } -static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(parport_handle_parport_port_command) { if (argc == 1) { @@ -431,7 +431,7 @@ static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx return ERROR_OK; } -static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(parport_handle_parport_cable_command) { if (argc == 0) return ERROR_OK; @@ -446,7 +446,7 @@ static int parport_handle_parport_cable_command(struct command_context_s *cmd_ct return ERROR_OK; } -static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(parport_handle_write_on_exit_command) { if (argc != 1) { diff --git a/src/jtag/presto.c b/src/jtag/presto.c index 09722233..8789bed2 100644 --- a/src/jtag/presto.c +++ b/src/jtag/presto.c @@ -752,7 +752,7 @@ static int presto_jtag_speed(int speed) static char *presto_serial; -static int presto_handle_serial_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(presto_handle_serial_command) { if (argc == 1) { diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index b86e006a..653d3a7e 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -603,8 +603,7 @@ static int default_srst_asserted(int *srst_asserted) return ERROR_OK; } -static int handle_interface_list_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_interface_list_command) { if (strcmp(cmd, "interface_list") == 0 && argc > 0) return ERROR_COMMAND_SYNTAX_ERROR; @@ -619,8 +618,7 @@ static int handle_interface_list_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_interface_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_interface_command) { /* check whether the interface is already configured */ if (jtag_interface) @@ -664,7 +662,7 @@ static int handle_interface_command(struct command_context_s *cmd_ctx, return ERROR_JTAG_INVALID_INTERFACE; } -static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_scan_chain_command) { jtag_tap_t *tap; @@ -701,7 +699,7 @@ static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -static int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_reset_config_command) { int new_cfg = 0; int mask = 0; @@ -897,8 +895,7 @@ next: return ERROR_OK; } -static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_jtag_nsrst_delay_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -913,8 +910,7 @@ static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_jtag_ntrst_delay_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -929,8 +925,7 @@ static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_jtag_nsrst_assert_width_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -945,8 +940,7 @@ static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ return ERROR_OK; } -static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -961,7 +955,7 @@ static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ return ERROR_OK; } -static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_jtag_khz_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -990,7 +984,7 @@ static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, return retval; } -static int handle_jtag_rclk_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_jtag_rclk_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -1019,8 +1013,7 @@ static int handle_jtag_rclk_command(struct command_context_s *cmd_ctx, char *cmd return retval; } -static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_jtag_reset_command) { if (argc != 2) return ERROR_COMMAND_SYNTAX_ERROR; @@ -1048,8 +1041,7 @@ static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, return jtag_execute_queue(); } -static int handle_runtest_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_runtest_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -1083,7 +1075,7 @@ static bool scan_is_safe(tap_state_t state) } -static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_irscan_command) { int i; scan_field_t *fields; @@ -1358,7 +1350,7 @@ static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const } -static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_verify_ircapture_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -1379,7 +1371,7 @@ static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, ch return ERROR_OK; } -static int handle_verify_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_verify_jtag_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -1400,7 +1392,7 @@ static int handle_verify_jtag_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } -static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_tms_sequence_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c index b0084673..decca16c 100644 --- a/src/jtag/vsllink.c +++ b/src/jtag/vsllink.c @@ -1325,7 +1325,7 @@ static void vsllink_simple_command(uint8_t command) } } -static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(vsllink_handle_mode_command) { if (argc != 1) { LOG_ERROR("parameter error, should be one parameter for VID"); @@ -1349,7 +1349,7 @@ static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char * return ERROR_OK; } -static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(vsllink_handle_usb_vid_command) { if (argc != 1) { @@ -1361,7 +1361,7 @@ static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, cha return ERROR_OK; } -static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(vsllink_handle_usb_pid_command) { if (argc != 1) { @@ -1372,7 +1372,7 @@ static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, cha return ERROR_OK; } -static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(vsllink_handle_usb_bulkin_command) { if (argc != 1) { @@ -1387,7 +1387,7 @@ static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(vsllink_handle_usb_bulkout_command) { if (argc != 1) { @@ -1402,7 +1402,7 @@ static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(vsllink_handle_usb_interface_command) { if (argc != 1) { diff --git a/src/openocd.c b/src/openocd.c index 7384065a..2a74a46b 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -67,7 +67,7 @@ static void print_version(void) } /* Give TELNET a way to find out what version this is */ -static int handle_version_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_version_command) { if (argc != 0) return ERROR_COMMAND_SYNTAX_ERROR; @@ -109,7 +109,7 @@ static int log_target_callback_event_handler(struct target_s *target, enum targe int ioutil_init(struct command_context_s *cmd_ctx); /* OpenOCD can't really handle failure of this command. Patches welcome! :-) */ -static int handle_init_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_init_command) { if (argc != 0) diff --git a/src/pld/pld.c b/src/pld/pld.c index df7e2fda..c20b936c 100644 --- a/src/pld/pld.c +++ b/src/pld/pld.c @@ -57,8 +57,7 @@ pld_device_t *get_pld_device_by_num(int num) /* pld device <driver> [driver_options ...] */ -static int handle_pld_device_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_pld_device_command) { int i; int found = 0; @@ -120,8 +119,7 @@ static int handle_pld_device_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_pld_devices_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_pld_devices_command) { pld_device_t *p; int i = 0; @@ -140,8 +138,7 @@ static int handle_pld_devices_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_pld_load_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_pld_load_command) { int retval; struct timeval start, end, duration; diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c index fa646505..3c6d61fe 100644 --- a/src/pld/virtex2.c +++ b/src/pld/virtex2.c @@ -177,8 +177,7 @@ static int virtex2_load(struct pld_device_s *pld_device, const char *filename) return ERROR_OK; } -static int virtex2_handle_read_stat_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(virtex2_handle_read_stat_command) { pld_device_t *device; virtex2_pld_device_t *virtex2_info; diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 21b58d0e..c0c5d775 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2249,7 +2249,7 @@ int gdb_init(void) return ERROR_OK; } -static int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_gdb_sync_command) { if (argc != 0) { @@ -2269,12 +2269,12 @@ static int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, } /* daemon configuration command gdb_port */ -static int handle_gdb_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_gdb_port_command) { return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port); } -static int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_gdb_memory_map_command) { if (argc == 1) { @@ -2295,7 +2295,7 @@ static int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char return ERROR_COMMAND_SYNTAX_ERROR; } -static int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_gdb_flash_program_command) { if (argc == 1) { @@ -2316,7 +2316,7 @@ static int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, c return ERROR_COMMAND_SYNTAX_ERROR; } -static int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_gdb_report_data_abort_command) { if (argc == 1) { @@ -2338,7 +2338,7 @@ static int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ct } /* gdb_breakpoint_override */ -static int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_gdb_breakpoint_override_command) { if (argc == 0) { diff --git a/src/server/server.c b/src/server/server.c index 05018694..c000b7c2 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -534,8 +534,7 @@ int server_quit(void) } /* tell the server we want to shut down */ -static int handle_shutdown_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_shutdown_command) { shutdown_openocd = 1; diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index 2e93e361..3410ca91 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -170,8 +170,7 @@ int tcl_init(void) return retval; } -static int handle_tcl_port_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_tcl_port_command) { return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port); } diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index b77deff1..c409ec0a 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -606,14 +606,12 @@ int telnet_init(char *banner) } /* daemon configuration command telnet_port */ -static int handle_telnet_port_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_telnet_port_command) { return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port); } -static int handle_exit_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_exit_command) { return ERROR_COMMAND_CLOSE_CONNECTION; } diff --git a/src/svf/svf.c b/src/svf/svf.c index ba6ed1b7..76b06704 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -301,7 +301,7 @@ int svf_add_statemove(tap_state_t state_to) return ERROR_FAIL; } -static int handle_svf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_svf_command) { #define SVF_NUM_OF_OPTIONS 1 int command_num = 0, i; diff --git a/src/target/arm11.c b/src/target/arm11.c index fe39d6e8..098b0afa 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2028,7 +2028,7 @@ static int arm11_handle_bool(struct command_context_s *cmd_ctx, } #define BOOL_WRAPPER(name, print_name) \ -static int arm11_handle_bool_##name(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) \ +COMMAND_HANDLER(arm11_handle_bool_##name) \ { \ return arm11_handle_bool(cmd_ctx, cmd, args, argc, &arm11_config_##name, print_name); \ } @@ -2038,7 +2038,7 @@ BOOL_WRAPPER(memwrite_error_fatal, "fatal error mode for memory writes") BOOL_WRAPPER(step_irq_enable, "IRQs while stepping") BOOL_WRAPPER(hardware_step, "hardware single step") -static int arm11_handle_vcr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(arm11_handle_vcr) { switch (argc) { case 0: @@ -2185,17 +2185,16 @@ static int arm11_handle_etm_read_write(struct command_context_s *cmd_ctx, char * return ERROR_OK; } -int arm11_handle_etmr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(arm11_handle_etmr) { return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, true); } -int arm11_handle_etmw(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(arm11_handle_etmw) { return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, false); } - #define ARM11_HANDLER(x) .x = arm11_##x target_type_t arm11_target = { diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 6ce79807..6a5a4e74 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -409,8 +409,7 @@ static int arm720t_target_create(struct target_s *target, Jim_Interp *interp) return arm720t_init_arch_info(target, arm720t, target->tap); } -static int arm720t_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm720t_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index b6606a17..6a56417e 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -2871,7 +2871,7 @@ int arm7_9_blank_check_memory(struct target_s *target, uint32_t address, uint32_ return ERROR_OK; } -int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_write_xpsr_command) { uint32_t value; int spsr; @@ -2915,7 +2915,7 @@ int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -int handle_arm7_9_write_xpsr_im8_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_write_xpsr_im8_command) { uint32_t value; int rotate; @@ -2957,7 +2957,7 @@ int handle_arm7_9_write_xpsr_im8_command(struct command_context_s *cmd_ctx, char return ERROR_OK; } -int handle_arm7_9_write_core_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_write_core_reg_command) { uint32_t value; uint32_t mode; @@ -2991,7 +2991,7 @@ int handle_arm7_9_write_core_reg_command(struct command_context_s *cmd_ctx, char return arm7_9_write_core_reg(target, num, mode, value); } -int handle_arm7_9_dbgrq_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_dbgrq_command) { target_t *target = get_current_target(cmd_ctx); armv4_5_common_t *armv4_5; @@ -3024,7 +3024,7 @@ int handle_arm7_9_dbgrq_command(struct command_context_s *cmd_ctx, char *cmd, ch return ERROR_OK; } -int handle_arm7_9_fast_memory_access_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_fast_memory_access_command) { target_t *target = get_current_target(cmd_ctx); armv4_5_common_t *armv4_5; @@ -3057,7 +3057,7 @@ int handle_arm7_9_fast_memory_access_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -int handle_arm7_9_dcc_downloads_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm7_9_dcc_downloads_command) { target_t *target = get_current_target(cmd_ctx); armv4_5_common_t *armv4_5; diff --git a/src/target/arm920t.c b/src/target/arm920t.c index e043aee0..5576f60f 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -662,8 +662,7 @@ static int arm920t_target_create(struct target_s *target, Jim_Interp *interp) return arm920t_init_arch_info(target, arm920t, target->tap); } -static int arm920t_handle_read_cache_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_read_cache_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); @@ -909,8 +908,7 @@ static int arm920t_handle_read_cache_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_read_mmu_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_read_mmu_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); @@ -1193,8 +1191,7 @@ static int arm920t_handle_read_mmu_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1247,8 +1244,7 @@ static int arm920t_handle_cp15_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_cp15i_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_cp15i_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1315,8 +1311,7 @@ static int arm920t_handle_cp15i_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int arm920t_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm920t_handle_cache_info_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 316f1276..6f347d87 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -713,8 +713,7 @@ static int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp) return arm926ejs_init_arch_info(target, arm926ejs, target->tap); } -static int arm926ejs_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm926ejs_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -775,9 +774,7 @@ static int arm926ejs_handle_cp15_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -arm926ejs_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm926ejs_handle_cache_info_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 5b464efb..e61943a3 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -162,8 +162,7 @@ int arm966e_write_cp15(target_t *target, int reg_addr, uint32_t value) return ERROR_OK; } -static int arm966e_handle_cp15_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(arm966e_handle_cp15_command) { int retval; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 58b8efd0..112ec2a4 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -856,8 +856,7 @@ static int arm9tdmi_target_create(struct target_s *target, Jim_Interp *interp) return ERROR_OK; } -static int handle_arm9tdmi_catch_vectors_command( - struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command) { target_t *target = get_current_target(cmd_ctx); struct arm7_9_common_s *arm7_9 = target_to_arm7_9(target); diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 0fe9ee4a..c0a9c8ab 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -307,7 +307,7 @@ int armv4_5_arch_state(struct target_s *target) return ERROR_OK; } -int handle_armv4_5_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv4_5_reg_command) { char output[128]; int output_len; @@ -359,7 +359,7 @@ int handle_armv4_5_reg_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } -int handle_armv4_5_core_state_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv4_5_core_state_command) { target_t *target = get_current_target(cmd_ctx); struct armv4_5_common_s *armv4_5 = target_to_armv4_5(target); @@ -387,9 +387,7 @@ int handle_armv4_5_core_state_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } -static int -handle_armv4_5_disassemble_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv4_5_disassemble_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 6dfbb162..f0679260 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -230,8 +230,7 @@ int armv7a_arch_state(struct target_s *target) } -static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_baseaddr_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -240,8 +239,7 @@ static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, return dap_baseaddr_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_memaccess_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -250,8 +248,7 @@ static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, return dap_memaccess_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apsel_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -260,8 +257,7 @@ static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, return dap_apsel_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_apid_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apid_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -270,8 +266,7 @@ static int handle_dap_apid_command(struct command_context_s *cmd_ctx, return dap_apid_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_info_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -292,9 +287,7 @@ static int handle_dap_info_command(struct command_context_s *cmd_ctx, return dap_info_command(cmd_ctx, swjdp, apsel); } -static int -handle_armv7a_disassemble_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_armv7a_disassemble_command) { target_t *target = get_current_target(cmd_ctx); struct armv4_5_common_s *armv4_5 = target_to_armv4_5(target); diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 0fcee317..f6de5e11 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -745,8 +745,7 @@ int armv7m_blank_check_memory(struct target_s *target, * Return the debug ap baseaddress in hexadecimal; * no extra output to simplify script processing */ -static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_baseaddr_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -783,8 +782,7 @@ static int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, * Return the debug ap id in hexadecimal; * no extra output to simplify script processing */ -static int handle_dap_apid_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apid_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -793,8 +791,7 @@ static int handle_dap_apid_command(struct command_context_s *cmd_ctx, return dap_apid_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_apsel_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -803,8 +800,7 @@ static int handle_dap_apsel_command(struct command_context_s *cmd_ctx, return dap_apsel_command(cmd_ctx, swjdp, args, argc); } -static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_memaccess_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); @@ -814,8 +810,7 @@ static int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, } -static int handle_dap_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dap_info_command) { target_t *target = get_current_target(cmd_ctx); struct armv7m_common_s *armv7m = target_to_armv7m(target); diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index 667c5825..3ce861c4 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1526,8 +1526,7 @@ static int cortex_a8_target_create(struct target_s *target, Jim_Interp *interp) return ERROR_OK; } -static int cortex_a8_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(cortex_a8_handle_cache_info_command) { target_t *target = get_current_target(cmd_ctx); struct armv7a_common_s *armv7a = target_to_armv7a(target); @@ -1537,8 +1536,7 @@ static int cortex_a8_handle_cache_info_command(struct command_context_s *cmd_ctx } -static int cortex_a8_handle_dbginit_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(cortex_a8_handle_dbginit_command) { target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 6c95b4ea..50842319 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1781,9 +1781,7 @@ static int cortex_m3_verify_pointer(struct command_context_s *cmd_ctx, * that *only* Thumb2 disassembly matters. There are also some small * additions to Thumb2 that are specific to ARMv7-M. */ -static int -handle_cortex_m3_disassemble_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_cortex_m3_disassemble_command) { int retval; target_t *target = get_current_target(cmd_ctx); @@ -1835,9 +1833,7 @@ static const struct { { "reset", VC_CORERESET, }, }; -static int -handle_cortex_m3_vector_catch_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_cortex_m3_vector_catch_command) { target_t *target = get_current_target(cmd_ctx); struct cortex_m3_common_s *cortex_m3 = target_to_cm3(target); @@ -1894,9 +1890,7 @@ write: return ERROR_OK; } -static int -handle_cortex_m3_mask_interrupts_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command) { target_t *target = get_current_target(cmd_ctx); struct cortex_m3_common_s *cortex_m3 = target_to_cm3(target); diff --git a/src/target/etb.c b/src/target/etb.c index 3a4e3fe4..c0c485fe 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -349,7 +349,7 @@ static int etb_write_reg(reg_t *reg, uint32_t value) return ERROR_OK; } -static int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etb_config_command) { target_t *target; jtag_tap_t *tap; diff --git a/src/target/etm.c b/src/target/etm.c index f01f3666..0fc92491 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1248,8 +1248,7 @@ static int handle_etm_tracemode_command_update( return ERROR_OK; } -static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_tracemode_command) { target_t *target = get_current_target(cmd_ctx); struct arm *arm = target_to_arm(target); @@ -1371,8 +1370,7 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_config_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_config_command) { target_t *target; struct arm *arm; @@ -1522,8 +1520,7 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, return etm_register_user_commands(cmd_ctx); } -static int handle_etm_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_info_command) { target_t *target; struct arm *arm; @@ -1655,8 +1652,7 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_status_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_status_command) { target_t *target; struct arm *arm; @@ -1732,8 +1728,7 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_image_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_image_command) { target_t *target; struct arm *arm; @@ -1792,8 +1787,7 @@ static int handle_etm_image_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_dump_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_dump_command) { fileio_t file; target_t *target; @@ -1861,8 +1855,7 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_load_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_load_command) { fileio_t file; target_t *target; @@ -1946,8 +1939,7 @@ static int handle_etm_load_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_trigger_percent_command) { target_t *target; struct arm *arm; @@ -1988,8 +1980,7 @@ static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_start_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_start_command) { target_t *target; struct arm *arm; @@ -2037,8 +2028,7 @@ static int handle_etm_start_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_stop_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_stop_command) { target_t *target; struct arm *arm; @@ -2077,8 +2067,7 @@ static int handle_etm_stop_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_analyze_command) { target_t *target; struct arm *arm; diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index 0c5fc111..6bb2cde4 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -25,7 +25,7 @@ #include "etm_dummy.h" -static int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_etm_dummy_config_command) { target_t *target; struct arm *arm; diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index e0048e64..755e1b69 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -289,7 +289,7 @@ etm_capture_driver_t oocd_trace_capture_driver = .read_trace = oocd_trace_read_trace, }; -static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_oocd_trace_config_command) { target_t *target; struct arm *arm; @@ -326,7 +326,7 @@ static int handle_oocd_trace_config_command(struct command_context_s *cmd_ctx, c return ERROR_OK; } -static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_oocd_trace_status_command) { target_t *target; struct arm *arm; @@ -366,7 +366,7 @@ static int handle_oocd_trace_status_command(struct command_context_s *cmd_ctx, c return ERROR_OK; } -static int handle_oocd_trace_resync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_oocd_trace_resync_command) { target_t *target; struct arm *arm; diff --git a/src/target/target.c b/src/target/target.c index 575a99ce..401f4dfb 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1650,7 +1650,7 @@ int target_write_u8(struct target_s *target, uint32_t address, uint8_t value) return retval; } -static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_targets_command) { target_t *target = all_targets; @@ -1862,7 +1862,7 @@ int handle_target(void *priv) return retval; } -static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_reg_command) { target_t *target; reg_t *reg = NULL; @@ -1993,7 +1993,7 @@ static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -static int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_poll_command) { int retval = ERROR_OK; target_t *target = get_current_target(cmd_ctx); @@ -2035,7 +2035,7 @@ static int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, cha return retval; } -static int handle_wait_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_wait_halt_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2102,7 +2102,7 @@ int target_wait_state(target_t *target, enum target_state state, int ms) return ERROR_OK; } -static int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_halt_command) { LOG_DEBUG("-"); @@ -2124,7 +2124,7 @@ static int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, cha return handle_wait_halt_command(cmd_ctx, cmd, args, argc); } -static int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_soft_reset_halt_command) { target_t *target = get_current_target(cmd_ctx); @@ -2135,7 +2135,7 @@ static int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, cha return ERROR_OK; } -static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_reset_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2156,7 +2156,7 @@ static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, ch } -static int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_resume_command) { int current = 1; if (argc > 1) @@ -2178,7 +2178,7 @@ static int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, c return target_resume(target, current, addr, 1, 0); } -static int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_step_command) { if (argc > 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2250,7 +2250,7 @@ static void handle_md_output(struct command_context_s *cmd_ctx, } } -static int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_md_command) { if (argc < 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2299,7 +2299,7 @@ static int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char return retval; } -static int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_mw_command) { if (argc < 2) { @@ -2401,7 +2401,7 @@ static int parse_load_image_command_args(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_load_image_command) { uint8_t *buffer; uint32_t buf_cnt; @@ -2492,7 +2492,7 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm } -static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_dump_image_command) { fileio_t fileio; @@ -2700,12 +2700,12 @@ done: return retval; } -static int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_verify_image_command) { return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 1); } -static int handle_test_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_test_image_command) { return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0); } @@ -2750,8 +2750,7 @@ static int handle_bp_command_set(struct command_context_s *cmd_ctx, return retval; } -static int handle_bp_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_bp_command) { if (argc == 0) return handle_bp_command_list(cmd_ctx); @@ -2779,7 +2778,7 @@ static int handle_bp_command(struct command_context_s *cmd_ctx, return handle_bp_command_set(cmd_ctx, addr, length, hw); } -static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_rbp_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2793,7 +2792,7 @@ static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char return ERROR_OK; } -static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_wp_command) { target_t *target = get_current_target(cmd_ctx); @@ -2865,7 +2864,7 @@ static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char return retval; } -static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_rwp_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -2886,8 +2885,7 @@ static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char * The low-level target implementation must have logged a detailed error * which is forwarded to telnet/GDB session. */ -static int handle_virt2phys_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_virt2phys_command) { if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; @@ -3021,7 +3019,7 @@ static void writeGmon(uint32_t *samples, uint32_t sampleNum, const char *filenam } /* profiling samples the CPU PC as quickly as OpenOCD is able, which will be used as a random sampling of PC */ -static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_profile_command) { target_t *target = get_current_target(cmd_ctx); struct timeval timeout, now; @@ -4539,7 +4537,7 @@ static void free_fastload(void) -static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_fast_load_image_command) { uint8_t *buffer; uint32_t buf_cnt; @@ -4650,7 +4648,7 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha return retval; } -static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_fast_load_command) { if (argc > 0) return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/target_request.c b/src/target/target_request.c index 5bfd57a4..4bfda5bf 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -257,7 +257,7 @@ int delete_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *targe return ERROR_OK; } -static int handle_target_request_debugmsgs_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_target_request_debugmsgs_command) { target_t *target = get_current_target(cmd_ctx); diff --git a/src/target/trace.c b/src/target/trace.c index e74c6160..2c259709 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -47,7 +47,7 @@ int trace_point(target_t *target, uint32_t number) return ERROR_OK; } -static int handle_trace_point_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_trace_point_command) { target_t *target = get_current_target(cmd_ctx); trace_t *trace = target->trace_info; @@ -95,7 +95,7 @@ static int handle_trace_point_command(struct command_context_s *cmd_ctx, char *c return ERROR_OK; } -static int handle_trace_history_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_trace_history_command) { target_t *target = get_current_target(cmd_ctx); trace_t *trace = target->trace_info; diff --git a/src/target/xscale.c b/src/target/xscale.c index 0dc18f0b..6f2d6ee3 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2989,9 +2989,7 @@ static int xscale_target_create(struct target_s *target, Jim_Interp *interp) target->variant); } -static int -xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_debug_handler_command) { target_t *target = NULL; xscale_common_t *xscale; @@ -3031,9 +3029,7 @@ xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_cache_clean_address_command) { target_t *target = NULL; xscale_common_t *xscale; @@ -3070,9 +3066,7 @@ xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_cache_info_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_cache_info_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3121,8 +3115,7 @@ static int xscale_mmu(struct target_s *target, int *enabled) return ERROR_OK; } -static int xscale_handle_mmu_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_mmu_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3157,8 +3150,7 @@ static int xscale_handle_mmu_command(command_context_t *cmd_ctx, return ERROR_OK; } -static int xscale_handle_idcache_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_idcache_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3211,8 +3203,7 @@ static int xscale_handle_idcache_command(command_context_t *cmd_ctx, return ERROR_OK; } -static int xscale_handle_vector_catch_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_vector_catch_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3239,8 +3230,7 @@ static int xscale_handle_vector_catch_command(command_context_t *cmd_ctx, } -static int xscale_handle_vector_table_command(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_vector_table_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3298,9 +3288,7 @@ static int xscale_handle_vector_table_command(command_context_t *cmd_ctx, } -static int -xscale_handle_trace_buffer_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_trace_buffer_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3379,9 +3367,7 @@ xscale_handle_trace_buffer_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_trace_image_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_trace_image_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3429,8 +3415,7 @@ xscale_handle_trace_image_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int xscale_handle_dump_trace_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_dump_trace_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3487,9 +3472,7 @@ static int xscale_handle_dump_trace_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int -xscale_handle_analyze_trace_buffer_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_analyze_trace_buffer_command) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); @@ -3504,8 +3487,7 @@ xscale_handle_analyze_trace_buffer_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int xscale_handle_cp15(command_context_t *cmd_ctx, - char *cmd, char **args, int argc) +COMMAND_HANDLER(xscale_handle_cp15) { target_t *target = get_current_target(cmd_ctx); struct xscale_common_s *xscale = target_to_xscale(target); diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index 909d7a1e..e0756b50 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -175,7 +175,7 @@ static int xsvf_read_buffer(int num_bits, int fd, uint8_t* buf) } -static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +COMMAND_HANDLER(handle_xsvf_command) { uint8_t *dr_out_buf = NULL; /* from host to device (TDI) */ uint8_t *dr_in_buf = NULL; /* from device to host (TDO) */ |