Change-Id: I17308f5237338ce468e5b86289a0634429deaaa9
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6201
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
jtag_execute_queue();
status = read_status(bank);
jtag_execute_queue();
status = read_status(bank);
- if (false == status.isc_mode) {
+ if (!status.isc_mode) {
LOG_ERROR("*** XCF: FAILED to enter ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
}
LOG_ERROR("*** XCF: FAILED to enter ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
}
struct xcf_status status = read_status(bank);
struct xcf_status status = read_status(bank);
- if (false == status.isc_mode)
return ERROR_OK;
else {
struct scan_field scan;
return ERROR_OK;
else {
struct scan_field scan;
alive_sleep(1); /* device needs 50 uS to leave ISC mode */
status = read_status(bank);
alive_sleep(1); /* device needs 50 uS to leave ISC mode */
status = read_status(bank);
- if (true == status.isc_mode) {
LOG_ERROR("*** XCF: FAILED to leave ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
}
LOG_ERROR("*** XCF: FAILED to leave ISC mode");
return ERROR_FLASH_OPERATION_FAILED;
}
scan.in_value = NULL;
jtag_add_dr_scan(bank->target->tap, 1, &scan, TAP_IDLE);
scan.in_value = NULL;
jtag_add_dr_scan(bank->target->tap, 1, &scan, TAP_IDLE);
return jtag_execute_queue();
else
return isc_wait_erase_program(bank, timeout_ms);
return jtag_execute_queue();
else
return isc_wait_erase_program(bank, timeout_ms);
scan.in_value = NULL;
jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
scan.in_value = NULL;
jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
return jtag_execute_queue();
else
return isc_wait_erase_program(bank, timeout_ms);
return jtag_execute_queue();
else
return isc_wait_erase_program(bank, timeout_ms);
reference[18] = 0xAA;
reference[19] = 0x66;
reference[18] = 0xAA;
reference[19] = 0x66;
- if (0 == memcmp(reference, buffer, L))
+ if (memcmp(reference, buffer, L) == 0)
return false;
else
return true;
return false;
else
return true;
- if ((write_flag) && (0 == offset) && (count >= XCF_PAGE_SIZE))
+ if ((write_flag) && (offset == 0) && (count >= XCF_PAGE_SIZE))
revbit = need_bit_reverse(w_buffer);
while (count > 0) {
revbit = need_bit_reverse(w_buffer);
while (count > 0) {
{
const struct xcf_priv *priv = bank->driver_priv;
{
const struct xcf_priv *priv = bank->driver_priv;
- if (false == priv->probed) {
snprintf(buf, buf_size, "\nXCF flash bank not probed yet\n");
return ERROR_OK;
}
snprintf(buf, buf_size, "\nXCF flash bank not probed yet\n");
return ERROR_OK;
}
struct xcf_priv *priv = bank->driver_priv;
uint32_t id;
struct xcf_priv *priv = bank->driver_priv;
uint32_t id;
- if (true == priv->probed)
free(bank->sectors);
priv->probed = false;
free(bank->sectors);
priv->probed = false;
}
bank->sectors = malloc(bank->num_sectors * sizeof(struct flash_sector));
}
bank->sectors = malloc(bank->num_sectors * sizeof(struct flash_sector));
- if (NULL == bank->sectors) {
+ if (bank->sectors == NULL) {
LOG_ERROR("No memory for sector table");
return ERROR_FAIL;
}
LOG_ERROR("No memory for sector table");
return ERROR_FAIL;
}
{
struct xcf_priv *priv = bank->driver_priv;
{
struct xcf_priv *priv = bank->driver_priv;
- if (true == priv->probed)
return ERROR_OK;
else
return xcf_probe(bank);
return ERROR_OK;
else
return xcf_probe(bank);