flash/nor/cfi: Use 'bool' data type 38/5738/4
authorMarc Schink <dev@zapb.de>
Wed, 1 Jul 2020 08:23:44 +0000 (10:23 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Wed, 8 Jul 2020 21:05:52 +0000 (22:05 +0100)
Change-Id: I25198223175c26aded9ad667b802da09883e94ee
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5738
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/flash/nor/cfi.c
src/flash/nor/cfi.h
src/flash/nor/non_cfi.c

index 19fb6b2c2ceef95c5dfd5df522205230ec2cb613..9d2a53a6bc971c7d696f6060e22dd41cd7ef0399 100644 (file)
@@ -814,7 +814,7 @@ static int cfi_intel_info(struct flash_bank *bank, char *buf, int buf_size)
 int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char **argv)
 {
        struct cfi_flash_bank *cfi_info;
-       int bus_swap = 0;
+       bool bus_swap = false;
 
        if (argc < 6)
                return ERROR_COMMAND_SYNTAX_ERROR;
@@ -841,20 +841,20 @@ int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char **
        cfi_info->pri_ext = NULL;
        bank->driver_priv = cfi_info;
 
-       cfi_info->x16_as_x8 = 0;
-       cfi_info->jedec_probe = 0;
-       cfi_info->not_cfi = 0;
-       cfi_info->data_swap = 0;
+       cfi_info->x16_as_x8 = false;
+       cfi_info->jedec_probe = false;
+       cfi_info->not_cfi = false;
+       cfi_info->data_swap = false;
 
        for (unsigned i = 6; i < argc; i++) {
                if (strcmp(argv[i], "x16_as_x8") == 0)
-                       cfi_info->x16_as_x8 = 1;
+                       cfi_info->x16_as_x8 = true;
                else if (strcmp(argv[i], "data_swap") == 0)
-                       cfi_info->data_swap = 1;
+                       cfi_info->data_swap = true;
                else if (strcmp(argv[i], "bus_swap") == 0)
-                       bus_swap = 1;
+                       bus_swap = true;
                else if (strcmp(argv[i], "jedec_probe") == 0)
-                       cfi_info->jedec_probe = 1;
+                       cfi_info->jedec_probe = true;
        }
 
        if (bus_swap)
@@ -2661,7 +2661,7 @@ int cfi_probe(struct flash_bank *bank)
        /* query only if this is a CFI compatible flash,
         * otherwise the relevant info has already been filled in
         */
-       if (cfi_info->not_cfi == 0) {
+       if (!cfi_info->not_cfi) {
                /* enter CFI query mode
                 * according to JEDEC Standard No. 68.01,
                 * a single bus sequence with address = 0x55, data = 0x98 should put
@@ -3011,7 +3011,7 @@ int cfi_get_info(struct flash_bank *bank, char *buf, int buf_size)
                return ERROR_OK;
        }
 
-       if (cfi_info->not_cfi == 0)
+       if (!cfi_info->not_cfi)
                printed = snprintf(buf, buf_size, "\nCFI flash: ");
        else
                printed = snprintf(buf, buf_size, "\nnon-CFI flash: ");
index effa1d5c0d469f128be1e1c9ce1670b1e532ae54..eceb9a4b3c2895c523432bef4a71d8fee6a54955 100644 (file)
 #define CFI_STATUS_POLL_MASK_DQ6_DQ7     0xC0 /* DQ6..DQ7 */
 
 struct cfi_flash_bank {
-       int x16_as_x8;
-       int jedec_probe;
-       int not_cfi;
-       int probed;
+       bool x16_as_x8;
+       bool jedec_probe;
+       bool not_cfi;
+       bool probed;
 
        enum target_endianness endianness;
-       int data_swap;
+       bool data_swap;
 
        uint16_t manufacturer;
        uint16_t device_id;
index 851c0ae8193e1ddc6b6fea040c52e7458fbe7347..f44adba137e13ab15afa70cbaabbcca2183c4dc2 100644 (file)
@@ -487,7 +487,7 @@ void cfi_fixup_non_cfi(struct flash_bank *bank)
        if (!non_cfi->mfr)
                return;
 
-       cfi_info->not_cfi = 1;
+       cfi_info->not_cfi = true;
 
        /* fill in defaults for non-critical data */
        cfi_info->vcc_min = 0x0;

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)