flash_command_get_bank_by_num: make COMMAND_HELPER
[openocd.git] / src / flash / str9xpec.c
index ad51cf191eb555fa84362b216247bccd39673400..4bf5bcaec49c12625af577143f50788c7460bc84 100644 (file)
@@ -28,9 +28,9 @@
 #include "arm7_9_common.h"
 
 
-static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last);
-static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector);
-static int str9xpec_write_options(struct flash_bank_s *bank);
+static int str9xpec_erase_area(struct flash_bank *bank, int first, int last);
+static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector);
+static int str9xpec_write_options(struct flash_bank *bank);
 
 int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state)
 {
@@ -81,7 +81,7 @@ static uint8_t str9xpec_isc_status(struct jtag_tap *tap)
        return status;
 }
 
-static int str9xpec_isc_enable(struct flash_bank_s *bank)
+static int str9xpec_isc_enable(struct flash_bank *bank)
 {
        uint8_t status;
        struct jtag_tap *tap;
@@ -108,7 +108,7 @@ static int str9xpec_isc_enable(struct flash_bank_s *bank)
        return ERROR_OK;
 }
 
-static int str9xpec_isc_disable(struct flash_bank_s *bank)
+static int str9xpec_isc_disable(struct flash_bank *bank)
 {
        uint8_t status;
        struct jtag_tap *tap;
@@ -137,7 +137,7 @@ static int str9xpec_isc_disable(struct flash_bank_s *bank)
        return ERROR_OK;
 }
 
-static int str9xpec_read_config(struct flash_bank_s *bank)
+static int str9xpec_read_config(struct flash_bank *bank)
 {
        struct scan_field field;
        uint8_t status;
@@ -166,7 +166,7 @@ static int str9xpec_read_config(struct flash_bank_s *bank)
        return status;
 }
 
-static int str9xpec_build_block_list(struct flash_bank_s *bank)
+static int str9xpec_build_block_list(struct flash_bank *bank)
 {
        struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv;
 
@@ -238,9 +238,9 @@ static int str9xpec_build_block_list(struct flash_bank_s *bank)
 FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command)
 {
        struct str9xpec_flash_controller *str9xpec_info;
-       armv4_5_common_t *armv4_5 = NULL;
+       struct arm *armv4_5 = NULL;
        struct arm7_9_common *arm7_9 = NULL;
-       arm_jtag_t *jtag_info = NULL;
+       struct arm_jtag *jtag_info = NULL;
 
        if (argc < 6)
        {
@@ -269,7 +269,7 @@ FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command)
        return ERROR_OK;
 }
 
-static int str9xpec_blank_check(struct flash_bank_s *bank, int first, int last)
+static int str9xpec_blank_check(struct flash_bank *bank, int first, int last)
 {
        struct scan_field field;
        uint8_t status;
@@ -336,7 +336,7 @@ static int str9xpec_blank_check(struct flash_bank_s *bank, int first, int last)
        return ERROR_OK;
 }
 
-static int str9xpec_protect_check(struct flash_bank_s *bank)
+static int str9xpec_protect_check(struct flash_bank *bank)
 {
        uint8_t status;
        int i;
@@ -358,7 +358,7 @@ static int str9xpec_protect_check(struct flash_bank_s *bank)
        return ERROR_OK;
 }
 
-static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last)
+static int str9xpec_erase_area(struct flash_bank *bank, int first, int last)
 {
        struct scan_field field;
        uint8_t status;
@@ -428,7 +428,7 @@ static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last)
        return status;
 }
 
-static int str9xpec_erase(struct flash_bank_s *bank, int first, int last)
+static int str9xpec_erase(struct flash_bank *bank, int first, int last)
 {
        int status;
 
@@ -440,7 +440,7 @@ static int str9xpec_erase(struct flash_bank_s *bank, int first, int last)
        return ERROR_OK;
 }
 
-static int str9xpec_lock_device(struct flash_bank_s *bank)
+static int str9xpec_lock_device(struct flash_bank *bank)
 {
        struct scan_field field;
        uint8_t status;
@@ -482,7 +482,7 @@ static int str9xpec_lock_device(struct flash_bank_s *bank)
        return status;
 }
 
-static int str9xpec_unlock_device(struct flash_bank_s *bank)
+static int str9xpec_unlock_device(struct flash_bank *bank)
 {
        uint8_t status;
 
@@ -491,7 +491,7 @@ static int str9xpec_unlock_device(struct flash_bank_s *bank)
        return status;
 }
 
-static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int last)
+static int str9xpec_protect(struct flash_bank *bank, int set, int first, int last)
 {
        uint8_t status;
        int i;
@@ -537,7 +537,7 @@ static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int l
        return ERROR_OK;
 }
 
-static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector)
+static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector)
 {
        struct jtag_tap *tap;
        struct scan_field field;
@@ -558,7 +558,7 @@ static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector)
        return ERROR_OK;
 }
 
-static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
+static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
 {
        struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv;
        uint32_t dwords_remaining = (count / 8);
@@ -721,7 +721,7 @@ static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o
        return ERROR_OK;
 }
 
-static int str9xpec_probe(struct flash_bank_s *bank)
+static int str9xpec_probe(struct flash_bank *bank)
 {
        return ERROR_OK;
 }
@@ -737,8 +737,8 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
        if (argc < 1)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -766,12 +766,12 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
        return ERROR_OK;
 }
 
-static int str9xpec_erase_check(struct flash_bank_s *bank)
+static int str9xpec_erase_check(struct flash_bank *bank)
 {
        return str9xpec_blank_check(bank, 0, bank->num_sectors - 1);
 }
 
-static int str9xpec_info(struct flash_bank_s *bank, char *buf, int buf_size)
+static int str9xpec_info(struct flash_bank *bank, char *buf, int buf_size)
 {
        snprintf(buf, buf_size, "str9xpec flash driver info");
        return ERROR_OK;
@@ -788,8 +788,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -833,7 +833,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
        return ERROR_OK;
 }
 
-static int str9xpec_write_options(struct flash_bank_s *bank)
+static int str9xpec_write_options(struct flash_bank *bank)
 {
        struct scan_field field;
        uint8_t status;
@@ -904,8 +904,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -927,8 +927,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -956,8 +956,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -985,8 +985,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1014,8 +1014,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1043,8 +1043,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1066,8 +1066,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1092,8 +1092,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1139,8 +1139,8 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
                return ERROR_OK;
        }
 
-       flash_bank_t *bank;
-       int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank);
+       struct flash_bank *bank;
+       int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 0, &bank);
        if (ERROR_OK != retval)
                return retval;
 
@@ -1163,9 +1163,9 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
        return ERROR_OK;
 }
 
-static int str9xpec_register_commands(struct command_context_s *cmd_ctx)
+static int str9xpec_register_commands(struct command_context *cmd_ctx)
 {
-       command_t *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec",
+       struct command *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec",
                        NULL, COMMAND_ANY, "str9xpec flash specific commands");
 
        register_command(cmd_ctx, str9xpec_cmd, "enable_turbo",

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)