target: Implement generic multi-register read/write
This commit is contained in:
parent
19a8078f99
commit
20cad17ce3
|
@ -347,8 +347,26 @@ ssize_t target_reg_write(target *t, int reg, const void *data, size_t size)
|
||||||
return t->reg_write(t, reg, data, size);
|
return t->reg_write(t, reg, data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void target_regs_read(target *t, void *data) { t->regs_read(t, data); }
|
void target_regs_read(target *t, void *data)
|
||||||
void target_regs_write(target *t, const void *data) { t->regs_write(t, data); }
|
{
|
||||||
|
if (t->regs_read) {
|
||||||
|
t->regs_read(t, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (size_t x = 0, i = 0; x < t->regs_size; ) {
|
||||||
|
x += t->reg_read(t, i++, data + x, t->regs_size - x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void target_regs_write(target *t, const void *data)
|
||||||
|
{
|
||||||
|
if (t->regs_write) {
|
||||||
|
t->regs_write(t, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (size_t x = 0, i = 0; x < t->regs_size; ) {
|
||||||
|
x += t->reg_write(t, i++, data + x, t->regs_size - x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Halt/resume functions */
|
/* Halt/resume functions */
|
||||||
void target_reset(target *t) { t->reset(t); }
|
void target_reset(target *t) { t->reset(t); }
|
||||||
|
|
Loading…
Reference in New Issue