diff options
author | Mathias K <kesmtp@freenet.de> | 2011-12-16 07:48:39 +0100 |
---|---|---|
committer | Øyvind Harboe <oyvindharboe@gmail.com> | 2012-01-04 17:56:46 +0000 |
commit | 16b6b5e7a86353dbc0c4823fe3d772c0faca7c1c (patch) | |
tree | 4950e26d07d60b16b3223e085227c583418c2ef8 /src/jtag | |
parent | 42cb62cf3b47b982d6444948b483f9c6ce32de05 (diff) | |
download | riscv-openocd-16b6b5e7a86353dbc0c4823fe3d772c0faca7c1c.zip riscv-openocd-16b6b5e7a86353dbc0c4823fe3d772c0faca7c1c.tar.gz riscv-openocd-16b6b5e7a86353dbc0c4823fe3d772c0faca7c1c.tar.bz2 |
Change return value on error.
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>
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/drivers/at91rm9200.c | 2 | ||||
-rw-r--r-- | src/jtag/drivers/buspirate.c | 24 | ||||
-rw-r--r-- | src/jtag/drivers/ft2232.c | 7 | ||||
-rw-r--r-- | src/jtag/drivers/parport.c | 3 | ||||
-rw-r--r-- | src/jtag/drivers/presto.c | 2 | ||||
-rw-r--r-- | src/jtag/drivers/ulink.c | 7 | ||||
-rw-r--r-- | src/jtag/drivers/vsllink.c | 20 |
7 files changed, 26 insertions, 39 deletions
diff --git a/src/jtag/drivers/at91rm9200.c b/src/jtag/drivers/at91rm9200.c index f7494fe..6d0dfac 100644 --- a/src/jtag/drivers/at91rm9200.c +++ b/src/jtag/drivers/at91rm9200.c @@ -175,7 +175,7 @@ static int at91rm9200_speed(int speed) 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) diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c index 41e3e19..f3edc8a 100644 --- a/src/jtag/drivers/buspirate.c +++ b/src/jtag/drivers/buspirate.c @@ -280,8 +280,7 @@ COMMAND_HANDLER(buspirate_handle_adc_command) 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) @@ -298,8 +297,7 @@ COMMAND_HANDLER(buspirate_handle_vreg_command) 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) @@ -316,8 +314,7 @@ COMMAND_HANDLER(buspirate_handle_pullup_command) 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) { @@ -339,8 +336,7 @@ COMMAND_HANDLER(buspirate_handle_led_command) 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') @@ -357,8 +353,7 @@ COMMAND_HANDLER(buspirate_handle_mode_command) 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') @@ -375,8 +370,7 @@ COMMAND_HANDLER(buspirate_handle_speed_command) 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) @@ -395,36 +389,42 @@ static const struct command_registration buspirate_command_handlers[] = { }, { .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", diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index 73aea01..4b9bdef 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -3431,7 +3431,7 @@ COMMAND_HANDLER(ft2232_handle_serial_command) } else { - LOG_ERROR("expected exactly one argument to ft2232_serial <serial-number>"); + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; @@ -3440,8 +3440,7 @@ COMMAND_HANDLER(ft2232_handle_serial_command) 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) { @@ -3504,7 +3503,7 @@ COMMAND_HANDLER(ft2232_handle_latency_command) } else { - LOG_ERROR("expected exactly one argument to ft2232_latency <ms>"); + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; diff --git a/src/jtag/drivers/parport.c b/src/jtag/drivers/parport.c index ad07791..ec175fa 100644 --- a/src/jtag/drivers/parport.c +++ b/src/jtag/drivers/parport.c @@ -449,8 +449,7 @@ COMMAND_HANDLER(parport_handle_write_on_exit_command) { 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); diff --git a/src/jtag/drivers/presto.c b/src/jtag/drivers/presto.c index 4bee67d..0de48ff 100644 --- a/src/jtag/drivers/presto.c +++ b/src/jtag/drivers/presto.c @@ -740,7 +740,7 @@ COMMAND_HANDLER(presto_handle_serial_command) } else { - LOG_ERROR("expected exactly one argument to presto_serial <serial-number>"); + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; diff --git a/src/jtag/drivers/ulink.c b/src/jtag/drivers/ulink.c index 73f1523..5c58da3 100644 --- a/src/jtag/drivers/ulink.c +++ b/src/jtag/drivers/ulink.c @@ -2320,10 +2320,9 @@ COMMAND_HANDLER(ulink_download_firmware_handler) { 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]); diff --git a/src/jtag/drivers/vsllink.c b/src/jtag/drivers/vsllink.c index e39a4d6..fe7bdb2 100644 --- a/src/jtag/drivers/vsllink.c +++ b/src/jtag/drivers/vsllink.c @@ -472,9 +472,7 @@ static void vsllink_reset(int trst, int srst) 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], @@ -485,9 +483,7 @@ COMMAND_HANDLER(vsllink_handle_usb_vid_command) 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); @@ -497,9 +493,7 @@ COMMAND_HANDLER(vsllink_handle_usb_pid_command) 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], @@ -513,9 +507,7 @@ COMMAND_HANDLER(vsllink_handle_usb_bulkin_command) 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], @@ -529,9 +521,7 @@ COMMAND_HANDLER(vsllink_handle_usb_bulkout_command) 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], |