flash/nor: Use proper data types in driver API
[openocd.git] / src / flash / nor / xmc1xxx.c
index 75897719077ac2eef68e149124fefc60c79548fa..eda1823f9834fa9ea855373ecc7379c80817593e 100644 (file)
@@ -76,19 +76,20 @@ static int xmc1xxx_nvm_check_idle(struct target *target)
        return retval;
 }
 
-static int xmc1xxx_erase(struct flash_bank *bank, int first, int last)
+static int xmc1xxx_erase(struct flash_bank *bank, unsigned int first,
+               unsigned int last)
 {
        struct target *target = bank->target;
        struct working_area *workarea;
        struct reg_param reg_params[3];
        struct armv7m_algorithm armv7m_algo;
        unsigned i;
-       int retval, sector;
+       int retval;
        const uint8_t erase_code[] = {
 #include "../../../contrib/loaders/flash/xmc1xxx/erase.inc"
        };
 
-       LOG_DEBUG("Infineon XMC1000 erase sectors %d to %d", first, last);
+       LOG_DEBUG("Infineon XMC1000 erase sectors %u to %u", first, last);
 
        if (bank->target->state != TARGET_HALTED) {
                LOG_WARNING("Cannot communicate... target not halted.");
@@ -139,7 +140,7 @@ static int xmc1xxx_erase(struct flash_bank *bank, int first, int last)
                goto err_run;
        }
 
-       for (sector = first; sector <= last; sector++)
+       for (unsigned int sector = first; sector <= last; sector++)
                bank->sectors[sector].is_erased = 1;
 
 err_run:
@@ -161,7 +162,7 @@ static int xmc1xxx_erase_check(struct flash_bank *bank)
        struct armv7m_algorithm armv7m_algo;
        uint16_t val;
        unsigned i;
-       int retval, sector;
+       int retval;
        const uint8_t erase_check_code[] = {
 #include "../../../contrib/loaders/flash/xmc1xxx/erase_check.inc"
        };
@@ -192,7 +193,7 @@ static int xmc1xxx_erase_check(struct flash_bank *bank)
 
        buf_set_u32(reg_params[0].value, 0, 32, NVM_BASE);
 
-       for (sector = 0; sector < bank->num_sectors; sector++) {
+       for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {
                uint32_t start = bank->base + bank->sectors[sector].offset;
                buf_set_u32(reg_params[1].value, 0, 32, start);
                buf_set_u32(reg_params[2].value, 0, 32, start + bank->sectors[sector].size);
@@ -379,7 +380,8 @@ err_alloc_code:
 static int xmc1xxx_protect_check(struct flash_bank *bank)
 {
        uint32_t nvmconf;
-       int i, num_protected, retval;
+       unsigned int num_protected;
+       int retval;
 
        if (bank->target->state != TARGET_HALTED) {
                LOG_WARNING("Cannot communicate... target not halted.");
@@ -395,7 +397,7 @@ static int xmc1xxx_protect_check(struct flash_bank *bank)
 
        num_protected = (nvmconf >> 4) & 0xff;
 
-       for (i = 0; i < bank->num_sectors; i++)
+       for (unsigned int i = 0; i < bank->num_sectors; i++)
                bank->sectors[i].is_protected = (i < num_protected) ? 1 : 0;
 
        return ERROR_OK;
@@ -442,7 +444,7 @@ static int xmc1xxx_probe(struct flash_bank *bank)
        struct xmc1xxx_flash_bank *xmc_bank = bank->driver_priv;
        uint32_t flash_addr = bank->base;
        uint32_t idchip, flsize;
-       int i, retval;
+       int retval;
 
        if (xmc_bank->probed)
                return ERROR_OK;
@@ -475,7 +477,7 @@ static int xmc1xxx_probe(struct flash_bank *bank)
        bank->size = bank->num_sectors * 4 * 1024;
        bank->sectors = calloc(bank->num_sectors,
                               sizeof(struct flash_sector));
-       for (i = 0; i < bank->num_sectors; i++) {
+       for (unsigned int i = 0; i < bank->num_sectors; i++) {
                if (i == 0) {
                        bank->sectors[i].size = 0x200;
                        bank->sectors[i].offset = 0xE00;

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)