aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jtag/commands.c14
-rw-r--r--src/jtag/core.c13
2 files changed, 27 insertions, 0 deletions
diff --git a/src/jtag/commands.c b/src/jtag/commands.c
index 3352e03..e88a3b7 100644
--- a/src/jtag/commands.c
+++ b/src/jtag/commands.c
@@ -31,6 +31,7 @@
#endif
#include <jtag/jtag.h>
+#include <transport/transport.h>
#include "commands.h"
struct cmd_queue_page {
@@ -48,6 +49,19 @@ static struct jtag_command **next_command_pointer = &jtag_command_queue;
void jtag_queue_command(struct jtag_command *cmd)
{
+ if (!transport_is_jtag()) {
+ /*
+ * FIXME: This should not happen!
+ * There could be old code that queues jtag commands with non jtag interfaces so, for
+ * the moment simply highlight it by log an error.
+ * We should fix it quitting with assert(0) because it is an internal error, or returning
+ * an error after call to jtag_command_queue_reset() to free the jtag queue and avoid
+ * memory leaks.
+ * The fix can be applied immediately after next release (v0.11.0 ?)
+ */
+ LOG_ERROR("JTAG API jtag_queue_command() called on non JTAG interface");
+ }
+
/* this command goes on the end, so ensure the queue terminates */
cmd->next = NULL;
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 69553eb..5e9777e 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -937,6 +937,19 @@ int default_interface_jtag_execute_queue(void)
return ERROR_FAIL;
}
+ if (!transport_is_jtag()) {
+ /*
+ * FIXME: This should not happen!
+ * There could be old code that queues jtag commands with non jtag interfaces so, for
+ * the moment simply highlight it by log an error and return on empty execute_queue.
+ * We should fix it quitting with assert(0) because it is an internal error.
+ * The fix can be applied immediately after next release (v0.11.0 ?)
+ */
+ LOG_ERROR("JTAG API jtag_execute_queue() called on non JTAG interface");
+ if (!jtag->execute_queue)
+ return ERROR_OK;
+ }
+
int result = jtag->execute_queue();
#if !BUILD_ZY1000