summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorMathias K <kesmtp@freenet.de>2011-02-17 09:05:42 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-02-17 09:22:17 +0100
commitb7163f534a4bb753b768398af11055cd3a9718cc (patch)
treeef8d580e2c141e477313dd2d5ba6bcf87dc75cd3 /src/target
parent0f863ecb0112e5032608b9b66ab4c69bfe43b12f (diff)
downloadopenocd+libswd-b7163f534a4bb753b768398af11055cd3a9718cc.tar.gz
openocd+libswd-b7163f534a4bb753b768398af11055cd3a9718cc.tar.bz2
openocd+libswd-b7163f534a4bb753b768398af11055cd3a9718cc.tar.xz
openocd+libswd-b7163f534a4bb753b768398af11055cd3a9718cc.zip
dsp563xx_once: Correct wrong return value on jtag communication errors
This patch change the return value on a jtag communication error to TARGET_UNKNOWN because this function should return the current target status and not a error code from the underlying api call. Also the validity of the jtag_status is extended to all static bits in this value.
Diffstat (limited to 'src/target')
-rw-r--r--src/target/dsp563xx_once.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/target/dsp563xx_once.c b/src/target/dsp563xx_once.c
index d19323ee..d95dcdfd 100644
--- a/src/target/dsp563xx_once.c
+++ b/src/target/dsp563xx_once.c
@@ -29,6 +29,9 @@
#include "dsp563xx.h"
#include "dsp563xx_once.h"
+#define JTAG_STATUS_STATIC_MASK 0x03
+#define JTAG_STATUS_STATIC_VALUE 0x01
+
#define JTAG_STATUS_NORMAL 0x01
#define JTAG_STATUS_STOPWAIT 0x05
#define JTAG_STATUS_BUSY 0x09
@@ -100,19 +103,16 @@ int dsp563xx_once_target_status(struct jtag_tap *tap)
uint8_t jtag_status;
if ((err = dsp563xx_jtag_sendinstr(tap, &jtag_status, JTAG_INSTR_ENABLE_ONCE)) != ERROR_OK)
- return err;
+ return TARGET_UNKNOWN;
if ((err = jtag_execute_queue()) != ERROR_OK)
- return err;
+ return TARGET_UNKNOWN;
- if ((jtag_status & 1) != 1)
- {
+ /* verify correct static status pattern */
+ if ( (jtag_status & JTAG_STATUS_STATIC_MASK) != JTAG_STATUS_STATIC_VALUE )
return TARGET_UNKNOWN;
- }
if (jtag_status != JTAG_STATUS_DEBUG)
- {
return TARGET_RUNNING;
- }
return TARGET_HALTED;
}