summaryrefslogtreecommitdiff
path: root/src/target/embeddedice.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-11-17 09:06:45 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-11-17 09:06:45 -0800
commitf4788652e45662d1e43933dc0620561bc4cddae0 (patch)
tree0cda3c8b5ad766f3dea26d83c2a70b7cb52837d7 /src/target/embeddedice.c
parent959b373f8cdc2c1ad11c67c6916f88f48769438f (diff)
downloadopenocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.tar.gz
openocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.tar.bz2
openocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.tar.xz
openocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.zip
target: simplify register get/set ops
No need to indirect from registered integers to pointers. Just stash the pointers directly in the register struct, and don't even bother registering. This is a small code shrink, speeds register access just a smidgeon, and gets rid of another rude exit() path. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target/embeddedice.c')
-rw-r--r--src/target/embeddedice.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c
index 2e9f1c00..e375475b 100644
--- a/src/target/embeddedice.c
+++ b/src/target/embeddedice.c
@@ -143,8 +143,6 @@ static const struct {
};
-static int embeddedice_reg_arch_type = -1;
-
static int embeddedice_get_reg(struct reg *reg)
{
int retval;
@@ -157,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
@@ -174,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--;
@@ -202,7 +200,7 @@ embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9)
reg_list[i].valid = 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;
}