unsik Kim <donari75@gmail.com>:
[openocd.git] / src / flash / at91sam7.c
index ebc934273b337b54922ce7700dae8a159d28a71b..82e98ef4c74796f90e385d049712fad7f27b2acd 100644 (file)
 #include "config.h"
 #endif
 
-#include "replacements.h"
-
 #include "at91sam7.h"
-
-#include "flash.h"
-#include "target.h"
-#include "log.h"
 #include "binarybuffer.h"
-#include "types.h"
 
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 
 static int at91sam7_register_commands(struct command_context_s *cmd_ctx);
 static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
@@ -72,7 +62,7 @@ static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char
 
 flash_driver_t at91sam7_flash =
 {
-       .name = "at91sam7_new",
+       .name = "at91sam7",
        .register_commands = at91sam7_register_commands,
        .flash_bank_command = at91sam7_flash_bank_command,
        .erase = at91sam7_erase,
@@ -114,7 +104,7 @@ static long SRAMSIZ[16] = {
 
 static int at91sam7_register_commands(struct command_context_s *cmd_ctx)
 {
-       command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7_new", NULL, COMMAND_ANY, NULL);
+       command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL);
 
        register_command(cmd_ctx, at91sam7_cmd, "gpnvm", at91sam7_handle_gpnvm_command, COMMAND_EXEC,
                                        "at91sam7 gpnvm <bit> set|clear, set or clear one gpnvm bit");
@@ -322,11 +312,11 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank)
        u16 bnk, sec;
        u16 arch;
        u32 cidr;
-       u8 banks_num;
-       u16 num_nvmbits;
-       u16 sectors_num;
-       u16 pages_per_sector;
-       u16 page_size;
+       u8 banks_num = 0;
+       u16 num_nvmbits = 0;
+       u16 sectors_num = 0;
+       u16 pages_per_sector = 0;
+       u16 page_size = 0;
        u32 ext_freq;
        u32 bank_size;
        u32 base_address = 0;
@@ -675,7 +665,7 @@ static int at91sam7_erase_check(struct flash_bank_s *bank)
        for (nSector=0; nSector<bank->num_sectors; nSector++)
        {
                bank->sectors[nSector].is_erased = 1;
-               retval = target->type->read_memory(target, bank->base+bank->sectors[nSector].offset, 4,
+               retval = target_read_memory(target, bank->base+bank->sectors[nSector].offset, 4,
                        bank->sectors[nSector].size/4, buffer);
                if (retval != ERROR_OK)
                        return retval;
@@ -1037,7 +1027,7 @@ static int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32
                /* Write one block to the PageWriteBuffer */
                buffer_pos = (pagen-first_page)*dst_min_alignment;
                wcount = CEIL(count,4);
-               if((retval = target->type->write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK)
+               if((retval = target_write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK)
                {
                        return retval;
                }

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)