]> git.sur5r.net Git - openocd/commitdiff
retire ERROR_INVALID_ARGUMENTS and replace with ERROR_COMMAND_SYNTAX_ERROR
authorØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 28 Dec 2011 11:56:08 +0000 (12:56 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 4 Jan 2012 17:13:46 +0000 (17:13 +0000)
Change-Id: I6dee51e1fab1944085391f274a343cdb9014c7a4
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/300
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
36 files changed:
src/flash/mflash.c
src/flash/nand/core.c
src/flash/nand/tcl.c
src/flash/nor/stellaris.c
src/flash/nor/tcl.c
src/flash/nor/tms470.c
src/helper/command.c
src/helper/fileio.c
src/helper/ioutil.c
src/helper/log.c
src/helper/log.h
src/jtag/adapter.c
src/jtag/core.c
src/jtag/drivers/presto.c
src/jtag/zy1000/zy1000.c
src/pld/xilinx_bit.c
src/server/server.c
src/target/arm7_9_common.c
src/target/arm_adi_v5.c
src/target/arm_disassembler.c
src/target/arm_dpm.c
src/target/armv4_5.c
src/target/armv7a.c
src/target/armv7m.c
src/target/avr32_ap7k.c
src/target/cortex_a.c
src/target/cortex_m.c
src/target/dsp563xx.c
src/target/embeddedice.c
src/target/etm.c
src/target/image.c
src/target/mips32.c
src/target/mips_m4k.c
src/target/target.c
src/target/target_request.c
src/target/xscale.c

index ba34422237d10cd3c6ac9e1f6e3a30a59f7e5f96..8fca4aa310a4e152767382b8c509b41e0cc0e0b7 100644 (file)
@@ -141,7 +141,7 @@ static int s3c2440_set_gpio_to_output (struct mflash_gpio_num gpio)
                gpio_con = S3C2440_GPJCON;
        } else {
                LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        ret = target_read_u32(target, gpio_con, &data);
@@ -173,7 +173,7 @@ static int s3c2440_set_gpio_output_val (struct mflash_gpio_num gpio, uint8_t val
                gpio_dat = S3C2440_GPJDAT;
        } else {
                LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        ret = target_read_u32(target, gpio_dat, &data);
index d9bb7dea9299fb910b329099a538c60053da6967..777b2fdc40dc699a5510130614985984e0a60929 100644 (file)
@@ -221,7 +221,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index,
        *nand = get_nand_device_by_num(num);
        if (!*nand) {
                command_print(CMD_CTX, "NAND flash device '%s' not found", str);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        return ERROR_OK;
 }
@@ -542,7 +542,7 @@ int nand_erase(struct nand_device *nand, int first_block, int last_block)
                return ERROR_NAND_DEVICE_NOT_PROBED;
 
        if ((first_block < 0) || (last_block >= nand->num_blocks))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        /* make sure we know if a block is bad before erasing it */
        for (i = first_block; i <= last_block; i++)
index e4bfb4d1c9f21c8c89d96a50010041a3c2ce4ae0..5fba1bcc93d61e35852b77b39c2a8c2d0415de5a 100644 (file)
@@ -177,12 +177,12 @@ COMMAND_HANDLER(handle_nand_erase_command)
 
                COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset);
                if ((offset % p->erase_size) != 0 || offset >= size)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
 
                COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length);
                if ((length == 0) || (length % p->erase_size) != 0
                                || (length + offset) > size)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
 
                offset /= p->erase_size;
                length /= p->erase_size;
@@ -226,12 +226,12 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
 
                COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset);
                if (offset % p->erase_size)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                offset /= p->erase_size;
 
                COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length);
                if (length % p->erase_size)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
 
                length -= 1;
                length /= p->erase_size;
index 6fa9fe25ffaeaf2f5a2e72edef002598d5ede6e4..7351aed950726f38b8dd3bf403f4edf12ccb88cb 100644 (file)
@@ -897,7 +897,7 @@ static int stellaris_protect(struct flash_bank *bank, int set, int first, int la
        {
                LOG_ERROR("Hardware doesn't support page-level unprotect. "
                        "Try the 'recover' command.");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (stellaris_info->did1 == 0)
index 92b85be7e79917527f44e72e217fa329df271bed..4ba5f47ca3d58236cf033404454cc47b2bfe6d06 100644 (file)
@@ -848,7 +848,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
 COMMAND_HANDLER(handle_flash_banks_command)
 {
        if (CMD_ARGC != 0)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        unsigned n = 0;
        for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++)
index 359d3aa7daf396f4042db0da95582bc65fe23385..bf708be2d90d889a4c277dfb1bf4aa2e048f7349 100644 (file)
@@ -314,7 +314,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
        if (CMD_ARGC > 4)
        {
                command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        else if (CMD_ARGC == 4)
        {
@@ -328,7 +328,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
                        {
                                command_print(CMD_CTX, "could not process flash key %s", CMD_ARGV[i]);
                                LOG_ERROR("could not process flash key %s", CMD_ARGV[i]);
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
                }
 
@@ -337,7 +337,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
        else if (CMD_ARGC != 0)
        {
                command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (keysSet)
@@ -378,7 +378,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
        if (CMD_ARGC > 1)
        {
                command_print(CMD_CTX, "tms470 osc_megahertz <MHz>");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        else if (CMD_ARGC == 1)
        {
@@ -390,7 +390,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
                LOG_ERROR("osc_megahertz must be positive and non-zero!");
                command_print(CMD_CTX, "osc_megahertz must be positive and non-zero!");
                oscMHz = 12;
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        command_print(CMD_CTX, "osc_megahertz=%d", oscMHz);
@@ -407,7 +407,7 @@ COMMAND_HANDLER(tms470_handle_plldis_command)
        if (CMD_ARGC > 1)
        {
                command_print(CMD_CTX, "tms470 plldis <0 | 1>");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        else if (CMD_ARGC == 1)
        {
index 65e538bbdcf8e60d650c54273d779b48eb8dc5a9..3ed8dc87d8d55fecfe2416ca4c3360211f67c4f7 100644 (file)
@@ -494,7 +494,7 @@ int unregister_command(struct command_context *context,
                struct command *parent, const char *name)
 {
        if ((!context) || (!name))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        struct command *p = NULL;
        struct command **head = command_list_for_parent(context, parent);
@@ -832,12 +832,12 @@ static COMMAND_HELPER(command_help_find, struct command *head,
                struct command **out)
 {
        if (0 == CMD_ARGC)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        *out = command_find(head, CMD_ARGV[0]);
        if (NULL == *out && strncmp(CMD_ARGV[0], "ocd_", 4) == 0)
                *out = command_find(head, CMD_ARGV[0] + 4);
        if (NULL == *out)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        if (--CMD_ARGC == 0)
                return ERROR_OK;
        CMD_ARGV++;
@@ -1180,7 +1180,7 @@ COMMAND_HANDLER(handle_help_add_command)
        if (CMD_ARGC < 2)
        {
                LOG_ERROR("%s: insufficient arguments", CMD_NAME);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        // save help text and remove it from argument list
@@ -1190,7 +1190,7 @@ COMMAND_HANDLER(handle_help_add_command)
        if (!help && !usage)
        {
                LOG_ERROR("command name '%s' is unknown", CMD_NAME);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        // likewise for the leaf command name
        const char *cmd_name = CMD_ARGV[--CMD_ARGC];
@@ -1399,7 +1399,7 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp
 int command_context_mode(struct command_context *cmd_ctx, enum command_mode mode)
 {
        if (!cmd_ctx)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        cmd_ctx->mode = mode;
        return ERROR_OK;
@@ -1503,7 +1503,7 @@ int command_parse_bool_arg(const char *in, bool *out)
                return ERROR_OK;
        if (command_parse_bool(in, out, "1", "0") == ERROR_OK)
                return ERROR_OK;
-       return ERROR_INVALID_ARGUMENTS;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 }
 
 COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
@@ -1514,7 +1514,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
                if (command_parse_bool_arg(in, out) != ERROR_OK)
                {
                        LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, in);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                // fall through
        }
@@ -1522,7 +1522,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
                LOG_INFO("%s is %s", label, *out ? "enabled" : "disabled");
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        return ERROR_OK;
 }
index 9ae0134454c8ce6ef9a17eb530e4f453ade27401..b97ebf4260262b91a509283cfd15779baf0bf3bf 100644 (file)
@@ -63,7 +63,7 @@ static inline int fileio_open_local(struct fileio_internal *fileio)
                        break;
                default:
                        LOG_ERROR("BUG: access neither read, write nor readwrite");
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* win32 always opens in binary mode */
index 211c4ba6c5d0d44e46a8ef3b75810e12ab7cfe4f..3754fc5cf4c8be055d136fcb00a8f3e26bb806f4 100644 (file)
@@ -118,7 +118,7 @@ COMMAND_HANDLER(handle_cat_command)
        if (CMD_ARGC != 1)
        {
                command_print(CMD_CTX, "cat <filename>");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        // NOTE!!! we only have line printing capability so we print the entire file as a single line.
@@ -144,7 +144,7 @@ COMMAND_HANDLER(handle_trunc_command)
        if (CMD_ARGC != 1)
        {
                command_print(CMD_CTX, "trunc <filename>");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        FILE *config_file = NULL;
@@ -163,7 +163,7 @@ COMMAND_HANDLER(handle_meminfo_command)
        if (CMD_ARGC != 0)
        {
                command_print(CMD_CTX, "meminfo");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        info = mallinfo();
@@ -186,7 +186,7 @@ COMMAND_HANDLER(handle_append_command)
        {
                command_print(CMD_CTX,
                                "append <filename> [<string1>, [<string2>, ...]]");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        int retval = ERROR_FAIL;
@@ -224,7 +224,7 @@ COMMAND_HANDLER(handle_cp_command)
 {
        if (CMD_ARGC != 2)
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        // NOTE!!! we only have line printing capability so we print the entire file as a single line.
@@ -237,7 +237,7 @@ COMMAND_HANDLER(handle_cp_command)
 
        FILE *f = fopen(CMD_ARGV[1], "wb");
        if (f == NULL)
-               retval = ERROR_INVALID_ARGUMENTS;
+               retval = ERROR_COMMAND_SYNTAX_ERROR;
 
        size_t pos = 0;
        for (;;)
@@ -250,7 +250,7 @@ COMMAND_HANDLER(handle_cp_command)
                }
 
                if ((retval == ERROR_OK) && (fwrite(((char *)data) + pos, 1, chunk, f) != chunk))
-                       retval = ERROR_INVALID_ARGUMENTS;
+                       retval = ERROR_COMMAND_SYNTAX_ERROR;
 
                if (retval != ERROR_OK)
                {
@@ -405,7 +405,7 @@ void copydir(char *name, char *destdir)
 COMMAND_HANDLER(handle_rm_command)
 {
        if (CMD_ARGC != 1)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        bool del = false;
        if (rmdir(CMD_ARGV[0]) == 0)
index 8a8f08a709041201cedd354d52765bb865eadeff..fa66de065966de85f54c238f4275c790615118fc 100644 (file)
@@ -326,7 +326,7 @@ int log_add_callback(log_callback_fn fn, void *priv)
        for (cb = log_callbacks; cb; cb = cb->next)
        {
                if (cb->fn == fn && cb->priv == priv)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* alloc memory, it is safe just to return in case of an error, no need for the caller to check this */
@@ -357,7 +357,7 @@ int log_remove_callback(log_callback_fn fn, void *priv)
        }
 
        /* no such item */
-       return ERROR_INVALID_ARGUMENTS;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 }
 
 /* return allocated string w/printf() result */
index 801ae7f8296c83f312b10d1ad53d0a2a60198759..7edfa7b6b5e4fb552564eaac38c5e85a0cf7c91a 100644 (file)
@@ -132,7 +132,6 @@ extern int debug_level;
  * error codes < 100
  */
 #define ERROR_OK                                       (0)
-#define ERROR_INVALID_ARGUMENTS                ERROR_COMMAND_SYNTAX_ERROR
 #define ERROR_NO_CONFIG_FILE           (-2)
 #define ERROR_BUF_TOO_SMALL                    (-3)
 /* see "Error:" log entry for meaningful message to the user. The caller should
index a0cd5e3dabe826617e445dbfcb4840fc95d65c84..acd434c440f58c79816f0d5c79b5de6096edff79 100644 (file)
@@ -218,7 +218,7 @@ COMMAND_HANDLER(handle_reset_config_command)
                if (mask & m) {
                        LOG_ERROR("extra reset_config %s spec (%s)",
                                        "gating", *CMD_ARGV);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                if (m)
                        goto next;
@@ -238,7 +238,7 @@ COMMAND_HANDLER(handle_reset_config_command)
                if (mask & m) {
                        LOG_ERROR("extra reset_config %s spec (%s)",
                                        "signal", *CMD_ARGV);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                if (m)
                        goto next;
@@ -258,7 +258,7 @@ COMMAND_HANDLER(handle_reset_config_command)
                if (mask & m) {
                        LOG_ERROR("extra reset_config %s spec (%s)",
                                        "combination", *CMD_ARGV);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                if (m)
                        goto next;
@@ -274,7 +274,7 @@ COMMAND_HANDLER(handle_reset_config_command)
                if (mask & m) {
                        LOG_ERROR("extra reset_config %s spec (%s)",
                                        "trst_type", *CMD_ARGV);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                if (m)
                        goto next;
@@ -290,14 +290,14 @@ COMMAND_HANDLER(handle_reset_config_command)
                if (mask & m) {
                        LOG_ERROR("extra reset_config %s spec (%s)",
                                        "srst_type", *CMD_ARGV);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                if (m)
                        goto next;
 
                /* caller provided nonsense; fail */
                LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
 next:
                /* Remember the bits which were specified (mask)
index 48eef3e1000d527c105ae6e4684855f047d77220..a0feed1dc0cdf1cc98a0fea0b1c4665c5dc12012 100644 (file)
@@ -279,7 +279,7 @@ int jtag_register_event_callback(jtag_event_handler_t callback, void *priv)
 
        if (callback == NULL)
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (*callbacks_p)
@@ -303,7 +303,7 @@ int jtag_unregister_event_callback(jtag_event_handler_t callback, void *priv)
 
        if (callback == NULL)
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        while (*p)
index b23d196b9a3aa8edb619d90e3c7fb5732feab6b2..4bee67dcc73ef3eeff28d79ebfe55bf1d6cbc6f3 100644 (file)
@@ -686,7 +686,7 @@ static int presto_adapter_khz(int khz, int *jtag_speed)
        if (khz < 0)
        {
                *jtag_speed = 0;
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (khz >= 3000) *jtag_speed = 0;
@@ -700,7 +700,7 @@ static int presto_jtag_speed_div(int speed, int *khz)
        if ((speed < 0) || (speed > 1000))
        {
                *khz = 0;
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (speed == 0) *khz = 3000;
@@ -715,7 +715,7 @@ static int presto_jtag_speed(int speed)
 
        if (presto_jtag_speed_div(speed, &khz))
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        presto->jtag_speed = speed;
index 25783fa793171b3ad68662e1dcfbb11db7dfba37..22193abd2c74afe84890104e830f1eb27d860220 100644 (file)
@@ -283,7 +283,7 @@ int zy1000_speed(int speed)
                {
                        LOG_USER("valid ZY1000 jtag_speed=[8190,2]. With divisor is %dkHz / even values between 8190-2, i.e. min %dHz, max %dMHz",
                                        ZYLIN_KHZ, (ZYLIN_KHZ * 1000) / 8190, ZYLIN_KHZ / (2 * 1000));
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                int khz;
@@ -325,7 +325,7 @@ COMMAND_HANDLER(handle_power_command)
                LOG_INFO("Target power %s", savePower ? "on" : "off");
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
index 1ae1ea8df689ae7277d46510e1e083c0c8e9a648..ea4f0ec8897676f406b5177fbb70112ede47d5d4 100644 (file)
@@ -82,7 +82,7 @@ int xilinx_read_bit_file(struct xilinx_bit_file *bit_file, const char *filename)
        int read_count;
 
        if (!filename || !bit_file)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (stat(filename, &input_stat) == -1)
        {
index a7fddf67492ee5b8994a2b111969f8cd5352f621..e60eb3984552e4b38f8a44fd24d928816eadbd5c 100644 (file)
@@ -657,7 +657,7 @@ SERVER_PORT_COMMAND()
                break;
        }
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        return ERROR_OK;
 }
@@ -676,7 +676,7 @@ SERVER_PIPE_COMMAND()
                break;
        }
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        return ERROR_OK;
 }
index 5fbcd4dee23c3684916bff82e2b2b9b149482203..7ad70ea04aeca4cf26f076285303f0cef166f9ef 100644 (file)
@@ -2142,7 +2142,7 @@ static int arm7_9_read_core_reg(struct target *target, struct reg *r,
        if (!is_arm_mode(armv4_5->core_mode))
                return ERROR_FAIL;
        if ((num < 0) || (num > 16))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if ((mode != ARM_MODE_ANY)
                        && (mode != armv4_5->core_mode)
@@ -2205,7 +2205,7 @@ static int arm7_9_write_core_reg(struct target *target, struct reg *r,
        if (!is_arm_mode(armv4_5->core_mode))
                return ERROR_FAIL;
        if ((num < 0) || (num > 16))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if ((mode != ARM_MODE_ANY)
                        && (mode != armv4_5->core_mode)
@@ -2277,7 +2277,7 @@ int arm7_9_read_memory(struct target *target, uint32_t address, uint32_t size, u
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
@@ -2457,7 +2457,7 @@ int arm7_9_write_memory(struct target *target, uint32_t address, uint32_t size,
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
index 9ea7b5a145ea7f27b8ac8734e5d0cbeb6c24ffc5..c0d664d236daaf8c6ee6129bce09c99d954f8194 100644 (file)
@@ -1272,7 +1272,7 @@ int dap_get_debugbase(struct adiv5_dap *dap, int ap,
 
        /* AP address is in bits 31:24 of DP_SELECT */
        if (ap >= 256)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        ap_old = dap->ap_current;
        dap_ap_select(dap, ap);
@@ -1315,7 +1315,7 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
        int retval = ERROR_FAIL;
 
        if (ap >= 256)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        ap_old = dap->ap_current;
        dap_ap_select(dap, ap);
@@ -1799,7 +1799,7 @@ COMMAND_HANDLER(dap_baseaddr_command)
                COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
                /* AP address is in bits 31:24 of DP_SELECT */
                if (apsel >= 256)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                break;
        default:
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -1867,7 +1867,7 @@ COMMAND_HANDLER(dap_apsel_command)
                COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
                /* AP address is in bits 31:24 of DP_SELECT */
                if (apsel >= 256)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                break;
        default:
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -1906,7 +1906,7 @@ COMMAND_HANDLER(dap_apid_command)
                COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
                /* AP address is in bits 31:24 of DP_SELECT */
                if (apsel >= 256)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                break;
        default:
                return ERROR_COMMAND_SYNTAX_ERROR;
index 188b6ba7be58fc28cdef1b212e18d25ea2b21f32..34d679c113b7a33355842294e914653501383725 100644 (file)
@@ -3013,7 +3013,7 @@ static int t2ev_misc(uint32_t opcode, uint32_t address,
                mnemonic = "ISB";
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        strcpy(cp, mnemonic);
        return ERROR_OK;
@@ -3064,7 +3064,7 @@ static int t2ev_b_misc(uint32_t opcode, uint32_t address,
        }
 
 undef:
-       return ERROR_INVALID_ARGUMENTS;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 }
 
 static int t2ev_data_mod_immed(uint32_t opcode, uint32_t address,
@@ -3199,7 +3199,7 @@ static int t2ev_data_mod_immed(uint32_t opcode, uint32_t address,
                suffix2 = ".W";
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (one)
@@ -3288,7 +3288,7 @@ static int t2ev_data_immed(uint32_t opcode, uint32_t address,
                                        (int) (opcode & 0x1f) + 1 - immed);
                return ERROR_OK;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        sprintf(cp, "%s\tr%d, r%d, #%d\t; %#3.3x", mnemonic,
@@ -3321,7 +3321,7 @@ static int t2ev_store_single(uint32_t opcode, uint32_t address,
        unsigned rt = (opcode >> 12) & 0x0f;
 
        if (rn == 0xf)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (opcode & 0x0800)
                op |= 1;
@@ -3358,7 +3358,7 @@ static int t2ev_store_single(uint32_t opcode, uint32_t address,
                break;
        /* error */
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        sprintf(cp, "STR%s.W\tr%d, [r%d, r%d, LSL #%d]",
@@ -3381,7 +3381,7 @@ imm8:
                break;
        case 0x000:
        case 0x200:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* two indexed modes will write back rn */
@@ -3426,7 +3426,7 @@ static int t2ev_mul32(uint32_t opcode, uint32_t address,
                        (int) (opcode >> 0) & 0xf, ra);
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
        return ERROR_OK;
 }
@@ -3462,7 +3462,7 @@ static int t2ev_mul64_div(uint32_t opcode, uint32_t address,
                                (int) (opcode >> 0) & 0xf);
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
@@ -3516,7 +3516,7 @@ static int t2ev_ldm_stm(uint32_t opcode, uint32_t address,
                sprintf(cp, "LDMDB.W\tr%d%s, ", rn, t ? "!" : "");
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        cp = strchr(cp, 0);
@@ -3584,7 +3584,7 @@ static int t2ev_ldrex_strex(uint32_t opcode, uint32_t address,
                        mnemonic = "STREXH";
                        break;
                default:
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                rd = opcode & 0xf;
                imm = 0;
@@ -3604,12 +3604,12 @@ static int t2ev_ldrex_strex(uint32_t opcode, uint32_t address,
                        mnemonic = "LDREXH";
                        break;
                default:
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                imm = 0;
                goto ldrex;
        }
-       return ERROR_INVALID_ARGUMENTS;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 
 strex:
        imm <<= 2;
@@ -3680,7 +3680,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address,
        case 0:
                if (rd == 0xf) {
                        if (!(opcode & (1 << 20)))
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        instruction->type = ARM_TST;
                        mnemonic = "TST";
                        suffix = "";
@@ -3742,7 +3742,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address,
        case 4:
                if (rd == 0xf) {
                        if (!(opcode & (1 << 20)))
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        instruction->type = ARM_TEQ;
                        mnemonic = "TEQ";
                        suffix = "";
@@ -3754,7 +3754,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address,
        case 8:
                if (rd == 0xf) {
                        if (!(opcode & (1 << 20)))
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        instruction->type = ARM_CMN;
                        mnemonic = "CMN";
                        suffix = "";
@@ -3774,7 +3774,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address,
        case 0xd:
                if (rd == 0xf) {
                        if (!(opcode & (1 << 21)))
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        instruction->type = ARM_CMP;
                        mnemonic = "CMP";
                        suffix = "";
@@ -3788,7 +3788,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address,
                mnemonic = "RSB";
                break;
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        sprintf(cp, "%s%s.W\tr%d, r%d, r%d",
@@ -3857,7 +3857,7 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address,
                        mnemonic = "ROR";
                        break;
                default:
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                instruction->type = ARM_MOV;
@@ -3898,11 +3898,11 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address,
                case 0xa:
                case 0xb:
                        if (opcode & (1 << 6))
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        if (((opcode >> 12) & 0xf) != 0xf)
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        if (!(opcode & (1 << 20)))
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
 
                        switch (((opcode >> 19) & 0x04)
                                | ((opcode >> 4) & 0x3)) {
@@ -3922,7 +3922,7 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address,
                                mnemonic = "CLZ";
                                break;
                        default:
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
                        sprintf(cp, "%s\tr%d, r%d",
                                        mnemonic,
@@ -3930,7 +3930,7 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address,
                                        (int) (opcode >> 0) & 0xf);
                        break;
                default:
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
        }
 
@@ -3986,7 +3986,7 @@ static int t2ev_load_word(uint32_t opcode, uint32_t address,
                char *p1 = "]", *p2 = "";
 
                if (!(opcode & 0x0500))
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
 
                immed = opcode & 0x00ff;
 
@@ -4008,7 +4008,7 @@ static int t2ev_load_word(uint32_t opcode, uint32_t address,
                return ERROR_OK;
        }
 
-       return ERROR_INVALID_ARGUMENTS;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 }
 
 static int t2ev_load_byte_hints(uint32_t opcode, uint32_t address,
@@ -4187,7 +4187,7 @@ ldrsb_literal:
                goto ldrxb_immediate_t2;
        }
 
-       return ERROR_INVALID_ARGUMENTS;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 }
 
 static int t2ev_load_halfword(uint32_t opcode, uint32_t address,
@@ -4265,7 +4265,7 @@ ldrh_literal:
                return ERROR_OK;
        }
 
-       return ERROR_INVALID_ARGUMENTS;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 }
 
 /*
@@ -4377,7 +4377,7 @@ int thumb2_opcode(struct target *target, uint32_t address, struct arm_instructio
         * instructions; not yet handled here.
         */
 
-       if (retval == ERROR_INVALID_ARGUMENTS) {
+       if (retval == ERROR_COMMAND_SYNTAX_ERROR) {
                instruction->type = ARM_UNDEFINED_INSTRUCTION;
                strcpy(cp, "UNDEFINED OPCODE");
                return ERROR_OK;
index dfd3f275baec243816bfa70e385d67dde72199c9..9f7af4e79ae28027f0ed9f0351e76bb5a223a542 100644 (file)
@@ -536,7 +536,7 @@ static int arm_dpm_read_core_reg(struct target *target, struct reg *r,
        int retval;
 
        if (regnum < 0 || regnum > 16)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (regnum == 16) {
                if (mode != ARM_MODE_ANY)
@@ -579,7 +579,7 @@ static int arm_dpm_write_core_reg(struct target *target, struct reg *r,
 
 
        if (regnum < 0 || regnum > 16)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (regnum == 16) {
                if (mode != ARM_MODE_ANY)
@@ -729,7 +729,7 @@ static int dpm_bpwp_setup(struct arm_dpm *dpm, struct dpm_bpwp *xp,
                /* FALL THROUGH */
        default:
                LOG_ERROR("unsupported {break,watch}point length/alignment");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* other shared control bits:
@@ -756,7 +756,7 @@ static int dpm_add_breakpoint(struct target *target, struct breakpoint *bp)
        int retval = ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
 
        if (bp->length < 2)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        if (!dpm->bpwp_enable)
                return retval;
 
@@ -781,7 +781,7 @@ static int dpm_remove_breakpoint(struct target *target, struct breakpoint *bp)
 {
        struct arm *arm = target_to_arm(target);
        struct arm_dpm *dpm = arm->dpm;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
 
        for (unsigned i = 0; i < dpm->nbp; i++) {
                if (dpm->dbp[i].bp == bp) {
@@ -855,7 +855,7 @@ static int dpm_remove_watchpoint(struct target *target, struct watchpoint *wp)
 {
        struct arm *arm = target_to_arm(target);
        struct arm_dpm *dpm = arm->dpm;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
 
        for (unsigned i = 0; i < dpm->nwp; i++) {
                if (dpm->dwp[i].wp == wp) {
index e576d9c0b8a66cbe67ef378e4970e100e9d9aa47..d59ab5c7f389656956d9b08216fa81e8b21ec687 100644 (file)
@@ -1185,13 +1185,13 @@ int armv4_5_run_algorithm_inner(struct target *target,
                if (!reg)
                {
                        LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                if (reg->size != reg_params[i].size)
                {
                        LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                if ((retval = armv4_5_set_core_reg(reg, reg_params[i].value)) != ERROR_OK)
@@ -1208,7 +1208,7 @@ int armv4_5_run_algorithm_inner(struct target *target,
        else
        {
                LOG_ERROR("BUG: can't execute algorithms when not in ARM or Thumb state");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (arm_algorithm_info->core_mode != ARM_MODE_ANY)
@@ -1260,14 +1260,14 @@ int armv4_5_run_algorithm_inner(struct target *target,
                        if (!reg)
                        {
                                LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name);
-                               retval = ERROR_INVALID_ARGUMENTS;
+                               retval = ERROR_COMMAND_SYNTAX_ERROR;
                                continue;
                        }
 
                        if (reg->size != reg_params[i].size)
                        {
                                LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name);
-                               retval = ERROR_INVALID_ARGUMENTS;
+                               retval = ERROR_COMMAND_SYNTAX_ERROR;
                                continue;
                        }
 
index 67c563e67e17bf202174e9888d4045cce76dd26d..f975c6df808e375abb67e0ee852174601d0943dc 100644 (file)
@@ -748,7 +748,7 @@ int armv7a_arch_state(struct target *target)
        if (armv7a->common_magic != ARMV7_COMMON_MAGIC)
        {
                LOG_ERROR("BUG: called for a non-ARMv7A target");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        arm_arch_state(target);
index d9e63d7f31bef568f45348150a36f5d847118c1a..d8aed89ce04b56a164a9f615e8caab9e760f4d14 100644 (file)
@@ -206,7 +206,7 @@ static int armv7m_read_core_reg(struct target *target, unsigned num)
        struct armv7m_common *armv7m = target_to_armv7m(target);
 
        if (num >= ARMV7M_NUM_REGS)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        armv7m_core_reg = armv7m->core_cache->reg_list[num].arch_info;
        retval = armv7m->load_core_reg_u32(target, armv7m_core_reg->type, armv7m_core_reg->num, &reg_value);
@@ -225,7 +225,7 @@ static int armv7m_write_core_reg(struct target *target, unsigned num)
        struct armv7m_common *armv7m = target_to_armv7m(target);
 
        if (num >= ARMV7M_NUM_REGS)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        reg_value = buf_get_u32(armv7m->core_cache->reg_list[num].value, 0, 32);
        armv7m_core_reg = armv7m->core_cache->reg_list[num].arch_info;
@@ -363,13 +363,13 @@ int armv7m_start_algorithm(struct target *target,
                if (!reg)
                {
                        LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                if (reg->size != reg_params[i].size)
                {
                        LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
 //             regvalue = buf_get_u32(reg_params[i].value, 0, 32);
@@ -452,13 +452,13 @@ int armv7m_wait_algorithm(struct target *target,
                        if (!reg)
                        {
                                LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name);
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
 
                        if (reg->size != reg_params[i].size)
                        {
                                LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name);
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
 
                        buf_set_u32(reg_params[i].value, 0, 32, buf_get_u32(reg->value, 0, 32));
index afac664b51294ff95af384c8734e8f4a32ed6d37..635fe462405a4641dca048ec423c3e99878d78ac 100644 (file)
@@ -115,7 +115,7 @@ static int avr32_read_core_reg(struct target *target, int num)
        struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
 
        if ((num < 0) || (num >= AVR32NUMCOREREGS))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        reg_value = ap7k->core_regs[num];
        buf_set_u32(ap7k->core_cache->reg_list[num].value, 0, 32, reg_value);
@@ -133,7 +133,7 @@ static int avr32_write_core_reg(struct target *target, int num)
        struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
 
        if ((num < 0) || (num >= AVR32NUMCOREREGS))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        reg_value = buf_get_u32(ap7k->core_cache->reg_list[num].value, 0, 32);
        ap7k->core_regs[num] = reg_value;
@@ -487,7 +487,7 @@ static int avr32_ap7k_read_memory(struct target *target, uint32_t address,
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
@@ -525,7 +525,7 @@ static int avr32_ap7k_write_memory(struct target *target, uint32_t address,
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
index 8a1ca3b077b1c97a3332ced8b72d64be480ebbd8..0c2247ef588eb8ffa356f4088334e20653ffbf30 100755 (executable)
@@ -1906,7 +1906,7 @@ static int cortex_a8_write_apb_ab_memory(struct target *target,
 
        /* write memory through APB-AP */
 
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
        struct armv7a_common *armv7a = target_to_armv7a(target);
        struct arm *armv4_5 = &armv7a->armv4_5_common;
        int total_bytes = count * size;
@@ -1979,7 +1979,7 @@ static int cortex_a8_read_apb_ab_memory(struct target *target,
 
        /* read memory through APB-AP */
 
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
        struct armv7a_common *armv7a = target_to_armv7a(target);
        struct arm *armv4_5 = &armv7a->armv4_5_common;
        int total_bytes = count * size;
@@ -2047,7 +2047,7 @@ static int cortex_a8_read_phys_memory(struct target *target,
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
        struct adiv5_dap *swjdp = armv7a->armv4_5_common.dap;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
        uint8_t apsel = swjdp->apsel;
        LOG_DEBUG("Reading memory at real address 0x%x; size %d; count %d",
                        address, size, count);
@@ -2132,7 +2132,7 @@ static int cortex_a8_write_phys_memory(struct target *target,
 {
        struct armv7a_common *armv7a = target_to_armv7a(target);
        struct adiv5_dap *swjdp = armv7a->armv4_5_common.dap;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
        uint8_t apsel = swjdp->apsel;
 
        LOG_DEBUG("Writing memory to real address 0x%x; size %d; count %d", address,
index 2fbd71da5eac1455efe5d9fe319d7e130aa0933b..c7cb9d48245930183128f34e086ef462898bfad5 100644 (file)
@@ -1593,7 +1593,7 @@ static int cortex_m3_load_core_reg_u32(struct target *target,
                break;
 
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
@@ -1673,7 +1673,7 @@ static int cortex_m3_store_core_reg_u32(struct target *target,
                break;
 
        default:
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
@@ -1684,7 +1684,7 @@ static int cortex_m3_read_memory(struct target *target, uint32_t address,
 {
        struct armv7m_common *armv7m = target_to_armv7m(target);
        struct adiv5_dap *swjdp = &armv7m->dap;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
 
        /* cortex_m3 handles unaligned memory access */
        if (count && buffer) {
@@ -1709,7 +1709,7 @@ static int cortex_m3_write_memory(struct target *target, uint32_t address,
 {
        struct armv7m_common *armv7m = target_to_armv7m(target);
        struct adiv5_dap *swjdp = &armv7m->dap;
-       int retval = ERROR_INVALID_ARGUMENTS;
+       int retval = ERROR_COMMAND_SYNTAX_ERROR;
 
        if (count && buffer) {
                switch (size) {
@@ -2144,7 +2144,7 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command)
                        }
                        if (i == ARRAY_SIZE(vec_ids)) {
                                LOG_ERROR("No CM3 vector '%s'", CMD_ARGV[CMD_ARGC]);
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
                }
 write:
index a0e120627659ffd7c8f37bd5d28cea80e254451a..28f8bac02caf9cd3a4f9ec68fa8b9008bfcc0c07 100644 (file)
@@ -336,7 +336,7 @@ static int dsp563xx_get_gdb_reg_list(struct target *target, struct reg **reg_lis
        *reg_list = malloc(sizeof(struct reg *) * (*reg_list_size));
 
        if (!*reg_list)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        for (i = 0; i < DSP563XX_NUMCOREREGS; i++)
        {
@@ -353,7 +353,7 @@ static int dsp563xx_read_core_reg(struct target *target, int num)
        struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target);
 
        if ((num < 0) || (num >= DSP563XX_NUMCOREREGS))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        reg_value = dsp563xx->core_regs[num];
        buf_set_u32(dsp563xx->core_cache->reg_list[num].value, 0, 32, reg_value);
@@ -369,7 +369,7 @@ static int dsp563xx_write_core_reg(struct target *target, int num)
        struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target);
 
        if ((num < 0) || (num >= DSP563XX_NUMCOREREGS))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        reg_value = buf_get_u32(dsp563xx->core_cache->reg_list[num].value, 0, 32);
        dsp563xx->core_regs[num] = reg_value;
@@ -859,7 +859,7 @@ static int dsp563xx_target_create(struct target *target, Jim_Interp * interp)
        struct dsp563xx_common *dsp563xx = calloc(1, sizeof(struct dsp563xx_common));
 
        if (!dsp563xx)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        dsp563xx->jtag_info.tap = target->tap;
        target->arch_info = dsp563xx;
@@ -886,7 +886,7 @@ static int dsp563xx_examine(struct target *target)
        {
                LOG_ERROR("no IDCODE present on device");
 
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (!target_was_examined(target))
@@ -1480,7 +1480,7 @@ static int dsp563xx_read_memory_core(struct target *target, int mem_type, uint32
                        move_cmd = 0x07d891;
                        break;
                default:
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* we use r0 to store temporary data */
@@ -1556,7 +1556,7 @@ static int dsp563xx_read_memory(struct target *target, int mem_type, uint32_t ad
        /* we only support 4 byte aligned data */
        if ( (size != 4) || (!count) )
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if ( mem_type != MEM_L )
@@ -1566,13 +1566,13 @@ static int dsp563xx_read_memory(struct target *target, int mem_type, uint32_t ad
 
        if ( !(buffer_y = malloc(size*count)) )
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if ( !(buffer_x = malloc(size*count)) )
        {
                free(buffer_y);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        err = dsp563xx_read_memory_core(target,MEM_Y,address,size,count/2,buffer_y);
@@ -1647,7 +1647,7 @@ static int dsp563xx_write_memory_core(struct target *target, int mem_type, uint3
                        move_cmd = 0x075891;
                        break;
                default:
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* we use r0 to store temporary data */
@@ -1716,7 +1716,7 @@ static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t a
        /* we only support 4 byte aligned data */
        if ( (size != 4) || (!count) )
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if ( mem_type != MEM_L )
@@ -1726,13 +1726,13 @@ static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t a
 
        if ( !(buffer_y = malloc(size*count)) )
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if ( !(buffer_x = malloc(size*count)) )
        {
                free(buffer_y);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        for(i=0,i1=0;i<count;i+=2,i1++)
index a38028c8004b92dc879ba564beb80d7bd683920c..77e85df4c5956bd5ed2305f7b8be920df8ffbbbb 100644 (file)
@@ -589,7 +589,7 @@ int embeddedice_handshake(struct arm_jtag *jtag_info, int hsbit, uint32_t timeou
        else
        {
                LOG_ERROR("Invalid arguments");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
index 4e15878332cf93528753b1a31e6eb36bab813b15..cd50e44d511d09bdebdf03a1849086e9f16f1309 100644 (file)
@@ -499,7 +499,7 @@ static int etm_read_reg_w_check(struct reg *reg,
 
        if (etm_reg->reg_info->mode == WO) {
                LOG_ERROR("BUG: can't read write-only register %s", r->name);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        LOG_DEBUG("%s (%u)", r->name, reg_addr);
@@ -585,7 +585,7 @@ static int etm_write_reg(struct reg *reg, uint32_t value)
 
        if (etm_reg->reg_info->mode == RO) {
                LOG_ERROR("BUG: can't write read--only register %s", r->name);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        LOG_DEBUG("%s (%u): 0x%8.8" PRIx32 "", r->name, reg_addr, value);
@@ -1196,7 +1196,7 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update,
        else
        {
                command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[0]);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        uint8_t context_id;
@@ -1217,7 +1217,7 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update,
                break;
        default:
                command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[1]);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        bool etmv1_cycle_accurate;
index d1db136b7716b43a8cfb84ac16c9a8a161035582..c0aabecd5838cf47c3628053fbc81292da90a643 100644 (file)
@@ -902,7 +902,7 @@ int image_read_section(struct image *image, int section, uint32_t offset, uint32
        {
                LOG_DEBUG("read past end of section: 0x%8.8" PRIx32 " + 0x%8.8" PRIx32 " > 0x%8.8" PRIx32 "",
                                offset, size, image->sections[section].size);
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (image->type == IMAGE_BINARY)
@@ -911,7 +911,7 @@ int image_read_section(struct image *image, int section, uint32_t offset, uint32
 
                /* only one section in a plain binary */
                if (section != 0)
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
 
                /* seek to offset */
                if ((retval = fileio_seek(&image_binary->fileio, offset)) != ERROR_OK)
@@ -999,7 +999,7 @@ int image_add_section(struct image *image, uint32_t base, uint32_t size, int fla
 
        /* only image builder supports adding sections */
        if (image->type != IMAGE_BUILDER)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        /* see if there's a previous section */
        if (image->num_sections)
index d7f001e1f5de14010aafd266b159d1dd8a8b5e6f..80dfb1944fbaaac1ea6c646c89eb54a540e26d76 100644 (file)
@@ -151,7 +151,7 @@ static int mips32_read_core_reg(struct target *target, int num)
        struct mips32_common *mips32 = target_to_mips32(target);
 
        if ((num < 0) || (num >= MIPS32NUMCOREREGS))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        reg_value = mips32->core_regs[num];
        buf_set_u32(mips32->core_cache->reg_list[num].value, 0, 32, reg_value);
@@ -169,7 +169,7 @@ static int mips32_write_core_reg(struct target *target, int num)
        struct mips32_common *mips32 = target_to_mips32(target);
 
        if ((num < 0) || (num >= MIPS32NUMCOREREGS))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        reg_value = buf_get_u32(mips32->core_cache->reg_list[num].value, 0, 32);
        mips32->core_regs[num] = reg_value;
@@ -411,14 +411,14 @@ int mips32_run_algorithm(struct target *target, int num_mem_params,
                if (!reg)
                {
                        LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                if (reg->size != reg_params[i].size)
                {
                        LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size",
                                        reg_params[i].reg_name);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
 
                mips32_set_core_reg(reg, reg_params[i].value);
@@ -451,14 +451,14 @@ int mips32_run_algorithm(struct target *target, int num_mem_params,
                        if (!reg)
                        {
                                LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name);
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
 
                        if (reg->size != reg_params[i].size)
                        {
                                LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size",
                                                reg_params[i].reg_name);
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                        }
 
                        buf_set_u32(reg_params[i].value, 0, 32, buf_get_u32(reg->value, 0, 32));
index 7be96a4979aa4c8f193c5b828b9c9393da60426a..2a64372f72679ac513ab319570cdae28c8e142cc 100644 (file)
@@ -865,7 +865,7 @@ static int mips_m4k_read_memory(struct target *target, uint32_t address,
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
@@ -932,7 +932,7 @@ static int mips_m4k_write_memory(struct target *target, uint32_t address,
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
index 7763685db7548e9e4c5c3507d767e33bd6e4db09..eca69cf68629386effe2cc408c53a8b290baf737 100644 (file)
@@ -1074,7 +1074,7 @@ int target_register_event_callback(int (*callback)(struct target *target, enum t
 
        if (callback == NULL)
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (*callbacks_p)
@@ -1099,7 +1099,7 @@ int target_register_timer_callback(int (*callback)(void *priv), int time_ms, int
 
        if (callback == NULL)
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (*callbacks_p)
@@ -1137,7 +1137,7 @@ int target_unregister_event_callback(int (*callback)(struct target *target, enum
 
        if (callback == NULL)
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        while (c)
@@ -1164,7 +1164,7 @@ static int target_unregister_timer_callback(int (*callback)(void *priv), void *p
 
        if (callback == NULL)
        {
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        while (c)
@@ -1681,7 +1681,7 @@ int target_checksum_memory(struct target *target, uint32_t address, uint32_t siz
                if (buffer == NULL)
                {
                        LOG_ERROR("error allocating buffer for section (%d bytes)", (int)size);
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                retval = target_read_buffer(target, address, size, buffer);
                if (retval != ERROR_OK)
index 1fedfb222dd27e35eafb19db345f2645a432e0fd..387db2d6eeebba12ed5bd08029187af7a91dfed6 100644 (file)
@@ -168,7 +168,7 @@ static int add_debug_msg_receiver(struct command_context *cmd_ctx, struct target
        struct debug_msg_receiver **p = &target->dbgmsg;
 
        if (target == NULL)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        /* see if there's already a list */
        if (*p)
index 93074ee21c6c258a0a3e27d5231c49d926c2960d..46ed8a947ad16adc16b5a2585b39c6c40be6bc57 100644 (file)
@@ -250,7 +250,7 @@ static void xscale_getbuf(jtag_callback_data_t arg)
 static int xscale_receive(struct target *target, uint32_t *buffer, int num_words)
 {
        if (num_words == 0)
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        struct xscale_common *xscale = target_to_xscale(target);
        int retval = ERROR_OK;
@@ -577,7 +577,7 @@ static int xscale_send(struct target *target, const uint8_t *buffer, int count,
                        break;
                default:
                        LOG_ERROR("BUG: size neither 4, 2 nor 1");
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                jtag_add_dr_out(target->tap,
                                3,
@@ -840,7 +840,7 @@ static int xscale_arch_state(struct target *target)
        if (armv4_5->common_magic != ARM_COMMON_MAGIC)
        {
                LOG_ERROR("BUG: called for a non-ARMv4/5 target");
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        arm_arch_state(target);
@@ -1871,7 +1871,7 @@ static int xscale_read_memory(struct target *target, uint32_t address,
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
@@ -1911,7 +1911,7 @@ static int xscale_read_memory(struct target *target, uint32_t address,
                                break;
                        default:
                                LOG_ERROR("invalid read size");
-                               return ERROR_INVALID_ARGUMENTS;
+                               return ERROR_COMMAND_SYNTAX_ERROR;
                }
        }
 
@@ -1963,7 +1963,7 @@ static int xscale_write_memory(struct target *target, uint32_t address,
 
        /* sanitize arguments */
        if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
-               return ERROR_INVALID_ARGUMENTS;
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
                return ERROR_TARGET_UNALIGNED_ACCESS;
@@ -3513,7 +3513,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
           else if (strcmp("disable", CMD_ARGV[0]) == 0)
                  xscale->trace.mode = XSCALE_TRACE_DISABLED;
           else
-                 return ERROR_INVALID_ARGUMENTS;
+                 return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        if (CMD_ARGC >= 2 && xscale->trace.mode != XSCALE_TRACE_DISABLED)
@@ -3527,7 +3527,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
                  {
                         command_print(CMD_CTX, "fill buffer count must be > 0");
                         xscale->trace.mode = XSCALE_TRACE_DISABLED;
-                        return ERROR_INVALID_ARGUMENTS;
+                        return ERROR_COMMAND_SYNTAX_ERROR;
                  }
                  xscale->trace.buffer_fill = buffcount;
                  xscale->trace.mode = XSCALE_TRACE_FILL;
@@ -3537,7 +3537,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
           else
           {
                  xscale->trace.mode = XSCALE_TRACE_DISABLED;
-                 return ERROR_INVALID_ARGUMENTS;
+                 return ERROR_COMMAND_SYNTAX_ERROR;
           }
        }
        
@@ -3730,7 +3730,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
                        break;
                default:
                        command_print(CMD_CTX, "invalid register number");
-                       return ERROR_INVALID_ARGUMENTS;
+                       return ERROR_COMMAND_SYNTAX_ERROR;
                }
                reg = &xscale->reg_cache->reg_list[reg_no];