summaryrefslogtreecommitdiff
path: root/src/target/cortex_m3.c
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-16 03:29:30 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-16 09:58:11 -0800
commitdc1685ca25567fe75c8d50c825fb0303fbb66fac (patch)
treee51e63fe1e40d3c60673f57784f88c43277f5eba /src/target/cortex_m3.c
parent10cce4a5fe85bfd680bc338c900b0033d7174b6a (diff)
downloadopenocd+libswd-dc1685ca25567fe75c8d50c825fb0303fbb66fac.tar.gz
openocd+libswd-dc1685ca25567fe75c8d50c825fb0303fbb66fac.tar.bz2
openocd+libswd-dc1685ca25567fe75c8d50c825fb0303fbb66fac.tar.xz
openocd+libswd-dc1685ca25567fe75c8d50c825fb0303fbb66fac.zip
move ARRAY_SIZE macro to types.h
The ARRAY_SIZE macro was defined in several target files, so move it to types.h. This patch also removes two other identical macros: DIM (from jtag.h) and asizeof (from arm11.h).
Diffstat (limited to 'src/target/cortex_m3.c')
-rw-r--r--src/target/cortex_m3.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c
index e4949d20..e99e99c0 100644
--- a/src/target/cortex_m3.c
+++ b/src/target/cortex_m3.c
@@ -43,8 +43,6 @@
* Cortex-M0 cores too, although they're ARMv6-M not ARMv7-M.
*/
-#define ARRAY_SIZE(x) ((int)(sizeof(x)/sizeof((x)[0])))
-
/* forward declarations */
static int cortex_m3_set_breakpoint(struct target *target, struct breakpoint *breakpoint);
@@ -1843,8 +1841,6 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command)
struct swjdp_common *swjdp = &armv7m->swjdp_info;
uint32_t demcr = 0;
int retval;
- int i;
-
retval = cortex_m3_verify_pointer(cmd_ctx, cortex_m3);
if (retval != ERROR_OK)
return retval;
@@ -1865,6 +1861,7 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command)
}
}
while (argc-- > 0) {
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(vec_ids); i++) {
if (strcmp(args[argc], vec_ids[i].name) != 0)
continue;
@@ -1885,7 +1882,7 @@ write:
mem_ap_read_atomic_u32(swjdp, DCB_DEMCR, &demcr);
}
- for (i = 0; i < ARRAY_SIZE(vec_ids); i++)
+ for (unsigned i = 0; i < ARRAY_SIZE(vec_ids); i++)
command_print(cmd_ctx, "%9s: %s", vec_ids[i].name,
(demcr & vec_ids[i].mask) ? "catch" : "ignore");