flash/nor: Use proper data types in driver API
[openocd.git] / src / flash / nor / at91sam3.c
index c9ffa653b314faf10a2ff61df43fe4ee537b9019..415f3932c0a0ce1c1dfe5594898ce8999db5b437 100644 (file)
@@ -3171,12 +3171,11 @@ static int sam3_GetDetails(struct sam3_bank_private *pPrivate)
 
 static int _sam3_probe(struct flash_bank *bank, int noise)
 {
-       unsigned x;
        int r;
        struct sam3_bank_private *pPrivate;
 
 
-       LOG_DEBUG("Begin: Bank: %d, Noise: %d", bank->bank_number, noise);
+       LOG_DEBUG("Begin: Bank: %u, Noise: %d", bank->bank_number, noise);
        if (bank->target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
                return ERROR_TARGET_NOT_HALTED;
@@ -3201,7 +3200,7 @@ static int _sam3_probe(struct flash_bank *bank, int noise)
                return r;
 
        /* update the flash bank size */
-       for (x = 0; x < SAM3_MAX_FLASH_BANKS; x++) {
+       for (unsigned int x = 0; x < SAM3_MAX_FLASH_BANKS; x++) {
                if (bank->base == pPrivate->pChip->details.bank[x].base_address) {
                        bank->size = pPrivate->pChip->details.bank[x].size_bytes;
                        break;
@@ -3216,7 +3215,7 @@ static int _sam3_probe(struct flash_bank *bank, int noise)
                }
                bank->num_sectors = pPrivate->nsectors;
 
-               for (x = 0; ((int)(x)) < bank->num_sectors; x++) {
+               for (unsigned int x = 0; x < bank->num_sectors; x++) {
                        bank->sectors[x].size = pPrivate->sector_size;
                        bank->sectors[x].offset = x * (pPrivate->sector_size);
                        /* mark as unknown */
@@ -3252,7 +3251,8 @@ static int sam3_auto_probe(struct flash_bank *bank)
        return _sam3_probe(bank, 0);
 }
 
-static int sam3_erase(struct flash_bank *bank, int first, int last)
+static int sam3_erase(struct flash_bank *bank, unsigned int first,
+               unsigned int last)
 {
        struct sam3_bank_private *pPrivate;
        int r;
@@ -3273,7 +3273,7 @@ static int sam3_erase(struct flash_bank *bank, int first, int last)
        if (!(pPrivate->probed))
                return ERROR_FLASH_BANK_NOT_PROBED;
 
-       if ((first == 0) && ((last + 1) == ((int)(pPrivate->nsectors)))) {
+       if ((first == 0) && ((last + 1) == pPrivate->nsectors)) {
                /* whole chip */
                LOG_DEBUG("Here");
                return FLASHD_EraseEntireBank(pPrivate);
@@ -3282,7 +3282,8 @@ static int sam3_erase(struct flash_bank *bank, int first, int last)
        return ERROR_OK;
 }
 
-static int sam3_protect(struct flash_bank *bank, int set, int first, int last)
+static int sam3_protect(struct flash_bank *bank, int set, unsigned int first,
+               unsigned int last)
 {
        struct sam3_bank_private *pPrivate;
        int r;
@@ -3298,9 +3299,9 @@ static int sam3_protect(struct flash_bank *bank, int set, int first, int last)
                return ERROR_FLASH_BANK_NOT_PROBED;
 
        if (set)
-               r = FLASHD_Lock(pPrivate, (unsigned)(first), (unsigned)(last));
+               r = FLASHD_Lock(pPrivate, first, last);
        else
-               r = FLASHD_Unlock(pPrivate, (unsigned)(first), (unsigned)(last));
+               r = FLASHD_Unlock(pPrivate, first, last);
        LOG_DEBUG("End: r=%d", r);
 
        return r;

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)