flash/nor: Use proper data types in driver API
[openocd.git] / src / flash / nor / niietcm4.c
index 7b67bb8ad24d719e321c3b6b7a87a735bd5f5340..1ab0a5a35d71812350472584f7b7a08b795233f2 100644 (file)
@@ -330,7 +330,8 @@ static int niietcm4_uflash_page_erase(struct flash_bank *bank, int page_num, int
 /**
  * Enable or disable protection of userflash pages
  */
-static int niietcm4_uflash_protect(struct flash_bank *bank, int mem_type, int set, int first, int last)
+static int niietcm4_uflash_protect(struct flash_bank *bank, int mem_type,
+               int set, unsigned int first, unsigned int last)
 {
        int retval;
        if (mem_type == INFO_MEM_TYPE) {
@@ -359,7 +360,7 @@ static int niietcm4_uflash_protect(struct flash_bank *bank, int mem_type, int se
                if (retval != ERROR_OK)
                        return retval;
                /* modify dump */
-               for (int i = first; i <= last; i++)     {
+               for (unsigned int i = first; i <= last; i++) {
                        uint32_t reg_num = i/8;
                        uint32_t bit_num = i%8;
                        if (set)
@@ -563,7 +564,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_erase_command)
                        return retval;
        }
 
-       command_print(CMD, "Erase %s userflash pages %d through %d done!", CMD_ARGV[0], first, last);
+       command_print(CMD, "Erase %s userflash pages %u through %u done!", CMD_ARGV[0], first, last);
 
        return retval;
 }
@@ -693,11 +694,11 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_command)
 
        int set;
        if (strcmp("on", CMD_ARGV[3]) == 0) {
-               command_print(CMD, "Try to enable %s userflash sectors %d through %d protection. Please wait ... ",
+               command_print(CMD, "Try to enable %s userflash sectors %u through %u protection. Please wait ... ",
                                                                CMD_ARGV[0], first, last);
                set = 1;
        } else if (strcmp("off", CMD_ARGV[3]) == 0) {
-               command_print(CMD, "Try to disable %s userflash sectors %d through %d protection. Please wait ... ",
+               command_print(CMD, "Try to disable %s userflash sectors %u through %u protection. Please wait ... ",
                                                                CMD_ARGV[0], first, last);
                set = 0;
        } else
@@ -1111,7 +1112,7 @@ static int niietcm4_protect_check(struct flash_bank *bank)
        } else {
                uflash_addr = BF_LOCK_ADDR;
                uflash_cmd = UFMC_MAGIC_KEY | UFMC_READ_IFB;
-               for (int i = 0; i < bank->num_sectors/8; i++) {
+               for (unsigned int i = 0; i < bank->num_sectors/8; i++) {
                        retval = target_write_u32(target, UFMA, uflash_addr);
                        if (retval != ERROR_OK)
                                return retval;
@@ -1163,7 +1164,8 @@ static int niietcm4_mass_erase(struct flash_bank *bank)
        return retval;
 }
 
-static int niietcm4_erase(struct flash_bank *bank, int first, int last)
+static int niietcm4_erase(struct flash_bank *bank, unsigned int first,
+               unsigned int last)
 {
        struct target *target = bank->target;
        struct niietcm4_flash_bank *niietcm4_info = bank->driver_priv;
@@ -1188,7 +1190,7 @@ static int niietcm4_erase(struct flash_bank *bank, int first, int last)
 
        /* erasing pages */
        unsigned int page_size = bank->size / bank->num_sectors;
-       for (int i = first; i <= last; i++) {
+       for (unsigned int i = first; i <= last; i++) {
                /* current page addr */
                flash_addr = i*page_size;
                retval = target_write_u32(target, FMA, flash_addr);
@@ -1211,7 +1213,8 @@ static int niietcm4_erase(struct flash_bank *bank, int first, int last)
        return retval;
 }
 
-static int niietcm4_protect(struct flash_bank *bank, int set, int first, int last)
+static int niietcm4_protect(struct flash_bank *bank, int set,
+               unsigned int first, unsigned int last)
 {
        struct target *target = bank->target;
        struct niietcm4_flash_bank *niietcm4_info = bank->driver_priv;
@@ -1251,7 +1254,7 @@ static int niietcm4_protect(struct flash_bank *bank, int set, int first, int las
                if (retval != ERROR_OK)
                        return retval;
                /* modify dump */
-               for (int i = first; i <= last; i++)     {
+               for (unsigned int i = first; i <= last; i++)    {
                        uint32_t reg_num = i/8;
                        uint32_t bit_num = i%8;
                        if (set)

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)