flash/nor/cfi: Use 'bool' data type

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>
This commit is contained in:
Marc Schink 2020-07-01 10:23:44 +02:00 committed by Antonio Borneo
parent 46238fabb9
commit f23525e5dd
3 changed files with 17 additions and 17 deletions

View 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) int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char **argv)
{ {
struct cfi_flash_bank *cfi_info; struct cfi_flash_bank *cfi_info;
int bus_swap = 0; bool bus_swap = false;
if (argc < 6) if (argc < 6)
return ERROR_COMMAND_SYNTAX_ERROR; 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; cfi_info->pri_ext = NULL;
bank->driver_priv = cfi_info; bank->driver_priv = cfi_info;
cfi_info->x16_as_x8 = 0; cfi_info->x16_as_x8 = false;
cfi_info->jedec_probe = 0; cfi_info->jedec_probe = false;
cfi_info->not_cfi = 0; cfi_info->not_cfi = false;
cfi_info->data_swap = 0; cfi_info->data_swap = false;
for (unsigned i = 6; i < argc; i++) { for (unsigned i = 6; i < argc; i++) {
if (strcmp(argv[i], "x16_as_x8") == 0) 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) 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) else if (strcmp(argv[i], "bus_swap") == 0)
bus_swap = 1; bus_swap = true;
else if (strcmp(argv[i], "jedec_probe") == 0) else if (strcmp(argv[i], "jedec_probe") == 0)
cfi_info->jedec_probe = 1; cfi_info->jedec_probe = true;
} }
if (bus_swap) if (bus_swap)
@ -2661,7 +2661,7 @@ int cfi_probe(struct flash_bank *bank)
/* query only if this is a CFI compatible flash, /* query only if this is a CFI compatible flash,
* otherwise the relevant info has already been filled in * otherwise the relevant info has already been filled in
*/ */
if (cfi_info->not_cfi == 0) { if (!cfi_info->not_cfi) {
/* enter CFI query mode /* enter CFI query mode
* according to JEDEC Standard No. 68.01, * according to JEDEC Standard No. 68.01,
* a single bus sequence with address = 0x55, data = 0x98 should put * 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; return ERROR_OK;
} }
if (cfi_info->not_cfi == 0) if (!cfi_info->not_cfi)
printed = snprintf(buf, buf_size, "\nCFI flash: "); printed = snprintf(buf, buf_size, "\nCFI flash: ");
else else
printed = snprintf(buf, buf_size, "\nnon-CFI flash: "); printed = snprintf(buf, buf_size, "\nnon-CFI flash: ");

View File

@ -23,13 +23,13 @@
#define CFI_STATUS_POLL_MASK_DQ6_DQ7 0xC0 /* DQ6..DQ7 */ #define CFI_STATUS_POLL_MASK_DQ6_DQ7 0xC0 /* DQ6..DQ7 */
struct cfi_flash_bank { struct cfi_flash_bank {
int x16_as_x8; bool x16_as_x8;
int jedec_probe; bool jedec_probe;
int not_cfi; bool not_cfi;
int probed; bool probed;
enum target_endianness endianness; enum target_endianness endianness;
int data_swap; bool data_swap;
uint16_t manufacturer; uint16_t manufacturer;
uint16_t device_id; uint16_t device_id;

View File

@ -487,7 +487,7 @@ void cfi_fixup_non_cfi(struct flash_bank *bank)
if (!non_cfi->mfr) if (!non_cfi->mfr)
return; return;
cfi_info->not_cfi = 1; cfi_info->not_cfi = true;
/* fill in defaults for non-critical data */ /* fill in defaults for non-critical data */
cfi_info->vcc_min = 0x0; cfi_info->vcc_min = 0x0;