Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
|
f401f2304f | |
|
2ffa3f3382 | |
|
89481491a7 | |
|
bf22cae558 | |
|
e36a16701d |
|
@ -455,16 +455,28 @@ static uint64_t dbus_read(struct target *target, uint16_t address)
|
|||
dbus_status_t status;
|
||||
uint16_t address_in;
|
||||
|
||||
unsigned i = 0;
|
||||
do {
|
||||
status = dbus_scan(target, &address_in, &value, DBUS_OP_READ, address, 0);
|
||||
/* Assume dbus is idle and there aren't any busy/error states pending.
|
||||
* If there happens to be a busy state pending, we will clear it after we
|
||||
* discover it as part of the NOP scan. */
|
||||
for (unsigned i = 0; i < 256; i++) {
|
||||
status = dbus_scan(target, NULL, NULL, DBUS_OP_READ, address, 0);
|
||||
if (status == DBUS_STATUS_BUSY) {
|
||||
increase_dbus_busy_delay(target);
|
||||
continue;
|
||||
}
|
||||
status = dbus_scan(target, &address_in, &value, DBUS_OP_NOP, address, 0);
|
||||
if (status == DBUS_STATUS_BUSY)
|
||||
increase_dbus_busy_delay(target);
|
||||
} while (((status == DBUS_STATUS_BUSY) || (address_in != address)) &&
|
||||
i++ < 256);
|
||||
else if (address_in != address)
|
||||
LOG_ERROR("Tried to read from 0x%x, but actually read from 0x%x",
|
||||
address, address_in);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (status != DBUS_STATUS_SUCCESS)
|
||||
LOG_ERROR("failed read from 0x%x; value=0x%" PRIx64 ", status=%d\n", address, value, status);
|
||||
LOG_ERROR("failed read from 0x%x; value=0x%" PRIx64 ", status=%d",
|
||||
address, value, status);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -479,7 +491,7 @@ static void dbus_write(struct target *target, uint16_t address, uint64_t value)
|
|||
increase_dbus_busy_delay(target);
|
||||
}
|
||||
if (status != DBUS_STATUS_SUCCESS)
|
||||
LOG_ERROR("failed to write 0x%" PRIx64 " to 0x%x; status=%d\n", value, address, status);
|
||||
LOG_ERROR("failed to write 0x%" PRIx64 " to 0x%x; status=%d", value, address, status);
|
||||
}
|
||||
|
||||
/*** scans "class" ***/
|
||||
|
|
Loading…
Reference in New Issue