aboutsummaryrefslogtreecommitdiff
path: root/src/jtag
diff options
context:
space:
mode:
Diffstat (limited to 'src/jtag')
-rw-r--r--src/jtag/core.c19
-rw-r--r--src/jtag/jtag.h13
2 files changed, 31 insertions, 1 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 27c7b3d..806ee89 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -136,14 +136,19 @@ int jtag_error_clear(void)
/************/
-static bool jtag_poll = 1;
+static bool jtag_poll = true;
+static bool jtag_poll_en = true;
bool is_jtag_poll_safe(void)
{
/* Polling can be disabled explicitly with set_enabled(false).
+ * It can also be masked with mask().
* It is also implicitly disabled while TRST is active and
* while SRST is gating the JTAG clock.
*/
+ if (!jtag_poll_en)
+ return false;
+
if (!transport_is_jtag())
return jtag_poll;
@@ -162,6 +167,18 @@ void jtag_poll_set_enabled(bool value)
jtag_poll = value;
}
+bool jtag_poll_mask(void)
+{
+ bool retval = jtag_poll_en;
+ jtag_poll_en = false;
+ return retval;
+}
+
+void jtag_poll_unmask(bool saved)
+{
+ jtag_poll_en = saved;
+}
+
/************/
struct jtag_tap *jtag_all_taps(void)
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 18e09ce..4f94e99 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -587,6 +587,19 @@ bool jtag_poll_get_enabled(void);
*/
void jtag_poll_set_enabled(bool value);
+/**
+ * Mask (disable) polling and return the current mask status that should be
+ * feed to jtag_poll_unmask() to restore it.
+ * Multiple nested calls to jtag_poll_mask() are allowed, each balanced with
+ * its call to jtag_poll_unmask().
+ */
+bool jtag_poll_mask(void);
+
+/**
+ * Restore saved mask for polling.
+ */
+void jtag_poll_unmask(bool saved);
+
#include <jtag/minidriver.h>
int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv);