X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Fembeddedice.c;h=e375475bbf092a31046d91b061b2aa69e32077c0;hp=e73cb7f312e8245b1594dc81a1a4498291827fb4;hb=ec93209f51afc09e273a4742dc0b5f2cefc15e76;hpb=0f1163e823c6ca3c2a81fa296157f5dde0635fea diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index e73cb7f312..e375475bbf 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -28,8 +28,7 @@ #endif #include "embeddedice.h" - -#define ARRAY_SIZE(x) ((int)(sizeof(x)/sizeof((x)[0]))) +#include "register.h" /** * @file @@ -144,8 +143,6 @@ static const struct { }; -static int embeddedice_reg_arch_type = -1; - static int embeddedice_get_reg(struct reg *reg) { int retval; @@ -158,6 +155,11 @@ static int embeddedice_get_reg(struct reg *reg) return retval; } +static const struct reg_arch_type eice_reg_type = { + .get = embeddedice_get_reg, + .set = embeddedice_set_reg_w_exec, +}; + /** * Probe EmbeddedICE module and set up local records of its registers. * Different versions of the modules have different capabilities, such as @@ -175,11 +177,6 @@ embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9) int i; int eice_version = 0; - /* register arch-type for EmbeddedICE registers only once */ - if (embeddedice_reg_arch_type == -1) - embeddedice_reg_arch_type = register_reg_arch_type( - embeddedice_get_reg, embeddedice_set_reg_w_exec); - /* vector_catch isn't always present */ if (!arm7_9->has_vector_catch) num_regs--; @@ -201,11 +198,9 @@ embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9) reg_list[i].size = eice_regs[i].width; reg_list[i].dirty = 0; reg_list[i].valid = 0; - reg_list[i].bitfield_desc = NULL; - reg_list[i].num_bitfields = 0; reg_list[i].value = calloc(1, 4); reg_list[i].arch_info = &arch_info[i]; - reg_list[i].arch_type = embeddedice_reg_arch_type; + reg_list[i].type = &eice_reg_type; arch_info[i].addr = eice_regs[i].addr; arch_info[i].jtag_info = jtag_info; }