target: Add new methods for read/write individual regs.

This commit is contained in:
Gareth McMullin 2017-09-28 14:36:12 +13:00 committed by UweBonnes
parent 71b8a4e081
commit 9f4cf4124e
3 changed files with 14 additions and 0 deletions

View File

@ -62,6 +62,8 @@ size_t target_regs_size(target *t);
const char *target_tdesc(target *t);
void target_regs_read(target *t, void *data);
void target_regs_write(target *t, const void *data);
ssize_t target_reg_read(target *t, int reg, void *data, size_t max);
ssize_t target_reg_write(target *t, int reg, const void *data, size_t size);
/* Halt/resume functions */
enum target_halt_reason {

View File

@ -337,6 +337,16 @@ int target_mem_write(target *t, target_addr dest, const void *src, size_t len)
}
/* Register access functions */
ssize_t target_reg_read(target *t, int reg, void *data, size_t max)
{
return t->reg_read(t, reg, data, max);
}
ssize_t target_reg_write(target *t, int reg, const void *data, size_t 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_write(target *t, const void *data) { t->regs_write(t, data); }

View File

@ -92,6 +92,8 @@ struct target_s {
const char *tdesc;
void (*regs_read)(target *t, void *data);
void (*regs_write)(target *t, const void *data);
ssize_t (*reg_read)(target *t, int reg, void *data, size_t max);
ssize_t (*reg_write)(target *t, int reg, const void *data, size_t size);
/* Halt/resume functions */
void (*reset)(target *t);