]> git.sur5r.net Git - openocd/commitdiff
Change return value on error.
authorMathias K <kesmtp@freenet.de>
Fri, 16 Dec 2011 06:48:39 +0000 (07:48 +0100)
committerØyvind Harboe <oyvindharboe@gmail.com>
Wed, 4 Jan 2012 17:56:46 +0000 (17:56 +0000)
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>
50 files changed:
src/flash/nand/davinci.c
src/flash/nand/lpc3180.c
src/flash/nand/lpc32xx.c
src/flash/nand/mx3.c
src/flash/nand/orion.c
src/flash/nor/at91sam3.c
src/flash/nor/at91sam7.c
src/flash/nor/avrf.c
src/flash/nor/cfi.c
src/flash/nor/ecos.c
src/flash/nor/em357.c
src/flash/nor/faux.c
src/flash/nor/fm3.c
src/flash/nor/kinetis.c
src/flash/nor/lpc2000.c
src/flash/nor/lpc288x.c
src/flash/nor/lpc2900.c
src/flash/nor/ocl.c
src/flash/nor/pic32mx.c
src/flash/nor/stellaris.c
src/flash/nor/stm32f1x.c
src/flash/nor/stm32f2x.c
src/flash/nor/stm32lx.c
src/flash/nor/stmsmi.c
src/flash/nor/str7x.c
src/flash/nor/str9x.c
src/flash/nor/str9xpec.c
src/flash/nor/tms470.c
src/flash/nor/virtual.c
src/hello.c
src/helper/ioutil.c
src/jtag/drivers/at91rm9200.c
src/jtag/drivers/buspirate.c
src/jtag/drivers/ft2232.c
src/jtag/drivers/parport.c
src/jtag/drivers/presto.c
src/jtag/drivers/ulink.c
src/jtag/drivers/vsllink.c
src/pld/pld.c
src/pld/virtex2.c
src/target/arm920t.c
src/target/armv4_5.c
src/target/etm.c
src/target/mips32.c
src/target/mips_m4k.c
src/target/oocd_trace.c
src/target/target.c
src/target/target_request.c
src/target/xscale.c
src/xsvf/xsvf.c

index b7fe66eab97c2c8011f9d24171915fb42e989f02..e12fc46104692063c59aa70a1d150bb9f1a28a17 100644 (file)
@@ -689,10 +689,7 @@ NAND_DEVICE_COMMAND_HANDLER(davinci_nand_device_command)
         * 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);
@@ -783,6 +780,7 @@ fail:
 
 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,
index f196af79980c3bf6f80b8a5515834e4177633df6..9d8cbae176bd379891b0aa58f2ed6d0b8b8e2398 100644 (file)
@@ -45,8 +45,7 @@ NAND_DEVICE_COMMAND_HANDLER(lpc3180_nand_device_command)
 {
        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;
index ffb322c2dabc3b16f1e631ae3ce17203b22f5c32..addc323b132599ce5d6be7de8b1e413cd3ae7d84 100644 (file)
@@ -75,8 +75,7 @@ static dmac_ll_t dmalist[(2048/256) * 2 + 1];
 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;
index 45591e3930f4692fc7c6a9a05d4fcffb94be9a0a..54ba1f9b719dbfc64ee981d9dff97492c4db42dc 100644 (file)
@@ -76,8 +76,7 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command)
 
        if (CMD_ARGC < 3)
        {
-           LOG_ERROR ("use \"nand device imx31 target noecc|hwecc\"");
-           return ERROR_FAIL;
+           return ERROR_COMMAND_SYNTAX_ERROR;
        }
        /*
        * check hwecc requirements
@@ -851,6 +850,7 @@ static int do_data_output (struct nand_device *nand)
 
 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,
index 5b0c9642f1843f0f8e276539d492ba8e8640400e..e6a33eb680c7b35d9a699e73f51f07755abe4701 100644 (file)
@@ -121,8 +121,7 @@ NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command)
        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));
@@ -156,6 +155,7 @@ static int orion_nand_init(struct nand_device *nand)
 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,
index a5fbd43ab0a7ef61c8a25278570d148e9b41482a..dac901ecd54d5e20422169b54dc910ff0a5b5ce9 100644 (file)
@@ -3117,7 +3117,6 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)
 
        switch (CMD_ARGC) {
        default:
-               command_print(CMD_CTX,"Too many parameters\n");
                return ERROR_COMMAND_SYNTAX_ERROR;
                break;
        case 0:
index 74d9ba3d9c7074af2d7c513c51e3d8bd4bcfacb3..2b822b7d2d703b473180932de2be61f6c83a4df5 100644 (file)
@@ -1203,8 +1203,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
 
        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);
@@ -1295,6 +1294,7 @@ static const struct command_registration at91sam7_command_handlers[] = {
 
 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,
index 5a2482e4ecedf2f1ad25275357d55ab286530cf9..1ade45267deffd78d778b464e5e592406137a134 100644 (file)
@@ -191,8 +191,7 @@ FLASH_BANK_COMMAND_HANDLER(avrf_flash_bank_command)
 
        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));
@@ -451,8 +450,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "avr mass_erase <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -482,6 +480,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
 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",
index a4092b62adf1af060203d9d4cc2958795e271aa9..98633795529be15d8491039584654641a87e6217 100644 (file)
@@ -818,8 +818,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command)
 
        if (CMD_ARGC < 6)
        {
-               LOG_WARNING("incomplete flash_bank cfi configuration");
-               return ERROR_FLASH_BANK_INVALID;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        /* both widths must:
index c850f4f9c26d484c46bb1813af099d5d8644432f..cae89358db529a6b7f363718c38e4e2bd83d6e89 100644 (file)
@@ -111,8 +111,7 @@ FLASH_BANK_COMMAND_HANDLER(ecosflash_flash_bank_command)
 
        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));
index c400187d1b78a0ec2fc87c8b85b8207db7dcbe27..c045d57740970fdc399077b475d6caf4db8f4ef2 100644 (file)
@@ -104,8 +104,7 @@ FLASH_BANK_COMMAND_HANDLER(em357_flash_bank_command)
 
        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));
@@ -768,8 +767,7 @@ COMMAND_HANDLER(em357_handle_lock_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "em357 lock <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -813,8 +811,7 @@ COMMAND_HANDLER(em357_handle_unlock_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "em357 unlock <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -892,8 +889,7 @@ COMMAND_HANDLER(em357_handle_mass_erase_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "em357 mass_erase <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -923,23 +919,23 @@ COMMAND_HANDLER(em357_handle_mass_erase_command)
 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
index 92851ed0c34b67c03e43a1857f0b9a3377c4cfb8..75ea9d60f2cd2a0254b8c70339fe670eef5ba367 100644 (file)
@@ -44,8 +44,7 @@ FLASH_BANK_COMMAND_HANDLER(faux_flash_bank_command)
 
        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));
index e852589bdf21ecbcfb3ba87e1dce2ae73d68a541..78e71d2902cbbf82bade405c871dde9992289711 100644 (file)
@@ -69,8 +69,7 @@ FLASH_BANK_COMMAND_HANDLER(fm3_flash_bank_command)
 
        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));
@@ -847,8 +846,7 @@ COMMAND_HANDLER(fm3_handle_chip_erase_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "fm3 chip_erase <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -875,9 +873,9 @@ COMMAND_HANDLER(fm3_handle_chip_erase_command)
 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
index 1897549804eff51650e5b7fdda45c5f9d0d690b7..0cfbd7adaa033ac923f61ce2dea7474a667bf904 100644 (file)
@@ -70,9 +70,7 @@ FLASH_BANK_COMMAND_HANDLER(kinetis_flash_bank_command)
        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);
index b639d1ef55f695888ff585061be352bcc9a104a8..b4e17e7eabecc2f54d12518f1964fa3fc6a444e6 100644 (file)
@@ -481,8 +481,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command)
 
        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));
index 589527f735c060f60ecfe12a1872c451b93c10b6..d5fde9487e50f58a47d913018dcfa55613ceae6b 100644 (file)
@@ -184,8 +184,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command)
 
        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));
index 7bb9f141b28a9310b327b180ae13ca5b0a72753a..4960e9c6be7ab8992c1133d7eb6f0a90098a777f 100644 (file)
@@ -542,8 +542,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command)
 
        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;
@@ -954,9 +953,9 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
 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.",
        },
        {
@@ -1017,8 +1016,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command)
 
        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));
index 6c609239b3c9e75cc56676e869a85e0acf7fd245..2dd4f52185ad0b129bed17366c8459968801f400 100644 (file)
@@ -51,8 +51,7 @@ FLASH_BANK_COMMAND_HANDLER(ocl_flash_bank_command)
 
        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);
index 65d93ad40e1b8188180dbae9a9207f15c8824dda..957bfc2a5153b86a90c7c736c1e87b9a16118762 100644 (file)
@@ -172,8 +172,7 @@ FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command)
 
        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));
@@ -737,8 +736,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
 
        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);
@@ -781,7 +779,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
        if (CMD_ARGC < 1)
        {
                command_print(CMD_CTX, "pic32mx unlock <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -837,6 +835,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
 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",
index 7351aed950726f38b8dd3bf403f4edf12ccb88cb..c855995f7d8129377f4efc0ee291f9f67bc73800 100644 (file)
@@ -438,8 +438,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command)
 
        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);
@@ -1351,8 +1350,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "stellaris mass_erase <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1439,9 +1437,9 @@ done:
 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",
        },
        {
index 8e0fda7e8a43118b494141d2b4f1f4eb6be117a9..5d9da90351c16e024a62c91d0601e469f9d82374 100644 (file)
@@ -130,8 +130,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command)
 
        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));
@@ -1329,8 +1328,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "stm32x lock <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1378,8 +1376,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "stm32x unlock <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1426,8 +1423,7 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "stm32x options_read <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1496,9 +1492,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
 
        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;
@@ -1631,8 +1625,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "stm32x mass_erase <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
index 7c07c5365abd74e1c289ce9c4c0d3253428feff4..ec5527bcdf136ca844d1f1ff6011c29be97da65d 100644 (file)
@@ -165,8 +165,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command)
 
        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));
index 32b3315d843c259f88a3d38b7c5f6f8d2cf7f9c7..8a6ad7bcb3a04e8120401c7a87ae7d1dd8d10d42 100644 (file)
@@ -130,8 +130,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32lx_flash_bank_command)
        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
index bfec789452f2b52c60a0c7da9812c5c0e1f60ff7..df8dbe757ce1aebb5ad2091c2935ae3fe4e1aef9 100644 (file)
@@ -206,8 +206,7 @@ FLASH_BANK_COMMAND_HANDLER(stmsmi_flash_bank_command)
 
        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));
index 0084c67f79801597f810858f0a5b37ef826cf83d..91ef77b709bf2b6585d5651df6121ce5df9acf6a 100644 (file)
@@ -208,8 +208,7 @@ FLASH_BANK_COMMAND_HANDLER(str7x_flash_bank_command)
 
        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));
@@ -786,8 +785,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "str7x disable_jtag <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -849,6 +847,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
 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",
index 63cfd18f70f511299d77915d8ae1cc135b79e3d1..5bea2068c523f95c30ff8bf3094e0bed7dc3882a 100644 (file)
@@ -158,8 +158,7 @@ FLASH_BANK_COMMAND_HANDLER(str9x_flash_bank_command)
 
        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));
index c06e6d163dd707c1c9db3e259a1f54712fe0f248..6fa66a09ca8300e8786d5a2e14daa06d08fd8192 100644 (file)
@@ -292,8 +292,7 @@ FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command)
 
        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));
@@ -825,8 +824,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "str9xpec options_read <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -939,8 +937,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "str9xpec options_write <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -966,8 +963,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command)
 
        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;
@@ -995,8 +991,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command)
 
        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;
@@ -1024,8 +1019,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command)
 
        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;
@@ -1053,8 +1047,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command)
 
        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;
@@ -1082,8 +1075,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "str9xpec lock <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1105,8 +1097,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "str9xpec unlock <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1135,8 +1126,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "str9xpec enable_turbo <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1182,8 +1172,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "str9xpec disable_turbo <bank>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        struct flash_bank *bank;
@@ -1213,60 +1202,70 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
 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",
index bf708be2d90d889a4c277dfb1bf4aa2e048f7349..b28aee434625ce86e692b18cf003a76cc6ef43ca 100644 (file)
@@ -313,7 +313,6 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
 {
        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)
@@ -377,7 +376,6 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
 {
        if (CMD_ARGC > 1)
        {
-               command_print(CMD_CTX, "tms470 osc_megahertz <MHz>");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
        else if (CMD_ARGC == 1)
@@ -406,7 +404,6 @@ COMMAND_HANDLER(tms470_handle_plldis_command)
 {
        if (CMD_ARGC > 1)
        {
-               command_print(CMD_CTX, "tms470 plldis <0 | 1>");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
        else if (CMD_ARGC == 1)
@@ -840,18 +837,21 @@ static int tms470_erase_sector(struct flash_bank *bank, int sector)
 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>",
index e91dfc78411cf3801ee78707f37afa27fb9a4aa1..f1e84c29e0204b03a349063f74ba58f763702eae 100644 (file)
@@ -55,8 +55,7 @@ FLASH_BANK_COMMAND_HANDLER(virtual_flash_bank_command)
 {
        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 */
index d3fce3dc58821b23a2046b3b9dcf51305244b4c4..6584aa20db612dcca11c774f97ee5112f6651e40 100644 (file)
@@ -26,7 +26,6 @@ COMMAND_HANDLER(handle_foo_command)
 {
        if (CMD_ARGC < 1 || CMD_ARGC > 2)
        {
-               LOG_ERROR("%s: incorrect number of arguments", CMD_NAME);
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
@@ -82,7 +81,6 @@ static COMMAND_HELPER(handle_hello_args, const char **sep, const char **name)
 {
        if (CMD_ARGC > 1)
        {
-               LOG_ERROR("%s: too many arguments", CMD_NAME);
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
        if (1 == CMD_ARGC)
index 3754fc5cf4c8be055d136fcb00a8f3e26bb806f4..8dc70312afcd8876e78738e9b155245e23994e9d 100644 (file)
@@ -117,7 +117,6 @@ COMMAND_HANDLER(handle_cat_command)
 {
        if (CMD_ARGC != 1)
        {
-               command_print(CMD_CTX, "cat <filename>");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
@@ -143,7 +142,6 @@ COMMAND_HANDLER(handle_trunc_command)
 {
        if (CMD_ARGC != 1)
        {
-               command_print(CMD_CTX, "trunc <filename>");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
@@ -162,7 +160,6 @@ COMMAND_HANDLER(handle_meminfo_command)
 
        if (CMD_ARGC != 0)
        {
-               command_print(CMD_CTX, "meminfo");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
@@ -184,8 +181,6 @@ COMMAND_HANDLER(handle_append_command)
 {
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX,
-                               "append <filename> [<string1>, [<string2>, ...]]");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
@@ -644,7 +639,7 @@ static const struct command_registration ioutil_command_handlers[] = {
                .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",
index f7494fe3705529cbd916542d986d986e80401708..6d0dface23a81abe5fa44fb17e29707fa28d471e 100644 (file)
@@ -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)
index 41e3e19412366ccb7514350c612439623203a53c..f3edc8a52ba52a003493324266a59d9ade6d3cb1 100644 (file)
@@ -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",
index 73aea01f673a0830bf6792f6e64ccee86696b3a8..4b9bdef7dd5ae789faa4796f38fda6412f19f3ce 100644 (file)
@@ -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;
index ad07791de3dc691ca5365c93208d37576a10ded6..ec175fa9386928fdeba51e3542474bfa2eac039a 100644 (file)
@@ -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);
index 4bee67dcc73ef3eeff28d79ebfe55bf1d6cbc6f3..0de48ffd88a3734c63c687ca35adf85e7e9d7426 100644 (file)
@@ -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;
index 73f1523f384a76aa8e2fe9fa681eef947e10aa34..5c58da355c2f6f23fbc0eee10e5c749259d4d827 100644 (file)
@@ -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]);
 
index e39a4d627902baa0bc71af4bd60bcd698e5f788f..fe7bdb2414dc4965a6d90e24e655e6058c0b881f 100644 (file)
@@ -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],
index 90067e34a6fc397f9a436a2e5370c5b6350b3ec2..b2623613e02bdeef5ca180e8f36707af872878d4 100644 (file)
@@ -63,8 +63,7 @@ COMMAND_HANDLER(handle_pld_device_command)
 
        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++)
@@ -155,8 +154,7 @@ COMMAND_HANDLER(handle_pld_load_command)
 
        if (CMD_ARGC < 2)
        {
-               command_print(CMD_CTX, "usage: pld load <device#> <file>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        unsigned dev_id;
index fdaeb61ebf09fad74e6de8c4267fc7adb2265ad8..f4aed34f50826736824bc1275237dd29e8d30903 100644 (file)
@@ -179,8 +179,7 @@ COMMAND_HANDLER(virtex2_handle_read_stat_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "usage: virtex2 read_stat <num>");
-               return ERROR_OK;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        unsigned dev_id;
@@ -207,8 +206,7 @@ PLD_DEVICE_COMMAND_HANDLER(virtex2_pld_device_command)
 
        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]);
index f057d7b9b485eb3e101cfb221a354127955d47ab..1357820a9a14a2c9b023428ec750ec1fbeab5cec 100644 (file)
@@ -904,8 +904,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command)
 
        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)
@@ -1199,8 +1198,7 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command)
 
        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)
@@ -1650,8 +1648,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
        }
        else
        {
-               command_print(CMD_CTX,
-                       "usage: arm920t cp15i <opcode> [value] [address]");
+           return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
index d59ab5c7f389656956d9b08216fa81e8b21ec687..706733d2110201b35209c222daee7def898fe4f5 100644 (file)
@@ -784,10 +784,8 @@ COMMAND_HANDLER(handle_arm_disassemble_command)
                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) {
index cd50e44d511d09bdebdf03a1849086e9f16f1309..27983698f866f555eac13b4b6f1535737e2b13c2 100644 (file)
@@ -1268,13 +1268,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
                                &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;
        }
 
        /**
@@ -1738,8 +1732,7 @@ COMMAND_HANDLER(handle_etm_image_command)
 
        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);
@@ -1799,8 +1792,7 @@ COMMAND_HANDLER(handle_etm_dump_command)
 
        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);
@@ -1866,8 +1858,7 @@ COMMAND_HANDLER(handle_etm_load_command)
 
        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);
@@ -2206,7 +2197,7 @@ static const struct command_registration etm_exec_command_handlers[] = {
                .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",
index 80dfb1944fbaaac1ea6c646c89eb54a540e26d76..d9d84b729b128fdc54311f70858d01a45327c41c 100644 (file)
@@ -797,7 +797,7 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
        /* 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
        {
index 2a64372f72679ac513ab319570cdae28c8e142cc..4546093f216c4d5b9f866b7b91433641cd712e1d 100644 (file)
@@ -1140,7 +1140,7 @@ COMMAND_HANDLER(mips_m4k_handle_cp0_command)
        /* 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
        {
index 5af1ba65098ee7ff038f25c4942669b08ba91aeb..d2ed4fef414d9db14ca2259c0f9d4985b4caf574 100644 (file)
@@ -284,8 +284,7 @@ COMMAND_HANDLER(handle_oocd_trace_config_command)
 
        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);
@@ -400,7 +399,7 @@ static const struct command_registration oocd_trace_all_command_handlers[] = {
                .name = "config",
                .handler = handle_oocd_trace_config_command,
                .mode = COMMAND_CONFIG,
-               .usage = "target",
+               .usage = "<target> <tty>",
        },
        {
                .name = "status",
index eca69cf68629386effe2cc408c53a8b290baf737..692b78f8b10304428ed735406c3717ceaf1f66d9 100644 (file)
@@ -2246,9 +2246,7 @@ COMMAND_HANDLER(handle_reg_command)
                return ERROR_OK;
        }
 
-       command_print(CMD_CTX, "usage: reg <#|name> [value]");
-
-       return ERROR_OK;
+       return ERROR_COMMAND_SYNTAX_ERROR;
 }
 
 COMMAND_HANDLER(handle_poll_command)
@@ -2295,7 +2293,6 @@ COMMAND_HANDLER(handle_wait_halt_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)
@@ -3155,7 +3152,6 @@ COMMAND_HANDLER(handle_bp_command)
                        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;
        }
 }
@@ -3235,8 +3231,6 @@ COMMAND_HANDLER(handle_wp_command)
                break;
 
        default:
-               command_print(CMD_CTX, "usage: wp [address length "
-                               "[(r|w|a) [value [mask]]]]");
                return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
index 387db2d6eeebba12ed5bd08029187af7a91dfed6..c669ab4ab1c239beed3fb94a34b6e34b05159ae6 100644 (file)
@@ -302,7 +302,7 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command)
                }
                else
                {
-                       command_print(CMD_CTX, "usage: target_request debugmsgs ['enable'|'disable'|'charmsg']");
+                   return ERROR_COMMAND_SYNTAX_ERROR;
                }
        }
 
index 46ed8a947ad16adc16b5a2585b39c6c40be6bc57..484cdceafdf523fa3d57d68300ffd2819ed298e7 100644 (file)
@@ -3212,8 +3212,7 @@ COMMAND_HANDLER(xscale_handle_debug_handler_command)
 
        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)
@@ -3416,7 +3415,7 @@ COMMAND_HANDLER(xscale_handle_vector_catch_command)
 
        if (CMD_ARGC < 1)
        {
-               command_print(CMD_CTX, "usage: xscale vector_catch [mask]");
+           return ERROR_COMMAND_SYNTAX_ERROR;
        }
        else
        {
@@ -3483,7 +3482,7 @@ COMMAND_HANDLER(xscale_handle_vector_table_command)
        }
 
        if (err)
-               command_print(CMD_CTX, "usage: xscale vector_table <high|low> <index> <code>");
+               return ERROR_COMMAND_SYNTAX_ERROR;
 
        return ERROR_OK;
 }
@@ -3569,8 +3568,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command)
 
        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);
@@ -3629,8 +3627,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
 
        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;
@@ -3763,7 +3760,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
        }
        else
        {
-               command_print(CMD_CTX, "usage: cp15 [register]<, [value]>");
+           return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        return ERROR_OK;
@@ -3859,7 +3856,7 @@ static const struct command_registration xscale_any_command_handlers[] = {
                .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",
index 14b9e28d89c56a7a00c6e379a74921599ec429aa..9fda8e382ddcfbf316da376643e2c686c68b756f 100644 (file)
@@ -221,8 +221,7 @@ COMMAND_HANDLER(handle_xsvf_command)
 
        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 */