On wrong parameters a error is signalized to the calling function.
Change-Id: I484443fdb39938e20382edc9246d5ec546a5c960
Signed-off-by: Mathias K <kesmtp@freenet.de>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/282
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
* Plus someday, optionally, ALE and CLE masks.
*/
if (CMD_ARGC < 5) {
- LOG_ERROR("parameters: %s target "
- "chip_addr hwecc_mode aemif_addr",
- CMD_ARGV[0]);
- goto fail;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], chip);
struct nand_flash_controller davinci_nand_controller = {
.name = "davinci",
+ .usage = "chip_addr hwecc_mode aemif_addr",
.nand_device_command = davinci_nand_device_command,
.init = davinci_init,
.reset = davinci_reset,
{
if (CMD_ARGC < 3)
{
- LOG_WARNING("incomplete 'lpc3180' nand flash configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
uint32_t osc_freq;
NAND_DEVICE_COMMAND_HANDLER(lpc32xx_nand_device_command)
{
if (CMD_ARGC < 3) {
- LOG_WARNING("incomplete 'lpc32xx' nand flash configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
uint32_t osc_freq;
if (CMD_ARGC < 3)
{
- LOG_ERROR ("use \"nand device imx31 target noecc|hwecc\"");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/*
* check hwecc requirements
struct nand_flash_controller imx31_nand_flash_controller = {
.name = "imx31",
+ .usage = "nand device imx31 target noecc|hwecc",
.nand_device_command = &imx31_nand_device_command,
.init = &imx31_init,
.reset = &imx31_reset,
uint8_t ale, cle;
if (CMD_ARGC != 3) {
- LOG_ERROR("arguments must be: <target_id> <NAND_address>");
- return ERROR_NAND_DEVICE_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
hw = calloc(1, sizeof(*hw));
struct nand_flash_controller orion_nand_controller =
{
.name = "orion",
+ .usage = "<target_id> <NAND_address>",
.command = orion_nand_command,
.address = orion_nand_address,
.read_data = orion_nand_read,
switch (CMD_ARGC) {
default:
- command_print(CMD_CTX,"Too many parameters\n");
return ERROR_COMMAND_SYNTAX_ERROR;
break;
case 0:
if (CMD_ARGC != 2)
{
- command_print(CMD_CTX, "at91sam7 gpnvm <bit> <set | clear>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
bank = get_flash_bank_by_num_noprobe(0);
struct flash_driver at91sam7_flash = {
.name = "at91sam7",
+ .usage = "gpnvm <bit> <set | clear>",
.commands = at91sam7_command_handlers,
.flash_bank_command = at91sam7_flash_bank_command,
.erase = at91sam7_erase,
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank avr configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
avrf_info = malloc(sizeof(struct avrf_flash_bank));
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "avr mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration avrf_exec_command_handlers[] = {
{
.name = "mass_erase",
+ .usage = "<bank>",
.handler = avrf_handle_mass_erase_command,
.mode = COMMAND_EXEC,
.help = "erase entire device",
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank cfi configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/* both widths must:
if (CMD_ARGC < 7)
{
- LOG_WARNING("incomplete flash_bank ecosflash configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
info = malloc(sizeof(struct ecosflash_flash_bank));
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank em357 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
em357_info = malloc(sizeof(struct em357_flash_bank));
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "em357 lock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "em357 unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "em357 mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration em357_exec_command_handlers[] = {
{
.name = "lock",
+ .usage = "<bank>",
.handler = em357_handle_lock_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Lock entire flash device.",
},
{
.name = "unlock",
+ .usage = "<bank>",
.handler = em357_handle_unlock_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Unlock entire protected flash device.",
},
{
.name = "mass_erase",
+ .usage = "<bank>",
.handler = em357_handle_mass_erase_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Erase entire flash device.",
},
COMMAND_REGISTRATION_DONE
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank faux configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
info = malloc(sizeof(struct faux_flash_bank));
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank fm3 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
fm3_info = malloc(sizeof(struct fm3_flash_bank));
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "fm3 chip_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration fm3_exec_command_handlers[] = {
{
.name = "chip_erase",
+ .usage = "<bank>",
.handler = fm3_handle_chip_erase_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Erase entire Flash device.",
},
COMMAND_REGISTRATION_DONE
struct kinetis_flash_bank *bank_info;
if (CMD_ARGC < 6) {
- LOG_ERROR("incomplete flash_bank kinetis configuration %d",
- CMD_ARGC);
- return ERROR_FLASH_OPERATION_FAILED;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
LOG_INFO("add flash_bank kinetis %s", bank->name);
if (CMD_ARGC < 8)
{
- LOG_WARNING("incomplete flash_bank lpc2000 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
lpc2000_info = malloc(sizeof(struct lpc2000_flash_bank));
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank LPC288x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
lpc288x_info = malloc(sizeof(struct lpc288x_flash_bank));
if( CMD_ARGC < 1 )
{
- LOG_WARNING( "Too few arguments. Call: lpc2900 signature <bank#>" );
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration lpc2900_exec_command_handlers[] = {
{
.name = "signature",
+ .usage = "<bank>",
.handler = lpc2900_handle_signature_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Calculate and display signature of flash bank.",
},
{
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank LPC2900 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
lpc2900_info = malloc(sizeof(struct lpc2900_flash_bank));
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank ocl configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
arm7_9 = target_to_arm7_9(bank->target);
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank pic32mx configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
pic32mx_info = malloc(sizeof(struct pic32mx_flash_bank));
if (CMD_ARGC != 3)
{
- command_print(CMD_CTX, "pic32mx pgm_word <addr> <value> <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
if (CMD_ARGC < 1)
{
command_print(CMD_CTX, "pic32mx unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration pic32mx_exec_command_handlers[] = {
{
.name = "pgm_word",
+ .usage = "<addr> <value> <bank>",
.handler = pic32mx_handle_pgm_word_command,
.mode = COMMAND_EXEC,
.help = "program a word",
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stellaris configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stellaris_info = calloc(sizeof(struct stellaris_flash_bank), 1);
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stellaris mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration stellaris_exec_command_handlers[] = {
{
.name = "mass_erase",
+ .usage = "<bank>",
.handler = stellaris_handle_mass_erase_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "erase entire device",
},
{
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stm32x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stm32x_info = malloc(sizeof(struct stm32x_flash_bank));
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x lock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x options_read <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 4)
{
- command_print(CMD_CTX, "stm32x options_write <bank> <SWWDG | HWWDG> "
- "<RSTSTNDBY | NORSTSTNDBY> <RSTSTOP | NORSTSTOP> <BOOT0 | BOOT1>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stm32x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stm32x_info = malloc(sizeof(struct stm32x_flash_bank));
struct stm32lx_flash_bank *stm32lx_info;
if (CMD_ARGC < 6)
{
- LOG_ERROR("incomplete flash_bank stm32lx configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
// Create the bank structure
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stmsmi configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stmsmi_info = malloc(sizeof(struct stmsmi_flash_bank));
if (CMD_ARGC < 7)
{
- LOG_WARNING("incomplete flash_bank str7x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
str7x_info = malloc(sizeof(struct str7x_flash_bank));
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str7x disable_jtag <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration str7x_exec_command_handlers[] = {
{
.name = "disable_jtag",
+ .usage = "<bank>",
.handler = str7x_handle_disable_jtag_command,
.mode = COMMAND_EXEC,
.help = "disable jtag access",
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank str9x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
str9x_info = malloc(sizeof(struct str9x_flash_bank));
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank str9x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
str9xpec_info = malloc(sizeof(struct str9xpec_flash_controller));
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec options_read <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec options_write <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_cmap <bank> <bank0 | bank1>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_lvdthd <bank> <2.4v | 2.7v>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_lvdsel <bank> <vdd | vdd_vddq>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_lvdwarn <bank> <vdd | vdd_vddq>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec lock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec enable_turbo <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec disable_turbo <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration str9xpec_config_command_handlers[] = {
{
.name = "enable_turbo",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_enable_turbo_command,
.mode = COMMAND_EXEC,
.help = "enable str9xpec turbo mode",
},
{
.name = "disable_turbo",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_disable_turbo_command,
.mode = COMMAND_EXEC,
.help = "disable str9xpec turbo mode",
},
{
.name = "options_cmap",
+ .usage = "<bank> <bank0 | bank1>",
.handler = str9xpec_handle_flash_options_cmap_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec boot sector",
},
{
.name = "options_lvdthd",
+ .usage = "<bank> <2.4v | 2.7v>",
.handler = str9xpec_handle_flash_options_lvdthd_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec lvd threshold",
},
{
.name = "options_lvdsel",
+ .usage = "<bank> <vdd | vdd_vddq>",
.handler = str9xpec_handle_flash_options_lvdsel_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec lvd selection",
},
{
.name = "options_lvdwarn",
+ .usage = "<bank> <vdd | vdd_vddq>",
.handler = str9xpec_handle_flash_options_lvdwarn_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec lvd warning",
},
{
.name = "options_read",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_options_read_command,
.mode = COMMAND_EXEC,
.help = "read str9xpec options",
},
{
.name = "options_write",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_options_write_command,
.mode = COMMAND_EXEC,
.help = "write str9xpec options",
},
{
.name = "lock",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_lock_command,
.mode = COMMAND_EXEC,
.help = "lock str9xpec device",
},
{
.name = "unlock",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_unlock_command,
.mode = COMMAND_EXEC,
.help = "unlock str9xpec device",
{
if (CMD_ARGC > 4)
{
- command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else if (CMD_ARGC == 4)
{
if (CMD_ARGC > 1)
{
- command_print(CMD_CTX, "tms470 osc_megahertz <MHz>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else if (CMD_ARGC == 1)
{
if (CMD_ARGC > 1)
{
- command_print(CMD_CTX, "tms470 plldis <0 | 1>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else if (CMD_ARGC == 1)
static const struct command_registration tms470_any_command_handlers[] = {
{
.name = "flash_keyset",
+ .usage = "<key0> <key1> <key2> <key3>",
.handler = tms470_handle_flash_keyset_command,
.mode = COMMAND_ANY,
.help = "tms470 flash_keyset <key0> <key1> <key2> <key3>",
},
{
.name = "osc_megahertz",
+ .usage = "<MHz>",
.handler = tms470_handle_osc_megahertz_command,
.mode = COMMAND_ANY,
.help = "tms470 osc_megahertz <MHz>",
},
{
.name = "plldis",
+ .usage = "<0 | 1>",
.handler = tms470_handle_plldis_command,
.mode = COMMAND_ANY,
.help = "tms470 plldis <0/1>",
{
if (CMD_ARGC < 7)
{
- LOG_WARNING("incomplete flash_bank virtual configuration");
- return ERROR_FLASH_OPERATION_FAILED;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/* get the master flash bank */
{
if (CMD_ARGC < 1 || CMD_ARGC > 2)
{
- LOG_ERROR("%s: incorrect number of arguments", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
{
if (CMD_ARGC > 1)
{
- LOG_ERROR("%s: too many arguments", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
if (1 == CMD_ARGC)
{
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "cat <filename>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
{
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "trunc <filename>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
if (CMD_ARGC != 0)
{
- command_print(CMD_CTX, "meminfo");
return ERROR_COMMAND_SYNTAX_ERROR;
}
{
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX,
- "append <filename> [<string1>, [<string2>, ...]]");
return ERROR_COMMAND_SYNTAX_ERROR;
}
.handler = handle_append_command,
.mode = COMMAND_ANY,
.help = "append a variable number of strings to a file",
- .usage= "file_name [string ...]",
+ .usage = "file_name [<string1>, [<string2>, ...]]",
},
{
.name = "meminfo",
COMMAND_HANDLER(at91rm9200_handle_device_command)
{
if (CMD_ARGC == 0)
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
/* only if the device name wasn't overwritten by cmdline */
if (at91rm9200_device == 0)
COMMAND_HANDLER(buspirate_handle_vreg_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_vreg <1|0>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (atoi(CMD_ARGV[0]) == 1)
COMMAND_HANDLER(buspirate_handle_pullup_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_pullup <1|0>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (atoi(CMD_ARGV[0]) == 1)
COMMAND_HANDLER(buspirate_handle_led_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_led <1|0>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (atoi(CMD_ARGV[0]) == 1) {
COMMAND_HANDLER(buspirate_handle_mode_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_mode <normal|open-drain>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (CMD_ARGV[0][0] == 'n')
COMMAND_HANDLER(buspirate_handle_speed_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_speed <normal|fast>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (CMD_ARGV[0][0] == 'n')
COMMAND_HANDLER(buspirate_handle_port_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_port /dev/ttyUSB0");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (buspirate_port == NULL)
},
{
.name = "buspirate_vreg",
+ .usage = "<1|0>",
.handler = &buspirate_handle_vreg_command,
.mode = COMMAND_CONFIG,
.help = "changes the state of voltage regulators",
},
{
.name = "buspirate_pullup",
+ .usage = "<1|0>",
.handler = &buspirate_handle_pullup_command,
.mode = COMMAND_CONFIG,
.help = "changes the state of pullup",
},
{
.name = "buspirate_led",
+ .usage = "<1|0>",
.handler = &buspirate_handle_led_command,
.mode = COMMAND_EXEC,
.help = "changes the state of led",
},
{
.name = "buspirate_speed",
+ .usage = "<normal|fast>",
.handler = &buspirate_handle_speed_command,
.mode = COMMAND_CONFIG,
.help = "speed of the interface",
},
{
.name = "buspirate_mode",
+ .usage = "<normal|open-drain>",
.handler = &buspirate_handle_mode_command,
.mode = COMMAND_CONFIG,
.help = "pin mode of the interface",
},
{
.name = "buspirate_port",
+ .usage = "/dev/ttyUSB0",
.handler = &buspirate_handle_port_command,
.mode = COMMAND_CONFIG,
.help = "name of the serial port to open",
}
else
{
- LOG_ERROR("expected exactly one argument to ft2232_serial <serial-number>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
COMMAND_HANDLER(ft2232_handle_layout_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("Need exactly one argument to ft2232_layout");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (layout) {
}
else
{
- LOG_ERROR("expected exactly one argument to ft2232_latency <ms>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
{
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: parport_write_on_exit <on | off>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_ON_OFF(CMD_ARGV[0], parport_exit);
}
else
{
- LOG_ERROR("expected exactly one argument to presto_serial <serial-number>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
{
int ret;
- if (CMD_ARGC != 1) {
- LOG_ERROR("Need exactly one argument to ulink_download_firmware");
- return ERROR_FAIL;
- }
+ if (CMD_ARGC != 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
LOG_INFO("Downloading ULINK firmware image %s", CMD_ARGV[0]);
COMMAND_HANDLER(vsllink_handle_usb_vid_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for VID");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0],
COMMAND_HANDLER(vsllink_handle_usb_pid_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for PID");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0],
versaloon_interface.usb_setting.pid);
COMMAND_HANDLER(vsllink_handle_usb_bulkin_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for BULKIN endpoint");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0],
COMMAND_HANDLER(vsllink_handle_usb_bulkout_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for BULKOUT endpoint");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0],
COMMAND_HANDLER(vsllink_handle_usb_interface_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for interface number");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0],
if (CMD_ARGC < 1)
{
- LOG_WARNING("incomplete 'pld device' command");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
for (i = 0; pld_drivers[i]; i++)
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "usage: pld load <device#> <file>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
unsigned dev_id;
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: virtex2 read_stat <num>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
unsigned dev_id;
if (CMD_ARGC < 2)
{
- LOG_WARNING("incomplete pld device 'virtex2' configuration");
- return ERROR_PLD_DEVICE_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
tap = jtag_tap_by_string(CMD_ARGV[1]);
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: arm920t read_cache <filename>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: arm920t read_mmu <filename>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
}
else
{
- command_print(CMD_CTX,
- "usage: arm920t cp15i <opcode> [value] [address]");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
break;
default:
usage:
- command_print(CMD_CTX,
- "usage: arm disassemble <address> [<count> ['thumb']]");
count = 0;
- retval = ERROR_FAIL;
+ retval = ERROR_COMMAND_SYNTAX_ERROR;
}
while (count-- > 0) {
&tracemode);
break;
default:
- command_print(CMD_CTX, "usage: tracemode "
- "('none'|'data'|'address'|'all') "
- "context_id_bits "
- "('enable'|'disable') "
- "('enable'|'disable')"
- );
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/**
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: etm image <file> [base address] [type]");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: etm dump <file>");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: etm load <file>");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
.handler = handle_etm_image_command,
.mode = COMMAND_EXEC,
.help = "load image from file with optional offset",
- .usage = "filename [offset]",
+ .usage = "<file> [base address] [type]",
},
{
.name = "dump",
/* two or more argument, access a single register/select (write if third argument is given) */
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "command requires more arguments.");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
/* two or more argument, access a single register/select (write if third argument is given) */
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "command requires more arguments.");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
if (CMD_ARGC != 2)
{
- LOG_ERROR("incomplete 'oocd_trace config <target> <tty>' command");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
.name = "config",
.handler = handle_oocd_trace_config_command,
.mode = COMMAND_CONFIG,
- .usage = "target",
+ .usage = "<target> <tty>",
},
{
.name = "status",
return ERROR_OK;
}
- command_print(CMD_CTX, "usage: reg <#|name> [value]");
-
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_HANDLER(handle_poll_command)
int retval = parse_uint(CMD_ARGV[0], &ms);
if (ERROR_OK != retval)
{
- command_print(CMD_CTX, "usage: %s [seconds]", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
// convert seconds (given) to milliseconds (needed)
return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
default:
- command_print(CMD_CTX, "usage: bp <address> [<asid>]<length> ['hw'|'hw_ctx']");
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
break;
default:
- command_print(CMD_CTX, "usage: wp [address length "
- "[(r|w|a) [value [mask]]]]");
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
else
{
- command_print(CMD_CTX, "usage: target_request debugmsgs ['enable'|'disable'|'charmsg']");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
}
if (CMD_ARGC < 2)
{
- LOG_ERROR("'xscale debug_handler <target#> <address>' command takes two required operands");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((target = get_target(CMD_ARGV[0])) == NULL)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: xscale vector_catch [mask]");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
}
if (err)
- command_print(CMD_CTX, "usage: xscale vector_table <high|low> <index> <code>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
return ERROR_OK;
}
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: xscale trace_image <file> [base address] [type]");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
retval = xscale_verify_pointer(CMD_CTX, xscale);
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: xscale dump_trace <file>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
trace_data = xscale->trace.data;
}
else
{
- command_print(CMD_CTX, "usage: cp15 [register]<, [value]>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
.handler = xscale_handle_debug_handler_command,
.mode = COMMAND_ANY,
.help = "Change address used for debug handler.",
- .usage = "target address",
+ .usage = "<target> <address>",
},
{
.name = "cache_clean_address",
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "usage: xsvf <device#|plain> <file> [<variant>] [quiet]");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/* we mess with CMD_ARGV starting point below, snapshot filename here */