Make some error messages to be printed once

This commit is contained in:
Gleb Gagarin 2018-02-23 16:41:14 -08:00
parent e09dd62229
commit fb7009fc38
1 changed files with 16 additions and 3 deletions

View File

@ -383,7 +383,11 @@ static dmi_status_t dmi_scan(struct target *target, uint16_t *address_in,
int retval = jtag_execute_queue(); int retval = jtag_execute_queue();
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_INFO("dmi_scan failed jtag scan"); static int once = 1;
if (once) {
LOG_ERROR("dmi_scan failed jtag scan");
once = 0;
}
return DMI_STATUS_FAILED; return DMI_STATUS_FAILED;
} }
@ -418,13 +422,22 @@ static uint32_t dmi_read(struct target *target, uint16_t address)
} else if (status == DMI_STATUS_SUCCESS) { } else if (status == DMI_STATUS_SUCCESS) {
break; break;
} else { } else {
LOG_INFO("failed read from 0x%x, status=%d", address, status); static int once = 1;
if (once) {
LOG_ERROR("failed read from 0x%x, status=%d", address, status);
once = 0;
}
break; break;
} }
usleep(100000);
} }
if (status != DMI_STATUS_SUCCESS) { if (status != DMI_STATUS_SUCCESS) {
static int once = 1;
if (once) {
LOG_INFO("Failed read from 0x%x; status=%d", address, status); LOG_INFO("Failed read from 0x%x; status=%d", address, status);
once = 0;
}
return ~0; return ~0;
} }