diff options
Diffstat (limited to 'src')
63 files changed, 286 insertions, 310 deletions
diff --git a/src/ecosboard.c b/src/ecosboard.c index 58520c33..27894644 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -1091,7 +1091,7 @@ int main(int argc, char *argv[]) #ifdef CYGPKG_PROFILE_GPROF - register_command(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command, + COMMAND_REGISTER(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command, COMMAND_ANY, NULL); #endif diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index 195da91a..d8460b09 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -2478,18 +2478,18 @@ sam3_register_commands(struct command_context *cmd_ctx) if (!sam3_registered) { sam3_registered++; - pCmd = register_command(cmd_ctx, NULL, "at91sam3", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, pCmd, + pCmd = COMMAND_REGISTER(cmd_ctx, NULL, "at91sam3", NULL, COMMAND_ANY, NULL); + COMMAND_REGISTER(cmd_ctx, pCmd, "gpnvm", sam3_handle_gpnvm_command, COMMAND_EXEC, "at91sam3 gpnvm [action [<BIT>], by default 'show', otherwise set | clear BIT"); - register_command(cmd_ctx, pCmd, + COMMAND_REGISTER(cmd_ctx, pCmd, "info", sam3_handle_info_command, COMMAND_EXEC, "at91sam3 info - print information about the current sam3 chip"); - register_command(cmd_ctx, pCmd, + COMMAND_REGISTER(cmd_ctx, pCmd, "slowclk", sam3_handle_slowclk_command, COMMAND_EXEC, diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 3e5dbdd8..1665b915 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -1180,10 +1180,10 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command) static int at91sam7_register_commands(struct command_context *cmd_ctx) { - struct command *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", + struct command *at91sam7_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, at91sam7_cmd, "gpnvm", + COMMAND_REGISTER(cmd_ctx, at91sam7_cmd, "gpnvm", at91sam7_handle_gpnvm_command, COMMAND_EXEC, "at91sam7 gpnvm <bit> set | clear, " "set or clear one gpnvm bit"); diff --git a/src/flash/avrf.c b/src/flash/avrf.c index 356c4049..692992f4 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -451,10 +451,10 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command) static int avrf_register_commands(struct command_context *cmd_ctx) { - struct command *avr_cmd = register_command(cmd_ctx, NULL, "avr", + struct command *avr_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands"); - register_command(cmd_ctx, avr_cmd, "mass_erase", + COMMAND_REGISTER(cmd_ctx, avr_cmd, "mass_erase", avrf_handle_mass_erase_command, COMMAND_EXEC, "mass erase device"); diff --git a/src/flash/cfi.c b/src/flash/cfi.c index 59c9c6c9..e743fe9e 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -592,9 +592,9 @@ static int cfi_intel_info(struct flash_bank *bank, char *buf, int buf_size) static int cfi_register_commands(struct command_context *cmd_ctx) { /*struct command *cfi_cmd = */ - register_command(cmd_ctx, NULL, "cfi", NULL, COMMAND_ANY, "flash bank cfi <base> <size> <chip_width> <bus_width> <targetNum> [jedec_probe/x16_as_x8]"); + COMMAND_REGISTER(cmd_ctx, NULL, "cfi", NULL, COMMAND_ANY, "flash bank cfi <base> <size> <chip_width> <bus_width> <targetNum> [jedec_probe/x16_as_x8]"); /* - register_command(cmd_ctx, cfi_cmd, "part_id", cfi_handle_part_id_command, COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, cfi_cmd, "part_id", cfi_handle_part_id_command, COMMAND_EXEC, "print part id of cfi flash bank <num>"); */ return ERROR_OK; diff --git a/src/flash/ecos.c b/src/flash/ecos.c index 863c12b2..381f858c 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -338,7 +338,7 @@ static int ecosflash_probe(struct flash_bank *bank) static int ecosflash_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "ecosflash", NULL, COMMAND_ANY, NULL); + COMMAND_REGISTER(cmd_ctx, NULL, "ecosflash", NULL, COMMAND_ANY, NULL); return ERROR_OK; } diff --git a/src/flash/flash.c b/src/flash/flash.c index e2136b70..7bc74ab7 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -1280,42 +1280,42 @@ int flash_init_drivers(struct command_context *cmd_ctx) if (!flash_banks) return ERROR_OK; - register_command(cmd_ctx, flash_cmd, "info", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "info", handle_flash_info_command, COMMAND_EXEC, "print info about flash bank <num>"); - register_command(cmd_ctx, flash_cmd, "probe", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "probe", handle_flash_probe_command, COMMAND_EXEC, "identify flash bank <num>"); - register_command(cmd_ctx, flash_cmd, "erase_check", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "erase_check", handle_flash_erase_check_command, COMMAND_EXEC, "check erase state of sectors in flash bank <num>"); - register_command(cmd_ctx, flash_cmd, "protect_check", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "protect_check", handle_flash_protect_check_command, COMMAND_EXEC, "check protection state of sectors in flash bank <num>"); - register_command(cmd_ctx, flash_cmd, "erase_sector", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "erase_sector", handle_flash_erase_command, COMMAND_EXEC, "erase sectors at <bank> <first> <last>"); - register_command(cmd_ctx, flash_cmd, "erase_address", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "erase_address", handle_flash_erase_address_command, COMMAND_EXEC, "erase address range <address> <length>"); - register_command(cmd_ctx, flash_cmd, "fillw", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "fillw", handle_flash_fill_command, COMMAND_EXEC, "fill with pattern (no autoerase) <address> <word_pattern> <count>"); - register_command(cmd_ctx, flash_cmd, "fillh", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "fillh", handle_flash_fill_command, COMMAND_EXEC, "fill with pattern <address> <halfword_pattern> <count>"); - register_command(cmd_ctx, flash_cmd, "fillb", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "fillb", handle_flash_fill_command, COMMAND_EXEC, "fill with pattern <address> <byte_pattern> <count>"); - register_command(cmd_ctx, flash_cmd, "write_bank", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "write_bank", handle_flash_write_bank_command, COMMAND_EXEC, "write binary data to <bank> <file> <offset>"); - register_command(cmd_ctx, flash_cmd, "write_image", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "write_image", handle_flash_write_image_command, COMMAND_EXEC, "write_image [erase] [unlock] <file> [offset] [type]"); - register_command(cmd_ctx, flash_cmd, "protect", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "protect", handle_flash_protect_command, COMMAND_EXEC, "set protection of sectors at <bank> <first> <last> <on | off>"); @@ -1324,10 +1324,10 @@ int flash_init_drivers(struct command_context *cmd_ctx) int flash_register_commands(struct command_context *cmd_ctx) { - flash_cmd = register_command(cmd_ctx, NULL, "flash", + flash_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, flash_cmd, "bank", + COMMAND_REGISTER(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash bank <driver> <base> <size> " "<chip_width> <bus_width> <target> [driver_options ...]"); diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index b60c6cfd..4a934c02 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -778,10 +778,10 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command) static int lpc2000_register_commands(struct command_context *cmd_ctx) { - struct command *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000", + struct command *lpc2000_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "lpc2000", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, lpc2000_cmd, "part_id", + COMMAND_REGISTER(cmd_ctx, lpc2000_cmd, "part_id", lpc2000_handle_part_id_command, COMMAND_EXEC, "print part id of lpc2000 flash bank <num>"); diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index 465d7768..c7f1b3a2 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -954,60 +954,36 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command) */ static int lpc2900_register_commands(struct command_context *cmd_ctx) { - struct command *lpc2900_cmd = register_command(cmd_ctx, NULL, "lpc2900", + struct command *lpc2900_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "lpc2900", NULL, COMMAND_ANY, NULL); - register_command( - cmd_ctx, - lpc2900_cmd, - "signature", - lpc2900_handle_signature_command, - COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, lpc2900_cmd, "signature", + &lpc2900_handle_signature_command, COMMAND_EXEC, "<bank> | " - "print device signature of flash bank"); - - register_command( - cmd_ctx, - lpc2900_cmd, - "read_custom", - lpc2900_handle_read_custom_command, - COMMAND_EXEC, + "print device signature of flash bank"); + + COMMAND_REGISTER(cmd_ctx, lpc2900_cmd, "read_custom", + &lpc2900_handle_read_custom_command, COMMAND_EXEC, "<bank> <filename> | " "read customer information from index sector to file"); - register_command( - cmd_ctx, - lpc2900_cmd, - "password", - lpc2900_handle_password_command, - COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, lpc2900_cmd, "password", + &lpc2900_handle_password_command, COMMAND_EXEC, "<bank> <password> | " "enter password to enable 'dangerous' options"); - register_command( - cmd_ctx, - lpc2900_cmd, - "write_custom", - lpc2900_handle_write_custom_command, - COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, lpc2900_cmd, "write_custom", + &lpc2900_handle_write_custom_command, COMMAND_EXEC, "<bank> <filename> [<type>] | " "write customer info from file to index sector"); - register_command( - cmd_ctx, - lpc2900_cmd, - "secure_sector", - lpc2900_handle_secure_sector_command, - COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, lpc2900_cmd, "secure_sector", + &lpc2900_handle_secure_sector_command, COMMAND_EXEC, "<bank> <first> <last> | " "activate sector security for a range of sectors"); - register_command( - cmd_ctx, - lpc2900_cmd, - "secure_jtag", - lpc2900_handle_secure_jtag_command, - COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, lpc2900_cmd, "secure_jtag", + &lpc2900_handle_secure_jtag_command, COMMAND_EXEC, "<bank> <level> | " "activate JTAG security"); diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index 61bef90c..801607df 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -875,9 +875,9 @@ COMMAND_HANDLER(handle_lpc3180_select_command) static int lpc3180_register_commands(struct command_context *cmd_ctx) { - struct command *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers"); + struct command *lpc3180_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers"); - register_command(cmd_ctx, lpc3180_cmd, "select", handle_lpc3180_select_command, COMMAND_EXEC, "select <'mlc'|'slc'> controller (default is mlc)"); + COMMAND_REGISTER(cmd_ctx, lpc3180_cmd, "select", handle_lpc3180_select_command, COMMAND_EXEC, "select <'mlc'|'slc'> controller (default is mlc)"); return ERROR_OK; } diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 2a1fbe59..a4a45dca 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -1271,12 +1271,12 @@ COMMAND_HANDLER(mg_config_cmd) int mflash_init_drivers(struct command_context *cmd_ctx) { if (mflash_bank) { - register_command(cmd_ctx, mflash_cmd, "probe", mg_probe_cmd, COMMAND_EXEC, NULL); - register_command(cmd_ctx, mflash_cmd, "write", mg_write_cmd, COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, mflash_cmd, "probe", mg_probe_cmd, COMMAND_EXEC, NULL); + COMMAND_REGISTER(cmd_ctx, mflash_cmd, "write", mg_write_cmd, COMMAND_EXEC, "mflash write <num> <file> <address>"); - register_command(cmd_ctx, mflash_cmd, "dump", mg_dump_cmd, COMMAND_EXEC, + COMMAND_REGISTER(cmd_ctx, mflash_cmd, "dump", mg_dump_cmd, COMMAND_EXEC, "mflash dump <num> <file> <address> <size>"); - register_command(cmd_ctx, mflash_cmd, "config", mg_config_cmd, + COMMAND_REGISTER(cmd_ctx, mflash_cmd, "config", mg_config_cmd, COMMAND_EXEC, "mflash config <num> <stage>"); } @@ -1325,8 +1325,8 @@ COMMAND_HANDLER(mg_bank_cmd) int mflash_register_commands(struct command_context *cmd_ctx) { - mflash_cmd = register_command(cmd_ctx, NULL, "mflash", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, mflash_cmd, "bank", mg_bank_cmd, COMMAND_CONFIG, + mflash_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "mflash", NULL, COMMAND_ANY, NULL); + COMMAND_REGISTER(cmd_ctx, mflash_cmd, "bank", mg_bank_cmd, COMMAND_CONFIG, "mflash bank <soc> <base> <RST pin> <target #>"); return ERROR_OK; } diff --git a/src/flash/nand.c b/src/flash/nand.c index 77aa3e57..2438ddd5 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -281,13 +281,13 @@ COMMAND_HANDLER(handle_nand_device_command) int nand_register_commands(struct command_context *cmd_ctx) { - nand_cmd = register_command(cmd_ctx, NULL, "nand", + nand_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "nand", NULL, COMMAND_ANY, "NAND specific commands"); - register_command(cmd_ctx, nand_cmd, "device", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "device", &handle_nand_device_command, COMMAND_CONFIG, "defines a new NAND bank"); - register_command(cmd_ctx, nand_cmd, "drivers", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "drivers", &handle_nand_list_drivers, COMMAND_ANY, "lists available NAND drivers"); @@ -1705,36 +1705,36 @@ int nand_init(struct command_context *cmd_ctx) if (!nand_devices) return ERROR_OK; - register_command(cmd_ctx, nand_cmd, "list", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "list", handle_nand_list_command, COMMAND_EXEC, "list configured NAND flash devices"); - register_command(cmd_ctx, nand_cmd, "info", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "info", handle_nand_info_command, COMMAND_EXEC, "print info about NAND flash device <num>"); - register_command(cmd_ctx, nand_cmd, "probe", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "probe", handle_nand_probe_command, COMMAND_EXEC, "identify NAND flash device <num>"); - register_command(cmd_ctx, nand_cmd, "check_bad_blocks", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "check_bad_blocks", handle_nand_check_bad_blocks_command, COMMAND_EXEC, "check NAND flash device <num> for bad blocks [<offset> <length>]"); - register_command(cmd_ctx, nand_cmd, "erase", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "erase", handle_nand_erase_command, COMMAND_EXEC, "erase blocks on NAND flash device <num> [<offset> <length>]"); - register_command(cmd_ctx, nand_cmd, "dump", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "dump", handle_nand_dump_command, COMMAND_EXEC, "dump from NAND flash device <num> <filename> " "<offset> <length> [oob_raw | oob_only]"); - register_command(cmd_ctx, nand_cmd, "verify", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "verify", &handle_nand_verify_command, COMMAND_EXEC, "verify NAND flash device <num> <filename> <offset> " "[oob_raw | oob_only | oob_softecc | oob_softecc_kw]"); - register_command(cmd_ctx, nand_cmd, "write", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "write", handle_nand_write_command, COMMAND_EXEC, "write to NAND flash device <num> <filename> <offset> " "[oob_raw | oob_only | oob_softecc | oob_softecc_kw]"); - register_command(cmd_ctx, nand_cmd, "raw_access", + COMMAND_REGISTER(cmd_ctx, nand_cmd, "raw_access", handle_nand_raw_access_command, COMMAND_EXEC, "raw access to NAND flash device <num> ['enable'|'disable']"); diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index fa5a4d67..c6d4615a 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -885,20 +885,20 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command) static int pic32mx_register_commands(struct command_context *cmd_ctx) { - struct command *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx", + struct command *pic32mx_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "pic32mx", NULL, COMMAND_ANY, "pic32mx flash specific commands"); #if 0 - register_command(cmd_ctx, pic32mx_cmd, "lock", + COMMAND_REGISTER(cmd_ctx, pic32mx_cmd, "lock", pic32mx_handle_lock_command, COMMAND_EXEC, "lock device"); - register_command(cmd_ctx, pic32mx_cmd, "unlock", + COMMAND_REGISTER(cmd_ctx, pic32mx_cmd, "unlock", pic32mx_handle_unlock_command, COMMAND_EXEC, "unlock protected device"); #endif - register_command(cmd_ctx, pic32mx_cmd, "chip_erase", + COMMAND_REGISTER(cmd_ctx, pic32mx_cmd, "chip_erase", pic32mx_handle_chip_erase_command, COMMAND_EXEC, "erase device"); - register_command(cmd_ctx, pic32mx_cmd, "pgm_word", + COMMAND_REGISTER(cmd_ctx, pic32mx_cmd, "pgm_word", pic32mx_handle_pgm_word_command, COMMAND_EXEC, "program a word"); return ERROR_OK; diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index 32fa415e..2d653eca 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -1163,10 +1163,10 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command) static int stellaris_register_commands(struct command_context *cmd_ctx) { - struct command *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris", + struct command *stm32x_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "stellaris", NULL, COMMAND_ANY, "stellaris flash specific commands"); - register_command(cmd_ctx, stm32x_cmd, "mass_erase", + COMMAND_REGISTER(cmd_ctx, stm32x_cmd, "mass_erase", stellaris_handle_mass_erase_command, COMMAND_EXEC, "mass erase device"); return ERROR_OK; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index c96b49d7..c628f187 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -1184,22 +1184,22 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command) static int stm32x_register_commands(struct command_context *cmd_ctx) { - struct command *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x", + struct command *stm32x_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "stm32x", NULL, COMMAND_ANY, "stm32x flash specific commands"); - register_command(cmd_ctx, stm32x_cmd, "lock", + COMMAND_REGISTER(cmd_ctx, stm32x_cmd, "lock", stm32x_handle_lock_command, COMMAND_EXEC, "lock device"); - register_command(cmd_ctx, stm32x_cmd, "unlock", + COMMAND_REGISTER(cmd_ctx, stm32x_cmd, "unlock", stm32x_handle_unlock_command, COMMAND_EXEC, "unlock protected device"); - register_command(cmd_ctx, stm32x_cmd, "mass_erase", + COMMAND_REGISTER(cmd_ctx, stm32x_cmd, "mass_erase", stm32x_handle_mass_erase_command, COMMAND_EXEC, "mass erase device"); - register_command(cmd_ctx, stm32x_cmd, "options_read", + COMMAND_REGISTER(cmd_ctx, stm32x_cmd, "options_read", stm32x_handle_options_read_command, COMMAND_EXEC, "read device option bytes"); - register_command(cmd_ctx, stm32x_cmd, "options_write", + COMMAND_REGISTER(cmd_ctx, stm32x_cmd, "options_write", stm32x_handle_options_write_command, COMMAND_EXEC, "write device option bytes"); diff --git a/src/flash/str7x.c b/src/flash/str7x.c index b79dd17f..b53ddf99 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -674,10 +674,10 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command) static int str7x_register_commands(struct command_context *cmd_ctx) { - struct command *str7x_cmd = register_command(cmd_ctx, NULL, "str7x", + struct command *str7x_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "str7x", NULL, COMMAND_ANY, "str7x flash specific commands"); - register_command(cmd_ctx, str7x_cmd, "disable_jtag", + COMMAND_REGISTER(cmd_ctx, str7x_cmd, "disable_jtag", str7x_handle_disable_jtag_command, COMMAND_EXEC, "disable jtag access"); diff --git a/src/flash/str9x.c b/src/flash/str9x.c index 3bb89705..6d556d91 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -678,10 +678,10 @@ COMMAND_HANDLER(str9x_handle_flash_config_command) static int str9x_register_commands(struct command_context *cmd_ctx) { - struct command *str9x_cmd = register_command(cmd_ctx, NULL, "str9x", + struct command *str9x_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "str9x", NULL, COMMAND_ANY, "str9x flash commands"); - register_command(cmd_ctx, str9x_cmd, "flash_config", + COMMAND_REGISTER(cmd_ctx, str9x_cmd, "flash_config", str9x_handle_flash_config_command, COMMAND_EXEC, "configure str9 flash controller"); diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index f7c705e8..7519413c 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -1165,40 +1165,40 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command) static int str9xpec_register_commands(struct command_context *cmd_ctx) { - struct command *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec", + struct command *str9xpec_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "str9xpec", NULL, COMMAND_ANY, "str9xpec flash specific commands"); - register_command(cmd_ctx, str9xpec_cmd, "enable_turbo", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "enable_turbo", str9xpec_handle_flash_enable_turbo_command, COMMAND_EXEC, "enable str9xpec turbo mode"); - register_command(cmd_ctx, str9xpec_cmd, "disable_turbo", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "disable_turbo", str9xpec_handle_flash_disable_turbo_command, COMMAND_EXEC, "disable str9xpec turbo mode"); - register_command(cmd_ctx, str9xpec_cmd, "options_cmap", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "options_cmap", str9xpec_handle_flash_options_cmap_command, COMMAND_EXEC, "configure str9xpec boot sector"); - register_command(cmd_ctx, str9xpec_cmd, "options_lvdthd", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "options_lvdthd", str9xpec_handle_flash_options_lvdthd_command, COMMAND_EXEC, "configure str9xpec lvd threshold"); - register_command(cmd_ctx, str9xpec_cmd, "options_lvdsel", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "options_lvdsel", str9xpec_handle_flash_options_lvdsel_command, COMMAND_EXEC, "configure str9xpec lvd selection"); - register_command(cmd_ctx, str9xpec_cmd, "options_lvdwarn", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "options_lvdwarn", str9xpec_handle_flash_options_lvdwarn_command, COMMAND_EXEC, "configure str9xpec lvd warning"); - register_command(cmd_ctx, str9xpec_cmd, "options_read", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "options_read", str9xpec_handle_flash_options_read_command, COMMAND_EXEC, "read str9xpec options"); - register_command(cmd_ctx, str9xpec_cmd, "options_write", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "options_write", str9xpec_handle_flash_options_write_command, COMMAND_EXEC, "write str9xpec options"); - register_command(cmd_ctx, str9xpec_cmd, "lock", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "lock", str9xpec_handle_flash_lock_command, COMMAND_EXEC, "lock str9xpec device"); - register_command(cmd_ctx, str9xpec_cmd, "unlock", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "unlock", str9xpec_handle_flash_unlock_command, COMMAND_EXEC, "unlock str9xpec device"); - register_command(cmd_ctx, str9xpec_cmd, "part_id", + COMMAND_REGISTER(cmd_ctx, str9xpec_cmd, "part_id", str9xpec_handle_part_id_command, COMMAND_EXEC, "print part id of str9xpec flash bank <num>"); diff --git a/src/flash/tms470.c b/src/flash/tms470.c index f6f3900f..bf58f1db 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -819,11 +819,11 @@ static int tms470_erase_sector(struct flash_bank *bank, int sector) static int tms470_register_commands(struct command_context *cmd_ctx) { - struct command *tms470_cmd = register_command(cmd_ctx, NULL, "tms470", NULL, COMMAND_ANY, "applies to TI tms470 family"); + struct command *tms470_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "tms470", NULL, COMMAND_ANY, "applies to TI tms470 family"); - register_command(cmd_ctx, tms470_cmd, "flash_keyset", tms470_handle_flash_keyset_command, COMMAND_ANY, "tms470 flash_keyset <key0> <key1> <key2> <key3>"); - register_command(cmd_ctx, tms470_cmd, "osc_megahertz", tms470_handle_osc_megahertz_command, COMMAND_ANY, "tms470 osc_megahertz <MHz>"); - register_command(cmd_ctx, tms470_cmd, "plldis", tms470_handle_plldis_command, COMMAND_ANY, "tms470 plldis <0/1>"); + COMMAND_REGISTER(cmd_ctx, tms470_cmd, "flash_keyset", tms470_handle_flash_keyset_command, COMMAND_ANY, "tms470 flash_keyset <key0> <key1> <key2> <key3>"); + COMMAND_REGISTER(cmd_ctx, tms470_cmd, "osc_megahertz", tms470_handle_osc_megahertz_command, COMMAND_ANY, "tms470 osc_megahertz <MHz>"); + COMMAND_REGISTER(cmd_ctx, tms470_cmd, "plldis", tms470_handle_plldis_command, COMMAND_ANY, "tms470 plldis <0/1>"); return ERROR_OK; } diff --git a/src/hello.c b/src/hello.c index 2ab7eb50..8c97a401 100644 --- a/src/hello.c +++ b/src/hello.c @@ -56,17 +56,17 @@ COMMAND_HANDLER(handle_flag_command) int foo_register_commands(struct command_context *cmd_ctx) { // register several commands under the foo command - struct command *cmd = register_command(cmd_ctx, NULL, "foo", + struct command *cmd = COMMAND_REGISTER(cmd_ctx, NULL, "foo", NULL, COMMAND_ANY, "foo: command handler skeleton"); - register_command(cmd_ctx, cmd, "bar", + COMMAND_REGISTER(cmd_ctx, cmd, "bar", &handle_foo_command, COMMAND_ANY, "<address> [enable|disable] - an example command"); - register_command(cmd_ctx, cmd, "baz", + COMMAND_REGISTER(cmd_ctx, cmd, "baz", &handle_foo_command, COMMAND_ANY, "<address> [enable|disable] - a sample command"); - register_command(cmd_ctx, cmd, "flag", + COMMAND_REGISTER(cmd_ctx, cmd, "flag", &handle_flag_command, COMMAND_ANY, "[on|off] - set a flag"); @@ -103,7 +103,7 @@ int hello_register_commands(struct command_context *cmd_ctx) { foo_register_commands(cmd_ctx); - struct command *cmd = register_command(cmd_ctx, NULL, "hello", + struct command *cmd = COMMAND_REGISTER(cmd_ctx, NULL, "hello", &handle_hello_command, COMMAND_ANY, "[<name>] - prints a warm welcome"); return cmd ? ERROR_OK : -ENOMEM; diff --git a/src/helper/command.c b/src/helper/command.c index f6c6b2d7..0561c6c5 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -908,7 +908,7 @@ struct command_context* command_init(const char *startup_tcl) interp->cb_fflush = openocd_jim_fflush; interp->cb_fgets = openocd_jim_fgets; - register_command(context, NULL, "add_help_text", + COMMAND_REGISTER(context, NULL, "add_help_text", handle_help_add_command, COMMAND_ANY, "<command> [...] <help_text>] - " "add new command help text"); @@ -925,12 +925,12 @@ struct command_context* command_init(const char *startup_tcl) } Jim_DeleteAssocData(interp, "context"); - register_command(context, NULL, "sleep", + COMMAND_REGISTER(context, NULL, "sleep", handle_sleep_command, COMMAND_ANY, "<n> [busy] - sleep for n milliseconds. " "\"busy\" means busy wait"); - register_command(context, NULL, "help", + COMMAND_REGISTER(context, NULL, "help", &handle_help_command, COMMAND_ANY, "[<command_name> ...] - show built-in command help"); diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index 3fb3014a..52ecb9f2 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -647,22 +647,22 @@ static int zylinjtag_Jim_Command_mac(Jim_Interp *interp, int argc, int ioutil_init(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY, + COMMAND_REGISTER(cmd_ctx, NULL, "rm", handle_rm_command, COMMAND_ANY, "remove file"); - register_command(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY, + COMMAND_REGISTER(cmd_ctx, NULL, "cat", handle_cat_command, COMMAND_ANY, "display file content"); - register_command(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY, + COMMAND_REGISTER(cmd_ctx, NULL, "trunc", handle_trunc_command, COMMAND_ANY, "truncate a file to 0 size"); - register_command(cmd_ctx, NULL, "cp", handle_cp_command, + COMMAND_REGISTER(cmd_ctx, NULL, "cp", handle_cp_command, COMMAND_ANY, "copy a file <from> <to>"); - register_command(cmd_ctx, NULL, "append_file", handle_append_command, + COMMAND_REGISTER(cmd_ctx, NULL, "append_file", handle_append_command, COMMAND_ANY, "append a variable number of strings to a file"); - register_command(cmd_ctx, NULL, "meminfo", handle_meminfo_command, + COMMAND_REGISTER(cmd_ctx, NULL, "meminfo", handle_meminfo_command, COMMAND_ANY, "display available ram memory"); Jim_CreateCommand(interp, "rm", zylinjtag_Jim_Command_rm, NULL, NULL); diff --git a/src/helper/log.c b/src/helper/log.c index 2dcf7bb6..b1352a32 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -319,9 +319,9 @@ COMMAND_HANDLER(handle_log_output_command) int log_register_commands(struct command_context *cmd_ctx) { start = timeval_ms(); - register_command(cmd_ctx, NULL, "log_output", handle_log_output_command, + COMMAND_REGISTER(cmd_ctx, NULL, "log_output", handle_log_output_command, COMMAND_ANY, "redirect logging to <file> (default: stderr)"); - register_command(cmd_ctx, NULL, "debug_level", handle_debug_level_command, + COMMAND_REGISTER(cmd_ctx, NULL, "debug_level", handle_debug_level_command, COMMAND_ANY, "adjust debug level <0-3>"); return ERROR_OK; diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c index 4da2fa1f..0aabdc91 100644 --- a/src/jtag/amt_jtagaccel.c +++ b/src/jtag/amt_jtagaccel.c @@ -542,10 +542,10 @@ COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command) static int amt_jtagaccel_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "parport_port", + COMMAND_REGISTER(cmd_ctx, NULL, "parport_port", amt_jtagaccel_handle_parport_port_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "rtck", + COMMAND_REGISTER(cmd_ctx, NULL, "rtck", amt_jtagaccel_handle_rtck_command, COMMAND_CONFIG, NULL); diff --git a/src/jtag/arm-jtag-ew.c b/src/jtag/arm-jtag-ew.c index 01c5559f..f2393713 100644 --- a/src/jtag/arm-jtag-ew.c +++ b/src/jtag/arm-jtag-ew.c @@ -504,7 +504,7 @@ COMMAND_HANDLER(armjtagew_handle_armjtagew_info_command) static int armjtagew_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "armjtagew_info", + COMMAND_REGISTER(cmd_ctx, NULL, "armjtagew_info", &armjtagew_handle_armjtagew_info_command, COMMAND_EXEC, "query armjtagew info"); return ERROR_OK; diff --git a/src/jtag/at91rm9200.c b/src/jtag/at91rm9200.c index 8fbdf394..024dd6d7 100644 --- a/src/jtag/at91rm9200.c +++ b/src/jtag/at91rm9200.c @@ -202,7 +202,7 @@ static int at91rm9200_handle_device_command(struct command_context *cmd_ctx, cha static int at91rm9200_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "at91rm9200_device", at91rm9200_handle_device_command, + COMMAND_REGISTER(cmd_ctx, NULL, "at91rm9200_device", at91rm9200_handle_device_command, COMMAND_CONFIG, NULL); return ERROR_OK; } diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 451da41c..e560b22e 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -3971,20 +3971,20 @@ static void ktlink_blink(void) static int ft2232_register_commands(struct command_context* cmd_ctx) { - register_command(cmd_ctx, NULL, "ft2232_device_desc", + COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_device_desc", ft2232_handle_device_desc_command, COMMAND_CONFIG, "the USB device description of the FTDI FT2232 device"); - register_command(cmd_ctx, NULL, "ft2232_serial", + COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_serial", ft2232_handle_serial_command, COMMAND_CONFIG, "the serial number of the FTDI FT2232 device"); - register_command(cmd_ctx, NULL, "ft2232_layout", + COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_layout", ft2232_handle_layout_command, COMMAND_CONFIG, "the layout of the FT2232 GPIO signals used " "to control output-enables and reset signals"); - register_command(cmd_ctx, NULL, "ft2232_vid_pid", + COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_vid_pid", ft2232_handle_vid_pid_command, COMMAND_CONFIG, "the vendor ID and product ID of the FTDI FT2232 device"); - register_command(cmd_ctx, NULL, "ft2232_latency", + COMMAND_REGISTER(cmd_ctx, NULL, "ft2232_latency", ft2232_handle_latency_command, COMMAND_CONFIG, "set the FT2232 latency timer to a new value"); diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index 2d7b453b..bc0e4724 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -564,7 +564,7 @@ COMMAND_HANDLER(gw16012_handle_parport_port_command) static int gw16012_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "parport_port", + COMMAND_REGISTER(cmd_ctx, NULL, "parport_port", gw16012_handle_parport_port_command, COMMAND_CONFIG, NULL); diff --git a/src/jtag/jlink.c b/src/jtag/jlink.c index f173ed78..1ca9c390 100644 --- a/src/jtag/jlink.c +++ b/src/jtag/jlink.c @@ -630,10 +630,10 @@ COMMAND_HANDLER(jlink_handle_jlink_hw_jtag_command) static int jlink_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "jlink_info", + COMMAND_REGISTER(cmd_ctx, NULL, "jlink_info", &jlink_handle_jlink_info_command, COMMAND_EXEC, "query jlink info"); - register_command(cmd_ctx, NULL, "jlink_hw_jtag", + COMMAND_REGISTER(cmd_ctx, NULL, "jlink_hw_jtag", &jlink_handle_jlink_hw_jtag_command, COMMAND_EXEC, "set/get jlink hw jtag command version [2 | 3]"); return ERROR_OK; diff --git a/src/jtag/parport.c b/src/jtag/parport.c index b80626f5..4b4df090 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -484,22 +484,22 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command) static int parport_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "parport_port", + COMMAND_REGISTER(cmd_ctx, NULL, "parport_port", parport_handle_parport_port_command, COMMAND_CONFIG, "either the address of the I/O port " "or the number of the '/dev/parport' device"); - register_command(cmd_ctx, NULL, "parport_cable", + COMMAND_REGISTER(cmd_ctx, NULL, "parport_cable", parport_handle_parport_cable_command, COMMAND_CONFIG, "the layout of the parallel port cable " "used to connect to the target"); - register_command(cmd_ctx, NULL, "parport_write_on_exit", + COMMAND_REGISTER(cmd_ctx, NULL, "parport_write_on_exit", parport_handle_write_on_exit_command, COMMAND_CONFIG, "configure the parallel driver to write " "a known value to the parallel interface"); - register_command(cmd_ctx, NULL, "parport_toggling_time", + COMMAND_REGISTER(cmd_ctx, NULL, "parport_toggling_time", parport_handle_parport_toggling_time_command, COMMAND_ANY, "time <ns> it takes for the hardware to toggle TCK"); diff --git a/src/jtag/presto.c b/src/jtag/presto.c index 437e2c08..f22bd9eb 100644 --- a/src/jtag/presto.c +++ b/src/jtag/presto.c @@ -741,7 +741,7 @@ COMMAND_HANDLER(presto_handle_serial_command) static int presto_jtag_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "presto_serial", presto_handle_serial_command, + COMMAND_REGISTER(cmd_ctx, NULL, "presto_serial", presto_handle_serial_command, COMMAND_CONFIG, NULL); return ERROR_OK; } diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 7307f64e..bd672b6f 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -1418,21 +1418,21 @@ int jtag_register_commands(struct command_context *cmd_ctx) register_jim(cmd_ctx, "jtag", jim_jtag_command, "perform jtag tap actions"); - register_command(cmd_ctx, NULL, "interface", + COMMAND_REGISTER(cmd_ctx, NULL, "interface", handle_interface_command, COMMAND_CONFIG, "try to configure interface"); - register_command(cmd_ctx, NULL, "interface_list", + COMMAND_REGISTER(cmd_ctx, NULL, "interface_list", &handle_interface_list_command, COMMAND_ANY, "list all built-in interfaces"); - register_command(cmd_ctx, NULL, "jtag_khz", + COMMAND_REGISTER(cmd_ctx, NULL, "jtag_khz", handle_jtag_khz_command, COMMAND_ANY, "set maximum jtag speed (if supported); " "parameter is maximum khz, or 0 for adaptive clocking (RTCK)."); - register_command(cmd_ctx, NULL, "jtag_rclk", + COMMAND_REGISTER(cmd_ctx, NULL, "jtag_rclk", handle_jtag_rclk_command, COMMAND_ANY, "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed"); - register_command(cmd_ctx, NULL, "reset_config", + COMMAND_REGISTER(cmd_ctx, NULL, "reset_config", handle_reset_config_command, COMMAND_ANY, "reset_config " "[none|trst_only|srst_only|trst_and_srst] " @@ -1441,35 +1441,35 @@ int jtag_register_commands(struct command_context *cmd_ctx) "[trst_push_pull|trst_open_drain] " "[srst_push_pull|srst_open_drain]"); - register_command(cmd_ctx, NULL, "jtag_nsrst_delay", + COMMAND_REGISTER(cmd_ctx, NULL, "jtag_nsrst_delay", handle_jtag_nsrst_delay_command, COMMAND_ANY, "jtag_nsrst_delay <ms> " "- delay after deasserting srst in ms"); - register_command(cmd_ctx, NULL, "jtag_ntrst_delay", + COMMAND_REGISTER(cmd_ctx, NULL, "jtag_ntrst_delay", handle_jtag_ntrst_delay_command, COMMAND_ANY, "jtag_ntrst_delay <ms> " "- delay after deasserting trst in ms"); - register_command(cmd_ctx, NULL, "jtag_nsrst_assert_width", + COMMAND_REGISTER(cmd_ctx, NULL, "jtag_nsrst_assert_width", handle_jtag_nsrst_assert_width_command, COMMAND_ANY, "jtag_nsrst_assert_width <ms> " "- delay after asserting srst in ms"); - register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width", + COMMAND_REGISTER(cmd_ctx, NULL, "jtag_ntrst_assert_width", handle_jtag_ntrst_assert_width_command, COMMAND_ANY, "jtag_ntrst_assert_width <ms> " "- delay after asserting trst in ms"); - register_command(cmd_ctx, NULL, "scan_chain", + COMMAND_REGISTER(cmd_ctx, NULL, "scan_chain", handle_scan_chain_command, COMMAND_EXEC, "print current scan chain configuration"); - register_command(cmd_ctx, NULL, "jtag_reset", + COMMAND_REGISTER(cmd_ctx, NULL, "jtag_reset", handle_jtag_reset_command, COMMAND_EXEC, "toggle reset lines <trst> <srst>"); - register_command(cmd_ctx, NULL, "runtest", + COMMAND_REGISTER(cmd_ctx, NULL, "runtest", handle_runtest_command, COMMAND_EXEC, "move to Run-Test/Idle, and execute <num_cycles>"); - register_command(cmd_ctx, NULL, "irscan", + COMMAND_REGISTER(cmd_ctx, NULL, "irscan", handle_irscan_command, COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] ..."); @@ -1484,14 +1484,14 @@ int jtag_register_commands(struct command_context *cmd_ctx) "<state1>,<state2>,<state3>... " "- move JTAG to state1 then to state2, state3, etc."); - register_command(cmd_ctx, NULL, "verify_ircapture", + COMMAND_REGISTER(cmd_ctx, NULL, "verify_ircapture", handle_verify_ircapture_command, COMMAND_ANY, "verify value captured during Capture-IR <enable | disable>"); - register_command(cmd_ctx, NULL, "verify_jtag", + COMMAND_REGISTER(cmd_ctx, NULL, "verify_jtag", handle_verify_jtag_command, COMMAND_ANY, "verify value capture <enable | disable>"); - register_command(cmd_ctx, NULL, "tms_sequence", + COMMAND_REGISTER(cmd_ctx, NULL, "tms_sequence", handle_tms_sequence_command, COMMAND_ANY, "choose short(default) or long tms_sequence <short | long>"); diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c index d28854d8..3526198e 100644 --- a/src/jtag/vsllink.c +++ b/src/jtag/vsllink.c @@ -1858,22 +1858,22 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length) static int vsllink_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "vsllink_usb_vid", + COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_pid", + COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", + COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", + COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_interface", + COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_mode", + COMMAND_REGISTER(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command, COMMAND_CONFIG, NULL); diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 8b5b753a..5ea72a76 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -372,7 +372,7 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, int zy1000_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY, + COMMAND_REGISTER(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY, "power <on/off> - turn power switch to target on/off. No arguments - print status."); Jim_CreateCommand(interp, "zy1000_version", jim_zy1000_version, NULL, NULL); diff --git a/src/openocd.c b/src/openocd.c index 8e8ceac4..379373ce 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -171,7 +171,7 @@ struct command_context *setup_command_handler(void) global_cmd_ctx = cmd_ctx = command_init(openocd_startup_tcl); - register_command(cmd_ctx, NULL, "version", handle_version_command, + COMMAND_REGISTER(cmd_ctx, NULL, "version", handle_version_command, COMMAND_EXEC, "show OpenOCD version"); /* register subsystem commands */ @@ -198,7 +198,7 @@ struct command_context *setup_command_handler(void) LOG_OUTPUT(OPENOCD_VERSION "\n"); - register_command(cmd_ctx, NULL, "init", handle_init_command, + COMMAND_REGISTER(cmd_ctx, NULL, "init", handle_init_command, COMMAND_ANY, "initializes target and servers - nop on subsequent invocations"); return cmd_ctx; diff --git a/src/pld/pld.c b/src/pld/pld.c index d021f7bf..021a8e6f 100644 --- a/src/pld/pld.c +++ b/src/pld/pld.c @@ -189,10 +189,10 @@ int pld_init(struct command_context *cmd_ctx) if (!pld_devices) return ERROR_OK; - register_command(cmd_ctx, pld_cmd, "devices", + COMMAND_REGISTER(cmd_ctx, pld_cmd, "devices", handle_pld_devices_command, COMMAND_EXEC, "list configured pld devices"); - register_command(cmd_ctx, pld_cmd, "load", + COMMAND_REGISTER(cmd_ctx, pld_cmd, "load", handle_pld_load_command, COMMAND_EXEC, "load configuration <file> into programmable logic device"); @@ -201,9 +201,9 @@ int pld_init(struct command_context *cmd_ctx) int pld_register_commands(struct command_context *cmd_ctx) { - pld_cmd = register_command(cmd_ctx, NULL, "pld", NULL, COMMAND_ANY, "programmable logic device commands"); + pld_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "pld", NULL, COMMAND_ANY, "programmable logic device commands"); - register_command(cmd_ctx, pld_cmd, "device", handle_pld_device_command, COMMAND_CONFIG, NULL); + COMMAND_REGISTER(cmd_ctx, pld_cmd, "device", handle_pld_device_command, COMMAND_CONFIG, NULL); return ERROR_OK; } diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c index e8fe63b1..527434a2 100644 --- a/src/pld/virtex2.c +++ b/src/pld/virtex2.c @@ -235,10 +235,10 @@ PLD_DEVICE_COMMAND_HANDLER(virtex2_pld_device_command) static int virtex2_register_commands(struct command_context *cmd_ctx) { - struct command *virtex2_cmd = register_command(cmd_ctx, NULL, "virtex2", + struct command *virtex2_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "virtex2", NULL, COMMAND_ANY, "virtex2 specific commands"); - register_command(cmd_ctx, virtex2_cmd, "read_stat", + COMMAND_REGISTER(cmd_ctx, virtex2_cmd, "read_stat", &virtex2_handle_read_stat_command, COMMAND_EXEC, "read Virtex-II status register"); diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 21dc24c9..be1f8dbc 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2328,23 +2328,23 @@ COMMAND_HANDLER(handle_gdb_breakpoint_override_command) int gdb_register_commands(struct command_context *command_context) { - register_command(command_context, NULL, "gdb_sync", + COMMAND_REGISTER(command_context, NULL, "gdb_sync", handle_gdb_sync_command, COMMAND_ANY, "next stepi will return immediately allowing GDB to " "fetch register state without affecting target state"); - register_command(command_context, NULL, "gdb_port", + COMMAND_REGISTER(command_context, NULL, "gdb_port", handle_gdb_port_command, COMMAND_ANY, "daemon configuration command gdb_port"); - register_command(command_context, NULL, "gdb_memory_map", + COMMAND_REGISTER(command_context, NULL, "gdb_memory_map", handle_gdb_memory_map_command, COMMAND_CONFIG, "enable or disable memory map"); - register_command(command_context, NULL, "gdb_flash_program", + COMMAND_REGISTER(command_context, NULL, "gdb_flash_program", handle_gdb_flash_program_command, COMMAND_CONFIG, "enable or disable flash program"); - register_command(command_context, NULL, "gdb_report_data_abort", + COMMAND_REGISTER(command_context, NULL, "gdb_report_data_abort", handle_gdb_report_data_abort_command, COMMAND_CONFIG, "enable or disable reporting data aborts"); - register_command(command_context, NULL, "gdb_breakpoint_override", + COMMAND_REGISTER(command_context, NULL, "gdb_breakpoint_override", handle_gdb_breakpoint_override_command, COMMAND_EXEC, "hard/soft/disable - force type of breakpoint " "used by gdb 'break' commands."); diff --git a/src/server/server.c b/src/server/server.c index b28aa500..5be13166 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -541,7 +541,7 @@ COMMAND_HANDLER(handle_shutdown_command) int server_register_commands(struct command_context *context) { - register_command(context, NULL, "shutdown", + COMMAND_REGISTER(context, NULL, "shutdown", handle_shutdown_command, COMMAND_ANY, "shut the server down"); diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index 40a0428d..a12176ee 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -177,7 +177,7 @@ COMMAND_HANDLER(handle_tcl_port_command) int tcl_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "tcl_port", + COMMAND_REGISTER(cmd_ctx, NULL, "tcl_port", handle_tcl_port_command, COMMAND_CONFIG, "port on which to listen for incoming TCL syntax"); return ERROR_OK; diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 46d438e0..c52119da 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -618,11 +618,11 @@ COMMAND_HANDLER(handle_exit_command) int telnet_register_commands(struct command_context *command_context) { - register_command(command_context, NULL, "exit", + COMMAND_REGISTER(command_context, NULL, "exit", &handle_exit_command, COMMAND_EXEC, "exit telnet session"); - register_command(command_context, NULL, "telnet_port", + COMMAND_REGISTER(command_context, NULL, "telnet_port", &handle_telnet_port_command, COMMAND_ANY, "port on which to listen for incoming telnet connections"); diff --git a/src/svf/svf.c b/src/svf/svf.c index 545bcf8f..1fc38354 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -1462,7 +1462,7 @@ static int svf_run_command(struct command_context *cmd_ctx, char *cmd_str) int svf_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "svf", + COMMAND_REGISTER(cmd_ctx, NULL, "svf", &handle_svf_command, COMMAND_EXEC, "run svf <file>"); diff --git a/src/target/arm11.c b/src/target/arm11.c index a5175af7..66954fa7 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -1571,34 +1571,34 @@ static int arm11_register_commands(struct command_context *cmd_ctx) armv4_5_register_commands(cmd_ctx); - top_cmd = register_command(cmd_ctx, NULL, "arm11", + top_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm11", NULL, COMMAND_ANY, NULL); /* "hardware_step" is only here to check if the default * simulate + breakpoint implementation is broken. * TEMPORARY! NOT DOCUMENTED! */ - register_command(cmd_ctx, top_cmd, "hardware_step", + COMMAND_REGISTER(cmd_ctx, top_cmd, "hardware_step", arm11_handle_bool_hardware_step, COMMAND_ANY, "DEBUG ONLY - Hardware single stepping" " (default: disabled)"); - mw_cmd = register_command(cmd_ctx, top_cmd, "memwrite", + mw_cmd = COMMAND_REGISTER(cmd_ctx, top_cmd, "memwrite", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, mw_cmd, "burst", + COMMAND_REGISTER(cmd_ctx, mw_cmd, "burst", arm11_handle_bool_memwrite_burst, COMMAND_ANY, "Enable/Disable non-standard but fast burst mode" " (default: enabled)"); - register_command(cmd_ctx, mw_cmd, "error_fatal", + COMMAND_REGISTER(cmd_ctx, mw_cmd, "error_fatal", arm11_handle_bool_memwrite_error_fatal, COMMAND_ANY, "Terminate program if transfer error was found" " (default: enabled)"); - register_command(cmd_ctx, top_cmd, "step_irq_enable", + COMMAND_REGISTER(cmd_ctx, top_cmd, "step_irq_enable", arm11_handle_bool_step_irq_enable, COMMAND_ANY, "Enable interrupts while stepping" " (default: disabled)"); - register_command(cmd_ctx, top_cmd, "vcr", + COMMAND_REGISTER(cmd_ctx, top_cmd, "vcr", arm11_handle_vcr, COMMAND_ANY, "Control (Interrupt) Vector Catch Register"); diff --git a/src/target/arm720t.c b/src/target/arm720t.c index f9388ab6..4ca80e19 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -499,11 +499,11 @@ static int arm720t_register_commands(struct command_context *cmd_ctx) retval = arm7_9_register_commands(cmd_ctx); - arm720t_cmd = register_command(cmd_ctx, NULL, "arm720t", + arm720t_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm720t", NULL, COMMAND_ANY, "arm720t specific commands"); - register_command(cmd_ctx, arm720t_cmd, "cp15", + COMMAND_REGISTER(cmd_ctx, arm720t_cmd, "cp15", arm720t_handle_cp15_command, COMMAND_EXEC, "display/modify cp15 register <opcode> [value]"); diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 4c5e286c..1601ee17 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -2851,18 +2851,18 @@ int arm7_9_register_commands(struct command_context *cmd_ctx) { struct command *arm7_9_cmd; - arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", + arm7_9_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm7_9", NULL, COMMAND_ANY, "arm7/9 specific commands"); - register_command(cmd_ctx, arm7_9_cmd, "dbgrq", + COMMAND_REGISTER(cmd_ctx, arm7_9_cmd, "dbgrq", handle_arm7_9_dbgrq_command, COMMAND_ANY, "use EmbeddedICE dbgrq instead of breakpoint " "for target halt requests <enable | disable>"); - register_command(cmd_ctx, arm7_9_cmd, "fast_memory_access", + COMMAND_REGISTER(cmd_ctx, arm7_9_cmd, "fast_memory_access", handle_arm7_9_fast_memory_access_command, COMMAND_ANY, "use fast memory accesses instead of slower " "but potentially safer accesses <enable | disable>"); - register_command(cmd_ctx, arm7_9_cmd, "dcc_downloads", + COMMAND_REGISTER(cmd_ctx, arm7_9_cmd, "dcc_downloads", handle_arm7_9_dcc_downloads_command, COMMAND_ANY, "use DCC downloads for larger memory writes <enable | disable>"); diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 0610c93c..e9278449 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -1369,24 +1369,24 @@ int arm920t_register_commands(struct command_context *cmd_ctx) retval = arm9tdmi_register_commands(cmd_ctx); - arm920t_cmd = register_command(cmd_ctx, NULL, "arm920t", + arm920t_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm920t", NULL, COMMAND_ANY, "arm920t specific commands"); - register_command(cmd_ctx, arm920t_cmd, "cp15", + COMMAND_REGISTER(cmd_ctx, arm920t_cmd, "cp15", arm920t_handle_cp15_command, COMMAND_EXEC, "display/modify cp15 register <num> [value]"); - register_command(cmd_ctx, arm920t_cmd, "cp15i", + COMMAND_REGISTER(cmd_ctx, arm920t_cmd, "cp15i", arm920t_handle_cp15i_command, COMMAND_EXEC, "display/modify cp15 (interpreted access) " "<opcode> [value] [address]"); - register_command(cmd_ctx, arm920t_cmd, "cache_info", + COMMAND_REGISTER(cmd_ctx, arm920t_cmd, "cache_info", arm920t_handle_cache_info_command, COMMAND_EXEC, "display information about target caches"); - register_command(cmd_ctx, arm920t_cmd, "read_cache", + COMMAND_REGISTER(cmd_ctx, arm920t_cmd, "read_cache", arm920t_handle_read_cache_command, COMMAND_EXEC, "display I/D cache content"); - register_command(cmd_ctx, arm920t_cmd, "read_mmu", + COMMAND_REGISTER(cmd_ctx, arm920t_cmd, "read_mmu", arm920t_handle_read_mmu_command, COMMAND_EXEC, "display I/D mmu content"); diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 24488c40..030405a5 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -764,11 +764,11 @@ int arm926ejs_register_commands(struct command_context *cmd_ctx) retval = arm9tdmi_register_commands(cmd_ctx); - arm926ejs_cmd = register_command(cmd_ctx, NULL, "arm926ejs", + arm926ejs_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm926ejs", NULL, COMMAND_ANY, "arm926ejs specific commands"); - register_command(cmd_ctx, arm926ejs_cmd, "cache_info", + COMMAND_REGISTER(cmd_ctx, arm926ejs_cmd, "cache_info", arm926ejs_handle_cache_info_command, COMMAND_EXEC, "display information about target caches"); diff --git a/src/target/arm966e.c b/src/target/arm966e.c index 93021993..f6178758 100644 --- a/src/target/arm966e.c +++ b/src/target/arm966e.c @@ -228,10 +228,10 @@ int arm966e_register_commands(struct command_context *cmd_ctx) struct command *arm966e_cmd; retval = arm9tdmi_register_commands(cmd_ctx); - arm966e_cmd = register_command(cmd_ctx, NULL, "arm966e", + arm966e_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm966e", NULL, COMMAND_ANY, "arm966e specific commands"); - register_command(cmd_ctx, arm966e_cmd, "cp15", + COMMAND_REGISTER(cmd_ctx, arm966e_cmd, "cp15", arm966e_handle_cp15_command, COMMAND_EXEC, "display/modify cp15 register <num> [value]"); diff --git a/src/target/arm9tdmi.c b/src/target/arm9tdmi.c index 298b26ae..f9654297 100644 --- a/src/target/arm9tdmi.c +++ b/src/target/arm9tdmi.c @@ -914,10 +914,10 @@ int arm9tdmi_register_commands(struct command_context *cmd_ctx) struct command *arm9tdmi_cmd; retval = arm7_9_register_commands(cmd_ctx); - arm9tdmi_cmd = register_command(cmd_ctx, NULL, "arm9", + arm9tdmi_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm9", NULL, COMMAND_ANY, "arm9 specific commands"); - register_command(cmd_ctx, arm9tdmi_cmd, "vector_catch", + COMMAND_REGISTER(cmd_ctx, arm9tdmi_cmd, "vector_catch", handle_arm9tdmi_catch_vectors_command, COMMAND_EXEC, "arm9 vector_catch [all|none|reset|undef|swi|pabt|dabt|irq|fiq] ..."); diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index da5c75a2..ec6d5a0e 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -790,17 +790,17 @@ int armv4_5_register_commands(struct command_context *cmd_ctx) { struct command *armv4_5_cmd; - armv4_5_cmd = register_command(cmd_ctx, NULL, "arm", + armv4_5_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "arm", NULL, COMMAND_ANY, "generic ARM commands"); - register_command(cmd_ctx, armv4_5_cmd, "reg", + COMMAND_REGISTER(cmd_ctx, armv4_5_cmd, "reg", handle_armv4_5_reg_command, COMMAND_EXEC, "display ARM core registers"); - register_command(cmd_ctx, armv4_5_cmd, "core_state", + COMMAND_REGISTER(cmd_ctx, armv4_5_cmd, "core_state", handle_armv4_5_core_state_command, COMMAND_EXEC, "display/change ARM core state <arm | thumb>"); - register_command(cmd_ctx, armv4_5_cmd, "disassemble", + COMMAND_REGISTER(cmd_ctx, armv4_5_cmd, "disassemble", handle_armv4_5_disassemble_command, COMMAND_EXEC, "disassemble instructions " "<address> [<count> ['thumb']]"); diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 1d13779c..67638636 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -148,26 +148,26 @@ int armv7a_register_commands(struct command_context *cmd_ctx) { struct command *arm_adi_v5_dap_cmd; - arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap", + arm_adi_v5_dap_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "dap", NULL, COMMAND_ANY, "cortex dap specific commands"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "info", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "info", handle_dap_info_command, COMMAND_EXEC, "dap info for ap [num], " "default currently selected AP"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apsel", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "apsel", handle_dap_apsel_command, COMMAND_EXEC, "select a different AP [num] (default 0)"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apid", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "apid", handle_dap_apid_command, COMMAND_EXEC, "return id reg from AP [num], " "default currently selected AP"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "baseaddr", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "baseaddr", handle_dap_baseaddr_command, COMMAND_EXEC, "return debug base address from AP [num], " "default currently selected AP"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "memaccess", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "memaccess", handle_dap_memaccess_command, COMMAND_EXEC, "set/get number of extra tck for mem-ap memory " "bus access [0-255]"); diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 88ff6f27..9fd24e9e 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -800,26 +800,26 @@ int armv7m_register_commands(struct command_context *cmd_ctx) { struct command *arm_adi_v5_dap_cmd; - arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap", + arm_adi_v5_dap_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "dap", NULL, COMMAND_ANY, "cortex dap specific commands"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "info", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "info", handle_dap_info_command, COMMAND_EXEC, "Displays dap info for ap [num]," "default currently selected AP"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apsel", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "apsel", handle_dap_apsel_command, COMMAND_EXEC, "Select a different AP [num] (default 0)"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apid", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "apid", handle_dap_apid_command, COMMAND_EXEC, "Displays id reg from AP [num], " "default currently selected AP"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "baseaddr", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "baseaddr", handle_dap_baseaddr_command, COMMAND_EXEC, "Displays debug base address from AP [num]," "default currently selected AP"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "memaccess", + COMMAND_REGISTER(cmd_ctx, arm_adi_v5_dap_cmd, "memaccess", handle_dap_memaccess_command, COMMAND_EXEC, "set/get number of extra tck for mem-ap " "memory bus access [0-255]"); diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index 08e54601..519ba3f5 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1634,15 +1634,15 @@ static int cortex_a8_register_commands(struct command_context *cmd_ctx) armv4_5_register_commands(cmd_ctx); armv7a_register_commands(cmd_ctx); - cortex_a8_cmd = register_command(cmd_ctx, NULL, "cortex_a8", + cortex_a8_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "cortex_a8", NULL, COMMAND_ANY, "cortex_a8 specific commands"); - register_command(cmd_ctx, cortex_a8_cmd, "cache_info", + COMMAND_REGISTER(cmd_ctx, cortex_a8_cmd, "cache_info", cortex_a8_handle_cache_info_command, COMMAND_EXEC, "display information about target caches"); - register_command(cmd_ctx, cortex_a8_cmd, "dbginit", + COMMAND_REGISTER(cmd_ctx, cortex_a8_cmd, "dbginit", cortex_a8_handle_dbginit_command, COMMAND_EXEC, "Initialize core debug"); diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 8279a8b9..47052e90 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1919,16 +1919,16 @@ static int cortex_m3_register_commands(struct command_context *cmd_ctx) retval = armv7m_register_commands(cmd_ctx); - cortex_m3_cmd = register_command(cmd_ctx, NULL, "cortex_m3", + cortex_m3_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "cortex_m3", NULL, COMMAND_ANY, "cortex_m3 specific commands"); - register_command(cmd_ctx, cortex_m3_cmd, "disassemble", + COMMAND_REGISTER(cmd_ctx, cortex_m3_cmd, "disassemble", handle_cortex_m3_disassemble_command, COMMAND_EXEC, "disassemble Thumb2 instructions <address> [<count>]"); - register_command(cmd_ctx, cortex_m3_cmd, "maskisr", + COMMAND_REGISTER(cmd_ctx, cortex_m3_cmd, "maskisr", handle_cortex_m3_mask_interrupts_command, COMMAND_EXEC, "mask cortex_m3 interrupts ['on'|'off']"); - register_command(cmd_ctx, cortex_m3_cmd, "vector_catch", + COMMAND_REGISTER(cmd_ctx, cortex_m3_cmd, "vector_catch", handle_cortex_m3_vector_catch_command, COMMAND_EXEC, "catch hardware vectors ['all'|'none'|<list>]"); diff --git a/src/target/etb.c b/src/target/etb.c index df04e406..1f44d3a2 100644 --- a/src/target/etb.c +++ b/src/target/etb.c @@ -404,10 +404,10 @@ COMMAND_HANDLER(handle_etb_config_command) static int etb_register_commands(struct command_context *cmd_ctx) { - struct command *etb_cmd = register_command(cmd_ctx, NULL, "etb", + struct command *etb_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "etb", NULL, COMMAND_ANY, "Embedded Trace Buffer"); - register_command(cmd_ctx, etb_cmd, "config", + COMMAND_REGISTER(cmd_ctx, etb_cmd, "config", handle_etb_config_command, COMMAND_CONFIG, NULL); diff --git a/src/target/etm.c b/src/target/etm.c index 1678c2fb..6df354a5 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -2097,9 +2097,9 @@ COMMAND_HANDLER(handle_etm_analyze_command) int etm_register_commands(struct command_context *cmd_ctx) { - etm_cmd = register_command(cmd_ctx, NULL, "etm", NULL, COMMAND_ANY, "Embedded Trace Macrocell"); + etm_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "etm", NULL, COMMAND_ANY, "Embedded Trace Macrocell"); - register_command(cmd_ctx, etm_cmd, "config", handle_etm_config_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "config", handle_etm_config_command, COMMAND_CONFIG, "etm config <target> <port_width> <port_mode> <clocking> <capture_driver>"); return ERROR_OK; @@ -2107,32 +2107,32 @@ int etm_register_commands(struct command_context *cmd_ctx) static int etm_register_user_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, etm_cmd, "tracemode", handle_etm_tracemode_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "tracemode", handle_etm_tracemode_command, COMMAND_EXEC, "configure/display trace mode: " "<none | data | address | all> " "<context_id_bits> <cycle_accurate> <branch_output>"); - register_command(cmd_ctx, etm_cmd, "info", handle_etm_info_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "info", handle_etm_info_command, COMMAND_EXEC, "display info about the current target's ETM"); - register_command(cmd_ctx, etm_cmd, "trigger_percent", handle_etm_trigger_percent_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "trigger_percent", handle_etm_trigger_percent_command, COMMAND_EXEC, "amount (<percent>) of trace buffer to be filled after the trigger occured"); - register_command(cmd_ctx, etm_cmd, "status", handle_etm_status_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "status", handle_etm_status_command, COMMAND_EXEC, "display current target's ETM status"); - register_command(cmd_ctx, etm_cmd, "start", handle_etm_start_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "start", handle_etm_start_command, COMMAND_EXEC, "start ETM trace collection"); - register_command(cmd_ctx, etm_cmd, "stop", handle_etm_stop_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "stop", handle_etm_stop_command, COMMAND_EXEC, "stop ETM trace collection"); - register_command(cmd_ctx, etm_cmd, "analyze", handle_etm_analyze_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "analyze", handle_etm_analyze_command, COMMAND_EXEC, "anaylze collected ETM trace"); - register_command(cmd_ctx, etm_cmd, "image", handle_etm_image_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "image", handle_etm_image_command, COMMAND_EXEC, "load image from <file> [base address]"); - register_command(cmd_ctx, etm_cmd, "dump", handle_etm_dump_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "dump", handle_etm_dump_command, COMMAND_EXEC, "dump captured trace data <file>"); - register_command(cmd_ctx, etm_cmd, "load", handle_etm_load_command, + COMMAND_REGISTER(cmd_ctx, etm_cmd, "load", handle_etm_load_command, COMMAND_EXEC, "load trace data for analysis <file>"); return ERROR_OK; diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c index 7621414b..2df89435 100644 --- a/src/target/etm_dummy.c +++ b/src/target/etm_dummy.c @@ -62,9 +62,9 @@ static int etm_dummy_register_commands(struct command_context *cmd_ctx) { struct command *etm_dummy_cmd; - etm_dummy_cmd = register_command(cmd_ctx, NULL, "etm_dummy", NULL, COMMAND_ANY, "Dummy ETM capture driver"); + etm_dummy_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "etm_dummy", NULL, COMMAND_ANY, "Dummy ETM capture driver"); - register_command(cmd_ctx, etm_dummy_cmd, "config", handle_etm_dummy_config_command, COMMAND_CONFIG, NULL); + COMMAND_REGISTER(cmd_ctx, etm_dummy_cmd, "config", handle_etm_dummy_config_command, COMMAND_CONFIG, NULL); return ERROR_OK; } diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index 05df2581..596a4d60 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -411,12 +411,12 @@ int oocd_trace_register_commands(struct command_context *cmd_ctx) { struct command *oocd_trace_cmd; - oocd_trace_cmd = register_command(cmd_ctx, NULL, "oocd_trace", NULL, COMMAND_ANY, "OpenOCD + trace"); + oocd_trace_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "oocd_trace", NULL, COMMAND_ANY, "OpenOCD + trace"); - register_command(cmd_ctx, oocd_trace_cmd, "config", handle_oocd_trace_config_command, COMMAND_CONFIG, NULL); + COMMAND_REGISTER(cmd_ctx, oocd_trace_cmd, "config", handle_oocd_trace_config_command, COMMAND_CONFIG, NULL); - register_command(cmd_ctx, oocd_trace_cmd, "status", handle_oocd_trace_status_command, COMMAND_EXEC, "display OpenOCD + trace status"); - register_command(cmd_ctx, oocd_trace_cmd, "resync", handle_oocd_trace_resync_command, COMMAND_EXEC, "resync OpenOCD + trace capture clock"); + COMMAND_REGISTER(cmd_ctx, oocd_trace_cmd, "status", handle_oocd_trace_status_command, COMMAND_EXEC, "display OpenOCD + trace status"); + COMMAND_REGISTER(cmd_ctx, oocd_trace_cmd, "resync", handle_oocd_trace_resync_command, COMMAND_EXEC, "resync OpenOCD + trace capture clock"); return ERROR_OK; } diff --git a/src/target/target.c b/src/target/target.c index 55adcce6..2e933820 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -4765,7 +4765,7 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv) int target_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "targets", + COMMAND_REGISTER(cmd_ctx, NULL, "targets", handle_targets_command, COMMAND_EXEC, "change current command line target (one parameter) " "or list targets (no parameters)"); @@ -4784,7 +4784,7 @@ int target_register_user_commands(struct command_context *cmd_ctx) if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK) return retval; - register_command(cmd_ctx, NULL, "profile", + COMMAND_REGISTER(cmd_ctx, NULL, "profile", handle_profile_command, COMMAND_EXEC, "profiling samples the CPU PC"); @@ -4796,94 +4796,94 @@ int target_register_user_commands(struct command_context *cmd_ctx) "convert a TCL array to memory locations and write the values " "<ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>"); - register_command(cmd_ctx, NULL, "fast_load_image", + COMMAND_REGISTER(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY, "same CMD_ARGV as load_image, image stored in memory " "- mainly for profiling purposes"); - register_command(cmd_ctx, NULL, "fast_load", + COMMAND_REGISTER(cmd_ctx, NULL, "fast_load", handle_fast_load_command, COMMAND_ANY, "loads active fast load image to current target " "- mainly for profiling purposes"); /** @todo don't register virt2phys() unless target supports it */ - register_command(cmd_ctx, NULL, "virt2phys", + COMMAND_REGISTER(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "translate a virtual address into a physical address"); - register_command(cmd_ctx, NULL, "reg", + COMMAND_REGISTER(cmd_ctx, NULL, "reg", handle_reg_command, COMMAND_EXEC, "display or set a register"); - register_command(cmd_ctx, NULL, "poll", + COMMAND_REGISTER(cmd_ctx, NULL, "poll", handle_poll_command, COMMAND_EXEC, "poll target state"); - register_command(cmd_ctx, NULL, "wait_halt", + COMMAND_REGISTER(cmd_ctx, NULL, "wait_halt", handle_wait_halt_command, COMMAND_EXEC, "wait for target halt [time (s)]"); - register_command(cmd_ctx, NULL, "halt", + COMMAND_REGISTER(cmd_ctx, NULL, "halt", handle_halt_command, COMMAND_EXEC, "halt target"); - register_command(cmd_ctx, NULL, "resume", + COMMAND_REGISTER(cmd_ctx, NULL, "resume", handle_resume_command, COMMAND_EXEC, "resume target [addr]"); - register_command(cmd_ctx, NULL, "reset", + COMMAND_REGISTER(cmd_ctx, NULL, "reset", handle_reset_command, COMMAND_EXEC, "reset target [run | halt | init] - default is run"); - register_command(cmd_ctx, NULL, "soft_reset_halt", + COMMAND_REGISTER(cmd_ctx, NULL, "soft_reset_halt", handle_soft_reset_halt_command, COMMAND_EXEC, "halt the target and do a soft reset"); - register_command(cmd_ctx, NULL, "step", + COMMAND_REGISTER(cmd_ctx, NULL, "step", handle_step_command, COMMAND_EXEC, "step one instruction from current PC or [addr]"); - register_command(cmd_ctx, NULL, "mdw", + COMMAND_REGISTER(cmd_ctx, NULL, "mdw", handle_md_command, COMMAND_EXEC, "display memory words [phys] <addr> [count]"); - register_command(cmd_ctx, NULL, "mdh", + COMMAND_REGISTER(cmd_ctx, NULL, "mdh", handle_md_command, COMMAND_EXEC, "display memory half-words [phys] <addr> [count]"); - register_command(cmd_ctx, NULL, "mdb", + COMMAND_REGISTER(cmd_ctx, NULL, "mdb", handle_md_command, COMMAND_EXEC, "display memory bytes [phys] <addr> [count]"); - register_command(cmd_ctx, NULL, "mww", + COMMAND_REGISTER(cmd_ctx, NULL, "mww", handle_mw_command, COMMAND_EXEC, "write memory word [phys] <addr> <value> [count]"); - register_command(cmd_ctx, NULL, "mwh", + COMMAND_REGISTER(cmd_ctx, NULL, "mwh", handle_mw_command, COMMAND_EXEC, "write memory half-word [phys] <addr> <value> [count]"); - register_command(cmd_ctx, NULL, "mwb", + COMMAND_REGISTER(cmd_ctx, NULL, "mwb", handle_mw_command, COMMAND_EXEC, "write memory byte [phys] <addr> <value> [count]"); - register_command(cmd_ctx, NULL, "bp", + COMMAND_REGISTER(cmd_ctx, NULL, "bp", handle_bp_command, COMMAND_EXEC, "list or set breakpoint [<address> <length> [hw]]"); - register_command(cmd_ctx, NULL, "rbp", + COMMAND_REGISTER(cmd_ctx, NULL, "rbp", handle_rbp_command, COMMAND_EXEC, "remove breakpoint <address>"); - register_command(cmd_ctx, NULL, "wp", + COMMAND_REGISTER(cmd_ctx, NULL, "wp", handle_wp_command, COMMAND_EXEC, "list or set watchpoint " "[<address> <length> <r/w/a> [value] [mask]]"); - register_command(cmd_ctx, NULL, "rwp", + COMMAND_REGISTER(cmd_ctx, NULL, "rwp", handle_rwp_command, COMMAND_EXEC, "remove watchpoint <address>"); - register_command(cmd_ctx, NULL, "load_image", + COMMAND_REGISTER(cmd_ctx, NULL, "load_image", handle_load_image_command, COMMAND_EXEC, "load_image <file> <address> " "['bin'|'ihex'|'elf'|'s19'] [min_address] [max_length]"); - register_command(cmd_ctx, NULL, "dump_image", + COMMAND_REGISTER(cmd_ctx, NULL, "dump_image", handle_dump_image_command, COMMAND_EXEC, "dump_image <file> <address> <size>"); - register_command(cmd_ctx, NULL, "verify_image", + COMMAND_REGISTER(cmd_ctx, NULL, "verify_image", handle_verify_image_command, COMMAND_EXEC, "verify_image <file> [offset] [type]"); - register_command(cmd_ctx, NULL, "test_image", + COMMAND_REGISTER(cmd_ctx, NULL, "test_image", handle_test_image_command, COMMAND_EXEC, "test_image <file> [offset] [type]"); diff --git a/src/target/target_request.c b/src/target/target_request.c index 583f4c00..a02e2c12 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -303,9 +303,9 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command) int target_request_register_commands(struct command_context *cmd_ctx) { target_request_cmd = - register_command(cmd_ctx, NULL, "target_request", NULL, COMMAND_ANY, "target_request commands"); + COMMAND_REGISTER(cmd_ctx, NULL, "target_request", NULL, COMMAND_ANY, "target_request commands"); - register_command(cmd_ctx, target_request_cmd, "debugmsgs", handle_target_request_debugmsgs_command, + COMMAND_REGISTER(cmd_ctx, target_request_cmd, "debugmsgs", handle_target_request_debugmsgs_command, COMMAND_EXEC, "enable/disable reception of debug messages from target"); return ERROR_OK; diff --git a/src/target/trace.c b/src/target/trace.c index c038a152..c3897a07 100644 --- a/src/target/trace.c +++ b/src/target/trace.c @@ -159,12 +159,12 @@ COMMAND_HANDLER(handle_trace_history_command) int trace_register_commands(struct command_context *cmd_ctx) { struct command *trace_cmd = - register_command(cmd_ctx, NULL, "trace", NULL, COMMAND_ANY, "trace commands"); + COMMAND_REGISTER(cmd_ctx, NULL, "trace", NULL, COMMAND_ANY, "trace commands"); - register_command(cmd_ctx, trace_cmd, "history", handle_trace_history_command, + COMMAND_REGISTER(cmd_ctx, trace_cmd, "history", handle_trace_history_command, COMMAND_EXEC, "display trace history, ['clear'] history or set [size]"); - register_command(cmd_ctx, trace_cmd, "point", handle_trace_point_command, + COMMAND_REGISTER(cmd_ctx, trace_cmd, "point", handle_trace_point_command, COMMAND_EXEC, "display trace points, ['clear'] list of trace points, or add new tracepoint at [address]"); return ERROR_OK; diff --git a/src/target/xscale.c b/src/target/xscale.c index e471ac3b..c2b34931 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -3558,27 +3558,27 @@ static int xscale_register_commands(struct command_context *cmd_ctx) { struct command *xscale_cmd; - xscale_cmd = register_command(cmd_ctx, NULL, "xscale", NULL, COMMAND_ANY, "xscale specific commands"); + xscale_cmd = COMMAND_REGISTER(cmd_ctx, NULL, "xscale", NULL, COMMAND_ANY, "xscale specific commands"); - register_command(cmd_ctx, xscale_cmd, "debug_handler", xscale_handle_debug_handler_command, COMMAND_ANY, "'xscale debug_handler <target#> <address>' command takes two required operands"); - register_command(cmd_ctx, xscale_cmd, "cache_clean_address", xscale_handle_cache_clean_address_command, COMMAND_ANY, NULL); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "debug_handler", xscale_handle_debug_handler_command, COMMAND_ANY, "'xscale debug_handler <target#> <address>' command takes two required operands"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "cache_clean_address", xscale_handle_cache_clean_address_command, COMMAND_ANY, NULL); - register_command(cmd_ctx, xscale_cmd, "cache_info", xscale_handle_cache_info_command, COMMAND_EXEC, NULL); - register_command(cmd_ctx, xscale_cmd, "mmu", xscale_handle_mmu_command, COMMAND_EXEC, "['enable'|'disable'] the MMU"); - register_command(cmd_ctx, xscale_cmd, "icache", xscale_handle_idcache_command, COMMAND_EXEC, "['enable'|'disable'] the ICache"); - register_command(cmd_ctx, xscale_cmd, "dcache", xscale_handle_idcache_command, COMMAND_EXEC, "['enable'|'disable'] the DCache"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "cache_info", xscale_handle_cache_info_command, COMMAND_EXEC, NULL); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "mmu", xscale_handle_mmu_command, COMMAND_EXEC, "['enable'|'disable'] the MMU"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "icache", xscale_handle_idcache_command, COMMAND_EXEC, "['enable'|'disable'] the ICache"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "dcache", xscale_handle_idcache_command, COMMAND_EXEC, "['enable'|'disable'] the DCache"); - register_command(cmd_ctx, xscale_cmd, "vector_catch", xscale_handle_vector_catch_command, COMMAND_EXEC, "<mask> of vectors that should be catched"); - register_command(cmd_ctx, xscale_cmd, "vector_table", xscale_handle_vector_table_command, COMMAND_EXEC, "<high|low> <index> <code> set static code for exception handler entry"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "vector_catch", xscale_handle_vector_catch_command, COMMAND_EXEC, "<mask> of vectors that should be catched"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "vector_table", xscale_handle_vector_table_command, COMMAND_EXEC, "<high|low> <index> <code> set static code for exception handler entry"); - register_command(cmd_ctx, xscale_cmd, "trace_buffer", xscale_handle_trace_buffer_command, COMMAND_EXEC, "<enable | disable> ['fill' [n]|'wrap']"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "trace_buffer", xscale_handle_trace_buffer_command, COMMAND_EXEC, "<enable | disable> ['fill' [n]|'wrap']"); - register_command(cmd_ctx, xscale_cmd, "dump_trace", xscale_handle_dump_trace_command, COMMAND_EXEC, "dump content of trace buffer to <file>"); - register_command(cmd_ctx, xscale_cmd, "analyze_trace", xscale_handle_analyze_trace_buffer_command, COMMAND_EXEC, "analyze content of trace buffer"); - register_command(cmd_ctx, xscale_cmd, "trace_image", xscale_handle_trace_image_command, + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "dump_trace", xscale_handle_dump_trace_command, COMMAND_EXEC, "dump content of trace buffer to <file>"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "analyze_trace", xscale_handle_analyze_trace_buffer_command, COMMAND_EXEC, "analyze content of trace buffer"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "trace_image", xscale_handle_trace_image_command, COMMAND_EXEC, "load image from <file> [base address]"); - register_command(cmd_ctx, xscale_cmd, "cp15", xscale_handle_cp15, COMMAND_EXEC, "access coproc 15 <register> [value]"); + COMMAND_REGISTER(cmd_ctx, xscale_cmd, "cp15", xscale_handle_cp15, COMMAND_EXEC, "access coproc 15 <register> [value]"); armv4_5_register_commands(cmd_ctx); diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index 9af9767e..82ddb84b 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -1052,7 +1052,7 @@ COMMAND_HANDLER(handle_xsvf_command) int xsvf_register_commands(struct command_context *cmd_ctx) { - register_command(cmd_ctx, NULL, "xsvf", + COMMAND_REGISTER(cmd_ctx, NULL, "xsvf", &handle_xsvf_command, COMMAND_EXEC, "run xsvf <file> [virt2] [quiet]"); |