flash/nor: Use proper data types in driver API
[openocd.git] / src / flash / nor / tcl.c
index fb2053b89c61b580494f4ed504681e0f605d9bfd..3bdaf0b59dcded972ebdca45f32206cd67c038e2 100644 (file)
@@ -112,8 +112,8 @@ COMMAND_HANDLER(handle_flash_info_command)
                        LOG_INFO("Flash protection check is not implemented.");
 
                command_print(CMD,
-                       "#%d : %s at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32
-                       ", buswidth %i, chipwidth %i",
+                       "#%u : %s at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32
+                       ", buswidth %u, chipwidth %u",
                        p->bank_number,
                        p->driver->name,
                        p->base,
@@ -199,7 +199,6 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
        if (ERROR_OK != retval)
                return retval;
 
-       int j;
        retval = p->driver->erase_check(p);
        if (retval == ERROR_OK)
                command_print(CMD, "successfully checked erase state");
@@ -211,7 +210,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
                        p->base);
        }
 
-       for (j = 0; j < p->num_sectors; j++) {
+       for (unsigned int j = 0; j < p->num_sectors; j++) {
                char *erase_state;
 
                if (p->sectors[j].is_erased == 0)
@@ -325,7 +324,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
                return ERROR_FAIL;
        }
 
-       if (!(last <= (uint32_t)(p->num_sectors - 1))) {
+       if (!(last <= (p->num_sectors - 1))) {
                command_print(CMD, "ERROR: "
                        "last sector must be <= %" PRIu32,
                        p->num_sectors - 1);
@@ -339,7 +338,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
 
        if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
                command_print(CMD, "erased sectors %" PRIu32 " "
-                       "through %" PRIu32 " on flash bank %d "
+                       "through %" PRIu32 " on flash bank %u "
                        "in %fs", first, last, p->bank_number, duration_elapsed(&bench));
        }
 
@@ -1007,11 +1006,10 @@ COMMAND_HANDLER(handle_flash_verify_bank_command)
 void flash_set_dirty(void)
 {
        struct flash_bank *c;
-       int i;
 
        /* set all flash to require erasing */
        for (c = flash_bank_list(); c; c = c->next) {
-               for (i = 0; i < c->num_sectors; i++)
+               for (unsigned int i = 0; i < c->num_sectors; i++)
                        c->sectors[i].is_erased = 0;
        }
 }
@@ -1243,8 +1241,8 @@ COMMAND_HANDLER(handle_flash_bank_command)
        c->driver = driver;
        COMMAND_PARSE_NUMBER(target_addr, CMD_ARGV[1], c->base);
        COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], c->size);
-       COMMAND_PARSE_NUMBER(int, CMD_ARGV[3], c->chip_width);
-       COMMAND_PARSE_NUMBER(int, CMD_ARGV[4], c->bus_width);
+       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[3], c->chip_width);
+       COMMAND_PARSE_NUMBER(uint, CMD_ARGV[4], c->bus_width);
        c->default_padded_value = c->erased_value = 0xff;
        c->minimal_write_gap = FLASH_WRITE_GAP_SECTOR;
 

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)