summaryrefslogtreecommitdiff
path: root/src/target/xscale.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/xscale.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/xscale.c')
-rw-r--r--src/target/xscale.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/target/xscale.c b/src/target/xscale.c
index 742dd257..4c3945c5 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -134,8 +134,6 @@ static const struct xscale_reg xscale_reg_arch_info[] =
{-1, NULL}, /* TXRXCTRL implicit access via JTAG */
};
-static int xscale_reg_arch_type = -1;
-
/* convenience wrapper to access XScale specific registers */
static int xscale_set_reg_u32(struct reg *reg, uint32_t value)
{
@@ -2819,6 +2817,11 @@ static int xscale_analyze_trace(struct target *target, struct command_context *c
return ERROR_OK;
}
+static const struct reg_arch_type xscale_reg_type = {
+ .get = xscale_get_reg,
+ .set = xscale_set_reg,
+};
+
static void xscale_build_reg_cache(struct target *target)
{
struct xscale_common *xscale = target_to_xscale(target);
@@ -2831,10 +2834,6 @@ static void xscale_build_reg_cache(struct target *target)
(*cache_p) = armv4_5_build_reg_cache(target, armv4_5);
armv4_5->core_cache = (*cache_p);
- /* register a register arch-type for XScale dbg registers only once */
- if (xscale_reg_arch_type == -1)
- xscale_reg_arch_type = register_reg_arch_type(xscale_get_reg, xscale_set_reg);
-
(*cache_p)->next = malloc(sizeof(struct reg_cache));
cache_p = &(*cache_p)->next;
@@ -2852,7 +2851,7 @@ static void xscale_build_reg_cache(struct target *target)
(*cache_p)->reg_list[i].valid = 0;
(*cache_p)->reg_list[i].size = 32;
(*cache_p)->reg_list[i].arch_info = &arch_info[i];
- (*cache_p)->reg_list[i].arch_type = xscale_reg_arch_type;
+ (*cache_p)->reg_list[i].type = &xscale_reg_type;
arch_info[i] = xscale_reg_arch_info[i];
arch_info[i].target = target;
}