This is an automated email from Gerrit.

Tobias Waldekranz ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/5830

-- gerrit

commit d5fc8676e380a940c8bc064468f3943c72a57f63
Author: Tobias Waldekranz <[email protected]>
Date:   Wed Sep 2 16:28:32 2020 +0200

    jtag: add post-srst event
    
    Add a new event that emitted every time that SRST is deasserted. This
    can be used to perform target specific initializations.
    
    As an example, the ARMv8 code assumes that SRST does not reset the
    debug logic, for targets where this does not hold true, something
    like...
    
        jtag configure $_CHIPNAME.cpu -event post-srst {
            pathmove RESET
            dap init
        }
    
    ... can be used as a workaround.
    
    Change-Id: Idf80aa87f2000a7cb1c19e6dfe370ce696531a06
    Signed-off-by: Tobias Waldekranz <[email protected]>

diff --git a/src/jtag/core.c b/src/jtag/core.c
index 1d424b2..52f8992 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -759,6 +759,7 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
 {
        int retval;
        int trst_with_tlr = 0;
+       int post_srst = 0;
        int new_srst = 0;
        int new_trst = 0;
 
@@ -830,6 +831,8 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
                        LOG_DEBUG("SRST line released");
                        if (adapter_nsrst_delay)
                                jtag_add_sleep(adapter_nsrst_delay * 1000);
+
+                       post_srst = 1;
                }
        }
 
@@ -865,6 +868,9 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
                        jtag_notify_event(JTAG_TRST_ASSERTED);
                }
        }
+
+       if (post_srst)
+               jtag_notify_event(JTAG_SRST_DEASSERTED);
 }
 
 void jtag_add_sleep(uint32_t us)
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index 2fa5802..7559abc 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -190,12 +190,16 @@ unsigned jtag_tap_count(void);
  *   deactivation outside the core using scripted code that understands
  *   the specific JTAG router type.  They might be triggered indirectly
  *   from EVENT_SETUP operations.
+ *
+ * - SRST_DEASSERTED is emitted whenever SRST transitions from asserted
+ *   to deasserted, i.e. every time the target comes out of reset.
  */
 enum jtag_event {
        JTAG_TRST_ASSERTED,
        JTAG_TAP_EVENT_SETUP,
        JTAG_TAP_EVENT_ENABLE,
        JTAG_TAP_EVENT_DISABLE,
+       JTAG_SRST_DEASSERTED,
 };
 
 struct jtag_tap_event_action {
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 8b76bff..9e81221 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -51,6 +51,7 @@
 
 static const Jim_Nvp nvp_jtag_tap_event[] = {
        { .value = JTAG_TRST_ASSERTED,          .name = "post-reset" },
+       { .value = JTAG_SRST_DEASSERTED,        .name = "post-srst" },
        { .value = JTAG_TAP_EVENT_SETUP,        .name = "setup" },
        { .value = JTAG_TAP_EVENT_ENABLE,       .name = "tap-enable" },
        { .value = JTAG_TAP_EVENT_DISABLE,      .name = "tap-disable" },

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to