rename flash and nand command helpers
authorZachary T Welch <zw@superlucidity.net>
Tue, 17 Nov 2009 21:07:36 +0000 (13:07 -0800)
committerZachary T Welch <zw@superlucidity.net>
Thu, 19 Nov 2009 21:39:41 +0000 (13:39 -0800)
After adding support for referencing banks by name, renames
the COMMAND_HELPERs appropriately:
flash_command_get_bank_by_num  -> flash_command_get_bank
nand_command_get_device_by_num -> flash_command_get_device

13 files changed:
src/flash/avrf.c
src/flash/flash.c
src/flash/flash.h
src/flash/lpc2000.c
src/flash/lpc2900.c
src/flash/nand.c
src/flash/nand.h
src/flash/pic32mx.c
src/flash/stellaris.c
src/flash/stm32x.c
src/flash/str7x.c
src/flash/str9x.c
src/flash/str9xpec.c

index 20c619d..356c404 100644 (file)
@@ -426,7 +426,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index 071503f..b960c64 100644 (file)
@@ -216,7 +216,7 @@ struct flash_bank *get_flash_bank_by_num(int num)
        return p;
 }
 
-COMMAND_HELPER(flash_command_get_bank_by_num, unsigned name_index,
+COMMAND_HELPER(flash_command_get_bank, unsigned name_index,
                struct flash_bank **bank)
 {
        const char *name = CMD_ARGV[name_index];
@@ -425,7 +425,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
        }
 
        struct flash_bank *p;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
@@ -513,7 +513,7 @@ COMMAND_HANDLER(handle_flash_protect_check_command)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        struct flash_bank *p;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
@@ -837,7 +837,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
        duration_start(&bench);
 
        struct flash_bank *p;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
index fb88c35..1235a41 100644 (file)
@@ -333,7 +333,7 @@ struct flash_bank *get_flash_bank_by_num(int num);
  * @param bank On output, contians a pointer to the bank or NULL.
  * @returns ERROR_OK on success, or an error indicating the problem.
  */
-COMMAND_HELPER(flash_command_get_bank_by_num, unsigned name_index,
+COMMAND_HELPER(flash_command_get_bank, unsigned name_index,
                struct flash_bank **bank);
 /**
  * Returns the flash bank like get_flash_bank_by_num(), without probing.
index 5442e71..b60c6cf 100644 (file)
@@ -749,7 +749,7 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index 1d5abd9..465d776 100644 (file)
@@ -544,7 +544,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -589,7 +589,7 @@ COMMAND_HANDLER(lpc2900_handle_read_custom_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -660,7 +660,7 @@ COMMAND_HANDLER(lpc2900_handle_password_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -695,7 +695,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -806,7 +806,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
 
        /* Get the bank descriptor */
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -905,7 +905,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
 
        /* Get the bank descriptor */
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index d812805..3518056 100644 (file)
@@ -322,7 +322,7 @@ struct nand_device *get_nand_device_by_num(int num)
        return NULL;
 }
 
-COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index,
+COMMAND_HELPER(nand_command_get_device, unsigned name_index,
                struct nand_device **nand)
 {
        const char *str = CMD_ARGV[name_index];
@@ -1100,7 +1100,7 @@ COMMAND_HANDLER(handle_nand_info_command)
        int last = -1;
 
        struct nand_device *p;
-       int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1175,7 +1175,7 @@ COMMAND_HANDLER(handle_nand_probe_command)
        }
 
        struct nand_device *p;
-       int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1204,7 +1204,7 @@ COMMAND_HANDLER(handle_nand_erase_command)
        }
 
        struct nand_device *p;
-       int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1263,7 +1263,7 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
        }
 
        struct nand_device *p;
-       int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1415,7 +1415,7 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        struct nand_device *nand;
-       int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &nand);
+       int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &nand);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1674,7 +1674,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)
        }
 
        struct nand_device *p;
-       int retval = CALL_COMMAND_HANDLER(nand_command_get_device_by_num, 0, &p);
+       int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p);
        if (ERROR_OK != retval)
                return retval;
 
index a108771..d38ed67 100644 (file)
@@ -239,7 +239,7 @@ int nand_register_commands(struct command_context *cmd_ctx);
 int nand_init(struct command_context *cmd_ctx);
 
 /// helper for parsing a nand device command argument string
-COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index,
+COMMAND_HELPER(nand_command_get_device, unsigned name_index,
                struct nand_device **nand);
 
 
index 4bfe91b..fa5a4d6 100644 (file)
@@ -684,7 +684,7 @@ COMMAND_HANDLER(pic32mx_handle_lock_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -730,7 +730,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -820,7 +820,7 @@ COMMAND_HANDLER(pic32mx_handle_chip_erase_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -858,7 +858,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
        COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 2, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 2, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index a18c99b..32fa415 100644 (file)
@@ -1139,7 +1139,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index 4db338d..c96b49d 100644 (file)
@@ -905,7 +905,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -951,7 +951,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -995,7 +995,7 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1051,7 +1051,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1160,7 +1160,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index da1899d..b79dd17 100644 (file)
@@ -618,7 +618,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index 50cddaf..3bb8970 100644 (file)
@@ -642,7 +642,7 @@ COMMAND_HANDLER(str9x_handle_flash_config_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
index de222fb..f7c705e 100644 (file)
@@ -738,7 +738,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -789,7 +789,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -905,7 +905,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -928,7 +928,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -957,7 +957,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -986,7 +986,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1015,7 +1015,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1044,7 +1044,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1067,7 +1067,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1093,7 +1093,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1140,7 +1140,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
        }
 
        struct flash_bank *bank;
-       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
        if (ERROR_OK != retval)
                return retval;