summaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-04-11 06:52:52 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-04-11 06:52:52 +0000
commit7805be1b3a8f65aff9a861fd8ca62518143f1524 (patch)
tree781e28e65d50b238decb01f06fac51b9d609c236 /src/target/target.c
parenta7d3a4a7f8a0def61ed3caa7fb461b82b2d6ade1 (diff)
downloadopenocd+libswd-7805be1b3a8f65aff9a861fd8ca62518143f1524.tar.gz
openocd+libswd-7805be1b3a8f65aff9a861fd8ca62518143f1524.tar.bz2
openocd+libswd-7805be1b3a8f65aff9a861fd8ca62518143f1524.tar.xz
openocd+libswd-7805be1b3a8f65aff9a861fd8ca62518143f1524.zip
added target->type->examine(). Eventually this will allow for bringing up telnet/gdb *before* jtag chain has been validated + it might fix some reset halt problems seen as examine() needs to run after TRST has been asserted.
git-svn-id: svn://svn.berlios.de/openocd/trunk@563 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/target/target.c b/src/target/target.c
index ce411b45..5850fada 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -264,7 +264,9 @@ int target_process_reset(struct command_context_s *cmd_ctx)
if ((retval = jtag_init_reset(cmd_ctx)) != ERROR_OK)
return retval;
-
+ if ((retval = target_examine(cmd_ctx)) != ERROR_OK)
+ return retval;
+
/* prepare reset_halt where necessary */
target = targets;
while (target)
@@ -428,12 +430,36 @@ static int default_mmu(struct target_s *target, int *enabled)
return ERROR_OK;
}
+static int default_examine(struct command_context_s *cmd_ctx, struct target_s *target)
+{
+ return ERROR_OK;
+}
+
+
+int target_examine(struct command_context_s *cmd_ctx)
+{
+ int retval = ERROR_OK;
+ target_t *target = targets;
+ while (target)
+ {
+ if ((retval = target->type->examine(cmd_ctx, target))!=ERROR_OK)
+ return retval;
+ target = target->next;
+ }
+ return retval;
+}
int target_init(struct command_context_s *cmd_ctx)
{
target_t *target = targets;
while (target)
{
+ target->type->examined = 0;
+ if (target->type->examine == NULL)
+ {
+ target->type->examine = default_examine;
+ }
+
if (target->type->init_target(cmd_ctx, target) != ERROR_OK)
{
LOG_ERROR("target '%s' init failed", target->type->name);