summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jtag/core.c13
-rw-r--r--src/jtag/jtag.h6
-rw-r--r--src/target/cortex_m3.c2
-rw-r--r--src/target/mips_m4k.c2
4 files changed, 17 insertions, 6 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c
index 5dae1775..45ece3c4 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -63,8 +63,8 @@ const Jim_Nvp nvp_jtag_tap_event[] = {
{ .name = NULL, .value = -1 }
};
-int jtag_trst = 0;
-int jtag_srst = 0;
+static int jtag_trst = 0;
+static int jtag_srst = 0;
/**
* List all TAPs that have been created.
@@ -1250,6 +1250,15 @@ int jtag_add_statemove(tap_state_t goal_state)
return ERROR_OK;
}
+int jtag_get_trst(void)
+{
+ return jtag_trst;
+}
+int jtag_get_srst(void)
+{
+ return jtag_srst;
+}
+
void jtag_set_nsrst_delay(unsigned delay)
{
jtag_nsrst_delay = delay;
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index a3e61e3b..40639dce 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -243,8 +243,10 @@ struct jtag_tap_event_action_s
jtag_tap_event_action_t* next;
};
-extern int jtag_trst;
-extern int jtag_srst;
+/// @returns The current state of TRST.
+int jtag_get_trst(void);
+/// @returns The current state of SRST.
+int jtag_get_srst(void);
typedef struct jtag_event_callback_s
{
diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c
index d105fe33..efa94ea4 100644
--- a/src/target/cortex_m3.c
+++ b/src/target/cortex_m3.c
@@ -544,7 +544,7 @@ int cortex_m3_halt(target_t *target)
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_srst)
+ if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
index d69a0a0a..466e0a2d 100644
--- a/src/target/mips_m4k.c
+++ b/src/target/mips_m4k.c
@@ -235,7 +235,7 @@ int mips_m4k_halt(struct target_s *target)
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_srst)
+ if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;